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
{{ message }}
Repository navigation
Commit e2c0607
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/postgresql.md
+78-31Lines changed: 78 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -362,6 +362,7 @@ are recorded with their declared type; see
362
362
| Column-level `CHECK (...)`| Accepted and ignored. |
363
363
| Table-level `FOREIGN KEY (...) REFERENCES ...`, named or unnamed | Accepted and ignored. |
364
364
| Table-level `CHECK (...)`, named or unnamed | Accepted and ignored. |
365
+
| Table-level `EXCLUDE USING ... (...)`, named or unnamed | Accepted and ignored. |
365
366
| A table statement sqlcj's parser cannot read, such as `ALTER FOREIGN TABLE`| Rejected; see [Ignored Statements](#ignored-statements). |
366
367
| Any other table-constraint kind | Rejected. |
367
368
| Unparsable SQL | Rejected. |
@@ -395,7 +396,7 @@ statements and files before them left; the enum-type statements are listed in
395
396
|`ALTER TABLE ... ALTER COLUMN ... SET NOT NULL`| Models the column non-null. |
396
397
|`ALTER TABLE ... ALTER COLUMN ... DROP NOT NULL`| Models the column nullable. |
397
398
|`ALTER TABLE IF EXISTS ...`| Does nothing when the table is not modeled. It covers only the table, so a missing column of a modeled table still fails. |
398
-
| Any other `ALTER TABLE` action outside the constraint actions listed in [Ignored Statements](#ignored-statements), such as `SET DEFAULT`| Rejected as `Unsupported ALTER TABLE actionat line <n>`. |
399
+
| Any other `ALTER TABLE` action outside the ignored actions listed in [Ignored Statements](#ignored-statements), such as `SET SCHEMA`| Rejected as `Unsupported ALTER TABLE action: <action> at line <n>`, quoting the action's own SQL. |
399
400
|`DROP` of any object other than a table, such as `DROP VIEW` or `DROP INDEX`| Ignored; see [Ignored Statements](#ignored-statements). |
400
401
401
402
One `ALTER TABLE` may state several actions; they are applied in the written
@@ -462,7 +463,7 @@ what they would do to the schema model:
462
463
463
464
| Statement | Diagnostic |
464
465
| --- | --- |
465
-
| An `ALTER TABLE` action outside [Ordered Table DDL](#ordered-table-ddl) and the constraint actions below |`Unsupported ALTER TABLE actionat line <n>`|
466
+
| An `ALTER TABLE` action outside [Ordered Table DDL](#ordered-table-ddl) and the ignored actions below |`Unsupported ALTER TABLE action: <action> at line <n>`, quoting the action's own SQL|
466
467
| An `ALTER TYPE` action other than `ADD VALUE`|`Unsupported ALTER TYPE action at line <n>`|
467
468
| A statement sqlcj's parser cannot read that opens as table or type DDL, outside the `ALTER TABLE` actions below | The parser's own reason with the line and column of the unexpected token, as in `Encountered unexpected token: "DATA" at line 18, column 41`|
468
469
| A statement sqlcj's parser reports only as opaque text, or as several statements, and that opens as table or type DDL |`Unsupported schema statement: ALTER FOREIGN TABLE at line <n>`, quoting the opening words |
@@ -475,27 +476,60 @@ in upper case, single-spaced, so both
475
476
`ALTER FOREIGN TABLE ft ADD COLUMN x integer` and its lower-case spelling are
476
477
rejected as `Unsupported schema statement: ALTER FOREIGN TABLE at line <n>`.
477
478
478
-
These `ALTER TABLE` actions are ignored like any other unmodeled statement,
479
-
except that the statement still resolves its table:
479
+
Every `ALTER TABLE` action that cannot change a column's existence, name, type,
480
+
or nullability is ignored like any other unmodeled statement, except that the
481
+
statement still resolves its table:
480
482
481
483
| Action | Notes |
482
484
| --- | --- |
483
-
|`ALTER TABLE ... ADD [CONSTRAINT name] PRIMARY KEY (...)`| Named or unnamed. |
484
-
|`ALTER TABLE ... ADD [CONSTRAINT name] UNIQUE (...)`| Named or unnamed. |
485
-
|`ALTER TABLE ... ADD [CONSTRAINT name] FOREIGN KEY (...) REFERENCES ...`| Named or unnamed. |
486
-
|`ALTER TABLE ... ADD CONSTRAINT name CHECK (...)`||
487
-
|`ALTER TABLE ... DROP CONSTRAINT [IF EXISTS] name`||
488
-
|`ALTER TABLE ... RENAME CONSTRAINT`||
485
+
|`ADD [CONSTRAINT name] PRIMARY KEY (...)`| Named or unnamed. |
486
+
|`ADD [CONSTRAINT name] UNIQUE (...)`| Named or unnamed. |
487
+
|`ADD [CONSTRAINT name] FOREIGN KEY (...) REFERENCES ...`| Named or unnamed. |
488
+
|`ADD CONSTRAINT name CHECK (...)`||
489
+
|`DROP CONSTRAINT [IF EXISTS] name`||
490
+
|`RENAME CONSTRAINT`||
491
+
|`ALTER [COLUMN] c SET DEFAULT ...` and `DROP DEFAULT`| A `DEFAULT` is accepted and ignored in a `CREATE TABLE` as well. |
492
+
|`ALTER [COLUMN] c SET STATISTICS`, `SET STORAGE`, and `SET COMPRESSION`| Column storage, not the column's type. |
493
+
|`ALTER [COLUMN] c DROP EXPRESSION`| Only the readable spelling; `DROP EXPRESSION IF EXISTS` is unreadable. |
494
+
|`ALTER [COLUMN] c ADD GENERATED ... AS IDENTITY`, `SET GENERATED ...`, a sequence option such as `SET INCREMENT BY 2`, `RESTART`, and `DROP IDENTITY [IF EXISTS]`| PostgreSQL requires the column to be `NOT NULL` already, so an identity never changes nullability. |
495
+
|`ENABLE`, `DISABLE`, `FORCE`, and `NO FORCE ROW LEVEL SECURITY`||
496
+
|`ATTACH PARTITION` and `DETACH PARTITION`| The partition's own table is modeled by its own statements. |
497
+
|`OWNER TO`||
498
+
|`ENABLE TRIGGER`, `DISABLE TRIGGER`, `ENABLE REPLICA TRIGGER`, and `ENABLE ALWAYS TRIGGER`, and the same four for `RULE`||
499
+
|`VALIDATE CONSTRAINT`||
500
+
|`REPLICA IDENTITY ...`||
501
+
|`CLUSTER ON` and `SET WITHOUT CLUSTER`||
502
+
|`SET WITHOUT OIDS`||
503
+
|`SET (...)` and `RESET (...)`| Storage parameters. |
504
+
|`SET TABLESPACE`, `SET LOGGED`, `SET UNLOGGED`, and `SET ACCESS METHOD`||
505
+
|`INHERIT` and `NO INHERIT`| A table's columns are modeled from its own statements; inherited columns are not modeled. |
506
+
|`OF type` and `NOT OF`||
507
+
508
+
An ignored action resolves its table but not its column, so
509
+
`ALTER TABLE users ALTER COLUMN nickname SET STATISTICS 100` is accepted for a
510
+
column that is not modeled, while `ALTER TABLE payments OWNER TO app` fails as
511
+
`Table not found in schema: payments`, exactly as any other `ALTER TABLE` of a
512
+
missing table does, and `ALTER TABLE IF EXISTS payments OWNER TO app` does
513
+
nothing.
489
514
490
515
A constraint an `ALTER TABLE` adds is not recorded, so it is not carried into
491
-
the schema model the way a `CREATE TABLE` constraint is. Because the table is
0 commit comments