Mohammed Toufeeq Ahamed09/26/2023, 6:04 PM
with postgres for ktor server, it turns out that sqldelight doesn't support `Postgres Extension`s, I want to have a non-null column with UUID as default, which is possible with
in postgres. Is ther any way that I will be able to set this up with sqldelight?
leonhardt09/26/2023, 9:22 PM
just works. Beyond that I'm subscribed to this GitHub issue for updates on postgres extensions in case it's ever supported. You might also want to chime in on this discussion where @griffio has asked for input to prioritize presently unsupported postgres features.
Mohammed Toufeeq Ahamed09/27/2023, 6:02 AM
Thanks for pointing to the issue, hope extensions are supported soon.
CREATE TABLE IF NOT EXISTS user( id UUID PRIMARY KEY NOT NULL GEN_RANDOM_UUID(), name TEXT NOT NULL UNIQUE, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, );
griffio09/27/2023, 8:59 AM
CREATE TABLE IF NOT EXISTS "user"( id UUID PRIMARY KEY NOT NULL DEFAULT (gen_random_uuid()), name TEXT NOT NULL UNIQUE, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP );
is a reserved word in Postgres, remove comma at the end of CURRENT_TIMESTAMP and
in parentheses for now - there is an issue with function calls in CREATE TABLE.
is built in from
However, I have a PR for CREATE EXTENSION, but the problem is that extensions define new functions. We can’t know about or define every possible extension function available to PostgreSQL. Once CREATE EXTENSION is available it would have to be down to the user to create an extended custom dialect to add in the functions for the extensions e.g https://github.com/cashapp/sqldelight/tree/master/sqldelight-gradle-plugin/src/test/custom-dialect
Mohammed Toufeeq Ahamed09/27/2023, 9:22 AM
leonhardt09/28/2023, 3:10 AM
Once CREATE EXTENSION is available it would have to be down to the user to create an extended custom dialect to add in the functions for the extensions@griffio that sounds like a great solution