libsql icon indicating copy to clipboard operation
libsql copied to clipboard

PRAGMA settings nowhere to be found

Open RafaelZasas opened this issue 1 year ago • 0 comments

I have an existing init.sql file that I use locally when running with the go SDK.

I start the program by running pragma commands:

func (db *db) Bootstrap() error {

	// Keeping this as a private function to avoid fuck ups
	if err := db.runMigrations(); err != nil {
		return fmt.Errorf("database.New: %q\n", err)
	}

	// Set default pragma settings
	_, err := db.Exec(
		`
            PRAGMA busy_timeout       = 10000;
            PRAGMA journal_mode       = WAL;
            PRAGMA journal_size_limit = 200000000;
            PRAGMA synchronous        = NORMAL;
            PRAGMA foreign_keys       = ON;
            PRAGMA temp_store         = MEMORY;
            PRAGMA cache_size         = -16000;`,
	)
	if err != nil {
		return fmt.Errorf("db.Exec: %v", err)
	}

	return nil
}

In development, when running with the Mattn driver and my local sqlite3 .db file everything works fine.

But when I try to use the libsql driver in production I get errors that say unsupported statement.

If PRAGMA settings are not the same for sqlite3 and libsql, where can I find this information?

Are there some PRAGMA settings that are available in libsql and some that are not? If so, I would like to know which are available and which are not.

RafaelZasas avatar Mar 01 '24 16:03 RafaelZasas