1+ /*----------------------------------------------------------------------
2+ * test_ddl_deparse.c
3+ * Support functions for the test_ddl_deparse module
4+ *
5+ * Copyright (C) 2014-2015, PostgreSQL Global Development Group
6+ *
7+ * IDENTIFICATION
8+ * src/test/modules/test_ddl_deparse/test_ddl_deparse.c
9+ *----------------------------------------------------------------------
10+ */
111#include "postgres.h"
212
313#include "catalog/pg_type.h"
@@ -11,6 +21,10 @@ PG_FUNCTION_INFO_V1(get_command_type);
1121PG_FUNCTION_INFO_V1 (get_command_tag );
1222PG_FUNCTION_INFO_V1 (get_altertable_subcmdtypes );
1323
24+ /*
25+ * Return the textual representation of the struct type used to represent a
26+ * command in struct CollectedCommand format.
27+ */
1428Datum
1529get_command_type (PG_FUNCTION_ARGS )
1630{
@@ -48,6 +62,10 @@ get_command_type(PG_FUNCTION_ARGS)
4862 PG_RETURN_TEXT_P (cstring_to_text (type ));
4963}
5064
65+ /*
66+ * Return the command tag corresponding to a parse node contained in a
67+ * CollectedCommand struct.
68+ */
5169Datum
5270get_command_tag (PG_FUNCTION_ARGS )
5371{
@@ -59,6 +77,10 @@ get_command_tag(PG_FUNCTION_ARGS)
5977 PG_RETURN_TEXT_P (cstring_to_text (CreateCommandTag (cmd -> parsetree )));
6078}
6179
80+ /*
81+ * Return a text array representation of the subcommands of an ALTER TABLE
82+ * command.
83+ */
6284Datum
6385get_altertable_subcmdtypes (PG_FUNCTION_ARGS )
6486{
@@ -130,6 +152,9 @@ get_altertable_subcmdtypes(PG_FUNCTION_ARGS)
130152 case AT_ReAddConstraint :
131153 strtype = "(re) ADD CONSTRAINT" ;
132154 break ;
155+ case AT_ReAddComment :
156+ strtype = "(re) ADD COMMENT" ;
157+ break ;
133158 case AT_AlterConstraint :
134159 strtype = "ALTER CONSTRAINT" ;
135160 break ;
@@ -258,6 +283,7 @@ get_altertable_subcmdtypes(PG_FUNCTION_ARGS)
258283 break ;
259284 default :
260285 strtype = "unrecognized" ;
286+ break ;
261287 }
262288
263289 astate =
0 commit comments