You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening this discussion topic in 🍔 SqlDelight (actually refers to sql-psi)
Problem
How to expand schema migration support?
I have been seeing/implementing a number of issues related to PostgreSql dialect, where adding just CREATE is only partially useful
Given that some schema DDL is not a standard and that these are mostly vendor extensions* - reference SQL in a Nutshell, 4th Edition
*CREATE has many variants in Postgres not listed below (ROLE, GROUP etc)
Currently the extension_stmt rule in sql-psi is the only escape hatch 🐥 to add CREATE | ALTER | DROP rules
Also, having explicit statements allows the ordering of DDL - this is needed for correct database generation.
e.g CREATE TYPE statements must be executed before using the new type in CREATE TABLE see sqldelight/sql-psi#535 (comment).
🕊️ Is a solution to add most the possible statements to the sql core grammar, just as abstract cases, and let the dialects be responsible to override - this is the same as extension_stmt does ?
It would allow to support and extend more dialects like CockRoachDB and MariaDB
Private custom dialects can refine these as needed see #4541
e.g CREATE EXTENSION would require a specific dialect to contain the functions that the extension imports 👿 - these third party dialects could be shared
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Opening this discussion topic in 🍔 SqlDelight (actually refers to sql-psi)
Problem
How to expand schema migration support?
I have been seeing/implementing a number of issues related to PostgreSql dialect, where adding just
CREATE
is only partially usefulGiven that some schema DDL is not a standard and that these are mostly vendor extensions* - reference SQL in a Nutshell, 4th Edition
*CREATE has many variants in Postgres not listed below (ROLE, GROUP etc)
Current issues/support in SqlDelight/Sql-Psi
It seems difficult or not possible to override the base
stmt
in dialectsCurrently the
extension_stmt
rule in sql-psi is the only escape hatch 🐥 to add CREATE | ALTER | DROP rulesAlso, having explicit statements allows the ordering of DDL - this is needed for correct database generation.
e.g CREATE TYPE statements must be executed before using the new type in CREATE TABLE see sqldelight/sql-psi#535 (comment).
🕊️ Is a solution to add most the possible statements to the sql core grammar, just as abstract cases, and let the dialects be responsible to override - this is the same as
extension_stmt
does ?It would allow to support and extend more dialects like CockRoachDB and MariaDB
Private custom dialects can refine these as needed see #4541
e.g
CREATE EXTENSION
would require a specific dialect to contain the functions that the extension imports 👿 - these third party dialects could be sharedBeta Was this translation helpful? Give feedback.
All reactions