feat: advanced ALTER COLUMN SET/DROP NOT NULL & DEFAULT, SET DATA TYPE (ADR-0035 Am2)
The standard-first ALTER COLUMN constraint gap-fill advanced mode lacked: - ALTER COLUMN <c> SET DATA TYPE <ty> — ISO canonical synonym for the PostgreSQL TYPE shorthand (same AlterColumnType action + executor). - SET NOT NULL / DROP NOT NULL — reuse the ADR-0029 do_add_constraint / do_drop_constraint executors (dry-run + internal-table guards free). - SET DEFAULT <expr> / DROP DEFAULT — SET DEFAULT uses a dedicated raw-SQL executor (do_set_column_default); sql_expr yields no typed Value, so it can't go through do_add_constraint. DROP DEFAULT reuses do_drop_constraint. Grammar: AT_ALTER_COLUMN gains a tail Choice (type / set / drop), reusing SQL_TYPE and the CREATE TABLE DEFAULT_NODES; builder dispatch routes the new column-attribute forms; runtime decomposes to the executors. ADR-0035 Am2 corrected in-place: SET DEFAULT decomposes to do_set_column_default, not do_add_constraint (Value-based) — found during build. Tests (test-first): 6 parse + 7 Tier-3 execution via run_replay. Suite 1962/0/1; clippy clean.
This commit is contained in:
+19
-1
@@ -756,8 +756,26 @@ pub enum AlterTableAction {
|
||||
/// with `ChangeColumnMode::ForceConversion`, which is the ADR-0035 §7
|
||||
/// advanced-mode policy (lossy cells are *performed* with a note, no
|
||||
/// force flag; static-refused / incompatible still refuse). One undo
|
||||
/// step (the executor's rebuild). ADR-0035 §4f.
|
||||
/// step (the executor's rebuild). ADR-0035 §4f. The ISO synonym
|
||||
/// `SET DATA TYPE` (canonical) and the PostgreSQL `TYPE` shorthand
|
||||
/// both build this action (ADR-0035 Amendment 2).
|
||||
AlterColumnType { column: String, ty: Type },
|
||||
/// `ALTER COLUMN <name> SET NOT NULL` (ADR-0035 Amendment 2) — a
|
||||
/// documented PostgreSQL extension (ISO has no in-place NOT-NULL
|
||||
/// verb). Decomposes to `do_add_constraint(NotNull)` (ADR-0029).
|
||||
SetColumnNotNull { column: String },
|
||||
/// `ALTER COLUMN <name> DROP NOT NULL` (ADR-0035 Amendment 2).
|
||||
/// Decomposes to `do_drop_constraint(NotNull)`.
|
||||
DropColumnNotNull { column: String },
|
||||
/// `ALTER COLUMN <name> SET DEFAULT <expr>` (ADR-0035 Amendment 2,
|
||||
/// ISO). `default_sql` is the raw `sql_expr` text (the §4a.2 / §4e
|
||||
/// mechanism — `sql_expr` builds no AST, so the default cannot be a
|
||||
/// typed `Value`). Decomposes to the dedicated `do_set_column_default`
|
||||
/// executor (not `do_add_constraint`, which is `Value`-based).
|
||||
SetColumnDefault { column: String, default_sql: String },
|
||||
/// `ALTER COLUMN <name> DROP DEFAULT` (ADR-0035 Amendment 2, ISO).
|
||||
/// Decomposes to `do_drop_constraint(Default)`.
|
||||
DropColumnDefault { column: String },
|
||||
/// `ADD [CONSTRAINT <name>] (CHECK (…) | UNIQUE (…) | FOREIGN KEY
|
||||
/// (…) REFERENCES …)` — a table-level constraint (ADR-0035 §4g). The
|
||||
/// `name` is the `CONSTRAINT <name>` prefix (the FK carries its own
|
||||
|
||||
Reference in New Issue
Block a user