From cb1025a59e5b03b9f84c0006b4d71dc9311030c9 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 4 Nov 2024 14:19:37 -0800 Subject: [PATCH 1/4] support multi-alter statements --- server/ast/alter_table.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/ast/alter_table.go b/server/ast/alter_table.go index 3013dd75fb..0751e35a73 100644 --- a/server/ast/alter_table.go +++ b/server/ast/alter_table.go @@ -64,8 +64,6 @@ func nodeAlterTableCmds( if len(node) == 0 { return nil, fmt.Errorf("no commands specified for ALTER TABLE statement") - } else if len(node) > 1 { - return nil, fmt.Errorf("ALTER TABLE with multiple commands is not yet supported") } vitessDdlCmds := make([]*vitess.DDL, 0, len(node)) From e133a6561c119e67728f5e8aabff766da9582772 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 4 Nov 2024 14:58:43 -0800 Subject: [PATCH 2/4] converts --- .../command_docs/output/alter_table_test.go | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/testing/generation/command_docs/output/alter_table_test.go b/testing/generation/command_docs/output/alter_table_test.go index 656045ee95..a02ac77dde 100644 --- a/testing/generation/command_docs/output/alter_table_test.go +++ b/testing/generation/command_docs/output/alter_table_test.go @@ -87,7 +87,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE name * ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable ON UPDATE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET NULL ( column_name ) ON UPDATE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) ON DELETE SET NULL"), Parses("ALTER TABLE name ADD IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON UPDATE SET NULL REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name , column_name ) NOT DEFERRABLE INITIALLY DEFERRED , ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) ON DELETE SET NULL"), Parses("ALTER TABLE name * ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT NOT DEFERRABLE REFERENCES reftable ON DELETE SET NULL ON UPDATE SET DEFAULT ( column_name ) INITIALLY DEFERRED , ADD COLUMN column_name data_type REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE RESTRICT NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET NULL"), - Parses("ALTER TABLE name ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE NO ACTION DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE , ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET NULL"), + Converts("ALTER TABLE name ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE NO ACTION DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE , ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET NULL"), Parses("ALTER TABLE IF EXISTS name * ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name ) ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT ( column_name , column_name ) DEFERRABLE INITIALLY IMMEDIATE , ADD IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT ( column_name ) REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL"), Parses("ALTER TABLE IF EXISTS name * ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE NO ACTION ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE , ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE NO ACTION INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL"), Parses("ALTER TABLE IF EXISTS name * ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE CASCADE NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE RESTRICT DEFERRABLE INITIALLY IMMEDIATE , ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL"), @@ -207,7 +207,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE ONLY name ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE NO ACTION ON UPDATE SET NULL DEFERRABLE , ADD column_name data_type REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE NO ACTION"), Parses("ALTER TABLE name ADD COLUMN column_name data_type REFERENCES reftable ON DELETE NO ACTION ON UPDATE CASCADE REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY DEFERRED , ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable ON DELETE SET NULL ( column_name ) ON UPDATE SET DEFAULT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE NO ACTION"), Parses("ALTER TABLE name ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT ( column_name , column_name ) DEFERRABLE INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE NO ACTION"), - Parses("ALTER TABLE IF EXISTS name ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE CASCADE ON UPDATE SET DEFAULT INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE , ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name GENERATED ALWAYS AS IDENTITY ( NO MINVALUE ) NOT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE NO ACTION"), + Converts("ALTER TABLE IF EXISTS name ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE CASCADE ON UPDATE SET DEFAULT INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE , ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name GENERATED ALWAYS AS IDENTITY ( NO MINVALUE ) NOT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE NO ACTION"), Parses("ALTER TABLE IF EXISTS ONLY name ADD IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name ) ON UPDATE SET DEFAULT ( column_name , column_name ) CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET DEFAULT ( column_name ) ON UPDATE NO ACTION INITIALLY DEFERRED , ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE RESTRICT ON UPDATE NO ACTION INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE NO ACTION"), Parses("ALTER TABLE ONLY name ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE RESTRICT ON UPDATE SET NULL ( column_name , column_name ) NOT DEFERRABLE REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET DEFAULT ( column_name , column_name ) INITIALLY IMMEDIATE , ADD COLUMN column_name data_type REFERENCES reftable MATCH FULL ON DELETE SET NULL ( column_name ) ON UPDATE SET DEFAULT REFERENCES reftable ON DELETE SET NULL ( column_name ) ON UPDATE NO ACTION"), Parses("ALTER TABLE name ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE NO ACTION ON UPDATE SET DEFAULT ( column_name , column_name ) NOT DEFERRABLE , ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ON UPDATE RESTRICT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET NULL ( column_name ) ON UPDATE NO ACTION"), @@ -537,7 +537,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE IF EXISTS name ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ON UPDATE SET NULL ( column_name ) INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE RESTRICT DEFERRABLE INITIALLY IMMEDIATE , ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE RESTRICT INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET NULL"), Parses("ALTER TABLE name ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE RESTRICT NOT DEFERRABLE , ADD IF NOT EXISTS column_name data_type REFERENCES reftable ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET NULL"), Parses("ALTER TABLE ONLY name ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable MATCH SIMPLE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH FULL ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE , ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE RESTRICT ON UPDATE SET DEFAULT ( column_name ) INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE SET NULL"), - Parses("ALTER TABLE IF EXISTS name * ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) ON DELETE SET NULL ON UPDATE NO ACTION INITIALLY DEFERRED , ADD column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) ON UPDATE SET DEFAULT INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE SET NULL"), + Converts("ALTER TABLE IF EXISTS name * ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) ON DELETE SET NULL ON UPDATE NO ACTION INITIALLY DEFERRED , ADD column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) ON UPDATE SET DEFAULT INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE SET NULL"), Parses("ALTER TABLE IF EXISTS name ADD COLUMN IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH SIMPLE ON DELETE NO ACTION ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY DEFERRED , ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET NULL ( column_name ) ON UPDATE SET DEFAULT ( column_name ) REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE SET NULL"), Parses("ALTER TABLE IF EXISTS ONLY name ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name ) ON UPDATE SET NULL ( column_name ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH FULL ON DELETE RESTRICT ON UPDATE SET NULL ( column_name ) DEFERRABLE INITIALLY DEFERRED , ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE NO ACTION ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE SET NULL"), Parses("ALTER TABLE IF EXISTS ONLY name ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY DEFERRED , ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET DEFAULT ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE SET NULL"), @@ -1412,7 +1412,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type COLLATE en_US REFERENCES reftable MATCH PARTIAL ON UPDATE SET DEFAULT ( column_name ) CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE CASCADE ON UPDATE SET DEFAULT DEFERRABLE , ADD column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE NO ACTION ON UPDATE RESTRICT INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE RESTRICT ON UPDATE RESTRICT DEFERRABLE"), Parses("ALTER TABLE name ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable MATCH FULL ON DELETE SET NULL ( column_name , column_name ) CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT NOT DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE NO ACTION ON UPDATE CASCADE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE RESTRICT ON UPDATE RESTRICT DEFERRABLE"), Parses("ALTER TABLE IF EXISTS name * ADD IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET NULL ( column_name , column_name ) CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable ON DELETE NO ACTION ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE RESTRICT DEFERRABLE"), - Parses("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type REFERENCES reftable MATCH PARTIAL ON DELETE RESTRICT ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET DEFAULT INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE RESTRICT DEFERRABLE"), + Converts("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type REFERENCES reftable MATCH PARTIAL ON DELETE RESTRICT ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET DEFAULT INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE RESTRICT DEFERRABLE"), Parses("ALTER TABLE ONLY name ADD IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE , ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ON DELETE CASCADE ON UPDATE RESTRICT DEFERRABLE"), Parses("ALTER TABLE name ADD IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable ON DELETE NO ACTION ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE SET DEFAULT INITIALLY DEFERRED , ADD IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE SET NULL ON UPDATE CASCADE NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT DEFERRABLE"), Parses("ALTER TABLE name ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE RESTRICT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ON DELETE CASCADE ON UPDATE SET NULL , ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE CASCADE ON UPDATE CASCADE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT DEFERRABLE"), @@ -1609,7 +1609,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE name * ADD IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT ( column_name ) , ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE NO ACTION ON UPDATE SET NULL DEFERRABLE"), Parses("ALTER TABLE name * ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE NO ACTION NOT DEFERRABLE INITIALLY DEFERRED , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE NO ACTION ON UPDATE SET NULL DEFERRABLE"), Parses("ALTER TABLE IF EXISTS name * ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE NO ACTION ON UPDATE SET DEFAULT CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE NO ACTION ON UPDATE SET NULL DEFERRABLE"), - Parses("ALTER TABLE ONLY name ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE RESTRICT ON UPDATE CASCADE DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE RESTRICT ON UPDATE NO ACTION , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE SET NULL DEFERRABLE"), + Converts("ALTER TABLE ONLY name ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE RESTRICT ON UPDATE CASCADE DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE RESTRICT ON UPDATE NO ACTION , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE SET NULL DEFERRABLE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE RESTRICT ON UPDATE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT , ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET DEFAULT ( column_name , column_name ) INITIALLY DEFERRED REFERENCES reftable ON DELETE RESTRICT ON UPDATE SET NULL DEFERRABLE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE NO ACTION NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET NULL DEFERRABLE , ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE RESTRICT ON UPDATE SET NULL DEFERRABLE"), Parses("ALTER TABLE IF EXISTS name * ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE SET DEFAULT INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET DEFAULT ON UPDATE RESTRICT DEFERRABLE , ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE SET DEFAULT DEFERRABLE REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET NULL DEFERRABLE"), @@ -2591,7 +2591,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE ONLY name ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE SET NULL ON UPDATE SET NULL ( column_name ) DEFERRABLE REFERENCES reftable ( refcolumn ) ON DELETE NO ACTION ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN column_name data_type REFERENCES reftable MATCH PARTIAL ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE RESTRICT ON UPDATE CASCADE NOT DEFERRABLE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ON DELETE NO ACTION ON UPDATE SET DEFAULT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name ) ON UPDATE CASCADE NOT DEFERRABLE INITIALLY DEFERRED , ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ON UPDATE SET DEFAULT ( column_name , column_name ) REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE CASCADE NOT DEFERRABLE"), Parses("ALTER TABLE IF EXISTS name ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET NULL ( column_name ) INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE RESTRICT ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY DEFERRED , ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name , column_name ) CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE CASCADE NOT DEFERRABLE"), - Parses("ALTER TABLE name * ADD COLUMN column_name data_type REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) ON DELETE SET NULL INITIALLY IMMEDIATE , ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE CASCADE NOT DEFERRABLE"), + Converts("ALTER TABLE name * ADD COLUMN column_name data_type REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) ON DELETE SET NULL INITIALLY IMMEDIATE , ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE CASCADE NOT DEFERRABLE"), Parses("ALTER TABLE IF EXISTS name * ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ( column_name ) ON UPDATE SET NULL ( column_name , column_name ) INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE CASCADE INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL ( column_name ) ON UPDATE RESTRICT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE"), Parses("ALTER TABLE name ADD IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT NOT DEFERRABLE , ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable MATCH FULL ON DELETE SET NULL ( column_name ) ON UPDATE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE"), Parses("ALTER TABLE name * ADD column_name data_type COLLATE en_US REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET DEFAULT ON UPDATE SET NULL ( column_name ) DEFERRABLE INITIALLY IMMEDIATE , ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE CASCADE ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE"), @@ -5229,7 +5229,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE IF EXISTS name * ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON UPDATE SET NULL DEFERRABLE , ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE name * ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name , column_name ) DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE CASCADE INITIALLY DEFERRED , ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET DEFAULT ON UPDATE CASCADE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE NO ACTION ON UPDATE SET DEFAULT ( column_name , column_name ) DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE RESTRICT INITIALLY DEFERRED , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED"), - Parses("ALTER TABLE name * ADD column_name data_type REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET NULL INITIALLY DEFERRED , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE NO ACTION INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED"), + Converts("ALTER TABLE name * ADD column_name data_type REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET NULL INITIALLY DEFERRED , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE NO ACTION INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE ONLY name ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE , ADD COLUMN column_name data_type REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET DEFAULT ( column_name ) NOT DEFERRABLE REFERENCES reftable MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE name ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET NULL ( column_name ) INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE CASCADE INITIALLY DEFERRED , ADD COLUMN column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE NO ACTION ON UPDATE CASCADE NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE ONLY name ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE RESTRICT INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET NULL ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE , ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH FULL ON DELETE SET NULL ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED"), @@ -5736,7 +5736,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE name * ADD COLUMN IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE CASCADE ON UPDATE RESTRICT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE name ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE RESTRICT INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET NULL ( column_name , column_name ) , ADD COLUMN column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE NO ACTION ON UPDATE SET NULL NOT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ON DELETE CASCADE ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE NO ACTION NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT DEFERRABLE INITIALLY DEFERRED , ADD COLUMN column_name data_type REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED"), - Parses("ALTER TABLE ONLY name ADD column_name data_type REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE RESTRICT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT INITIALLY IMMEDIATE , ADD COLUMN column_name data_type COLLATE en_US UNIQUE NULLS DISTINCT USING INDEX TABLESPACE tablespace_name DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED"), + Converts("ALTER TABLE ONLY name ADD column_name data_type REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE RESTRICT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT INITIALLY IMMEDIATE , ADD COLUMN column_name data_type COLLATE en_US UNIQUE NULLS DISTINCT USING INDEX TABLESPACE tablespace_name DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE ONLY name ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED , ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE SET NULL ON UPDATE CASCADE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE name * ADD IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ON DELETE NO ACTION ON UPDATE CASCADE DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH FULL ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED"), Parses("ALTER TABLE name ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON UPDATE NO ACTION REFERENCES reftable MATCH FULL ON DELETE SET NULL ( column_name ) ON UPDATE CASCADE NOT DEFERRABLE , ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ON DELETE RESTRICT ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED"), @@ -6657,7 +6657,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE name ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT ( column_name , column_name ) CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE NO ACTION , ADD IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT ( column_name , column_name ) INITIALLY IMMEDIATE REFERENCES reftable ON DELETE RESTRICT INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS name * ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE REFERENCES reftable MATCH FULL ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED , ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable MATCH FULL ON DELETE SET DEFAULT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ON DELETE RESTRICT INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET DEFAULT ( column_name ) ON UPDATE CASCADE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON UPDATE CASCADE INITIALLY IMMEDIATE , ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ON DELETE RESTRICT INITIALLY IMMEDIATE"), - Parses("ALTER TABLE IF EXISTS name ADD COLUMN column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name , column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE NO ACTION CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE RESTRICT INITIALLY IMMEDIATE"), + Converts("ALTER TABLE IF EXISTS name ADD COLUMN column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name , column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE NO ACTION CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE RESTRICT INITIALLY IMMEDIATE"), Parses("ALTER TABLE name * ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE REFERENCES reftable ON DELETE NO ACTION ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED , ADD column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL ( column_name ) ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE RESTRICT INITIALLY IMMEDIATE"), Parses("ALTER TABLE ONLY name ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET NULL ( column_name ) ON UPDATE RESTRICT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET DEFAULT , ADD column_name data_type CONSTRAINT constraint_name CHECK ( expression ) NO INHERIT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE RESTRICT INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable ON DELETE NO ACTION ON UPDATE SET NULL ( column_name , column_name ) DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED , ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE RESTRICT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE RESTRICT INITIALLY IMMEDIATE"), @@ -7625,7 +7625,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE name ADD column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) REFERENCES reftable MATCH SIMPLE ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name ) , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name ) NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name , column_name ) NOT DEFERRABLE INITIALLY DEFERRED , ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), - Parses("ALTER TABLE IF EXISTS name * ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE NO ACTION REFERENCES reftable MATCH PARTIAL ON DELETE NO ACTION ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN column_name data_type REFERENCES reftable ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), + Converts("ALTER TABLE IF EXISTS name * ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE NO ACTION REFERENCES reftable MATCH PARTIAL ON DELETE NO ACTION ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN column_name data_type REFERENCES reftable ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS name * ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET NULL NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH FULL ON DELETE SET DEFAULT ( column_name ) ON UPDATE CASCADE NOT DEFERRABLE , ADD column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ( column_name ) ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS name * ADD IF NOT EXISTS column_name data_type REFERENCES reftable MATCH PARTIAL ON UPDATE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED , ADD COLUMN IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) ON UPDATE SET DEFAULT ( column_name , column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE name * ADD column_name data_type REFERENCES reftable ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name , column_name ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE , ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON UPDATE SET DEFAULT ( column_name , column_name ) INITIALLY IMMEDIATE"), From 2dd87eff3885e2303882ac45ac5251b27030f196 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 4 Nov 2024 15:09:05 -0800 Subject: [PATCH 3/4] missed one --- testing/generation/command_docs/output/alter_table_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/generation/command_docs/output/alter_table_test.go b/testing/generation/command_docs/output/alter_table_test.go index a02ac77dde..1515468827 100644 --- a/testing/generation/command_docs/output/alter_table_test.go +++ b/testing/generation/command_docs/output/alter_table_test.go @@ -903,7 +903,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE ONLY name ADD column_name data_type CONSTRAINT constraint_name REFERENCES reftable ON DELETE CASCADE ON UPDATE RESTRICT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED , ADD COLUMN column_name data_type REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL DEFERRABLE REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL ON UPDATE SET DEFAULT"), Parses("ALTER TABLE IF EXISTS name ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET NULL ( column_name ) DEFERRABLE REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name ) ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT"), Parses("ALTER TABLE IF EXISTS name ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE NO ACTION ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ON DELETE SET NULL ON UPDATE SET DEFAULT ( column_name , column_name ) INITIALLY DEFERRED , ADD IF NOT EXISTS column_name data_type GENERATED ALWAYS AS IDENTITY DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT"), - Parses("ALTER TABLE name ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE SET NULL ( column_name , column_name ) CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE CASCADE DEFERRABLE , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON UPDATE SET NULL ( column_name , column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT"), + Converts("ALTER TABLE name ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE SET NULL ( column_name , column_name ) CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE CASCADE DEFERRABLE , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON UPDATE SET NULL ( column_name , column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT"), Parses("ALTER TABLE name * ADD COLUMN IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE CASCADE ON UPDATE SET DEFAULT NOT DEFERRABLE , ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT"), Parses("ALTER TABLE name ADD COLUMN IF NOT EXISTS column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE , ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT"), Parses("ALTER TABLE IF EXISTS name ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE RESTRICT NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE SET NULL ( column_name ) NOT DEFERRABLE , ADD COLUMN column_name data_type COLLATE en_US REFERENCES reftable ON DELETE SET DEFAULT ON UPDATE SET NULL NOT DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ON UPDATE SET DEFAULT"), From 2ef2e207ff515f339baf60a187a109d2dfbc25bf Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 4 Nov 2024 15:20:43 -0800 Subject: [PATCH 4/4] undo --- testing/generation/command_docs/output/alter_table_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/generation/command_docs/output/alter_table_test.go b/testing/generation/command_docs/output/alter_table_test.go index 1515468827..0b0bfd221b 100644 --- a/testing/generation/command_docs/output/alter_table_test.go +++ b/testing/generation/command_docs/output/alter_table_test.go @@ -7625,7 +7625,7 @@ func TestAlterTable(t *testing.T) { Parses("ALTER TABLE name ADD column_name data_type REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE , ADD column_name data_type REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD column_name data_type REFERENCES reftable MATCH PARTIAL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) REFERENCES reftable MATCH SIMPLE ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name ) , ADD COLUMN column_name data_type CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name ) NOT DEFERRABLE CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS ONLY name ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH FULL ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE INITIALLY DEFERRED CONSTRAINT constraint_name REFERENCES reftable MATCH SIMPLE ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name , column_name ) NOT DEFERRABLE INITIALLY DEFERRED , ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), - Converts("ALTER TABLE IF EXISTS name * ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE NO ACTION REFERENCES reftable MATCH PARTIAL ON DELETE NO ACTION ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN column_name data_type REFERENCES reftable ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), + Parses("ALTER TABLE IF EXISTS name * ADD COLUMN column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH PARTIAL ON DELETE SET NULL ON UPDATE NO ACTION REFERENCES reftable MATCH PARTIAL ON DELETE NO ACTION ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE , ADD COLUMN column_name data_type REFERENCES reftable ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET DEFAULT ( column_name ) NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS name * ADD IF NOT EXISTS column_name data_type COLLATE en_US CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON DELETE SET DEFAULT ( column_name ) ON UPDATE SET NULL NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable MATCH FULL ON DELETE SET DEFAULT ( column_name ) ON UPDATE CASCADE NOT DEFERRABLE , ADD column_name data_type COLLATE en_US REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET NULL ( column_name ) ON UPDATE RESTRICT NOT DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET DEFAULT ( column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE IF EXISTS name * ADD IF NOT EXISTS column_name data_type REFERENCES reftable MATCH PARTIAL ON UPDATE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET DEFAULT ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) INITIALLY DEFERRED , ADD COLUMN IF NOT EXISTS column_name data_type CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) MATCH FULL ON DELETE SET NULL ( column_name , column_name ) ON UPDATE SET NULL ( column_name , column_name ) NOT DEFERRABLE REFERENCES reftable ( refcolumn ) ON UPDATE SET DEFAULT ( column_name , column_name ) INITIALLY IMMEDIATE"), Parses("ALTER TABLE name * ADD column_name data_type REFERENCES reftable ON DELETE CASCADE ON UPDATE SET DEFAULT ( column_name , column_name ) DEFERRABLE INITIALLY DEFERRED REFERENCES reftable ( refcolumn ) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE SET DEFAULT ( column_name ) DEFERRABLE , ADD IF NOT EXISTS column_name data_type COLLATE en_US REFERENCES reftable MATCH PARTIAL ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name REFERENCES reftable ( refcolumn ) ON UPDATE SET DEFAULT ( column_name , column_name ) INITIALLY IMMEDIATE"),