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
+ */
1
11
#include "postgres.h"
2
12
3
13
#include "catalog/pg_type.h"
@@ -11,6 +21,10 @@ PG_FUNCTION_INFO_V1(get_command_type);
11
21
PG_FUNCTION_INFO_V1 (get_command_tag );
12
22
PG_FUNCTION_INFO_V1 (get_altertable_subcmdtypes );
13
23
24
+ /*
25
+ * Return the textual representation of the struct type used to represent a
26
+ * command in struct CollectedCommand format.
27
+ */
14
28
Datum
15
29
get_command_type (PG_FUNCTION_ARGS )
16
30
{
@@ -48,6 +62,10 @@ get_command_type(PG_FUNCTION_ARGS)
48
62
PG_RETURN_TEXT_P (cstring_to_text (type ));
49
63
}
50
64
65
+ /*
66
+ * Return the command tag corresponding to a parse node contained in a
67
+ * CollectedCommand struct.
68
+ */
51
69
Datum
52
70
get_command_tag (PG_FUNCTION_ARGS )
53
71
{
@@ -59,6 +77,10 @@ get_command_tag(PG_FUNCTION_ARGS)
59
77
PG_RETURN_TEXT_P (cstring_to_text (CreateCommandTag (cmd -> parsetree )));
60
78
}
61
79
80
+ /*
81
+ * Return a text array representation of the subcommands of an ALTER TABLE
82
+ * command.
83
+ */
62
84
Datum
63
85
get_altertable_subcmdtypes (PG_FUNCTION_ARGS )
64
86
{
@@ -130,6 +152,9 @@ get_altertable_subcmdtypes(PG_FUNCTION_ARGS)
130
152
case AT_ReAddConstraint :
131
153
strtype = "(re) ADD CONSTRAINT" ;
132
154
break ;
155
+ case AT_ReAddComment :
156
+ strtype = "(re) ADD COMMENT" ;
157
+ break ;
133
158
case AT_AlterConstraint :
134
159
strtype = "ALTER CONSTRAINT" ;
135
160
break ;
@@ -258,6 +283,7 @@ get_altertable_subcmdtypes(PG_FUNCTION_ARGS)
258
283
break ;
259
284
default :
260
285
strtype = "unrecognized" ;
286
+ break ;
261
287
}
262
288
263
289
astate =
0 commit comments