mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(dsql): allow explicit NULL in ALTER TABLE ADD COLUMN (#8489)
DSQL's statement checker listed NULL among the column constraints that ALTER TABLE ADD COLUMN refuses, so an explicit nullable marker, which Laravel's schema builder writes for every nullable column, was rejected with 0A000. A bare NULL now passes through to PostgreSQL; NOT NULL, DEFAULT and the other column constraints are still refused. Closes #8485
This commit is contained in:
1 parent
be18211c98
commit
07ef865dfa
3 files changed
+11
-2
No files matched your search
@@ -548,6 +548,13 @@ class DsqlDataPlaneIntegrationTest {
|
||||
try (Connection connection = admin(); Statement statement = connection.createStatement()) {
|
||||
statement.execute("CREATE SCHEMA dialect");
|
||||
statement.execute("CREATE TABLE dialect.t (id uuid PRIMARY KEY DEFAULT gen_random_uuid(), n int)");
|
||||
statement.execute("ALTER TABLE dialect.t ADD COLUMN notes varchar(255) NULL");
|
||||
|
||||
SQLException notNullColumn = assertThrows(SQLException.class, () ->
|
||||
statement.execute("ALTER TABLE dialect.t ADD COLUMN required varchar(255) NOT NULL"));
|
||||
assertEquals("0A000", notNullColumn.getSQLState());
|
||||
assertEquals("ALTER TABLE ADD COLUMN with constraint not supported",
|
||||
((PSQLException) notNullColumn).getServerErrorMessage().getMessage());
|
||||
|
||||
String jobId;
|
||||
try (ResultSet job = statement.executeQuery("CREATE INDEX ASYNC t_n ON dialect.t (n)")) {
|
||||
|
||||
@@ -52,6 +52,7 @@ class DsqlStatementsTest {
|
||||
+ " greater than or equal to 65536 or equal to 1",
|
||||
"CREATE SEQUENCE s2 CACHE 100|22023|CACHE (100) must be greater than or equal to 65536 or equal to 1",
|
||||
"ALTER TABLE t ADD COLUMN c int DEFAULT 1|0A000|ALTER TABLE ADD COLUMN with constraint not supported",
|
||||
"ALTER TABLE t ADD COLUMN c varchar(255) NOT NULL|0A000|ALTER TABLE ADD COLUMN with constraint not supported",
|
||||
"ALTER TABLE t ADD CONSTRAINT ck CHECK (n > 0)|0A000|unsupported ALTER TABLE ADD CONSTRAINT statement",
|
||||
"SELECT * FROM t FOR SHARE|0A000|locking clauses other than FOR UPDATE/FOR KEY SHARE are not supported",
|
||||
"SELECT * FROM t FOR NO KEY UPDATE|0A000|locking clauses other than FOR UPDATE/FOR KEY SHARE are not supported",
|
||||
@@ -136,6 +137,8 @@ class DsqlStatementsTest {
|
||||
"CREATE SEQUENCE s1 CACHE 1",
|
||||
"CREATE SEQUENCE s3 CACHE 65536",
|
||||
"ALTER TABLE t ADD COLUMN d int",
|
||||
"ALTER TABLE t ADD COLUMN b varchar(255) NULL",
|
||||
"ALTER TABLE \"t\" ADD COLUMN \"notes\" varchar(255) null",
|
||||
"ALTER TABLE t DROP COLUMN d",
|
||||
"SET TRANSACTION ISOLATION LEVEL REPEATABLE READ",
|
||||
"SET search_path TO probe",
|
||||
|
||||
Reference in new issue
Block a user