From 840ff5f451cd9a391d237fc60894fea7ad82a189 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 12 Dec 2022 11:13:26 +0100 Subject: Get rid of recursion-marker values in enum AlterTableType During ALTER TABLE execution, when prep-time handling of subcommands of certain types determine that execution-time handling requires recursion, they signal this by changing the subcommand type to a special value. This can be done in a simpler way by using a separate flag introduced by commit ec0925c22a3d, so do that. Catversion bumped. It's not clear to me that ALTER TABLE subcommands are stored anywhere in catalogs (CREATE FUNCTION rejects it in BEGIN ATOMIC function bodies), but we do have both write and read support for them, so be safe. Discussion: https://postgr.es/m/20220929090033.zxuaezcdwh2fgfjb@alvherre.pgsql --- src/test/modules/test_ddl_deparse/test_ddl_deparse.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/test') diff --git a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c index 7e9e443306c..fa90b717489 100644 --- a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c +++ b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c @@ -114,9 +114,6 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS) case AT_AddColumn: strtype = "ADD COLUMN"; break; - case AT_AddColumnRecurse: - strtype = "ADD COLUMN (and recurse)"; - break; case AT_AddColumnToView: strtype = "ADD COLUMN TO VIEW"; break; @@ -156,9 +153,6 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS) case AT_DropColumn: strtype = "DROP COLUMN"; break; - case AT_DropColumnRecurse: - strtype = "DROP COLUMN (and recurse)"; - break; case AT_AddIndex: strtype = "ADD INDEX"; break; @@ -168,9 +162,6 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS) case AT_AddConstraint: strtype = "ADD CONSTRAINT"; break; - case AT_AddConstraintRecurse: - strtype = "ADD CONSTRAINT (and recurse)"; - break; case AT_ReAddConstraint: strtype = "(re) ADD CONSTRAINT"; break; @@ -183,18 +174,12 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS) case AT_ValidateConstraint: strtype = "VALIDATE CONSTRAINT"; break; - case AT_ValidateConstraintRecurse: - strtype = "VALIDATE CONSTRAINT (and recurse)"; - break; case AT_AddIndexConstraint: strtype = "ADD CONSTRAINT (using index)"; break; case AT_DropConstraint: strtype = "DROP CONSTRAINT"; break; - case AT_DropConstraintRecurse: - strtype = "DROP CONSTRAINT (and recurse)"; - break; case AT_ReAddComment: strtype = "(re) ADD COMMENT"; break; @@ -326,7 +311,10 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS) break; } - values[0] = CStringGetTextDatum(strtype); + if (subcmd->recurse) + values[0] = CStringGetTextDatum(psprintf("%s (and recurse)", strtype)); + else + values[0] = CStringGetTextDatum(strtype); if (OidIsValid(sub->address.objectId)) { char *objdesc; -- cgit v1.2.3