pg_query 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03f50d45442f732b290c62fc085b1ca6f14afcb3
4
- data.tar.gz: dd68a99eda75075a43e945f56f829892ee5b1a46
3
+ metadata.gz: 64ead8467a9aeb8238aff25b10396577e21e46c0
4
+ data.tar.gz: 0c1b17563b05e8216e06c6bbb9041c2c2d8f70bc
5
5
  SHA512:
6
- metadata.gz: 2537e341ea8cc0cbb485f050f4c1ce0f6d18373f9c23048e7d0d425e2779b1730a3cccb72e76cb9faf0c9db01ed2dce7f7e2237f1bf4a94ef3241bf943f78c80
7
- data.tar.gz: 540b814ab9bb053391f432c85d052fe49d9237a8e63af75353b657fb33a274ec4d608c4a9fa77f79e95e51b1218bffabf7b9053e3f153c0813dff066bd6633c5
6
+ metadata.gz: 6877feae2dd1e47c80d07dd684bc8036c42b539ed00adcce25bffc52d9df62043937f6fc572d8be7becfbdabbfaf4616aef69cca7bf3f2a4f626d67c0862450b
7
+ data.tar.gz: 7e28d3b841b94ad22fb4ff2a8229abd98ce84916811cf948e10f1013eddc3b85600af9d9e6c3b54bb717c34f5d7fc901c508f7fdf7c9855c9216cc062ca3b5e8
@@ -1,8 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## 0.7.1 UNRELEASED
3
+ ## 0.7.1 2015-11-17
4
4
 
5
- * ...
5
+ * Abstracted parser access into libpg_query [#24](https://github.com/lfittl/pg_query/pull/35)
6
+ * libpg_query
7
+ * Use UTF-8 encoding for parsing [#4](https://github.com/lfittl/libpg_query/pull/4) [@zhm](https://github.com/zhm)
8
+ * Add type to A_CONST nodes[#5](https://github.com/lfittl/libpg_query/pull/5) [@zhm](https://github.com/zhm)
6
9
 
7
10
 
8
11
  ## 0.7.0 2015-10-17
data/README.md CHANGED
@@ -16,9 +16,7 @@ You can find further examples and a longer rationale here: https://pganalyze.com
16
16
  gem install pg_query
17
17
  ```
18
18
 
19
- Due to compiling parts of PostgreSQL, installation will take a while. Expect between 2 and 10 minutes.
20
-
21
- Note: On some Linux systems you'll have to install the ```flex``` package beforehand.
19
+ Due to compiling parts of PostgreSQL, installation might take a while on slower systems. Expect up to 5 minutes.
22
20
 
23
21
  ## Usage
24
22
 
@@ -4,65 +4,30 @@ require 'mkmf'
4
4
  require 'open-uri'
5
5
 
6
6
  workdir = Dir.pwd
7
- pgdir = File.join(workdir, 'postgres')
7
+ libdir = File.join(workdir, 'libpg_query-master')
8
8
 
9
- PG_VERSION = '9.4.5'
10
-
11
- # Limit the objects we build to speed up compilation times
12
- PG_OBJS = {
13
- 'backend/utils' => [
14
- 'mb/wchar.o', 'mb/encnames.o', 'mb/mbutils.o',
15
- 'mmgr/mcxt.o', 'mmgr/aset.o',
16
- 'error/elog.o', 'init/globals.o',
17
- 'adt/name.o' # namein
18
- ],
19
- 'backend/parser' => [
20
- 'gram.o', 'parser.o', 'keywords.o', 'kwlookup.o', 'scansup.o'
21
- ],
22
- 'backend/nodes' => [
23
- 'copyfuncs.o', 'nodeFuncs.o', 'makefuncs.o', 'value.o', 'list.o', 'outfuncs_json.o'
24
- ],
25
- 'backend/lib' => ['stringinfo.o'],
26
- 'port' => ['qsort.o'],
27
- 'common' => ['psprintf.o'],
28
- 'timezone' => ['pgtz.o']
29
- }
30
-
31
- # Download PostgreSQL if we don't have it yet
32
- unless File.exist?("#{workdir}/postgres.tar.gz")
33
- File.open("#{workdir}/postgres.tar.gz", 'wb') do |target_file|
34
- open(format('https://ftp.postgresql.org/pub/source/v%s/postgresql-%s.tar.bz2', PG_VERSION, PG_VERSION), 'rb') do |read_file|
9
+ unless File.exist?("#{workdir}/libpg_query.tar.gz")
10
+ File.open("#{workdir}/libpg_query.tar.gz", 'wb') do |target_file|
11
+ open('https://codeload.github.com/lfittl/libpg_query/tar.gz/master', 'rb') do |read_file|
35
12
  target_file.write(read_file.read)
36
13
  end
37
14
  end
38
15
  end
39
16
 
40
- unless Dir.exist?(pgdir)
41
- system("tar -xf #{workdir}/postgres.tar.gz") || fail('ERROR')
42
- system("mv #{workdir}/postgresql-#{PG_VERSION} #{pgdir}") || fail('ERROR')
43
-
44
- # Apply patches
45
- Dir[File.join(File.absolute_path(File.dirname(__FILE__)), 'patches/*')].each do |patch|
46
- system("cd #{pgdir}; patch -p1 < #{patch}")
47
- end
48
- end
49
-
50
- # We always run the build process in case this was cached between build (e.g. on Heroku)
51
- system("cd #{pgdir}; CFLAGS=-fPIC ./configure -q --without-readline --without-zlib") || fail('ERROR')
52
- system("cd #{pgdir}; make -C src/backend lib-recursive") # Ensures headers are generated
53
- PG_OBJS.each do |directory, objs|
54
- system("cd #{pgdir}; make -C src/#{directory} #{objs.join(' ')}") || fail('ERROR')
17
+ unless Dir.exist?(libdir)
18
+ system("tar -xf #{workdir}/libpg_query.tar.gz") || fail('ERROR')
55
19
  end
56
20
 
57
- $objs = PG_OBJS.map { |directory, objs| objs.map { |obj| "#{pgdir}/src/#{directory}/#{obj}" } }.flatten
58
- $objs += %w(pg_query.o pg_query_parse.o pg_query_normalize.o pg_polyfills.o)
21
+ # Build libpg_query (and parts of PostgreSQL)
22
+ system("cd #{libdir}; make")
59
23
 
60
- $CFLAGS << " -I #{pgdir}/src/include"
24
+ $objs = ['pg_query_ruby.o']
61
25
 
62
- # Similar to those used by PostgreSQL
63
- $CFLAGS << ' -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv'
26
+ $LOCAL_LIBS << '-lpg_query'
27
+ $LIBPATH << libdir
28
+ $CFLAGS << " -I #{libdir} -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv"
64
29
 
65
- SYMFILE = File.join(File.dirname(__FILE__), 'pg_query.sym')
30
+ SYMFILE = File.join(File.dirname(__FILE__), 'pg_query_ruby.sym')
66
31
  if RUBY_PLATFORM =~ /darwin/
67
32
  $DLDFLAGS << " -Wl,-exported_symbols_list #{SYMFILE}" unless defined?(::Rubinius)
68
33
  else
@@ -0,0 +1,89 @@
1
+ #include "pg_query_ruby.h"
2
+
3
+ void raise_ruby_parse_error(PgQueryParseResult result);
4
+ void raise_ruby_normalize_error(PgQueryNormalizeResult result);
5
+ VALUE pg_query_ruby_parse(VALUE self, VALUE input);
6
+ VALUE pg_query_ruby_normalize(VALUE self, VALUE input);
7
+
8
+ void Init_pg_query(void)
9
+ {
10
+ VALUE cPgQuery;
11
+
12
+ pg_query_init();
13
+
14
+ cPgQuery = rb_const_get(rb_cObject, rb_intern("PgQuery"));
15
+
16
+ rb_define_singleton_method(cPgQuery, "_raw_parse", pg_query_ruby_parse, 1);
17
+ rb_define_singleton_method(cPgQuery, "normalize", pg_query_ruby_normalize, 1);
18
+ }
19
+
20
+ void raise_ruby_parse_error(PgQueryParseResult result)
21
+ {
22
+ VALUE cPgQuery, cParseError;
23
+ VALUE args[4];
24
+
25
+ cPgQuery = rb_const_get(rb_cObject, rb_intern("PgQuery"));
26
+ cParseError = rb_const_get_at(cPgQuery, rb_intern("ParseError"));
27
+
28
+ args[0] = rb_str_new2(result.error->message);
29
+ args[1] = rb_str_new2(result.error->filename);
30
+ args[2] = INT2NUM(result.error->lineno);
31
+ args[3] = INT2NUM(result.error->cursorpos);
32
+
33
+ pg_query_free_parse_result(result);
34
+
35
+ rb_exc_raise(rb_class_new_instance(4, args, cParseError));
36
+ }
37
+
38
+ void raise_ruby_normalize_error(PgQueryNormalizeResult result)
39
+ {
40
+ VALUE cPgQuery, cParseError;
41
+ VALUE args[4];
42
+
43
+ cPgQuery = rb_const_get(rb_cObject, rb_intern("PgQuery"));
44
+ cParseError = rb_const_get_at(cPgQuery, rb_intern("ParseError"));
45
+
46
+ args[0] = rb_str_new2(result.error->message);
47
+ args[1] = rb_str_new2(result.error->filename);
48
+ args[2] = INT2NUM(result.error->lineno);
49
+ args[3] = INT2NUM(result.error->cursorpos);
50
+
51
+ pg_query_free_normalize_result(result);
52
+
53
+ rb_exc_raise(rb_class_new_instance(4, args, cParseError));
54
+ }
55
+
56
+ VALUE pg_query_ruby_parse(VALUE self, VALUE input)
57
+ {
58
+ Check_Type(input, T_STRING);
59
+
60
+ VALUE output;
61
+ PgQueryParseResult result = pg_query_parse(StringValueCStr(input));
62
+
63
+ if (result.error) raise_ruby_parse_error(result);
64
+
65
+ output = rb_ary_new();
66
+
67
+ rb_ary_push(output, rb_str_new2(result.parse_tree));
68
+ rb_ary_push(output, rb_str_new2(result.stderr_buffer));
69
+
70
+ pg_query_free_parse_result(result);
71
+
72
+ return output;
73
+ }
74
+
75
+ VALUE pg_query_ruby_normalize(VALUE self, VALUE input)
76
+ {
77
+ Check_Type(input, T_STRING);
78
+
79
+ VALUE output;
80
+ PgQueryNormalizeResult result = pg_query_normalize(StringValueCStr(input));
81
+
82
+ if (result.error) raise_ruby_normalize_error(result);
83
+
84
+ output = rb_str_new2(result.normalized_query);
85
+
86
+ pg_query_free_normalize_result(result);
87
+
88
+ return output;
89
+ }
@@ -0,0 +1,10 @@
1
+ #ifndef PG_QUERY_RUBY_H
2
+ #define PG_QUERY_RUBY_H
3
+
4
+ #include "pg_query.h"
5
+
6
+ #include <ruby.h>
7
+
8
+ void Init_pg_query(void);
9
+
10
+ #endif
@@ -1,3 +1,3 @@
1
1
  class PgQuery
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Fittl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-18 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -94,15 +94,9 @@ files:
94
94
  - README.md
95
95
  - Rakefile
96
96
  - ext/pg_query/extconf.rb
97
- - ext/pg_query/patches/01_output_nodes_as_json.patch
98
- - ext/pg_query/patches/02_parse_replacement_char.patch
99
- - ext/pg_query/patches/03_regenerate_bison_flex_files.patch
100
- - ext/pg_query/pg_polyfills.c
101
- - ext/pg_query/pg_query.c
102
- - ext/pg_query/pg_query.h
103
- - ext/pg_query/pg_query.sym
104
- - ext/pg_query/pg_query_normalize.c
105
- - ext/pg_query/pg_query_parse.c
97
+ - ext/pg_query/pg_query_ruby.c
98
+ - ext/pg_query/pg_query_ruby.h
99
+ - ext/pg_query/pg_query_ruby.sym
106
100
  - lib/pg_query.rb
107
101
  - lib/pg_query/deparse.rb
108
102
  - lib/pg_query/deparse/alter_table.rb
@@ -1,4626 +0,0 @@
1
- diff --git a/src/backend/nodes/Makefile b/src/backend/nodes/Makefile
2
- index fe2e460..df2b494 100644
3
- --- a/src/backend/nodes/Makefile
4
- +++ b/src/backend/nodes/Makefile
5
- @@ -14,6 +14,8 @@ include $(top_builddir)/src/Makefile.global
6
-
7
- OBJS = nodeFuncs.o nodes.o list.o bitmapset.o tidbitmap.o \
8
- copyfuncs.o equalfuncs.o makefuncs.o \
9
- - outfuncs.o readfuncs.o print.o read.o params.o value.o
10
- + outfuncs.o outfuncs_json.o readfuncs.o print.o read.o params.o value.o
11
- +
12
- +outfuncs_json.o: outfuncs_shared_conds.c outfuncs_shared_defs.c
13
-
14
- include $(top_srcdir)/src/backend/common.mk
15
- diff --git a/src/backend/nodes/outfuncs_json.c b/src/backend/nodes/outfuncs_json.c
16
- new file mode 100644
17
- index 0000000..eaded0f
18
- --- /dev/null
19
- +++ b/src/backend/nodes/outfuncs_json.c
20
- @@ -0,0 +1,1035 @@
21
- +/*-------------------------------------------------------------------------
22
- + *
23
- + * outfuncs_json.c
24
- + * JSON Output functions for Postgres tree nodes.
25
- + *
26
- + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
27
- + * Portions Copyright (c) 1994, Regents of the University of California
28
- + *
29
- + *
30
- + * IDENTIFICATION
31
- + * src/backend/nodes/outfuncs_json.c
32
- + *
33
- + * NOTES
34
- + * This is a copy of outfuncs.c modified to output JSON.
35
- + *
36
- + * The focus of this is to make parse trees available to external tools,
37
- + * it is not used internally right now.
38
- + *
39
- + *-------------------------------------------------------------------------
40
- + */
41
- +#include "postgres.h"
42
- +
43
- +#include <ctype.h>
44
- +
45
- +#include "lib/stringinfo.h"
46
- +#include "nodes/plannodes.h"
47
- +#include "nodes/relation.h"
48
- +#include "utils/datum.h"
49
- +
50
- +
51
- +/*
52
- + * Macros to simplify output of different kinds of fields. Use these
53
- + * wherever possible to reduce the chance for silly typos. Note that these
54
- + * hard-wire conventions about the names of the local variables in an Out
55
- + * routine.
56
- + */
57
- +
58
- +/* Write the label for the node type */
59
- +#define WRITE_NODE_TYPE(nodelabel) \
60
- + appendStringInfoString(str, "\"" nodelabel "\": {")
61
- +
62
- +/* Write an integer field (anything written as ":fldname %d") */
63
- +#define WRITE_INT_FIELD(fldname) \
64
- + appendStringInfo(str, "\"" CppAsString(fldname) "\": %d, ", node->fldname)
65
- +
66
- +/* Write an unsigned integer field (anything written as ":fldname %u") */
67
- +#define WRITE_UINT_FIELD(fldname) \
68
- + appendStringInfo(str, "\"" CppAsString(fldname) "\": %u, ", node->fldname)
69
- +
70
- +/* Write an OID field (don't hard-wire assumption that OID is same as uint) */
71
- +#define WRITE_OID_FIELD(fldname) \
72
- + appendStringInfo(str, "\"" CppAsString(fldname) "\": %u, ", node->fldname)
73
- +
74
- +/* Write a long-integer field */
75
- +#define WRITE_LONG_FIELD(fldname) \
76
- + appendStringInfo(str, "\"" CppAsString(fldname) "\": %ld, ", node->fldname)
77
- +
78
- +/* Write a char field (ie, one ascii character) */
79
- +#define WRITE_CHAR_FIELD(fldname) \
80
- + if (node->fldname == 0) { appendStringInfo(str, "\"" CppAsString(fldname) "\": null, "); \
81
- + } else { appendStringInfo(str, "\"" CppAsString(fldname) "\": \"%c\", ", node->fldname); }
82
- +
83
- +/* Write an enumerated-type field as an integer code */
84
- +#define WRITE_ENUM_FIELD(fldname, enumtype) \
85
- + appendStringInfo(str, "\"" CppAsString(fldname) "\": %d, ", \
86
- + (int) node->fldname)
87
- +
88
- +/* Write a float field --- caller must give format to define precision */
89
- +#define WRITE_FLOAT_FIELD(fldname,format) \
90
- + appendStringInfo(str, "\"" CppAsString(fldname) "\": " format ", ", node->fldname)
91
- +
92
- +/* Write a boolean field */
93
- +#define WRITE_BOOL_FIELD(fldname) \
94
- + appendStringInfo(str, "\"" CppAsString(fldname) "\": %s, ", \
95
- + booltostr(node->fldname))
96
- +
97
- +/* Write a character-string (possibly NULL) field */
98
- +#define WRITE_STRING_FIELD(fldname) \
99
- + (appendStringInfo(str, "\"" CppAsString(fldname) "\": "), \
100
- + _outToken(str, node->fldname), \
101
- + appendStringInfo(str, ", "))
102
- +
103
- +/* Write a parse location field (actually same as INT case) */
104
- +#define WRITE_LOCATION_FIELD(fldname) \
105
- + appendStringInfo(str, "\"" CppAsString(fldname) "\": %d, ", node->fldname)
106
- +
107
- +/* Write a Node field */
108
- +#define WRITE_NODE_FIELD(fldname) \
109
- + (appendStringInfo(str, "\"" CppAsString(fldname) "\": "), \
110
- + _outNode(str, node->fldname), \
111
- + appendStringInfo(str, ", "))
112
- +
113
- +/* Write a bitmapset field */
114
- +#define WRITE_BITMAPSET_FIELD(fldname) \
115
- + (appendStringInfo(str, "\"" CppAsString(fldname) "\": "), \
116
- + _outBitmapset(str, node->fldname), \
117
- + appendStringInfo(str, ", "))
118
- +
119
- +
120
- +#define booltostr(x) ((x) ? "true" : "false")
121
- +
122
- +static void _outNode(StringInfo str, const void *obj);
123
- +
124
- +static void
125
- +removeTrailingDelimiter(StringInfo str)
126
- +{
127
- + if (str->len >= 2 && str->data[str->len - 2] == ',' && str->data[str->len - 1] == ' ') {
128
- + str->len -= 2;
129
- + str->data[str->len] = '\0';
130
- + }
131
- +}
132
- +
133
- +/*
134
- + * _outToken
135
- + * Convert an ordinary string (eg, an identifier) into a form that
136
- + * will be decoded back to a plain token by read.c's functions.
137
- + *
138
- + * If a null or empty string is given, it is encoded as "<>".
139
- + */
140
- +static void
141
- +_outToken(StringInfo str, const char *s)
142
- +{
143
- + if (s == NULL || *s == '\0')
144
- + {
145
- + appendStringInfoString(str, "null");
146
- + return;
147
- + }
148
- +
149
- + appendStringInfoChar(str, '"');
150
- + while (*s)
151
- + {
152
- + /* These chars must be backslashed anywhere in the string */
153
- + if (*s == '\n')
154
- + appendStringInfoString(str, "\\n");
155
- + else if (*s == '\r')
156
- + appendStringInfoString(str, "\\r");
157
- + else if (*s == '\t')
158
- + appendStringInfoString(str, "\\t");
159
- + else if (*s == '\\' || *s == '"') {
160
- + appendStringInfoChar(str, '\\');
161
- + appendStringInfoChar(str, *s);
162
- + } else
163
- + appendStringInfoChar(str, *s);
164
- + s++;
165
- + }
166
- + appendStringInfoChar(str, '"');
167
- +}
168
- +
169
- +static void
170
- +_outList(StringInfo str, const List *node)
171
- +{
172
- + const ListCell *lc;
173
- +
174
- + appendStringInfoChar(str, '[');
175
- +
176
- + /*if (IsA(node, IntList))
177
- + appendStringInfoChar(str, 'i');
178
- + else if (IsA(node, OidList))
179
- + appendStringInfoChar(str, 'o');*/
180
- +
181
- + foreach(lc, node)
182
- + {
183
- + /*
184
- + * For the sake of backward compatibility, we emit a slightly
185
- + * different whitespace format for lists of nodes vs. other types of
186
- + * lists. XXX: is this necessary?
187
- + */
188
- + if (IsA(node, List))
189
- + _outNode(str, lfirst(lc));
190
- + else if (IsA(node, IntList))
191
- + appendStringInfo(str, " %d", lfirst_int(lc));
192
- + else if (IsA(node, OidList))
193
- + appendStringInfo(str, " %u", lfirst_oid(lc));
194
- + else
195
- + elog(ERROR, "unrecognized list node type: %d",
196
- + (int) node->type);
197
- +
198
- + if (lnext(lc))
199
- + appendStringInfoString(str, ", ");
200
- + }
201
- +
202
- + appendStringInfoChar(str, ']');
203
- +}
204
- +
205
- +/*
206
- + * _outBitmapset -
207
- + * converts a bitmap set of integers
208
- + *
209
- + * Note: the output format is "(b int int ...)", similar to an integer List.
210
- + */
211
- +static void
212
- +_outBitmapset(StringInfo str, const Bitmapset *bms)
213
- +{
214
- + Bitmapset *tmpset;
215
- + int x;
216
- +
217
- + appendStringInfoChar(str, '[');
218
- + /*appendStringInfoChar(str, 'b');*/
219
- + tmpset = bms_copy(bms);
220
- + while ((x = bms_first_member(tmpset)) >= 0)
221
- + appendStringInfo(str, "%d, ", x);
222
- + bms_free(tmpset);
223
- + removeTrailingDelimiter(str);
224
- + appendStringInfoChar(str, ']');
225
- +}
226
- +
227
- +/*
228
- + * Print the value of a Datum given its type.
229
- + */
230
- +static void
231
- +_outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
232
- +{
233
- + Size length,
234
- + i;
235
- + char *s;
236
- +
237
- + length = datumGetSize(value, typbyval, typlen);
238
- +
239
- + if (typbyval)
240
- + {
241
- + s = (char *) (&value);
242
- + /*appendStringInfo(str, "%u [ ", (unsigned int) length);*/
243
- + appendStringInfoChar(str, '[');
244
- + for (i = 0; i < (Size) sizeof(Datum); i++)
245
- + appendStringInfo(str, "%d, ", (int) (s[i]));
246
- + removeTrailingDelimiter(str);
247
- + appendStringInfoChar(str, ']');
248
- + }
249
- + else
250
- + {
251
- + s = (char *) DatumGetPointer(value);
252
- + if (!PointerIsValid(s))
253
- + appendStringInfoString(str, "[]");
254
- + else
255
- + {
256
- + /*appendStringInfo(str, "%u [ ", (unsigned int) length);*/
257
- + appendStringInfoChar(str, '[');
258
- + for (i = 0; i < length; i++)
259
- + appendStringInfo(str, "%d, ", (int) (s[i]));
260
- + removeTrailingDelimiter(str);
261
- + appendStringInfoChar(str, ']');
262
- + }
263
- + }
264
- +}
265
- +
266
- +/*
267
- +* print the basic stuff of all nodes that inherit from Path
268
- +*
269
- +* Note we do NOT print the parent, else we'd be in infinite recursion.
270
- +* We can print the parent's relids for identification purposes, though.
271
- +* We also do not print the whole of param_info, since it's printed by
272
- +* _outRelOptInfo; it's sufficient and less cluttering to print just the
273
- +* required outer relids.
274
- +*/
275
- +static void
276
- +_outPathInfo(StringInfo str, const Path *node)
277
- +{
278
- + WRITE_ENUM_FIELD(pathtype, NodeTag);
279
- + appendStringInfoString(str, "\"parent_relids\": ");
280
- + _outBitmapset(str, node->parent->relids);
281
- + appendStringInfoString(str, ", ");
282
- + appendStringInfoString(str, "\"required_outer\": ");
283
- + if (node->param_info)
284
- + _outBitmapset(str, node->param_info->ppi_req_outer);
285
- + else
286
- + _outBitmapset(str, NULL);
287
- + appendStringInfoString(str, ", ");
288
- + WRITE_FLOAT_FIELD(rows, "%.0f");
289
- + WRITE_FLOAT_FIELD(startup_cost, "%.2f");
290
- + WRITE_FLOAT_FIELD(total_cost, "%.2f");
291
- + WRITE_NODE_FIELD(pathkeys);
292
- +}
293
- +
294
- +#include "outfuncs_shared_defs.c"
295
- +
296
- +/*
297
- + * Stuff from plannodes.h
298
- + */
299
- +
300
- +static void
301
- +_outMergeAppend(StringInfo str, const MergeAppend *node)
302
- +{
303
- + int i;
304
- +
305
- + WRITE_NODE_TYPE("MERGEAPPEND");
306
- +
307
- + _outPlanInfo(str, (const Plan *) node);
308
- +
309
- + WRITE_NODE_FIELD(mergeplans);
310
- +
311
- + WRITE_INT_FIELD(numCols);
312
- +
313
- + appendStringInfoString(str, "\"sortColIdx\": [");
314
- + for (i = 0; i < node->numCols; i++)
315
- + appendStringInfo(str, "%d, ", node->sortColIdx[i]);
316
- + removeTrailingDelimiter(str);
317
- + appendStringInfoString(str, "], ");
318
- +
319
- + appendStringInfo(str, "\"sortOperators\": [");
320
- + for (i = 0; i < node->numCols; i++)
321
- + appendStringInfo(str, "%u, ", node->sortOperators[i]);
322
- + removeTrailingDelimiter(str);
323
- + appendStringInfoString(str, "], ");
324
- +
325
- + appendStringInfoString(str, "\"collations\": [");
326
- + for (i = 0; i < node->numCols; i++)
327
- + appendStringInfo(str, "%u, ", node->collations[i]);
328
- + removeTrailingDelimiter(str);
329
- + appendStringInfoString(str, "], ");
330
- +
331
- + appendStringInfoString(str, "\"nullsFirst\": [");
332
- + for (i = 0; i < node->numCols; i++)
333
- + appendStringInfo(str, "%s, ", booltostr(node->nullsFirst[i]));
334
- + removeTrailingDelimiter(str);
335
- + appendStringInfoString(str, "], ");
336
- +}
337
- +
338
- +static void
339
- +_outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
340
- +{
341
- + int i;
342
- +
343
- + WRITE_NODE_TYPE("RECURSIVEUNION");
344
- +
345
- + _outPlanInfo(str, (const Plan *) node);
346
- +
347
- + WRITE_INT_FIELD(wtParam);
348
- + WRITE_INT_FIELD(numCols);
349
- +
350
- + appendStringInfoString(str, "\"dupColIdx\": [");
351
- + for (i = 0; i < node->numCols; i++)
352
- + appendStringInfo(str, "%d, ", node->dupColIdx[i]);
353
- + removeTrailingDelimiter(str);
354
- + appendStringInfoString(str, "], ");
355
- +
356
- + appendStringInfoString(str, "\"dupOperators\": [");
357
- + for (i = 0; i < node->numCols; i++)
358
- + appendStringInfo(str, "%u, ", node->dupOperators[i]);
359
- + removeTrailingDelimiter(str);
360
- + appendStringInfoString(str, "], ");
361
- +
362
- + WRITE_LONG_FIELD(numGroups);
363
- +}
364
- +
365
- +static void
366
- +_outMergeJoin(StringInfo str, const MergeJoin *node)
367
- +{
368
- + int numCols;
369
- + int i;
370
- +
371
- + WRITE_NODE_TYPE("MERGEJOIN");
372
- +
373
- + _outJoinInfo(str, (const Join *) node);
374
- +
375
- + WRITE_NODE_FIELD(mergeclauses);
376
- +
377
- + numCols = list_length(node->mergeclauses);
378
- +
379
- + appendStringInfoString(str, "\"mergeFamilies\": [");
380
- + for (i = 0; i < numCols; i++)
381
- + appendStringInfo(str, "%u, ", node->mergeFamilies[i]);
382
- + removeTrailingDelimiter(str);
383
- + appendStringInfoString(str, "], ");
384
- +
385
- + appendStringInfoString(str, "\"mergeCollations\": [");
386
- + for (i = 0; i < numCols; i++)
387
- + appendStringInfo(str, "%u, ", node->mergeCollations[i]);
388
- + removeTrailingDelimiter(str);
389
- + appendStringInfoString(str, "], ");
390
- +
391
- + appendStringInfoString(str, "\"mergeStrategies\": [");
392
- + for (i = 0; i < numCols; i++)
393
- + appendStringInfo(str, "%d, ", node->mergeStrategies[i]);
394
- + removeTrailingDelimiter(str);
395
- + appendStringInfoString(str, "], ");
396
- +
397
- + appendStringInfoString(str, "\"mergeNullsFirst\": [");
398
- + for (i = 0; i < numCols; i++)
399
- + appendStringInfo(str, "%d, ", (int) node->mergeNullsFirst[i]);
400
- + removeTrailingDelimiter(str);
401
- + appendStringInfoString(str, "], ");
402
- +}
403
- +
404
- +static void
405
- +_outAgg(StringInfo str, const Agg *node)
406
- +{
407
- + int i;
408
- +
409
- + WRITE_NODE_TYPE("AGG");
410
- +
411
- + _outPlanInfo(str, (const Plan *) node);
412
- +
413
- + WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
414
- + WRITE_INT_FIELD(numCols);
415
- +
416
- + appendStringInfoString(str, "\"grpColIdx\": [");
417
- + for (i = 0; i < node->numCols; i++)
418
- + appendStringInfo(str, "%d, ", node->grpColIdx[i]);
419
- + removeTrailingDelimiter(str);
420
- + appendStringInfoString(str, "], ");
421
- +
422
- + appendStringInfoString(str, "\"grpOperators\": [");
423
- + for (i = 0; i < node->numCols; i++)
424
- + appendStringInfo(str, "%u, ", node->grpOperators[i]);
425
- + removeTrailingDelimiter(str);
426
- + appendStringInfoString(str, "], ");
427
- +
428
- + WRITE_LONG_FIELD(numGroups);
429
- +}
430
- +
431
- +static void
432
- +_outWindowAgg(StringInfo str, const WindowAgg *node)
433
- +{
434
- + int i;
435
- +
436
- + WRITE_NODE_TYPE("WINDOWAGG");
437
- +
438
- + _outPlanInfo(str, (const Plan *) node);
439
- +
440
- + WRITE_UINT_FIELD(winref);
441
- + WRITE_INT_FIELD(partNumCols);
442
- +
443
- + appendStringInfoString(str, "\"partColIdx\": [");
444
- + for (i = 0; i < node->partNumCols; i++)
445
- + appendStringInfo(str, "%d, ", node->partColIdx[i]);
446
- + removeTrailingDelimiter(str);
447
- + appendStringInfoString(str, "], ");
448
- +
449
- + appendStringInfoString(str, "\"partOperations\": [");
450
- + for (i = 0; i < node->partNumCols; i++)
451
- + appendStringInfo(str, "%u, ", node->partOperators[i]);
452
- + removeTrailingDelimiter(str);
453
- + appendStringInfoString(str, "], ");
454
- +
455
- + WRITE_INT_FIELD(ordNumCols);
456
- +
457
- + appendStringInfoString(str, "\"ordColIdx\": [");
458
- + for (i = 0; i < node->ordNumCols; i++)
459
- + appendStringInfo(str, "%d, ", node->ordColIdx[i]);
460
- + removeTrailingDelimiter(str);
461
- + appendStringInfoString(str, "], ");
462
- +
463
- + appendStringInfoString(str, "\"ordOperations\": [");
464
- + for (i = 0; i < node->ordNumCols; i++)
465
- + appendStringInfo(str, "%u, ", node->ordOperators[i]);
466
- + removeTrailingDelimiter(str);
467
- + appendStringInfoString(str, "], ");
468
- +
469
- + WRITE_INT_FIELD(frameOptions);
470
- + WRITE_NODE_FIELD(startOffset);
471
- + WRITE_NODE_FIELD(endOffset);
472
- +}
473
- +
474
- +static void
475
- +_outGroup(StringInfo str, const Group *node)
476
- +{
477
- + int i;
478
- +
479
- + WRITE_NODE_TYPE("GROUP");
480
- +
481
- + _outPlanInfo(str, (const Plan *) node);
482
- +
483
- + WRITE_INT_FIELD(numCols);
484
- +
485
- + appendStringInfoString(str, "\"grpColIdx\": [");
486
- + for (i = 0; i < node->numCols; i++)
487
- + appendStringInfo(str, "%d, ", node->grpColIdx[i]);
488
- + removeTrailingDelimiter(str);
489
- + appendStringInfoString(str, "], ");
490
- +
491
- + appendStringInfoString(str, "\"grpOperators\": [");
492
- + for (i = 0; i < node->numCols; i++)
493
- + appendStringInfo(str, "%u, ", node->grpOperators[i]);
494
- + removeTrailingDelimiter(str);
495
- + appendStringInfoString(str, "], ");
496
- +}
497
- +
498
- +static void
499
- +_outSort(StringInfo str, const Sort *node)
500
- +{
501
- + int i;
502
- +
503
- + WRITE_NODE_TYPE("SORT");
504
- +
505
- + _outPlanInfo(str, (const Plan *) node);
506
- +
507
- + WRITE_INT_FIELD(numCols);
508
- +
509
- + appendStringInfoString(str, "\"sortColIdx\": [");
510
- + for (i = 0; i < node->numCols; i++)
511
- + appendStringInfo(str, "%d, ", node->sortColIdx[i]);
512
- + removeTrailingDelimiter(str);
513
- + appendStringInfoString(str, "], ");
514
- +
515
- + appendStringInfoString(str, "\"sortOperators\": [");
516
- + for (i = 0; i < node->numCols; i++)
517
- + appendStringInfo(str, "%u, ", node->sortOperators[i]);
518
- + removeTrailingDelimiter(str);
519
- + appendStringInfoString(str, "], ");
520
- +
521
- + appendStringInfoString(str, "\"collations\": [");
522
- + for (i = 0; i < node->numCols; i++)
523
- + appendStringInfo(str, "%u, ", node->collations[i]);
524
- + removeTrailingDelimiter(str);
525
- + appendStringInfoString(str, "], ");
526
- +
527
- + appendStringInfoString(str, "\"nullsFirst\": [");
528
- + for (i = 0; i < node->numCols; i++)
529
- + appendStringInfo(str, "%s, ", booltostr(node->nullsFirst[i]));
530
- + removeTrailingDelimiter(str);
531
- + appendStringInfoString(str, "], ");
532
- +}
533
- +
534
- +static void
535
- +_outUnique(StringInfo str, const Unique *node)
536
- +{
537
- + int i;
538
- +
539
- + WRITE_NODE_TYPE("UNIQUE");
540
- +
541
- + _outPlanInfo(str, (const Plan *) node);
542
- +
543
- + WRITE_INT_FIELD(numCols);
544
- +
545
- + appendStringInfoString(str, "\"uniqColIdx\": [");
546
- + for (i = 0; i < node->numCols; i++)
547
- + appendStringInfo(str, "%d, ", node->uniqColIdx[i]);
548
- + removeTrailingDelimiter(str);
549
- + appendStringInfoString(str, "], ");
550
- +
551
- + appendStringInfoString(str, "\"uniqOperators\": [");
552
- + for (i = 0; i < node->numCols; i++)
553
- + appendStringInfo(str, "%u, ", node->uniqOperators[i]);
554
- + removeTrailingDelimiter(str);
555
- + appendStringInfoString(str, "], ");
556
- +}
557
- +
558
- +static void
559
- +_outSetOp(StringInfo str, const SetOp *node)
560
- +{
561
- + int i;
562
- +
563
- + WRITE_NODE_TYPE("SETOP");
564
- +
565
- + _outPlanInfo(str, (const Plan *) node);
566
- +
567
- + WRITE_ENUM_FIELD(cmd, SetOpCmd);
568
- + WRITE_ENUM_FIELD(strategy, SetOpStrategy);
569
- + WRITE_INT_FIELD(numCols);
570
- +
571
- + appendStringInfoString(str, "\"dupColIdx\": [");
572
- + for (i = 0; i < node->numCols; i++)
573
- + appendStringInfo(str, "%d, ", node->dupColIdx[i]);
574
- + removeTrailingDelimiter(str);
575
- + appendStringInfoString(str, "], ");
576
- +
577
- + appendStringInfoString(str, "\"dupOperators\": [");
578
- + for (i = 0; i < node->numCols; i++)
579
- + appendStringInfo(str, "%u, ", node->dupOperators[i]);
580
- + removeTrailingDelimiter(str);
581
- + appendStringInfoString(str, "], ");
582
- +
583
- + WRITE_INT_FIELD(flagColIdx);
584
- + WRITE_INT_FIELD(firstFlag);
585
- + WRITE_LONG_FIELD(numGroups);
586
- +}
587
- +
588
- +/*****************************************************************************
589
- + *
590
- + * Stuff from primnodes.h.
591
- + *
592
- + *****************************************************************************/
593
- +
594
- +static void
595
- +_outConst(StringInfo str, const Const *node)
596
- +{
597
- + WRITE_NODE_TYPE("CONST");
598
- +
599
- + WRITE_OID_FIELD(consttype);
600
- + WRITE_INT_FIELD(consttypmod);
601
- + WRITE_OID_FIELD(constcollid);
602
- + WRITE_INT_FIELD(constlen);
603
- + WRITE_BOOL_FIELD(constbyval);
604
- + WRITE_BOOL_FIELD(constisnull);
605
- + WRITE_LOCATION_FIELD(location);
606
- +
607
- + appendStringInfoString(str, "\"constvalue\": ");
608
- + if (node->constisnull)
609
- + appendStringInfoString(str, "null");
610
- + else
611
- + _outDatum(str, node->constvalue, node->constlen, node->constbyval);
612
- + appendStringInfoString(str, ", ");
613
- +}
614
- +
615
- +static void
616
- +_outBoolExpr(StringInfo str, const BoolExpr *node)
617
- +{
618
- + char *opstr = NULL;
619
- +
620
- + WRITE_NODE_TYPE("BOOLEXPR");
621
- +
622
- + /* do-it-yourself enum representation */
623
- + switch (node->boolop)
624
- + {
625
- + case AND_EXPR:
626
- + opstr = "and";
627
- + break;
628
- + case OR_EXPR:
629
- + opstr = "or";
630
- + break;
631
- + case NOT_EXPR:
632
- + opstr = "not";
633
- + break;
634
- + }
635
- + appendStringInfoString(str, "\"boolop\": ");
636
- + _outToken(str, opstr);
637
- + appendStringInfoString(str, ", ");
638
- +
639
- + WRITE_NODE_FIELD(args);
640
- + WRITE_LOCATION_FIELD(location);
641
- +}
642
- +
643
- +/*****************************************************************************
644
- + *
645
- + * Stuff from relation.h.
646
- + *
647
- + *****************************************************************************/
648
- +
649
- +static void
650
- +_outPath(StringInfo str, const Path *node)
651
- +{
652
- + WRITE_NODE_TYPE("PATH");
653
- +
654
- + _outPathInfo(str, (const Path *) node);
655
- +}
656
- +
657
- +static void
658
- +_outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
659
- +{
660
- + /*
661
- + * To simplify reading, we just chase up to the topmost merged EC and
662
- + * print that, without bothering to show the merge-ees separately.
663
- + */
664
- + while (node->ec_merged)
665
- + node = node->ec_merged;
666
- +
667
- + WRITE_NODE_TYPE("EQUIVALENCECLASS");
668
- +
669
- + WRITE_NODE_FIELD(ec_opfamilies);
670
- + WRITE_OID_FIELD(ec_collation);
671
- + WRITE_NODE_FIELD(ec_members);
672
- + WRITE_NODE_FIELD(ec_sources);
673
- + WRITE_NODE_FIELD(ec_derives);
674
- + WRITE_BITMAPSET_FIELD(ec_relids);
675
- + WRITE_BOOL_FIELD(ec_has_const);
676
- + WRITE_BOOL_FIELD(ec_has_volatile);
677
- + WRITE_BOOL_FIELD(ec_below_outer_join);
678
- + WRITE_BOOL_FIELD(ec_broken);
679
- + WRITE_UINT_FIELD(ec_sortref);
680
- +}
681
- +
682
- +/*****************************************************************************
683
- + *
684
- + * Stuff from parsenodes.h.
685
- + *
686
- + *****************************************************************************/
687
- +
688
- +static void
689
- +_outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
690
- +{
691
- + WRITE_NODE_TYPE("RTE");
692
- +
693
- + /* put alias + eref first to make dump more legible */
694
- + WRITE_NODE_FIELD(alias);
695
- + WRITE_NODE_FIELD(eref);
696
- + WRITE_ENUM_FIELD(rtekind, RTEKind);
697
- +
698
- + switch (node->rtekind)
699
- + {
700
- + case RTE_RELATION:
701
- + WRITE_OID_FIELD(relid);
702
- + WRITE_CHAR_FIELD(relkind);
703
- + break;
704
- + case RTE_SUBQUERY:
705
- + WRITE_NODE_FIELD(subquery);
706
- + WRITE_BOOL_FIELD(security_barrier);
707
- + break;
708
- + case RTE_JOIN:
709
- + WRITE_ENUM_FIELD(jointype, JoinType);
710
- + WRITE_NODE_FIELD(joinaliasvars);
711
- + break;
712
- + case RTE_FUNCTION:
713
- + WRITE_NODE_FIELD(functions);
714
- + WRITE_BOOL_FIELD(funcordinality);
715
- + break;
716
- + case RTE_VALUES:
717
- + WRITE_NODE_FIELD(values_lists);
718
- + WRITE_NODE_FIELD(values_collations);
719
- + break;
720
- + case RTE_CTE:
721
- + WRITE_STRING_FIELD(ctename);
722
- + WRITE_UINT_FIELD(ctelevelsup);
723
- + WRITE_BOOL_FIELD(self_reference);
724
- + WRITE_NODE_FIELD(ctecoltypes);
725
- + WRITE_NODE_FIELD(ctecoltypmods);
726
- + WRITE_NODE_FIELD(ctecolcollations);
727
- + break;
728
- + default:
729
- + elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
730
- + break;
731
- + }
732
- +
733
- + WRITE_BOOL_FIELD(lateral);
734
- + WRITE_BOOL_FIELD(inh);
735
- + WRITE_BOOL_FIELD(inFromCl);
736
- + WRITE_UINT_FIELD(requiredPerms);
737
- + WRITE_OID_FIELD(checkAsUser);
738
- + WRITE_BITMAPSET_FIELD(selectedCols);
739
- + WRITE_BITMAPSET_FIELD(modifiedCols);
740
- + WRITE_NODE_FIELD(securityQuals);
741
- +}
742
- +
743
- +static void
744
- +_outAExpr(StringInfo str, const A_Expr *node)
745
- +{
746
- + switch (node->kind)
747
- + {
748
- + case AEXPR_OP:
749
- + WRITE_NODE_TYPE("AEXPR");
750
- + WRITE_NODE_FIELD(name);
751
- + break;
752
- + case AEXPR_AND:
753
- + WRITE_NODE_TYPE("AEXPR AND");
754
- + break;
755
- + case AEXPR_OR:
756
- + WRITE_NODE_TYPE("AEXPR OR");
757
- + break;
758
- + case AEXPR_NOT:
759
- + WRITE_NODE_TYPE("AEXPR NOT");
760
- + break;
761
- + case AEXPR_OP_ANY:
762
- + WRITE_NODE_TYPE("AEXPR ANY");
763
- + WRITE_NODE_FIELD(name);
764
- + break;
765
- + case AEXPR_OP_ALL:
766
- + WRITE_NODE_TYPE("AEXPR ALL");
767
- + WRITE_NODE_FIELD(name);
768
- + break;
769
- + case AEXPR_DISTINCT:
770
- + WRITE_NODE_TYPE("AEXPR DISTINCT");
771
- + WRITE_NODE_FIELD(name);
772
- + break;
773
- + case AEXPR_NULLIF:
774
- + WRITE_NODE_TYPE("AEXPR NULLIF");
775
- + WRITE_NODE_FIELD(name);
776
- + break;
777
- + case AEXPR_OF:
778
- + WRITE_NODE_TYPE("AEXPR OF");
779
- + WRITE_NODE_FIELD(name);
780
- + break;
781
- + case AEXPR_IN:
782
- + WRITE_NODE_TYPE("AEXPR IN");
783
- + WRITE_NODE_FIELD(name);
784
- + break;
785
- + default:
786
- + WRITE_NODE_TYPE("AEXPR ??");
787
- + break;
788
- + }
789
- +
790
- + WRITE_NODE_FIELD(lexpr);
791
- + WRITE_NODE_FIELD(rexpr);
792
- + WRITE_LOCATION_FIELD(location);
793
- +}
794
- +
795
- +static void
796
- +_outValue(StringInfo str, const Value *value)
797
- +{
798
- + switch (value->type)
799
- + {
800
- + case T_Integer:
801
- + appendStringInfo(str, "%ld", value->val.ival);
802
- + break;
803
- + case T_Float:
804
- +
805
- + /*
806
- + * We assume the value is a valid numeric literal and so does not
807
- + * need quoting.
808
- + */
809
- + if (strlen(value->val.str) > 0 && value->val.str[0] == '.')
810
- + appendStringInfoChar(str, '0');
811
- + appendStringInfoString(str, value->val.str);
812
- + if (strlen(value->val.str) > 0 && value->val.str[strlen(value->val.str) - 1] == '.')
813
- + appendStringInfoChar(str, '0');
814
- + break;
815
- + case T_String:
816
- + _outToken(str, value->val.str);
817
- + break;
818
- + case T_BitString:
819
- + /* internal representation already has leading 'b' */
820
- + appendStringInfoString(str, value->val.str);
821
- + break;
822
- + case T_Null:
823
- + /* this is seen only within A_Const, not in transformed trees */
824
- + appendStringInfoString(str, "null");
825
- + break;
826
- + default:
827
- + elog(ERROR, "unrecognized node type: %d", (int) value->type);
828
- + break;
829
- + }
830
- +}
831
- +
832
- +static void
833
- +_outAConst(StringInfo str, const A_Const *node)
834
- +{
835
- + WRITE_NODE_TYPE("A_CONST");
836
- +
837
- + appendStringInfoString(str, "\"val\": ");
838
- + _outValue(str, &(node->val));
839
- + appendStringInfoString(str, ", ");
840
- + WRITE_LOCATION_FIELD(location);
841
- +}
842
- +
843
- +static void
844
- +_outConstraint(StringInfo str, const Constraint *node)
845
- +{
846
- + WRITE_NODE_TYPE("CONSTRAINT");
847
- +
848
- + WRITE_STRING_FIELD(conname);
849
- + WRITE_BOOL_FIELD(deferrable);
850
- + WRITE_BOOL_FIELD(initdeferred);
851
- + WRITE_LOCATION_FIELD(location);
852
- +
853
- + switch (node->contype)
854
- + {
855
- + case CONSTR_NULL:
856
- + appendStringInfoString(str, "\"contype\": \"NULL\", ");
857
- + break;
858
- +
859
- + case CONSTR_NOTNULL:
860
- + appendStringInfoString(str, "\"contype\": \"NOT_NULL\", ");
861
- + break;
862
- +
863
- + case CONSTR_DEFAULT:
864
- + appendStringInfoString(str, "\"contype\": \"DEFAULT\", ");
865
- + WRITE_NODE_FIELD(raw_expr);
866
- + WRITE_STRING_FIELD(cooked_expr);
867
- + break;
868
- +
869
- + case CONSTR_CHECK:
870
- + appendStringInfoString(str, "\"contype\": \"CHECK\", ");
871
- + WRITE_BOOL_FIELD(is_no_inherit);
872
- + WRITE_NODE_FIELD(raw_expr);
873
- + WRITE_STRING_FIELD(cooked_expr);
874
- + break;
875
- +
876
- + case CONSTR_PRIMARY:
877
- + appendStringInfoString(str, "\"contype\": \"PRIMARY_KEY\", ");
878
- + WRITE_NODE_FIELD(keys);
879
- + WRITE_NODE_FIELD(options);
880
- + WRITE_STRING_FIELD(indexname);
881
- + WRITE_STRING_FIELD(indexspace);
882
- + /* access_method and where_clause not currently used */
883
- + break;
884
- +
885
- + case CONSTR_UNIQUE:
886
- + appendStringInfoString(str, "\"contype\": \"UNIQUE\", ");
887
- + WRITE_NODE_FIELD(keys);
888
- + WRITE_NODE_FIELD(options);
889
- + WRITE_STRING_FIELD(indexname);
890
- + WRITE_STRING_FIELD(indexspace);
891
- + /* access_method and where_clause not currently used */
892
- + break;
893
- +
894
- + case CONSTR_EXCLUSION:
895
- + appendStringInfoString(str, "\"contype\": \"EXCLUSION\", ");
896
- + WRITE_NODE_FIELD(exclusions);
897
- + WRITE_NODE_FIELD(options);
898
- + WRITE_STRING_FIELD(indexname);
899
- + WRITE_STRING_FIELD(indexspace);
900
- + WRITE_STRING_FIELD(access_method);
901
- + WRITE_NODE_FIELD(where_clause);
902
- + break;
903
- +
904
- + case CONSTR_FOREIGN:
905
- + appendStringInfoString(str, "\"contype\": \"FOREIGN_KEY\", ");
906
- + WRITE_NODE_FIELD(pktable);
907
- + WRITE_NODE_FIELD(fk_attrs);
908
- + WRITE_NODE_FIELD(pk_attrs);
909
- + WRITE_CHAR_FIELD(fk_matchtype);
910
- + WRITE_CHAR_FIELD(fk_upd_action);
911
- + WRITE_CHAR_FIELD(fk_del_action);
912
- + WRITE_NODE_FIELD(old_conpfeqop);
913
- + WRITE_OID_FIELD(old_pktable_oid);
914
- + WRITE_BOOL_FIELD(skip_validation);
915
- + WRITE_BOOL_FIELD(initially_valid);
916
- + break;
917
- +
918
- + case CONSTR_ATTR_DEFERRABLE:
919
- + appendStringInfoString(str, "\"contype\": \"ATTR_DEFERRABLE\", ");
920
- + break;
921
- +
922
- + case CONSTR_ATTR_NOT_DEFERRABLE:
923
- + appendStringInfoString(str, "\"contype\": \"ATTR_NOT_DEFERRABLE\", ");
924
- + break;
925
- +
926
- + case CONSTR_ATTR_DEFERRED:
927
- + appendStringInfoString(str, "\"contype\": \"ATTR_DEFERRED\", ");
928
- + break;
929
- +
930
- + case CONSTR_ATTR_IMMEDIATE:
931
- + appendStringInfoString(str, "\"contype\": \"ATTR_IMMEDIATE\", ");
932
- + break;
933
- +
934
- + default:
935
- + /*appendStringInfo(str, "<unrecognized_constraint %d>",
936
- + (int) node->contype);*/
937
- + appendStringInfoString(str, "\"contype\": null, ");
938
- + break;
939
- + }
940
- +}
941
- +
942
- +/*
943
- + * _outNode -
944
- + * converts a Node into ascii string and append it to 'str'
945
- + */
946
- +static void
947
- +_outNode(StringInfo str, const void *obj)
948
- +{
949
- + if (obj == NULL)
950
- + appendStringInfoString(str, "null");
951
- + else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
952
- + _outList(str, obj);
953
- + else if (IsA(obj, Integer) ||
954
- + IsA(obj, Float) ||
955
- + IsA(obj, String) ||
956
- + IsA(obj, BitString))
957
- + {
958
- + /* nodeRead does not want to see { } around these! */
959
- + _outValue(str, obj);
960
- + }
961
- + else
962
- + {
963
- + appendStringInfoChar(str, '{');
964
- + switch (nodeTag(obj))
965
- + {
966
- + case T_MergeAppend:
967
- + _outMergeAppend(str, obj);
968
- + break;
969
- + case T_RecursiveUnion:
970
- + _outRecursiveUnion(str, obj);
971
- + break;
972
- + case T_MergeJoin:
973
- + _outMergeJoin(str, obj);
974
- + break;
975
- + case T_Agg:
976
- + _outAgg(str, obj);
977
- + break;
978
- + case T_WindowAgg:
979
- + _outWindowAgg(str, obj);
980
- + break;
981
- + case T_Group:
982
- + _outGroup(str, obj);
983
- + break;
984
- + case T_Sort:
985
- + _outSort(str, obj);
986
- + break;
987
- + case T_Unique:
988
- + _outUnique(str, obj);
989
- + break;
990
- + case T_SetOp:
991
- + _outSetOp(str, obj);
992
- + break;
993
- + case T_Const:
994
- + _outConst(str, obj);
995
- + break;
996
- + case T_BoolExpr:
997
- + _outBoolExpr(str, obj);
998
- + break;
999
- + case T_Path:
1000
- + _outPath(str, obj);
1001
- + break;
1002
- + case T_EquivalenceClass:
1003
- + _outEquivalenceClass(str, obj);
1004
- + break;
1005
- + case T_RangeTblEntry:
1006
- + _outRangeTblEntry(str, obj);
1007
- + break;
1008
- + case T_A_Expr:
1009
- + _outAExpr(str, obj);
1010
- + break;
1011
- + case T_A_Const:
1012
- + _outAConst(str, obj);
1013
- + break;
1014
- + case T_Constraint:
1015
- + _outConstraint(str, obj);
1016
- + break;
1017
- +
1018
- + #include "outfuncs_shared_conds.c"
1019
- +
1020
- + default:
1021
- +
1022
- + /*
1023
- + * This should be an ERROR, but it's too useful to be able to
1024
- + * dump structures that _outNode only understands part of.
1025
- + */
1026
- + elog(WARNING, "could not dump unrecognized node type: %d",
1027
- + (int) nodeTag(obj));
1028
- +
1029
- + appendStringInfo(str, "}");
1030
- + return;
1031
- + }
1032
- + removeTrailingDelimiter(str);
1033
- + appendStringInfo(str, "}}");
1034
- + }
1035
- +}
1036
- +
1037
- +/*
1038
- + * nodeToJSONString -
1039
- + * returns the JSON representation of the Node as a palloc'd string
1040
- + */
1041
- +char *
1042
- +nodeToJSONString(const void *obj)
1043
- +{
1044
- + StringInfoData str;
1045
- +
1046
- + /* see stringinfo.h for an explanation of this maneuver */
1047
- + initStringInfo(&str);
1048
- +
1049
- + if (obj == NULL) /* Make sure we generate valid JSON for empty queries */
1050
- + appendStringInfoString(&str, "[]");
1051
- + else
1052
- + _outNode(&str, obj);
1053
- +
1054
- + return str.data;
1055
- +}
1056
- diff --git a/src/backend/nodes/outfuncs_shared_conds.c b/src/backend/nodes/outfuncs_shared_conds.c
1057
- new file mode 100644
1058
- index 0000000..d502f84
1059
- --- /dev/null
1060
- +++ b/src/backend/nodes/outfuncs_shared_conds.c
1061
- @@ -0,0 +1,699 @@
1062
- +case T_Plan:
1063
- + _outPlan(str, obj);
1064
- + break;
1065
- +case T_Result:
1066
- + _outResult(str, obj);
1067
- + break;
1068
- +case T_ModifyTable:
1069
- + _outModifyTable(str, obj);
1070
- + break;
1071
- +case T_Append:
1072
- + _outAppend(str, obj);
1073
- + break;
1074
- +case T_BitmapAnd:
1075
- + _outBitmapAnd(str, obj);
1076
- + break;
1077
- +case T_BitmapOr:
1078
- + _outBitmapOr(str, obj);
1079
- + break;
1080
- +case T_Scan:
1081
- + _outScan(str, obj);
1082
- + break;
1083
- +case T_SeqScan:
1084
- + _outSeqScan(str, obj);
1085
- + break;
1086
- +case T_IndexScan:
1087
- + _outIndexScan(str, obj);
1088
- + break;
1089
- +case T_IndexOnlyScan:
1090
- + _outIndexOnlyScan(str, obj);
1091
- + break;
1092
- +case T_BitmapIndexScan:
1093
- + _outBitmapIndexScan(str, obj);
1094
- + break;
1095
- +case T_BitmapHeapScan:
1096
- + _outBitmapHeapScan(str, obj);
1097
- + break;
1098
- +case T_TidScan:
1099
- + _outTidScan(str, obj);
1100
- + break;
1101
- +case T_SubqueryScan:
1102
- + _outSubqueryScan(str, obj);
1103
- + break;
1104
- +case T_FunctionScan:
1105
- + _outFunctionScan(str, obj);
1106
- + break;
1107
- +case T_ValuesScan:
1108
- + _outValuesScan(str, obj);
1109
- + break;
1110
- +case T_CteScan:
1111
- + _outCteScan(str, obj);
1112
- + break;
1113
- +case T_WorkTableScan:
1114
- + _outWorkTableScan(str, obj);
1115
- + break;
1116
- +case T_ForeignScan:
1117
- + _outForeignScan(str, obj);
1118
- + break;
1119
- +case T_Join:
1120
- + _outJoin(str, obj);
1121
- + break;
1122
- +case T_NestLoop:
1123
- + _outNestLoop(str, obj);
1124
- + break;
1125
- +case T_HashJoin:
1126
- + _outHashJoin(str, obj);
1127
- + break;
1128
- +case T_Material:
1129
- + _outMaterial(str, obj);
1130
- + break;
1131
- +case T_Hash:
1132
- + _outHash(str, obj);
1133
- + break;
1134
- +case T_LockRows:
1135
- + _outLockRows(str, obj);
1136
- + break;
1137
- +case T_Limit:
1138
- + _outLimit(str, obj);
1139
- + break;
1140
- +case T_NestLoopParam:
1141
- + _outNestLoopParam(str, obj);
1142
- + break;
1143
- +case T_PlanRowMark:
1144
- + _outPlanRowMark(str, obj);
1145
- + break;
1146
- +case T_PlanInvalItem:
1147
- + _outPlanInvalItem(str, obj);
1148
- + break;
1149
- +case T_Alias:
1150
- + _outAlias(str, obj);
1151
- + break;
1152
- +case T_RangeVar:
1153
- + _outRangeVar(str, obj);
1154
- + break;
1155
- +case T_Var:
1156
- + _outVar(str, obj);
1157
- + break;
1158
- +case T_Param:
1159
- + _outParam(str, obj);
1160
- + break;
1161
- +case T_Aggref:
1162
- + _outAggref(str, obj);
1163
- + break;
1164
- +case T_WindowFunc:
1165
- + _outWindowFunc(str, obj);
1166
- + break;
1167
- +case T_ArrayRef:
1168
- + _outArrayRef(str, obj);
1169
- + break;
1170
- +case T_FuncExpr:
1171
- + _outFuncExpr(str, obj);
1172
- + break;
1173
- +case T_NamedArgExpr:
1174
- + _outNamedArgExpr(str, obj);
1175
- + break;
1176
- +case T_OpExpr:
1177
- + _outOpExpr(str, obj);
1178
- + break;
1179
- +case T_DistinctExpr:
1180
- + _outDistinctExpr(str, obj);
1181
- + break;
1182
- +case T_NullIfExpr:
1183
- + _outNullIfExpr(str, obj);
1184
- + break;
1185
- +case T_ScalarArrayOpExpr:
1186
- + _outScalarArrayOpExpr(str, obj);
1187
- + break;
1188
- +case T_SubLink:
1189
- + _outSubLink(str, obj);
1190
- + break;
1191
- +case T_SubPlan:
1192
- + _outSubPlan(str, obj);
1193
- + break;
1194
- +case T_AlternativeSubPlan:
1195
- + _outAlternativeSubPlan(str, obj);
1196
- + break;
1197
- +case T_FieldSelect:
1198
- + _outFieldSelect(str, obj);
1199
- + break;
1200
- +case T_FieldStore:
1201
- + _outFieldStore(str, obj);
1202
- + break;
1203
- +case T_RelabelType:
1204
- + _outRelabelType(str, obj);
1205
- + break;
1206
- +case T_CoerceViaIO:
1207
- + _outCoerceViaIO(str, obj);
1208
- + break;
1209
- +case T_ArrayCoerceExpr:
1210
- + _outArrayCoerceExpr(str, obj);
1211
- + break;
1212
- +case T_ConvertRowtypeExpr:
1213
- + _outConvertRowtypeExpr(str, obj);
1214
- + break;
1215
- +case T_CollateExpr:
1216
- + _outCollateExpr(str, obj);
1217
- + break;
1218
- +case T_CaseExpr:
1219
- + _outCaseExpr(str, obj);
1220
- + break;
1221
- +case T_CaseWhen:
1222
- + _outCaseWhen(str, obj);
1223
- + break;
1224
- +case T_CaseTestExpr:
1225
- + _outCaseTestExpr(str, obj);
1226
- + break;
1227
- +case T_ArrayExpr:
1228
- + _outArrayExpr(str, obj);
1229
- + break;
1230
- +case T_RowExpr:
1231
- + _outRowExpr(str, obj);
1232
- + break;
1233
- +case T_RowCompareExpr:
1234
- + _outRowCompareExpr(str, obj);
1235
- + break;
1236
- +case T_CoalesceExpr:
1237
- + _outCoalesceExpr(str, obj);
1238
- + break;
1239
- +case T_MinMaxExpr:
1240
- + _outMinMaxExpr(str, obj);
1241
- + break;
1242
- +case T_XmlExpr:
1243
- + _outXmlExpr(str, obj);
1244
- + break;
1245
- +case T_NullTest:
1246
- + _outNullTest(str, obj);
1247
- + break;
1248
- +case T_BooleanTest:
1249
- + _outBooleanTest(str, obj);
1250
- + break;
1251
- +case T_CoerceToDomain:
1252
- + _outCoerceToDomain(str, obj);
1253
- + break;
1254
- +case T_CoerceToDomainValue:
1255
- + _outCoerceToDomainValue(str, obj);
1256
- + break;
1257
- +case T_SetToDefault:
1258
- + _outSetToDefault(str, obj);
1259
- + break;
1260
- +case T_CurrentOfExpr:
1261
- + _outCurrentOfExpr(str, obj);
1262
- + break;
1263
- +case T_TargetEntry:
1264
- + _outTargetEntry(str, obj);
1265
- + break;
1266
- +case T_RangeTblRef:
1267
- + _outRangeTblRef(str, obj);
1268
- + break;
1269
- +case T_JoinExpr:
1270
- + _outJoinExpr(str, obj);
1271
- + break;
1272
- +case T_FromExpr:
1273
- + _outFromExpr(str, obj);
1274
- + break;
1275
- +case T_IntoClause:
1276
- + _outIntoClause(str, obj);
1277
- + break;
1278
- +case T_PlannerInfo:
1279
- + _outPlannerInfo(str, obj);
1280
- + break;
1281
- +case T_PlannerGlobal:
1282
- + _outPlannerGlobal(str, obj);
1283
- + break;
1284
- +case T_RelOptInfo:
1285
- + _outRelOptInfo(str, obj);
1286
- + break;
1287
- +case T_IndexOptInfo:
1288
- + _outIndexOptInfo(str, obj);
1289
- + break;
1290
- +case T_ParamPathInfo:
1291
- + _outParamPathInfo(str, obj);
1292
- + break;
1293
- +case T_IndexPath:
1294
- + _outIndexPath(str, obj);
1295
- + break;
1296
- +case T_BitmapHeapPath:
1297
- + _outBitmapHeapPath(str, obj);
1298
- + break;
1299
- +case T_BitmapAndPath:
1300
- + _outBitmapAndPath(str, obj);
1301
- + break;
1302
- +case T_BitmapOrPath:
1303
- + _outBitmapOrPath(str, obj);
1304
- + break;
1305
- +case T_NestPath:
1306
- + _outNestPath(str, obj);
1307
- + break;
1308
- +case T_MergePath:
1309
- + _outMergePath(str, obj);
1310
- + break;
1311
- +case T_HashPath:
1312
- + _outHashPath(str, obj);
1313
- + break;
1314
- +case T_TidPath:
1315
- + _outTidPath(str, obj);
1316
- + break;
1317
- +case T_ForeignPath:
1318
- + _outForeignPath(str, obj);
1319
- + break;
1320
- +case T_AppendPath:
1321
- + _outAppendPath(str, obj);
1322
- + break;
1323
- +case T_MergeAppendPath:
1324
- + _outMergeAppendPath(str, obj);
1325
- + break;
1326
- +case T_ResultPath:
1327
- + _outResultPath(str, obj);
1328
- + break;
1329
- +case T_MaterialPath:
1330
- + _outMaterialPath(str, obj);
1331
- + break;
1332
- +case T_UniquePath:
1333
- + _outUniquePath(str, obj);
1334
- + break;
1335
- +case T_EquivalenceMember:
1336
- + _outEquivalenceMember(str, obj);
1337
- + break;
1338
- +case T_PathKey:
1339
- + _outPathKey(str, obj);
1340
- + break;
1341
- +case T_RestrictInfo:
1342
- + _outRestrictInfo(str, obj);
1343
- + break;
1344
- +case T_PlaceHolderVar:
1345
- + _outPlaceHolderVar(str, obj);
1346
- + break;
1347
- +case T_SpecialJoinInfo:
1348
- + _outSpecialJoinInfo(str, obj);
1349
- + break;
1350
- +case T_LateralJoinInfo:
1351
- + _outLateralJoinInfo(str, obj);
1352
- + break;
1353
- +case T_AppendRelInfo:
1354
- + _outAppendRelInfo(str, obj);
1355
- + break;
1356
- +case T_PlaceHolderInfo:
1357
- + _outPlaceHolderInfo(str, obj);
1358
- + break;
1359
- +case T_MinMaxAggInfo:
1360
- + _outMinMaxAggInfo(str, obj);
1361
- + break;
1362
- +case T_PlannerParamItem:
1363
- + _outPlannerParamItem(str, obj);
1364
- + break;
1365
- +case T_Query:
1366
- + _outQuery(str, obj);
1367
- + break;
1368
- +case T_PlannedStmt:
1369
- + _outPlannedStmt(str, obj);
1370
- + break;
1371
- +case T_InsertStmt:
1372
- + _outInsertStmt(str, obj);
1373
- + break;
1374
- +case T_DeleteStmt:
1375
- + _outDeleteStmt(str, obj);
1376
- + break;
1377
- +case T_UpdateStmt:
1378
- + _outUpdateStmt(str, obj);
1379
- + break;
1380
- +case T_SelectStmt:
1381
- + _outSelectStmt(str, obj);
1382
- + break;
1383
- +case T_AlterTableStmt:
1384
- + _outAlterTableStmt(str, obj);
1385
- + break;
1386
- +case T_AlterTableCmd:
1387
- + _outAlterTableCmd(str, obj);
1388
- + break;
1389
- +case T_AlterDomainStmt:
1390
- + _outAlterDomainStmt(str, obj);
1391
- + break;
1392
- +case T_SetOperationStmt:
1393
- + _outSetOperationStmt(str, obj);
1394
- + break;
1395
- +case T_GrantStmt:
1396
- + _outGrantStmt(str, obj);
1397
- + break;
1398
- +case T_GrantRoleStmt:
1399
- + _outGrantRoleStmt(str, obj);
1400
- + break;
1401
- +case T_AlterDefaultPrivilegesStmt:
1402
- + _outAlterDefaultPrivilegesStmt(str, obj);
1403
- + break;
1404
- +case T_ClosePortalStmt:
1405
- + _outClosePortalStmt(str, obj);
1406
- + break;
1407
- +case T_ClusterStmt:
1408
- + _outClusterStmt(str, obj);
1409
- + break;
1410
- +case T_CopyStmt:
1411
- + _outCopyStmt(str, obj);
1412
- + break;
1413
- +case T_CreateStmt:
1414
- + _outCreateStmt(str, obj);
1415
- + break;
1416
- +case T_DefineStmt:
1417
- + _outDefineStmt(str, obj);
1418
- + break;
1419
- +case T_DropStmt:
1420
- + _outDropStmt(str, obj);
1421
- + break;
1422
- +case T_TruncateStmt:
1423
- + _outTruncateStmt(str, obj);
1424
- + break;
1425
- +case T_CommentStmt:
1426
- + _outCommentStmt(str, obj);
1427
- + break;
1428
- +case T_FetchStmt:
1429
- + _outFetchStmt(str, obj);
1430
- + break;
1431
- +case T_IndexStmt:
1432
- + _outIndexStmt(str, obj);
1433
- + break;
1434
- +case T_CreateFunctionStmt:
1435
- + _outCreateFunctionStmt(str, obj);
1436
- + break;
1437
- +case T_AlterFunctionStmt:
1438
- + _outAlterFunctionStmt(str, obj);
1439
- + break;
1440
- +case T_DoStmt:
1441
- + _outDoStmt(str, obj);
1442
- + break;
1443
- +case T_RenameStmt:
1444
- + _outRenameStmt(str, obj);
1445
- + break;
1446
- +case T_RuleStmt:
1447
- + _outRuleStmt(str, obj);
1448
- + break;
1449
- +case T_NotifyStmt:
1450
- + _outNotifyStmt(str, obj);
1451
- + break;
1452
- +case T_ListenStmt:
1453
- + _outListenStmt(str, obj);
1454
- + break;
1455
- +case T_UnlistenStmt:
1456
- + _outUnlistenStmt(str, obj);
1457
- + break;
1458
- +case T_TransactionStmt:
1459
- + _outTransactionStmt(str, obj);
1460
- + break;
1461
- +case T_ViewStmt:
1462
- + _outViewStmt(str, obj);
1463
- + break;
1464
- +case T_LoadStmt:
1465
- + _outLoadStmt(str, obj);
1466
- + break;
1467
- +case T_CreateDomainStmt:
1468
- + _outCreateDomainStmt(str, obj);
1469
- + break;
1470
- +case T_CreatedbStmt:
1471
- + _outCreatedbStmt(str, obj);
1472
- + break;
1473
- +case T_DropdbStmt:
1474
- + _outDropdbStmt(str, obj);
1475
- + break;
1476
- +case T_VacuumStmt:
1477
- + _outVacuumStmt(str, obj);
1478
- + break;
1479
- +case T_ExplainStmt:
1480
- + _outExplainStmt(str, obj);
1481
- + break;
1482
- +case T_CreateTableAsStmt:
1483
- + _outCreateTableAsStmt(str, obj);
1484
- + break;
1485
- +case T_CreateSeqStmt:
1486
- + _outCreateSeqStmt(str, obj);
1487
- + break;
1488
- +case T_AlterSeqStmt:
1489
- + _outAlterSeqStmt(str, obj);
1490
- + break;
1491
- +case T_VariableSetStmt:
1492
- + _outVariableSetStmt(str, obj);
1493
- + break;
1494
- +case T_VariableShowStmt:
1495
- + _outVariableShowStmt(str, obj);
1496
- + break;
1497
- +case T_DiscardStmt:
1498
- + _outDiscardStmt(str, obj);
1499
- + break;
1500
- +case T_CreateTrigStmt:
1501
- + _outCreateTrigStmt(str, obj);
1502
- + break;
1503
- +case T_CreatePLangStmt:
1504
- + _outCreatePLangStmt(str, obj);
1505
- + break;
1506
- +case T_CreateRoleStmt:
1507
- + _outCreateRoleStmt(str, obj);
1508
- + break;
1509
- +case T_AlterRoleStmt:
1510
- + _outAlterRoleStmt(str, obj);
1511
- + break;
1512
- +case T_DropRoleStmt:
1513
- + _outDropRoleStmt(str, obj);
1514
- + break;
1515
- +case T_LockStmt:
1516
- + _outLockStmt(str, obj);
1517
- + break;
1518
- +case T_ConstraintsSetStmt:
1519
- + _outConstraintsSetStmt(str, obj);
1520
- + break;
1521
- +case T_ReindexStmt:
1522
- + _outReindexStmt(str, obj);
1523
- + break;
1524
- +case T_CheckPointStmt:
1525
- + _outCheckPointStmt(str, obj);
1526
- + break;
1527
- +case T_CreateSchemaStmt:
1528
- + _outCreateSchemaStmt(str, obj);
1529
- + break;
1530
- +case T_AlterDatabaseStmt:
1531
- + _outAlterDatabaseStmt(str, obj);
1532
- + break;
1533
- +case T_AlterDatabaseSetStmt:
1534
- + _outAlterDatabaseSetStmt(str, obj);
1535
- + break;
1536
- +case T_AlterRoleSetStmt:
1537
- + _outAlterRoleSetStmt(str, obj);
1538
- + break;
1539
- +case T_CreateConversionStmt:
1540
- + _outCreateConversionStmt(str, obj);
1541
- + break;
1542
- +case T_CreateCastStmt:
1543
- + _outCreateCastStmt(str, obj);
1544
- + break;
1545
- +case T_CreateOpClassStmt:
1546
- + _outCreateOpClassStmt(str, obj);
1547
- + break;
1548
- +case T_CreateOpFamilyStmt:
1549
- + _outCreateOpFamilyStmt(str, obj);
1550
- + break;
1551
- +case T_AlterOpFamilyStmt:
1552
- + _outAlterOpFamilyStmt(str, obj);
1553
- + break;
1554
- +case T_PrepareStmt:
1555
- + _outPrepareStmt(str, obj);
1556
- + break;
1557
- +case T_ExecuteStmt:
1558
- + _outExecuteStmt(str, obj);
1559
- + break;
1560
- +case T_DeallocateStmt:
1561
- + _outDeallocateStmt(str, obj);
1562
- + break;
1563
- +case T_DeclareCursorStmt:
1564
- + _outDeclareCursorStmt(str, obj);
1565
- + break;
1566
- +case T_CreateTableSpaceStmt:
1567
- + _outCreateTableSpaceStmt(str, obj);
1568
- + break;
1569
- +case T_DropTableSpaceStmt:
1570
- + _outDropTableSpaceStmt(str, obj);
1571
- + break;
1572
- +case T_AlterObjectSchemaStmt:
1573
- + _outAlterObjectSchemaStmt(str, obj);
1574
- + break;
1575
- +case T_AlterOwnerStmt:
1576
- + _outAlterOwnerStmt(str, obj);
1577
- + break;
1578
- +case T_DropOwnedStmt:
1579
- + _outDropOwnedStmt(str, obj);
1580
- + break;
1581
- +case T_ReassignOwnedStmt:
1582
- + _outReassignOwnedStmt(str, obj);
1583
- + break;
1584
- +case T_CompositeTypeStmt:
1585
- + _outCompositeTypeStmt(str, obj);
1586
- + break;
1587
- +case T_CreateEnumStmt:
1588
- + _outCreateEnumStmt(str, obj);
1589
- + break;
1590
- +case T_CreateRangeStmt:
1591
- + _outCreateRangeStmt(str, obj);
1592
- + break;
1593
- +case T_AlterEnumStmt:
1594
- + _outAlterEnumStmt(str, obj);
1595
- + break;
1596
- +case T_AlterTSDictionaryStmt:
1597
- + _outAlterTSDictionaryStmt(str, obj);
1598
- + break;
1599
- +case T_AlterTSConfigurationStmt:
1600
- + _outAlterTSConfigurationStmt(str, obj);
1601
- + break;
1602
- +case T_CreateFdwStmt:
1603
- + _outCreateFdwStmt(str, obj);
1604
- + break;
1605
- +case T_AlterFdwStmt:
1606
- + _outAlterFdwStmt(str, obj);
1607
- + break;
1608
- +case T_CreateForeignServerStmt:
1609
- + _outCreateForeignServerStmt(str, obj);
1610
- + break;
1611
- +case T_AlterForeignServerStmt:
1612
- + _outAlterForeignServerStmt(str, obj);
1613
- + break;
1614
- +case T_CreateUserMappingStmt:
1615
- + _outCreateUserMappingStmt(str, obj);
1616
- + break;
1617
- +case T_AlterUserMappingStmt:
1618
- + _outAlterUserMappingStmt(str, obj);
1619
- + break;
1620
- +case T_DropUserMappingStmt:
1621
- + _outDropUserMappingStmt(str, obj);
1622
- + break;
1623
- +case T_AlterTableSpaceOptionsStmt:
1624
- + _outAlterTableSpaceOptionsStmt(str, obj);
1625
- + break;
1626
- +case T_AlterTableMoveAllStmt:
1627
- + _outAlterTableMoveAllStmt(str, obj);
1628
- + break;
1629
- +case T_SecLabelStmt:
1630
- + _outSecLabelStmt(str, obj);
1631
- + break;
1632
- +case T_CreateForeignTableStmt:
1633
- + _outCreateForeignTableStmt(str, obj);
1634
- + break;
1635
- +case T_CreateExtensionStmt:
1636
- + _outCreateExtensionStmt(str, obj);
1637
- + break;
1638
- +case T_AlterExtensionStmt:
1639
- + _outAlterExtensionStmt(str, obj);
1640
- + break;
1641
- +case T_AlterExtensionContentsStmt:
1642
- + _outAlterExtensionContentsStmt(str, obj);
1643
- + break;
1644
- +case T_CreateEventTrigStmt:
1645
- + _outCreateEventTrigStmt(str, obj);
1646
- + break;
1647
- +case T_AlterEventTrigStmt:
1648
- + _outAlterEventTrigStmt(str, obj);
1649
- + break;
1650
- +case T_RefreshMatViewStmt:
1651
- + _outRefreshMatViewStmt(str, obj);
1652
- + break;
1653
- +case T_ReplicaIdentityStmt:
1654
- + _outReplicaIdentityStmt(str, obj);
1655
- + break;
1656
- +case T_AlterSystemStmt:
1657
- + _outAlterSystemStmt(str, obj);
1658
- + break;
1659
- +case T_ColumnRef:
1660
- + _outColumnRef(str, obj);
1661
- + break;
1662
- +case T_ParamRef:
1663
- + _outParamRef(str, obj);
1664
- + break;
1665
- +case T_FuncCall:
1666
- + _outFuncCall(str, obj);
1667
- + break;
1668
- +case T_A_Star:
1669
- + _outA_Star(str, obj);
1670
- + break;
1671
- +case T_A_Indices:
1672
- + _outA_Indices(str, obj);
1673
- + break;
1674
- +case T_A_Indirection:
1675
- + _outA_Indirection(str, obj);
1676
- + break;
1677
- +case T_A_ArrayExpr:
1678
- + _outA_ArrayExpr(str, obj);
1679
- + break;
1680
- +case T_ResTarget:
1681
- + _outResTarget(str, obj);
1682
- + break;
1683
- +case T_TypeCast:
1684
- + _outTypeCast(str, obj);
1685
- + break;
1686
- +case T_CollateClause:
1687
- + _outCollateClause(str, obj);
1688
- + break;
1689
- +case T_SortBy:
1690
- + _outSortBy(str, obj);
1691
- + break;
1692
- +case T_WindowDef:
1693
- + _outWindowDef(str, obj);
1694
- + break;
1695
- +case T_RangeSubselect:
1696
- + _outRangeSubselect(str, obj);
1697
- + break;
1698
- +case T_RangeFunction:
1699
- + _outRangeFunction(str, obj);
1700
- + break;
1701
- +case T_TypeName:
1702
- + _outTypeName(str, obj);
1703
- + break;
1704
- +case T_ColumnDef:
1705
- + _outColumnDef(str, obj);
1706
- + break;
1707
- +case T_IndexElem:
1708
- + _outIndexElem(str, obj);
1709
- + break;
1710
- +case T_DefElem:
1711
- + _outDefElem(str, obj);
1712
- + break;
1713
- +case T_RangeTblFunction:
1714
- + _outRangeTblFunction(str, obj);
1715
- + break;
1716
- +case T_WithCheckOption:
1717
- + _outWithCheckOption(str, obj);
1718
- + break;
1719
- +case T_SortGroupClause:
1720
- + _outSortGroupClause(str, obj);
1721
- + break;
1722
- +case T_WindowClause:
1723
- + _outWindowClause(str, obj);
1724
- + break;
1725
- +case T_PrivGrantee:
1726
- + _outPrivGrantee(str, obj);
1727
- + break;
1728
- +case T_FuncWithArgs:
1729
- + _outFuncWithArgs(str, obj);
1730
- + break;
1731
- +case T_AccessPriv:
1732
- + _outAccessPriv(str, obj);
1733
- + break;
1734
- +case T_CreateOpClassItem:
1735
- + _outCreateOpClassItem(str, obj);
1736
- + break;
1737
- +case T_TableLikeClause:
1738
- + _outTableLikeClause(str, obj);
1739
- + break;
1740
- +case T_FunctionParameter:
1741
- + _outFunctionParameter(str, obj);
1742
- + break;
1743
- +case T_LockingClause:
1744
- + _outLockingClause(str, obj);
1745
- + break;
1746
- +case T_RowMarkClause:
1747
- + _outRowMarkClause(str, obj);
1748
- + break;
1749
- +case T_XmlSerialize:
1750
- + _outXmlSerialize(str, obj);
1751
- + break;
1752
- +case T_WithClause:
1753
- + _outWithClause(str, obj);
1754
- + break;
1755
- +case T_CommonTableExpr:
1756
- + _outCommonTableExpr(str, obj);
1757
- + break;
1758
- +case T_InlineCodeBlock:
1759
- + _outInlineCodeBlock(str, obj);
1760
- + break;
1761
- diff --git a/src/backend/nodes/outfuncs_shared_defs.c b/src/backend/nodes/outfuncs_shared_defs.c
1762
- new file mode 100644
1763
- index 0000000..9645e69
1764
- --- /dev/null
1765
- +++ b/src/backend/nodes/outfuncs_shared_defs.c
1766
- @@ -0,0 +1,2844 @@
1767
- +static void
1768
- +_outPlanInfo(StringInfo str, const Plan *node)
1769
- +{
1770
- + WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1771
- + WRITE_FLOAT_FIELD(total_cost, "%.2f");
1772
- + WRITE_FLOAT_FIELD(plan_rows, "%.0f");
1773
- + WRITE_INT_FIELD(plan_width);
1774
- + WRITE_NODE_FIELD(targetlist);
1775
- + WRITE_NODE_FIELD(qual);
1776
- + WRITE_NODE_FIELD(lefttree);
1777
- + WRITE_NODE_FIELD(righttree);
1778
- + WRITE_NODE_FIELD(initPlan);
1779
- + WRITE_BITMAPSET_FIELD(extParam);
1780
- + WRITE_BITMAPSET_FIELD(allParam);
1781
- +}
1782
- +
1783
- +static void
1784
- +_outScanInfo(StringInfo str, const Scan *node)
1785
- +{
1786
- + _outPlanInfo(str, (const Plan *) node);
1787
- +
1788
- + WRITE_UINT_FIELD(scanrelid);
1789
- +}
1790
- +
1791
- +static void
1792
- +_outJoinInfo(StringInfo str, const Join *node)
1793
- +{
1794
- + _outPlanInfo(str, (const Plan *) node);
1795
- +
1796
- + WRITE_ENUM_FIELD(jointype, JoinType);
1797
- + WRITE_NODE_FIELD(joinqual);
1798
- +}
1799
- +
1800
- +static void
1801
- +_outJoinPathInfo(StringInfo str, const JoinPath *node)
1802
- +{
1803
- + _outPathInfo(str, (const Path *) node);
1804
- +
1805
- + WRITE_ENUM_FIELD(jointype, JoinType);
1806
- + WRITE_NODE_FIELD(outerjoinpath);
1807
- + WRITE_NODE_FIELD(innerjoinpath);
1808
- + WRITE_NODE_FIELD(joinrestrictinfo);
1809
- +}
1810
- +
1811
- +static void
1812
- +_outCreateStmtInfo(StringInfo str, const CreateStmt *node)
1813
- +{
1814
- + WRITE_NODE_FIELD(relation);
1815
- + WRITE_NODE_FIELD(tableElts);
1816
- + WRITE_NODE_FIELD(inhRelations);
1817
- + WRITE_NODE_FIELD(ofTypename);
1818
- + WRITE_NODE_FIELD(constraints);
1819
- + WRITE_NODE_FIELD(options);
1820
- + WRITE_ENUM_FIELD(oncommit, OnCommitAction);
1821
- + WRITE_STRING_FIELD(tablespacename);
1822
- + WRITE_BOOL_FIELD(if_not_exists);
1823
- +}
1824
- +
1825
- +static void
1826
- +_outPlan(StringInfo str, const Plan *node)
1827
- +{
1828
- + WRITE_NODE_TYPE("PLAN");
1829
- +
1830
- + _outPlanInfo(str, (const Plan *) node);
1831
- +
1832
- +}
1833
- +
1834
- +static void
1835
- +_outResult(StringInfo str, const Result *node)
1836
- +{
1837
- + WRITE_NODE_TYPE("RESULT");
1838
- +
1839
- + _outPlanInfo(str, (const Plan *) node);
1840
- +
1841
- + WRITE_NODE_FIELD(resconstantqual);
1842
- +}
1843
- +
1844
- +static void
1845
- +_outModifyTable(StringInfo str, const ModifyTable *node)
1846
- +{
1847
- + WRITE_NODE_TYPE("MODIFYTABLE");
1848
- +
1849
- + _outPlanInfo(str, (const Plan *) node);
1850
- +
1851
- + WRITE_ENUM_FIELD(operation, CmdType);
1852
- + WRITE_BOOL_FIELD(canSetTag);
1853
- + WRITE_NODE_FIELD(resultRelations);
1854
- + WRITE_INT_FIELD(resultRelIndex);
1855
- + WRITE_NODE_FIELD(plans);
1856
- + WRITE_NODE_FIELD(withCheckOptionLists);
1857
- + WRITE_NODE_FIELD(returningLists);
1858
- + WRITE_NODE_FIELD(fdwPrivLists);
1859
- + WRITE_NODE_FIELD(rowMarks);
1860
- + WRITE_INT_FIELD(epqParam);
1861
- +}
1862
- +
1863
- +static void
1864
- +_outAppend(StringInfo str, const Append *node)
1865
- +{
1866
- + WRITE_NODE_TYPE("APPEND");
1867
- +
1868
- + _outPlanInfo(str, (const Plan *) node);
1869
- +
1870
- + WRITE_NODE_FIELD(appendplans);
1871
- +}
1872
- +
1873
- +static void
1874
- +_outBitmapAnd(StringInfo str, const BitmapAnd *node)
1875
- +{
1876
- + WRITE_NODE_TYPE("BITMAPAND");
1877
- +
1878
- + _outPlanInfo(str, (const Plan *) node);
1879
- +
1880
- + WRITE_NODE_FIELD(bitmapplans);
1881
- +}
1882
- +
1883
- +static void
1884
- +_outBitmapOr(StringInfo str, const BitmapOr *node)
1885
- +{
1886
- + WRITE_NODE_TYPE("BITMAPOR");
1887
- +
1888
- + _outPlanInfo(str, (const Plan *) node);
1889
- +
1890
- + WRITE_NODE_FIELD(bitmapplans);
1891
- +}
1892
- +
1893
- +static void
1894
- +_outScan(StringInfo str, const Scan *node)
1895
- +{
1896
- + WRITE_NODE_TYPE("SCAN");
1897
- +
1898
- + _outScanInfo(str, (const Scan *) node);
1899
- +
1900
- +}
1901
- +
1902
- +static void
1903
- +_outSeqScan(StringInfo str, const SeqScan *node)
1904
- +{
1905
- + WRITE_NODE_TYPE("SEQSCAN");
1906
- +
1907
- + _outScanInfo(str, (const Scan *) node);
1908
- +
1909
- +}
1910
- +
1911
- +static void
1912
- +_outIndexScan(StringInfo str, const IndexScan *node)
1913
- +{
1914
- + WRITE_NODE_TYPE("INDEXSCAN");
1915
- +
1916
- + _outScanInfo(str, (const Scan *) node);
1917
- +
1918
- + WRITE_OID_FIELD(indexid);
1919
- + WRITE_NODE_FIELD(indexqual);
1920
- + WRITE_NODE_FIELD(indexqualorig);
1921
- + WRITE_NODE_FIELD(indexorderby);
1922
- + WRITE_NODE_FIELD(indexorderbyorig);
1923
- + WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
1924
- +}
1925
- +
1926
- +static void
1927
- +_outIndexOnlyScan(StringInfo str, const IndexOnlyScan *node)
1928
- +{
1929
- + WRITE_NODE_TYPE("INDEXONLYSCAN");
1930
- +
1931
- + _outScanInfo(str, (const Scan *) node);
1932
- +
1933
- + WRITE_OID_FIELD(indexid);
1934
- + WRITE_NODE_FIELD(indexqual);
1935
- + WRITE_NODE_FIELD(indexorderby);
1936
- + WRITE_NODE_FIELD(indextlist);
1937
- + WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
1938
- +}
1939
- +
1940
- +static void
1941
- +_outBitmapIndexScan(StringInfo str, const BitmapIndexScan *node)
1942
- +{
1943
- + WRITE_NODE_TYPE("BITMAPINDEXSCAN");
1944
- +
1945
- + _outScanInfo(str, (const Scan *) node);
1946
- +
1947
- + WRITE_OID_FIELD(indexid);
1948
- + WRITE_NODE_FIELD(indexqual);
1949
- + WRITE_NODE_FIELD(indexqualorig);
1950
- +}
1951
- +
1952
- +static void
1953
- +_outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
1954
- +{
1955
- + WRITE_NODE_TYPE("BITMAPHEAPSCAN");
1956
- +
1957
- + _outScanInfo(str, (const Scan *) node);
1958
- +
1959
- + WRITE_NODE_FIELD(bitmapqualorig);
1960
- +}
1961
- +
1962
- +static void
1963
- +_outTidScan(StringInfo str, const TidScan *node)
1964
- +{
1965
- + WRITE_NODE_TYPE("TIDSCAN");
1966
- +
1967
- + _outScanInfo(str, (const Scan *) node);
1968
- +
1969
- + WRITE_NODE_FIELD(tidquals);
1970
- +}
1971
- +
1972
- +static void
1973
- +_outSubqueryScan(StringInfo str, const SubqueryScan *node)
1974
- +{
1975
- + WRITE_NODE_TYPE("SUBQUERYSCAN");
1976
- +
1977
- + _outScanInfo(str, (const Scan *) node);
1978
- +
1979
- + WRITE_NODE_FIELD(subplan);
1980
- +}
1981
- +
1982
- +static void
1983
- +_outFunctionScan(StringInfo str, const FunctionScan *node)
1984
- +{
1985
- + WRITE_NODE_TYPE("FUNCTIONSCAN");
1986
- +
1987
- + _outScanInfo(str, (const Scan *) node);
1988
- +
1989
- + WRITE_NODE_FIELD(functions);
1990
- + WRITE_BOOL_FIELD(funcordinality);
1991
- +}
1992
- +
1993
- +static void
1994
- +_outValuesScan(StringInfo str, const ValuesScan *node)
1995
- +{
1996
- + WRITE_NODE_TYPE("VALUESSCAN");
1997
- +
1998
- + _outScanInfo(str, (const Scan *) node);
1999
- +
2000
- + WRITE_NODE_FIELD(values_lists);
2001
- +}
2002
- +
2003
- +static void
2004
- +_outCteScan(StringInfo str, const CteScan *node)
2005
- +{
2006
- + WRITE_NODE_TYPE("CTESCAN");
2007
- +
2008
- + _outScanInfo(str, (const Scan *) node);
2009
- +
2010
- + WRITE_INT_FIELD(ctePlanId);
2011
- + WRITE_INT_FIELD(cteParam);
2012
- +}
2013
- +
2014
- +static void
2015
- +_outWorkTableScan(StringInfo str, const WorkTableScan *node)
2016
- +{
2017
- + WRITE_NODE_TYPE("WORKTABLESCAN");
2018
- +
2019
- + _outScanInfo(str, (const Scan *) node);
2020
- +
2021
- + WRITE_INT_FIELD(wtParam);
2022
- +}
2023
- +
2024
- +static void
2025
- +_outForeignScan(StringInfo str, const ForeignScan *node)
2026
- +{
2027
- + WRITE_NODE_TYPE("FOREIGNSCAN");
2028
- +
2029
- + _outScanInfo(str, (const Scan *) node);
2030
- +
2031
- + WRITE_NODE_FIELD(fdw_exprs);
2032
- + WRITE_NODE_FIELD(fdw_private);
2033
- + WRITE_BOOL_FIELD(fsSystemCol);
2034
- +}
2035
- +
2036
- +static void
2037
- +_outJoin(StringInfo str, const Join *node)
2038
- +{
2039
- + WRITE_NODE_TYPE("JOIN");
2040
- +
2041
- + _outJoinInfo(str, (const Join *) node);
2042
- +
2043
- +}
2044
- +
2045
- +static void
2046
- +_outNestLoop(StringInfo str, const NestLoop *node)
2047
- +{
2048
- + WRITE_NODE_TYPE("NESTLOOP");
2049
- +
2050
- + _outJoinInfo(str, (const Join *) node);
2051
- +
2052
- + WRITE_NODE_FIELD(nestParams);
2053
- +}
2054
- +
2055
- +static void
2056
- +_outHashJoin(StringInfo str, const HashJoin *node)
2057
- +{
2058
- + WRITE_NODE_TYPE("HASHJOIN");
2059
- +
2060
- + _outJoinInfo(str, (const Join *) node);
2061
- +
2062
- + WRITE_NODE_FIELD(hashclauses);
2063
- +}
2064
- +
2065
- +static void
2066
- +_outMaterial(StringInfo str, const Material *node)
2067
- +{
2068
- + WRITE_NODE_TYPE("MATERIAL");
2069
- +
2070
- + _outPlanInfo(str, (const Plan *) node);
2071
- +
2072
- +}
2073
- +
2074
- +static void
2075
- +_outHash(StringInfo str, const Hash *node)
2076
- +{
2077
- + WRITE_NODE_TYPE("HASH");
2078
- +
2079
- + _outPlanInfo(str, (const Plan *) node);
2080
- +
2081
- + WRITE_OID_FIELD(skewTable);
2082
- + WRITE_INT_FIELD(skewColumn);
2083
- + WRITE_BOOL_FIELD(skewInherit);
2084
- + WRITE_OID_FIELD(skewColType);
2085
- + WRITE_INT_FIELD(skewColTypmod);
2086
- +}
2087
- +
2088
- +static void
2089
- +_outLockRows(StringInfo str, const LockRows *node)
2090
- +{
2091
- + WRITE_NODE_TYPE("LOCKROWS");
2092
- +
2093
- + _outPlanInfo(str, (const Plan *) node);
2094
- +
2095
- + WRITE_NODE_FIELD(rowMarks);
2096
- + WRITE_INT_FIELD(epqParam);
2097
- +}
2098
- +
2099
- +static void
2100
- +_outLimit(StringInfo str, const Limit *node)
2101
- +{
2102
- + WRITE_NODE_TYPE("LIMIT");
2103
- +
2104
- + _outPlanInfo(str, (const Plan *) node);
2105
- +
2106
- + WRITE_NODE_FIELD(limitOffset);
2107
- + WRITE_NODE_FIELD(limitCount);
2108
- +}
2109
- +
2110
- +static void
2111
- +_outNestLoopParam(StringInfo str, const NestLoopParam *node)
2112
- +{
2113
- + WRITE_NODE_TYPE("NESTLOOPPARAM");
2114
- +
2115
- + WRITE_INT_FIELD(paramno);
2116
- + WRITE_NODE_FIELD(paramval);
2117
- +}
2118
- +
2119
- +static void
2120
- +_outPlanRowMark(StringInfo str, const PlanRowMark *node)
2121
- +{
2122
- + WRITE_NODE_TYPE("PLANROWMARK");
2123
- +
2124
- + WRITE_UINT_FIELD(rti);
2125
- + WRITE_UINT_FIELD(prti);
2126
- + WRITE_UINT_FIELD(rowmarkId);
2127
- + WRITE_ENUM_FIELD(markType, RowMarkType);
2128
- + WRITE_BOOL_FIELD(noWait);
2129
- + WRITE_BOOL_FIELD(isParent);
2130
- +}
2131
- +
2132
- +static void
2133
- +_outPlanInvalItem(StringInfo str, const PlanInvalItem *node)
2134
- +{
2135
- + WRITE_NODE_TYPE("PLANINVALITEM");
2136
- +
2137
- + WRITE_INT_FIELD(cacheId);
2138
- + WRITE_UINT_FIELD(hashValue);
2139
- +}
2140
- +
2141
- +static void
2142
- +_outAlias(StringInfo str, const Alias *node)
2143
- +{
2144
- + WRITE_NODE_TYPE("ALIAS");
2145
- +
2146
- + WRITE_STRING_FIELD(aliasname);
2147
- + WRITE_NODE_FIELD(colnames);
2148
- +}
2149
- +
2150
- +static void
2151
- +_outRangeVar(StringInfo str, const RangeVar *node)
2152
- +{
2153
- + WRITE_NODE_TYPE("RANGEVAR");
2154
- +
2155
- + WRITE_STRING_FIELD(schemaname);
2156
- + WRITE_STRING_FIELD(relname);
2157
- + WRITE_ENUM_FIELD(inhOpt, InhOption);
2158
- + WRITE_CHAR_FIELD(relpersistence);
2159
- + WRITE_NODE_FIELD(alias);
2160
- + WRITE_LOCATION_FIELD(location);
2161
- +}
2162
- +
2163
- +static void
2164
- +_outVar(StringInfo str, const Var *node)
2165
- +{
2166
- + WRITE_NODE_TYPE("VAR");
2167
- +
2168
- + WRITE_UINT_FIELD(varno);
2169
- + WRITE_INT_FIELD(varattno);
2170
- + WRITE_OID_FIELD(vartype);
2171
- + WRITE_INT_FIELD(vartypmod);
2172
- + WRITE_OID_FIELD(varcollid);
2173
- + WRITE_UINT_FIELD(varlevelsup);
2174
- + WRITE_UINT_FIELD(varnoold);
2175
- + WRITE_INT_FIELD(varoattno);
2176
- + WRITE_LOCATION_FIELD(location);
2177
- +}
2178
- +
2179
- +static void
2180
- +_outParam(StringInfo str, const Param *node)
2181
- +{
2182
- + WRITE_NODE_TYPE("PARAM");
2183
- +
2184
- + WRITE_ENUM_FIELD(paramkind, ParamKind);
2185
- + WRITE_INT_FIELD(paramid);
2186
- + WRITE_OID_FIELD(paramtype);
2187
- + WRITE_INT_FIELD(paramtypmod);
2188
- + WRITE_OID_FIELD(paramcollid);
2189
- + WRITE_LOCATION_FIELD(location);
2190
- +}
2191
- +
2192
- +static void
2193
- +_outAggref(StringInfo str, const Aggref *node)
2194
- +{
2195
- + WRITE_NODE_TYPE("AGGREF");
2196
- +
2197
- + WRITE_OID_FIELD(aggfnoid);
2198
- + WRITE_OID_FIELD(aggtype);
2199
- + WRITE_OID_FIELD(aggcollid);
2200
- + WRITE_OID_FIELD(inputcollid);
2201
- + WRITE_NODE_FIELD(aggdirectargs);
2202
- + WRITE_NODE_FIELD(args);
2203
- + WRITE_NODE_FIELD(aggorder);
2204
- + WRITE_NODE_FIELD(aggdistinct);
2205
- + WRITE_NODE_FIELD(aggfilter);
2206
- + WRITE_BOOL_FIELD(aggstar);
2207
- + WRITE_BOOL_FIELD(aggvariadic);
2208
- + WRITE_CHAR_FIELD(aggkind);
2209
- + WRITE_UINT_FIELD(agglevelsup);
2210
- + WRITE_LOCATION_FIELD(location);
2211
- +}
2212
- +
2213
- +static void
2214
- +_outWindowFunc(StringInfo str, const WindowFunc *node)
2215
- +{
2216
- + WRITE_NODE_TYPE("WINDOWFUNC");
2217
- +
2218
- + WRITE_OID_FIELD(winfnoid);
2219
- + WRITE_OID_FIELD(wintype);
2220
- + WRITE_OID_FIELD(wincollid);
2221
- + WRITE_OID_FIELD(inputcollid);
2222
- + WRITE_NODE_FIELD(args);
2223
- + WRITE_NODE_FIELD(aggfilter);
2224
- + WRITE_UINT_FIELD(winref);
2225
- + WRITE_BOOL_FIELD(winstar);
2226
- + WRITE_BOOL_FIELD(winagg);
2227
- + WRITE_LOCATION_FIELD(location);
2228
- +}
2229
- +
2230
- +static void
2231
- +_outArrayRef(StringInfo str, const ArrayRef *node)
2232
- +{
2233
- + WRITE_NODE_TYPE("ARRAYREF");
2234
- +
2235
- + WRITE_OID_FIELD(refarraytype);
2236
- + WRITE_OID_FIELD(refelemtype);
2237
- + WRITE_INT_FIELD(reftypmod);
2238
- + WRITE_OID_FIELD(refcollid);
2239
- + WRITE_NODE_FIELD(refupperindexpr);
2240
- + WRITE_NODE_FIELD(reflowerindexpr);
2241
- + WRITE_NODE_FIELD(refexpr);
2242
- + WRITE_NODE_FIELD(refassgnexpr);
2243
- +}
2244
- +
2245
- +static void
2246
- +_outFuncExpr(StringInfo str, const FuncExpr *node)
2247
- +{
2248
- + WRITE_NODE_TYPE("FUNCEXPR");
2249
- +
2250
- + WRITE_OID_FIELD(funcid);
2251
- + WRITE_OID_FIELD(funcresulttype);
2252
- + WRITE_BOOL_FIELD(funcretset);
2253
- + WRITE_BOOL_FIELD(funcvariadic);
2254
- + WRITE_ENUM_FIELD(funcformat, CoercionForm);
2255
- + WRITE_OID_FIELD(funccollid);
2256
- + WRITE_OID_FIELD(inputcollid);
2257
- + WRITE_NODE_FIELD(args);
2258
- + WRITE_LOCATION_FIELD(location);
2259
- +}
2260
- +
2261
- +static void
2262
- +_outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
2263
- +{
2264
- + WRITE_NODE_TYPE("NAMEDARGEXPR");
2265
- +
2266
- + WRITE_NODE_FIELD(arg);
2267
- + WRITE_STRING_FIELD(name);
2268
- + WRITE_INT_FIELD(argnumber);
2269
- + WRITE_LOCATION_FIELD(location);
2270
- +}
2271
- +
2272
- +static void
2273
- +_outOpExpr(StringInfo str, const OpExpr *node)
2274
- +{
2275
- + WRITE_NODE_TYPE("OPEXPR");
2276
- +
2277
- + WRITE_OID_FIELD(opno);
2278
- + WRITE_OID_FIELD(opfuncid);
2279
- + WRITE_OID_FIELD(opresulttype);
2280
- + WRITE_BOOL_FIELD(opretset);
2281
- + WRITE_OID_FIELD(opcollid);
2282
- + WRITE_OID_FIELD(inputcollid);
2283
- + WRITE_NODE_FIELD(args);
2284
- + WRITE_LOCATION_FIELD(location);
2285
- +}
2286
- +
2287
- +static void
2288
- +_outDistinctExpr(StringInfo str, const DistinctExpr *node)
2289
- +{
2290
- + WRITE_NODE_TYPE("DISTINCTEXPR");
2291
- +
2292
- + WRITE_OID_FIELD(opno);
2293
- + WRITE_OID_FIELD(opfuncid);
2294
- + WRITE_OID_FIELD(opresulttype);
2295
- + WRITE_BOOL_FIELD(opretset);
2296
- + WRITE_OID_FIELD(opcollid);
2297
- + WRITE_OID_FIELD(inputcollid);
2298
- + WRITE_NODE_FIELD(args);
2299
- + WRITE_LOCATION_FIELD(location);
2300
- +}
2301
- +
2302
- +static void
2303
- +_outNullIfExpr(StringInfo str, const NullIfExpr *node)
2304
- +{
2305
- + WRITE_NODE_TYPE("NULLIFEXPR");
2306
- +
2307
- + WRITE_OID_FIELD(opno);
2308
- + WRITE_OID_FIELD(opfuncid);
2309
- + WRITE_OID_FIELD(opresulttype);
2310
- + WRITE_BOOL_FIELD(opretset);
2311
- + WRITE_OID_FIELD(opcollid);
2312
- + WRITE_OID_FIELD(inputcollid);
2313
- + WRITE_NODE_FIELD(args);
2314
- + WRITE_LOCATION_FIELD(location);
2315
- +}
2316
- +
2317
- +static void
2318
- +_outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
2319
- +{
2320
- + WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
2321
- +
2322
- + WRITE_OID_FIELD(opno);
2323
- + WRITE_OID_FIELD(opfuncid);
2324
- + WRITE_BOOL_FIELD(useOr);
2325
- + WRITE_OID_FIELD(inputcollid);
2326
- + WRITE_NODE_FIELD(args);
2327
- + WRITE_LOCATION_FIELD(location);
2328
- +}
2329
- +
2330
- +static void
2331
- +_outSubLink(StringInfo str, const SubLink *node)
2332
- +{
2333
- + WRITE_NODE_TYPE("SUBLINK");
2334
- +
2335
- + WRITE_ENUM_FIELD(subLinkType, SubLinkType);
2336
- + WRITE_NODE_FIELD(testexpr);
2337
- + WRITE_NODE_FIELD(operName);
2338
- + WRITE_NODE_FIELD(subselect);
2339
- + WRITE_LOCATION_FIELD(location);
2340
- +}
2341
- +
2342
- +static void
2343
- +_outSubPlan(StringInfo str, const SubPlan *node)
2344
- +{
2345
- + WRITE_NODE_TYPE("SUBPLAN");
2346
- +
2347
- + WRITE_ENUM_FIELD(subLinkType, SubLinkType);
2348
- + WRITE_NODE_FIELD(testexpr);
2349
- + WRITE_NODE_FIELD(paramIds);
2350
- + WRITE_INT_FIELD(plan_id);
2351
- + WRITE_STRING_FIELD(plan_name);
2352
- + WRITE_OID_FIELD(firstColType);
2353
- + WRITE_INT_FIELD(firstColTypmod);
2354
- + WRITE_OID_FIELD(firstColCollation);
2355
- + WRITE_BOOL_FIELD(useHashTable);
2356
- + WRITE_BOOL_FIELD(unknownEqFalse);
2357
- + WRITE_NODE_FIELD(setParam);
2358
- + WRITE_NODE_FIELD(parParam);
2359
- + WRITE_NODE_FIELD(args);
2360
- + WRITE_FLOAT_FIELD(startup_cost, "%.2f");
2361
- + WRITE_FLOAT_FIELD(per_call_cost, "%.2f");
2362
- +}
2363
- +
2364
- +static void
2365
- +_outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
2366
- +{
2367
- + WRITE_NODE_TYPE("ALTERNATIVESUBPLAN");
2368
- +
2369
- + WRITE_NODE_FIELD(subplans);
2370
- +}
2371
- +
2372
- +static void
2373
- +_outFieldSelect(StringInfo str, const FieldSelect *node)
2374
- +{
2375
- + WRITE_NODE_TYPE("FIELDSELECT");
2376
- +
2377
- + WRITE_NODE_FIELD(arg);
2378
- + WRITE_INT_FIELD(fieldnum);
2379
- + WRITE_OID_FIELD(resulttype);
2380
- + WRITE_INT_FIELD(resulttypmod);
2381
- + WRITE_OID_FIELD(resultcollid);
2382
- +}
2383
- +
2384
- +static void
2385
- +_outFieldStore(StringInfo str, const FieldStore *node)
2386
- +{
2387
- + WRITE_NODE_TYPE("FIELDSTORE");
2388
- +
2389
- + WRITE_NODE_FIELD(arg);
2390
- + WRITE_NODE_FIELD(newvals);
2391
- + WRITE_NODE_FIELD(fieldnums);
2392
- + WRITE_OID_FIELD(resulttype);
2393
- +}
2394
- +
2395
- +static void
2396
- +_outRelabelType(StringInfo str, const RelabelType *node)
2397
- +{
2398
- + WRITE_NODE_TYPE("RELABELTYPE");
2399
- +
2400
- + WRITE_NODE_FIELD(arg);
2401
- + WRITE_OID_FIELD(resulttype);
2402
- + WRITE_INT_FIELD(resulttypmod);
2403
- + WRITE_OID_FIELD(resultcollid);
2404
- + WRITE_ENUM_FIELD(relabelformat, CoercionForm);
2405
- + WRITE_LOCATION_FIELD(location);
2406
- +}
2407
- +
2408
- +static void
2409
- +_outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
2410
- +{
2411
- + WRITE_NODE_TYPE("COERCEVIAIO");
2412
- +
2413
- + WRITE_NODE_FIELD(arg);
2414
- + WRITE_OID_FIELD(resulttype);
2415
- + WRITE_OID_FIELD(resultcollid);
2416
- + WRITE_ENUM_FIELD(coerceformat, CoercionForm);
2417
- + WRITE_LOCATION_FIELD(location);
2418
- +}
2419
- +
2420
- +static void
2421
- +_outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
2422
- +{
2423
- + WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
2424
- +
2425
- + WRITE_NODE_FIELD(arg);
2426
- + WRITE_OID_FIELD(elemfuncid);
2427
- + WRITE_OID_FIELD(resulttype);
2428
- + WRITE_INT_FIELD(resulttypmod);
2429
- + WRITE_OID_FIELD(resultcollid);
2430
- + WRITE_BOOL_FIELD(isExplicit);
2431
- + WRITE_ENUM_FIELD(coerceformat, CoercionForm);
2432
- + WRITE_LOCATION_FIELD(location);
2433
- +}
2434
- +
2435
- +static void
2436
- +_outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
2437
- +{
2438
- + WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
2439
- +
2440
- + WRITE_NODE_FIELD(arg);
2441
- + WRITE_OID_FIELD(resulttype);
2442
- + WRITE_ENUM_FIELD(convertformat, CoercionForm);
2443
- + WRITE_LOCATION_FIELD(location);
2444
- +}
2445
- +
2446
- +static void
2447
- +_outCollateExpr(StringInfo str, const CollateExpr *node)
2448
- +{
2449
- + WRITE_NODE_TYPE("COLLATE");
2450
- +
2451
- + WRITE_NODE_FIELD(arg);
2452
- + WRITE_OID_FIELD(collOid);
2453
- + WRITE_LOCATION_FIELD(location);
2454
- +}
2455
- +
2456
- +static void
2457
- +_outCaseExpr(StringInfo str, const CaseExpr *node)
2458
- +{
2459
- + WRITE_NODE_TYPE("CASE");
2460
- +
2461
- + WRITE_OID_FIELD(casetype);
2462
- + WRITE_OID_FIELD(casecollid);
2463
- + WRITE_NODE_FIELD(arg);
2464
- + WRITE_NODE_FIELD(args);
2465
- + WRITE_NODE_FIELD(defresult);
2466
- + WRITE_LOCATION_FIELD(location);
2467
- +}
2468
- +
2469
- +static void
2470
- +_outCaseWhen(StringInfo str, const CaseWhen *node)
2471
- +{
2472
- + WRITE_NODE_TYPE("WHEN");
2473
- +
2474
- + WRITE_NODE_FIELD(expr);
2475
- + WRITE_NODE_FIELD(result);
2476
- + WRITE_LOCATION_FIELD(location);
2477
- +}
2478
- +
2479
- +static void
2480
- +_outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
2481
- +{
2482
- + WRITE_NODE_TYPE("CASETESTEXPR");
2483
- +
2484
- + WRITE_OID_FIELD(typeId);
2485
- + WRITE_INT_FIELD(typeMod);
2486
- + WRITE_OID_FIELD(collation);
2487
- +}
2488
- +
2489
- +static void
2490
- +_outArrayExpr(StringInfo str, const ArrayExpr *node)
2491
- +{
2492
- + WRITE_NODE_TYPE("ARRAY");
2493
- +
2494
- + WRITE_OID_FIELD(array_typeid);
2495
- + WRITE_OID_FIELD(array_collid);
2496
- + WRITE_OID_FIELD(element_typeid);
2497
- + WRITE_NODE_FIELD(elements);
2498
- + WRITE_BOOL_FIELD(multidims);
2499
- + WRITE_LOCATION_FIELD(location);
2500
- +}
2501
- +
2502
- +static void
2503
- +_outRowExpr(StringInfo str, const RowExpr *node)
2504
- +{
2505
- + WRITE_NODE_TYPE("ROW");
2506
- +
2507
- + WRITE_NODE_FIELD(args);
2508
- + WRITE_OID_FIELD(row_typeid);
2509
- + WRITE_ENUM_FIELD(row_format, CoercionForm);
2510
- + WRITE_NODE_FIELD(colnames);
2511
- + WRITE_LOCATION_FIELD(location);
2512
- +}
2513
- +
2514
- +static void
2515
- +_outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
2516
- +{
2517
- + WRITE_NODE_TYPE("ROWCOMPARE");
2518
- +
2519
- + WRITE_ENUM_FIELD(rctype, RowCompareType);
2520
- + WRITE_NODE_FIELD(opnos);
2521
- + WRITE_NODE_FIELD(opfamilies);
2522
- + WRITE_NODE_FIELD(inputcollids);
2523
- + WRITE_NODE_FIELD(largs);
2524
- + WRITE_NODE_FIELD(rargs);
2525
- +}
2526
- +
2527
- +static void
2528
- +_outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
2529
- +{
2530
- + WRITE_NODE_TYPE("COALESCE");
2531
- +
2532
- + WRITE_OID_FIELD(coalescetype);
2533
- + WRITE_OID_FIELD(coalescecollid);
2534
- + WRITE_NODE_FIELD(args);
2535
- + WRITE_LOCATION_FIELD(location);
2536
- +}
2537
- +
2538
- +static void
2539
- +_outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
2540
- +{
2541
- + WRITE_NODE_TYPE("MINMAX");
2542
- +
2543
- + WRITE_OID_FIELD(minmaxtype);
2544
- + WRITE_OID_FIELD(minmaxcollid);
2545
- + WRITE_OID_FIELD(inputcollid);
2546
- + WRITE_ENUM_FIELD(op, MinMaxOp);
2547
- + WRITE_NODE_FIELD(args);
2548
- + WRITE_LOCATION_FIELD(location);
2549
- +}
2550
- +
2551
- +static void
2552
- +_outXmlExpr(StringInfo str, const XmlExpr *node)
2553
- +{
2554
- + WRITE_NODE_TYPE("XMLEXPR");
2555
- +
2556
- + WRITE_ENUM_FIELD(op, XmlExprOp);
2557
- + WRITE_STRING_FIELD(name);
2558
- + WRITE_NODE_FIELD(named_args);
2559
- + WRITE_NODE_FIELD(arg_names);
2560
- + WRITE_NODE_FIELD(args);
2561
- + WRITE_ENUM_FIELD(xmloption, XmlOptionType);
2562
- + WRITE_OID_FIELD(type);
2563
- + WRITE_INT_FIELD(typmod);
2564
- + WRITE_LOCATION_FIELD(location);
2565
- +}
2566
- +
2567
- +static void
2568
- +_outNullTest(StringInfo str, const NullTest *node)
2569
- +{
2570
- + WRITE_NODE_TYPE("NULLTEST");
2571
- +
2572
- + WRITE_NODE_FIELD(arg);
2573
- + WRITE_ENUM_FIELD(nulltesttype, NullTestType);
2574
- + WRITE_BOOL_FIELD(argisrow);
2575
- +}
2576
- +
2577
- +static void
2578
- +_outBooleanTest(StringInfo str, const BooleanTest *node)
2579
- +{
2580
- + WRITE_NODE_TYPE("BOOLEANTEST");
2581
- +
2582
- + WRITE_NODE_FIELD(arg);
2583
- + WRITE_ENUM_FIELD(booltesttype, BoolTestType);
2584
- +}
2585
- +
2586
- +static void
2587
- +_outCoerceToDomain(StringInfo str, const CoerceToDomain *node)
2588
- +{
2589
- + WRITE_NODE_TYPE("COERCETODOMAIN");
2590
- +
2591
- + WRITE_NODE_FIELD(arg);
2592
- + WRITE_OID_FIELD(resulttype);
2593
- + WRITE_INT_FIELD(resulttypmod);
2594
- + WRITE_OID_FIELD(resultcollid);
2595
- + WRITE_ENUM_FIELD(coercionformat, CoercionForm);
2596
- + WRITE_LOCATION_FIELD(location);
2597
- +}
2598
- +
2599
- +static void
2600
- +_outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
2601
- +{
2602
- + WRITE_NODE_TYPE("COERCETODOMAINVALUE");
2603
- +
2604
- + WRITE_OID_FIELD(typeId);
2605
- + WRITE_INT_FIELD(typeMod);
2606
- + WRITE_OID_FIELD(collation);
2607
- + WRITE_LOCATION_FIELD(location);
2608
- +}
2609
- +
2610
- +static void
2611
- +_outSetToDefault(StringInfo str, const SetToDefault *node)
2612
- +{
2613
- + WRITE_NODE_TYPE("SETTODEFAULT");
2614
- +
2615
- + WRITE_OID_FIELD(typeId);
2616
- + WRITE_INT_FIELD(typeMod);
2617
- + WRITE_OID_FIELD(collation);
2618
- + WRITE_LOCATION_FIELD(location);
2619
- +}
2620
- +
2621
- +static void
2622
- +_outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
2623
- +{
2624
- + WRITE_NODE_TYPE("CURRENTOFEXPR");
2625
- +
2626
- + WRITE_UINT_FIELD(cvarno);
2627
- + WRITE_STRING_FIELD(cursor_name);
2628
- + WRITE_INT_FIELD(cursor_param);
2629
- +}
2630
- +
2631
- +static void
2632
- +_outTargetEntry(StringInfo str, const TargetEntry *node)
2633
- +{
2634
- + WRITE_NODE_TYPE("TARGETENTRY");
2635
- +
2636
- + WRITE_NODE_FIELD(expr);
2637
- + WRITE_INT_FIELD(resno);
2638
- + WRITE_STRING_FIELD(resname);
2639
- + WRITE_UINT_FIELD(ressortgroupref);
2640
- + WRITE_OID_FIELD(resorigtbl);
2641
- + WRITE_INT_FIELD(resorigcol);
2642
- + WRITE_BOOL_FIELD(resjunk);
2643
- +}
2644
- +
2645
- +static void
2646
- +_outRangeTblRef(StringInfo str, const RangeTblRef *node)
2647
- +{
2648
- + WRITE_NODE_TYPE("RANGETBLREF");
2649
- +
2650
- + WRITE_INT_FIELD(rtindex);
2651
- +}
2652
- +
2653
- +static void
2654
- +_outJoinExpr(StringInfo str, const JoinExpr *node)
2655
- +{
2656
- + WRITE_NODE_TYPE("JOINEXPR");
2657
- +
2658
- + WRITE_ENUM_FIELD(jointype, JoinType);
2659
- + WRITE_BOOL_FIELD(isNatural);
2660
- + WRITE_NODE_FIELD(larg);
2661
- + WRITE_NODE_FIELD(rarg);
2662
- + WRITE_NODE_FIELD(usingClause);
2663
- + WRITE_NODE_FIELD(quals);
2664
- + WRITE_NODE_FIELD(alias);
2665
- + WRITE_INT_FIELD(rtindex);
2666
- +}
2667
- +
2668
- +static void
2669
- +_outFromExpr(StringInfo str, const FromExpr *node)
2670
- +{
2671
- + WRITE_NODE_TYPE("FROMEXPR");
2672
- +
2673
- + WRITE_NODE_FIELD(fromlist);
2674
- + WRITE_NODE_FIELD(quals);
2675
- +}
2676
- +
2677
- +static void
2678
- +_outIntoClause(StringInfo str, const IntoClause *node)
2679
- +{
2680
- + WRITE_NODE_TYPE("INTOCLAUSE");
2681
- +
2682
- + WRITE_NODE_FIELD(rel);
2683
- + WRITE_NODE_FIELD(colNames);
2684
- + WRITE_NODE_FIELD(options);
2685
- + WRITE_ENUM_FIELD(onCommit, OnCommitAction);
2686
- + WRITE_STRING_FIELD(tableSpaceName);
2687
- + WRITE_NODE_FIELD(viewQuery);
2688
- + WRITE_BOOL_FIELD(skipData);
2689
- +}
2690
- +
2691
- +static void
2692
- +_outPlannerInfo(StringInfo str, const PlannerInfo *node)
2693
- +{
2694
- + WRITE_NODE_TYPE("PLANNERINFO");
2695
- +
2696
- + WRITE_NODE_FIELD(parse);
2697
- + WRITE_NODE_FIELD(glob);
2698
- + WRITE_UINT_FIELD(query_level);
2699
- + WRITE_NODE_FIELD(plan_params);
2700
- + WRITE_BITMAPSET_FIELD(all_baserels);
2701
- + WRITE_BITMAPSET_FIELD(nullable_baserels);
2702
- + WRITE_NODE_FIELD(join_rel_list);
2703
- + WRITE_INT_FIELD(join_cur_level);
2704
- + WRITE_NODE_FIELD(init_plans);
2705
- + WRITE_NODE_FIELD(cte_plan_ids);
2706
- + WRITE_NODE_FIELD(eq_classes);
2707
- + WRITE_NODE_FIELD(canon_pathkeys);
2708
- + WRITE_NODE_FIELD(left_join_clauses);
2709
- + WRITE_NODE_FIELD(right_join_clauses);
2710
- + WRITE_NODE_FIELD(full_join_clauses);
2711
- + WRITE_NODE_FIELD(join_info_list);
2712
- + WRITE_NODE_FIELD(lateral_info_list);
2713
- + WRITE_NODE_FIELD(append_rel_list);
2714
- + WRITE_NODE_FIELD(rowMarks);
2715
- + WRITE_NODE_FIELD(placeholder_list);
2716
- + WRITE_NODE_FIELD(query_pathkeys);
2717
- + WRITE_NODE_FIELD(group_pathkeys);
2718
- + WRITE_NODE_FIELD(window_pathkeys);
2719
- + WRITE_NODE_FIELD(distinct_pathkeys);
2720
- + WRITE_NODE_FIELD(sort_pathkeys);
2721
- + WRITE_NODE_FIELD(minmax_aggs);
2722
- + WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
2723
- + WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
2724
- + WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
2725
- + WRITE_BOOL_FIELD(hasInheritedTarget);
2726
- + WRITE_BOOL_FIELD(hasJoinRTEs);
2727
- + WRITE_BOOL_FIELD(hasLateralRTEs);
2728
- + WRITE_BOOL_FIELD(hasHavingQual);
2729
- + WRITE_BOOL_FIELD(hasPseudoConstantQuals);
2730
- + WRITE_BOOL_FIELD(hasRecursion);
2731
- + WRITE_INT_FIELD(wt_param_id);
2732
- + WRITE_BITMAPSET_FIELD(curOuterRels);
2733
- + WRITE_NODE_FIELD(curOuterParams);
2734
- +}
2735
- +
2736
- +static void
2737
- +_outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
2738
- +{
2739
- + WRITE_NODE_TYPE("PLANNERGLOBAL");
2740
- +
2741
- + WRITE_NODE_FIELD(subplans);
2742
- + WRITE_BITMAPSET_FIELD(rewindPlanIDs);
2743
- + WRITE_NODE_FIELD(finalrtable);
2744
- + WRITE_NODE_FIELD(finalrowmarks);
2745
- + WRITE_NODE_FIELD(resultRelations);
2746
- + WRITE_NODE_FIELD(relationOids);
2747
- + WRITE_NODE_FIELD(invalItems);
2748
- + WRITE_INT_FIELD(nParamExec);
2749
- + WRITE_UINT_FIELD(lastPHId);
2750
- + WRITE_UINT_FIELD(lastRowMarkId);
2751
- + WRITE_BOOL_FIELD(transientPlan);
2752
- +}
2753
- +
2754
- +static void
2755
- +_outRelOptInfo(StringInfo str, const RelOptInfo *node)
2756
- +{
2757
- + WRITE_NODE_TYPE("RELOPTINFO");
2758
- +
2759
- + WRITE_ENUM_FIELD(reloptkind, RelOptKind);
2760
- + WRITE_BITMAPSET_FIELD(relids);
2761
- + WRITE_FLOAT_FIELD(rows, "%.0f");
2762
- + WRITE_INT_FIELD(width);
2763
- + WRITE_BOOL_FIELD(consider_startup);
2764
- + WRITE_NODE_FIELD(reltargetlist);
2765
- + WRITE_NODE_FIELD(pathlist);
2766
- + WRITE_NODE_FIELD(ppilist);
2767
- + WRITE_NODE_FIELD(cheapest_startup_path);
2768
- + WRITE_NODE_FIELD(cheapest_total_path);
2769
- + WRITE_NODE_FIELD(cheapest_unique_path);
2770
- + WRITE_NODE_FIELD(cheapest_parameterized_paths);
2771
- + WRITE_UINT_FIELD(relid);
2772
- + WRITE_UINT_FIELD(reltablespace);
2773
- + WRITE_ENUM_FIELD(rtekind, RTEKind);
2774
- + WRITE_INT_FIELD(min_attr);
2775
- + WRITE_INT_FIELD(max_attr);
2776
- + WRITE_NODE_FIELD(lateral_vars);
2777
- + WRITE_BITMAPSET_FIELD(lateral_relids);
2778
- + WRITE_BITMAPSET_FIELD(lateral_referencers);
2779
- + WRITE_NODE_FIELD(indexlist);
2780
- + WRITE_UINT_FIELD(pages);
2781
- + WRITE_FLOAT_FIELD(tuples, "%.0f");
2782
- + WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
2783
- + WRITE_NODE_FIELD(subplan);
2784
- + WRITE_NODE_FIELD(subroot);
2785
- + WRITE_NODE_FIELD(subplan_params);
2786
- + WRITE_NODE_FIELD(baserestrictinfo);
2787
- + WRITE_NODE_FIELD(joininfo);
2788
- + WRITE_BOOL_FIELD(has_eclass_joins);
2789
- +}
2790
- +
2791
- +static void
2792
- +_outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
2793
- +{
2794
- + WRITE_NODE_TYPE("INDEXOPTINFO");
2795
- +
2796
- + WRITE_OID_FIELD(indexoid);
2797
- + WRITE_UINT_FIELD(pages);
2798
- + WRITE_FLOAT_FIELD(tuples, "%.0f");
2799
- + WRITE_INT_FIELD(tree_height);
2800
- + WRITE_INT_FIELD(ncolumns);
2801
- + WRITE_OID_FIELD(relam);
2802
- + WRITE_NODE_FIELD(indpred);
2803
- + WRITE_NODE_FIELD(indextlist);
2804
- + WRITE_BOOL_FIELD(predOK);
2805
- + WRITE_BOOL_FIELD(unique);
2806
- + WRITE_BOOL_FIELD(immediate);
2807
- + WRITE_BOOL_FIELD(hypothetical);
2808
- +}
2809
- +
2810
- +static void
2811
- +_outParamPathInfo(StringInfo str, const ParamPathInfo *node)
2812
- +{
2813
- + WRITE_NODE_TYPE("PARAMPATHINFO");
2814
- +
2815
- + WRITE_BITMAPSET_FIELD(ppi_req_outer);
2816
- + WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
2817
- + WRITE_NODE_FIELD(ppi_clauses);
2818
- +}
2819
- +
2820
- +static void
2821
- +_outIndexPath(StringInfo str, const IndexPath *node)
2822
- +{
2823
- + WRITE_NODE_TYPE("INDEXPATH");
2824
- +
2825
- + _outPathInfo(str, (const Path *) node);
2826
- +
2827
- + WRITE_NODE_FIELD(indexinfo);
2828
- + WRITE_NODE_FIELD(indexclauses);
2829
- + WRITE_NODE_FIELD(indexquals);
2830
- + WRITE_NODE_FIELD(indexqualcols);
2831
- + WRITE_NODE_FIELD(indexorderbys);
2832
- + WRITE_NODE_FIELD(indexorderbycols);
2833
- + WRITE_ENUM_FIELD(indexscandir, ScanDirection);
2834
- + WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
2835
- + WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
2836
- +}
2837
- +
2838
- +static void
2839
- +_outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node)
2840
- +{
2841
- + WRITE_NODE_TYPE("BITMAPHEAPPATH");
2842
- +
2843
- + _outPathInfo(str, (const Path *) node);
2844
- +
2845
- + WRITE_NODE_FIELD(bitmapqual);
2846
- +}
2847
- +
2848
- +static void
2849
- +_outBitmapAndPath(StringInfo str, const BitmapAndPath *node)
2850
- +{
2851
- + WRITE_NODE_TYPE("BITMAPANDPATH");
2852
- +
2853
- + _outPathInfo(str, (const Path *) node);
2854
- +
2855
- + WRITE_NODE_FIELD(bitmapquals);
2856
- + WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
2857
- +}
2858
- +
2859
- +static void
2860
- +_outBitmapOrPath(StringInfo str, const BitmapOrPath *node)
2861
- +{
2862
- + WRITE_NODE_TYPE("BITMAPORPATH");
2863
- +
2864
- + _outPathInfo(str, (const Path *) node);
2865
- +
2866
- + WRITE_NODE_FIELD(bitmapquals);
2867
- + WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
2868
- +}
2869
- +
2870
- +static void
2871
- +_outNestPath(StringInfo str, const NestPath *node)
2872
- +{
2873
- + WRITE_NODE_TYPE("NESTPATH");
2874
- +
2875
- + _outJoinPathInfo(str, (const JoinPath *) node);
2876
- +
2877
- +}
2878
- +
2879
- +static void
2880
- +_outMergePath(StringInfo str, const MergePath *node)
2881
- +{
2882
- + WRITE_NODE_TYPE("MERGEPATH");
2883
- +
2884
- + _outJoinPathInfo(str, (const JoinPath *) node);
2885
- +
2886
- + WRITE_NODE_FIELD(path_mergeclauses);
2887
- + WRITE_NODE_FIELD(outersortkeys);
2888
- + WRITE_NODE_FIELD(innersortkeys);
2889
- + WRITE_BOOL_FIELD(materialize_inner);
2890
- +}
2891
- +
2892
- +static void
2893
- +_outHashPath(StringInfo str, const HashPath *node)
2894
- +{
2895
- + WRITE_NODE_TYPE("HASHPATH");
2896
- +
2897
- + _outJoinPathInfo(str, (const JoinPath *) node);
2898
- +
2899
- + WRITE_NODE_FIELD(path_hashclauses);
2900
- + WRITE_INT_FIELD(num_batches);
2901
- +}
2902
- +
2903
- +static void
2904
- +_outTidPath(StringInfo str, const TidPath *node)
2905
- +{
2906
- + WRITE_NODE_TYPE("TIDPATH");
2907
- +
2908
- + _outPathInfo(str, (const Path *) node);
2909
- +
2910
- + WRITE_NODE_FIELD(tidquals);
2911
- +}
2912
- +
2913
- +static void
2914
- +_outForeignPath(StringInfo str, const ForeignPath *node)
2915
- +{
2916
- + WRITE_NODE_TYPE("FOREIGNPATH");
2917
- +
2918
- + _outPathInfo(str, (const Path *) node);
2919
- +
2920
- + WRITE_NODE_FIELD(fdw_private);
2921
- +}
2922
- +
2923
- +static void
2924
- +_outAppendPath(StringInfo str, const AppendPath *node)
2925
- +{
2926
- + WRITE_NODE_TYPE("APPENDPATH");
2927
- +
2928
- + _outPathInfo(str, (const Path *) node);
2929
- +
2930
- + WRITE_NODE_FIELD(subpaths);
2931
- +}
2932
- +
2933
- +static void
2934
- +_outMergeAppendPath(StringInfo str, const MergeAppendPath *node)
2935
- +{
2936
- + WRITE_NODE_TYPE("MERGEAPPENDPATH");
2937
- +
2938
- + _outPathInfo(str, (const Path *) node);
2939
- +
2940
- + WRITE_NODE_FIELD(subpaths);
2941
- + WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
2942
- +}
2943
- +
2944
- +static void
2945
- +_outResultPath(StringInfo str, const ResultPath *node)
2946
- +{
2947
- + WRITE_NODE_TYPE("RESULTPATH");
2948
- +
2949
- + _outPathInfo(str, (const Path *) node);
2950
- +
2951
- + WRITE_NODE_FIELD(quals);
2952
- +}
2953
- +
2954
- +static void
2955
- +_outMaterialPath(StringInfo str, const MaterialPath *node)
2956
- +{
2957
- + WRITE_NODE_TYPE("MATERIALPATH");
2958
- +
2959
- + _outPathInfo(str, (const Path *) node);
2960
- +
2961
- + WRITE_NODE_FIELD(subpath);
2962
- +}
2963
- +
2964
- +static void
2965
- +_outUniquePath(StringInfo str, const UniquePath *node)
2966
- +{
2967
- + WRITE_NODE_TYPE("UNIQUEPATH");
2968
- +
2969
- + _outPathInfo(str, (const Path *) node);
2970
- +
2971
- + WRITE_NODE_FIELD(subpath);
2972
- + WRITE_ENUM_FIELD(umethod, UniquePathMethod);
2973
- + WRITE_NODE_FIELD(in_operators);
2974
- + WRITE_NODE_FIELD(uniq_exprs);
2975
- +}
2976
- +
2977
- +static void
2978
- +_outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
2979
- +{
2980
- + WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
2981
- +
2982
- + WRITE_NODE_FIELD(em_expr);
2983
- + WRITE_BITMAPSET_FIELD(em_relids);
2984
- + WRITE_BITMAPSET_FIELD(em_nullable_relids);
2985
- + WRITE_BOOL_FIELD(em_is_const);
2986
- + WRITE_BOOL_FIELD(em_is_child);
2987
- + WRITE_OID_FIELD(em_datatype);
2988
- +}
2989
- +
2990
- +static void
2991
- +_outPathKey(StringInfo str, const PathKey *node)
2992
- +{
2993
- + WRITE_NODE_TYPE("PATHKEY");
2994
- +
2995
- + WRITE_NODE_FIELD(pk_eclass);
2996
- + WRITE_OID_FIELD(pk_opfamily);
2997
- + WRITE_INT_FIELD(pk_strategy);
2998
- + WRITE_BOOL_FIELD(pk_nulls_first);
2999
- +}
3000
- +
3001
- +static void
3002
- +_outRestrictInfo(StringInfo str, const RestrictInfo *node)
3003
- +{
3004
- + WRITE_NODE_TYPE("RESTRICTINFO");
3005
- +
3006
- + WRITE_NODE_FIELD(clause);
3007
- + WRITE_BOOL_FIELD(is_pushed_down);
3008
- + WRITE_BOOL_FIELD(outerjoin_delayed);
3009
- + WRITE_BOOL_FIELD(can_join);
3010
- + WRITE_BOOL_FIELD(pseudoconstant);
3011
- + WRITE_BITMAPSET_FIELD(clause_relids);
3012
- + WRITE_BITMAPSET_FIELD(required_relids);
3013
- + WRITE_BITMAPSET_FIELD(outer_relids);
3014
- + WRITE_BITMAPSET_FIELD(nullable_relids);
3015
- + WRITE_BITMAPSET_FIELD(left_relids);
3016
- + WRITE_BITMAPSET_FIELD(right_relids);
3017
- + WRITE_NODE_FIELD(orclause);
3018
- + WRITE_FLOAT_FIELD(norm_selec, "%.4f");
3019
- + WRITE_FLOAT_FIELD(outer_selec, "%.4f");
3020
- + WRITE_NODE_FIELD(mergeopfamilies);
3021
- + WRITE_NODE_FIELD(left_em);
3022
- + WRITE_NODE_FIELD(right_em);
3023
- + WRITE_BOOL_FIELD(outer_is_left);
3024
- + WRITE_OID_FIELD(hashjoinoperator);
3025
- +}
3026
- +
3027
- +static void
3028
- +_outPlaceHolderVar(StringInfo str, const PlaceHolderVar *node)
3029
- +{
3030
- + WRITE_NODE_TYPE("PLACEHOLDERVAR");
3031
- +
3032
- + WRITE_NODE_FIELD(phexpr);
3033
- + WRITE_BITMAPSET_FIELD(phrels);
3034
- + WRITE_UINT_FIELD(phid);
3035
- + WRITE_UINT_FIELD(phlevelsup);
3036
- +}
3037
- +
3038
- +static void
3039
- +_outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
3040
- +{
3041
- + WRITE_NODE_TYPE("SPECIALJOININFO");
3042
- +
3043
- + WRITE_BITMAPSET_FIELD(min_lefthand);
3044
- + WRITE_BITMAPSET_FIELD(min_righthand);
3045
- + WRITE_BITMAPSET_FIELD(syn_lefthand);
3046
- + WRITE_BITMAPSET_FIELD(syn_righthand);
3047
- + WRITE_ENUM_FIELD(jointype, JoinType);
3048
- + WRITE_BOOL_FIELD(lhs_strict);
3049
- + WRITE_BOOL_FIELD(delay_upper_joins);
3050
- + WRITE_NODE_FIELD(join_quals);
3051
- +}
3052
- +
3053
- +static void
3054
- +_outLateralJoinInfo(StringInfo str, const LateralJoinInfo *node)
3055
- +{
3056
- + WRITE_NODE_TYPE("LATERALJOININFO");
3057
- +
3058
- + WRITE_BITMAPSET_FIELD(lateral_lhs);
3059
- + WRITE_BITMAPSET_FIELD(lateral_rhs);
3060
- +}
3061
- +
3062
- +static void
3063
- +_outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
3064
- +{
3065
- + WRITE_NODE_TYPE("APPENDRELINFO");
3066
- +
3067
- + WRITE_UINT_FIELD(parent_relid);
3068
- + WRITE_UINT_FIELD(child_relid);
3069
- + WRITE_OID_FIELD(parent_reltype);
3070
- + WRITE_OID_FIELD(child_reltype);
3071
- + WRITE_NODE_FIELD(translated_vars);
3072
- + WRITE_OID_FIELD(parent_reloid);
3073
- +}
3074
- +
3075
- +static void
3076
- +_outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
3077
- +{
3078
- + WRITE_NODE_TYPE("PLACEHOLDERINFO");
3079
- +
3080
- + WRITE_UINT_FIELD(phid);
3081
- + WRITE_NODE_FIELD(ph_var);
3082
- + WRITE_BITMAPSET_FIELD(ph_eval_at);
3083
- + WRITE_BITMAPSET_FIELD(ph_lateral);
3084
- + WRITE_BITMAPSET_FIELD(ph_needed);
3085
- + WRITE_INT_FIELD(ph_width);
3086
- +}
3087
- +
3088
- +static void
3089
- +_outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
3090
- +{
3091
- + WRITE_NODE_TYPE("MINMAXAGGINFO");
3092
- +
3093
- + WRITE_OID_FIELD(aggfnoid);
3094
- + WRITE_OID_FIELD(aggsortop);
3095
- + WRITE_NODE_FIELD(target);
3096
- + WRITE_NODE_FIELD(path);
3097
- + WRITE_FLOAT_FIELD(pathcost, "%.2f");
3098
- + WRITE_NODE_FIELD(param);
3099
- +}
3100
- +
3101
- +static void
3102
- +_outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
3103
- +{
3104
- + WRITE_NODE_TYPE("PLANNERPARAMITEM");
3105
- +
3106
- + WRITE_NODE_FIELD(item);
3107
- + WRITE_INT_FIELD(paramId);
3108
- +}
3109
- +
3110
- +static void
3111
- +_outQuery(StringInfo str, const Query *node)
3112
- +{
3113
- + WRITE_NODE_TYPE("QUERY");
3114
- +
3115
- + WRITE_ENUM_FIELD(commandType, CmdType);
3116
- + WRITE_ENUM_FIELD(querySource, QuerySource);
3117
- + WRITE_BOOL_FIELD(canSetTag);
3118
- + WRITE_NODE_FIELD(utilityStmt);
3119
- + WRITE_INT_FIELD(resultRelation);
3120
- + WRITE_BOOL_FIELD(hasAggs);
3121
- + WRITE_BOOL_FIELD(hasWindowFuncs);
3122
- + WRITE_BOOL_FIELD(hasSubLinks);
3123
- + WRITE_BOOL_FIELD(hasDistinctOn);
3124
- + WRITE_BOOL_FIELD(hasRecursive);
3125
- + WRITE_BOOL_FIELD(hasModifyingCTE);
3126
- + WRITE_BOOL_FIELD(hasForUpdate);
3127
- + WRITE_NODE_FIELD(cteList);
3128
- + WRITE_NODE_FIELD(rtable);
3129
- + WRITE_NODE_FIELD(jointree);
3130
- + WRITE_NODE_FIELD(targetList);
3131
- + WRITE_NODE_FIELD(withCheckOptions);
3132
- + WRITE_NODE_FIELD(returningList);
3133
- + WRITE_NODE_FIELD(groupClause);
3134
- + WRITE_NODE_FIELD(havingQual);
3135
- + WRITE_NODE_FIELD(windowClause);
3136
- + WRITE_NODE_FIELD(distinctClause);
3137
- + WRITE_NODE_FIELD(sortClause);
3138
- + WRITE_NODE_FIELD(limitOffset);
3139
- + WRITE_NODE_FIELD(limitCount);
3140
- + WRITE_NODE_FIELD(rowMarks);
3141
- + WRITE_NODE_FIELD(setOperations);
3142
- + WRITE_NODE_FIELD(constraintDeps);
3143
- +}
3144
- +
3145
- +static void
3146
- +_outPlannedStmt(StringInfo str, const PlannedStmt *node)
3147
- +{
3148
- + WRITE_NODE_TYPE("PLANNEDSTMT");
3149
- +
3150
- + WRITE_ENUM_FIELD(commandType, CmdType);
3151
- + WRITE_UINT_FIELD(queryId);
3152
- + WRITE_BOOL_FIELD(hasReturning);
3153
- + WRITE_BOOL_FIELD(hasModifyingCTE);
3154
- + WRITE_BOOL_FIELD(canSetTag);
3155
- + WRITE_BOOL_FIELD(transientPlan);
3156
- + WRITE_NODE_FIELD(planTree);
3157
- + WRITE_NODE_FIELD(rtable);
3158
- + WRITE_NODE_FIELD(resultRelations);
3159
- + WRITE_NODE_FIELD(utilityStmt);
3160
- + WRITE_NODE_FIELD(subplans);
3161
- + WRITE_BITMAPSET_FIELD(rewindPlanIDs);
3162
- + WRITE_NODE_FIELD(rowMarks);
3163
- + WRITE_NODE_FIELD(relationOids);
3164
- + WRITE_NODE_FIELD(invalItems);
3165
- + WRITE_INT_FIELD(nParamExec);
3166
- +}
3167
- +
3168
- +static void
3169
- +_outInsertStmt(StringInfo str, const InsertStmt *node)
3170
- +{
3171
- + WRITE_NODE_TYPE("INSERT INTO");
3172
- +
3173
- + WRITE_NODE_FIELD(relation);
3174
- + WRITE_NODE_FIELD(cols);
3175
- + WRITE_NODE_FIELD(selectStmt);
3176
- + WRITE_NODE_FIELD(returningList);
3177
- + WRITE_NODE_FIELD(withClause);
3178
- +}
3179
- +
3180
- +static void
3181
- +_outDeleteStmt(StringInfo str, const DeleteStmt *node)
3182
- +{
3183
- + WRITE_NODE_TYPE("DELETE FROM");
3184
- +
3185
- + WRITE_NODE_FIELD(relation);
3186
- + WRITE_NODE_FIELD(usingClause);
3187
- + WRITE_NODE_FIELD(whereClause);
3188
- + WRITE_NODE_FIELD(returningList);
3189
- + WRITE_NODE_FIELD(withClause);
3190
- +}
3191
- +
3192
- +static void
3193
- +_outUpdateStmt(StringInfo str, const UpdateStmt *node)
3194
- +{
3195
- + WRITE_NODE_TYPE("UPDATE");
3196
- +
3197
- + WRITE_NODE_FIELD(relation);
3198
- + WRITE_NODE_FIELD(targetList);
3199
- + WRITE_NODE_FIELD(whereClause);
3200
- + WRITE_NODE_FIELD(fromClause);
3201
- + WRITE_NODE_FIELD(returningList);
3202
- + WRITE_NODE_FIELD(withClause);
3203
- +}
3204
- +
3205
- +static void
3206
- +_outSelectStmt(StringInfo str, const SelectStmt *node)
3207
- +{
3208
- + WRITE_NODE_TYPE("SELECT");
3209
- +
3210
- + WRITE_NODE_FIELD(distinctClause);
3211
- + WRITE_NODE_FIELD(intoClause);
3212
- + WRITE_NODE_FIELD(targetList);
3213
- + WRITE_NODE_FIELD(fromClause);
3214
- + WRITE_NODE_FIELD(whereClause);
3215
- + WRITE_NODE_FIELD(groupClause);
3216
- + WRITE_NODE_FIELD(havingClause);
3217
- + WRITE_NODE_FIELD(windowClause);
3218
- + WRITE_NODE_FIELD(valuesLists);
3219
- + WRITE_NODE_FIELD(sortClause);
3220
- + WRITE_NODE_FIELD(limitOffset);
3221
- + WRITE_NODE_FIELD(limitCount);
3222
- + WRITE_NODE_FIELD(lockingClause);
3223
- + WRITE_NODE_FIELD(withClause);
3224
- + WRITE_ENUM_FIELD(op, SetOperation);
3225
- + WRITE_BOOL_FIELD(all);
3226
- + WRITE_NODE_FIELD(larg);
3227
- + WRITE_NODE_FIELD(rarg);
3228
- +}
3229
- +
3230
- +static void
3231
- +_outAlterTableStmt(StringInfo str, const AlterTableStmt *node)
3232
- +{
3233
- + WRITE_NODE_TYPE("ALTER TABLE");
3234
- +
3235
- + WRITE_NODE_FIELD(relation);
3236
- + WRITE_NODE_FIELD(cmds);
3237
- + WRITE_ENUM_FIELD(relkind, ObjectType);
3238
- + WRITE_BOOL_FIELD(missing_ok);
3239
- +}
3240
- +
3241
- +static void
3242
- +_outAlterTableCmd(StringInfo str, const AlterTableCmd *node)
3243
- +{
3244
- + WRITE_NODE_TYPE("ALTER TABLE CMD");
3245
- +
3246
- + WRITE_ENUM_FIELD(subtype, AlterTableType);
3247
- + WRITE_STRING_FIELD(name);
3248
- + WRITE_NODE_FIELD(def);
3249
- + WRITE_ENUM_FIELD(behavior, DropBehavior);
3250
- + WRITE_BOOL_FIELD(missing_ok);
3251
- +}
3252
- +
3253
- +static void
3254
- +_outAlterDomainStmt(StringInfo str, const AlterDomainStmt *node)
3255
- +{
3256
- + WRITE_NODE_TYPE("ALTERDOMAINSTMT");
3257
- +
3258
- + WRITE_CHAR_FIELD(subtype);
3259
- + WRITE_NODE_FIELD(typeName);
3260
- + WRITE_STRING_FIELD(name);
3261
- + WRITE_NODE_FIELD(def);
3262
- + WRITE_ENUM_FIELD(behavior, DropBehavior);
3263
- + WRITE_BOOL_FIELD(missing_ok);
3264
- +}
3265
- +
3266
- +static void
3267
- +_outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
3268
- +{
3269
- + WRITE_NODE_TYPE("SETOPERATIONSTMT");
3270
- +
3271
- + WRITE_ENUM_FIELD(op, SetOperation);
3272
- + WRITE_BOOL_FIELD(all);
3273
- + WRITE_NODE_FIELD(larg);
3274
- + WRITE_NODE_FIELD(rarg);
3275
- + WRITE_NODE_FIELD(colTypes);
3276
- + WRITE_NODE_FIELD(colTypmods);
3277
- + WRITE_NODE_FIELD(colCollations);
3278
- + WRITE_NODE_FIELD(groupClauses);
3279
- +}
3280
- +
3281
- +static void
3282
- +_outGrantStmt(StringInfo str, const GrantStmt *node)
3283
- +{
3284
- + WRITE_NODE_TYPE("GRANTSTMT");
3285
- +
3286
- + WRITE_BOOL_FIELD(is_grant);
3287
- + WRITE_ENUM_FIELD(targtype, GrantTargetType);
3288
- + WRITE_ENUM_FIELD(objtype, GrantObjectType);
3289
- + WRITE_NODE_FIELD(objects);
3290
- + WRITE_NODE_FIELD(privileges);
3291
- + WRITE_NODE_FIELD(grantees);
3292
- + WRITE_BOOL_FIELD(grant_option);
3293
- + WRITE_ENUM_FIELD(behavior, DropBehavior);
3294
- +}
3295
- +
3296
- +static void
3297
- +_outGrantRoleStmt(StringInfo str, const GrantRoleStmt *node)
3298
- +{
3299
- + WRITE_NODE_TYPE("GRANTROLESTMT");
3300
- +
3301
- + WRITE_NODE_FIELD(granted_roles);
3302
- + WRITE_NODE_FIELD(grantee_roles);
3303
- + WRITE_BOOL_FIELD(is_grant);
3304
- + WRITE_BOOL_FIELD(admin_opt);
3305
- + WRITE_STRING_FIELD(grantor);
3306
- + WRITE_ENUM_FIELD(behavior, DropBehavior);
3307
- +}
3308
- +
3309
- +static void
3310
- +_outAlterDefaultPrivilegesStmt(StringInfo str, const AlterDefaultPrivilegesStmt *node)
3311
- +{
3312
- + WRITE_NODE_TYPE("ALTERDEFAULTPRIVILEGESSTMT");
3313
- +
3314
- + WRITE_NODE_FIELD(options);
3315
- + WRITE_NODE_FIELD(action);
3316
- +}
3317
- +
3318
- +static void
3319
- +_outClosePortalStmt(StringInfo str, const ClosePortalStmt *node)
3320
- +{
3321
- + WRITE_NODE_TYPE("CLOSEPORTALSTMT");
3322
- +
3323
- + WRITE_STRING_FIELD(portalname);
3324
- +}
3325
- +
3326
- +static void
3327
- +_outClusterStmt(StringInfo str, const ClusterStmt *node)
3328
- +{
3329
- + WRITE_NODE_TYPE("CLUSTERSTMT");
3330
- +
3331
- + WRITE_NODE_FIELD(relation);
3332
- + WRITE_STRING_FIELD(indexname);
3333
- + WRITE_BOOL_FIELD(verbose);
3334
- +}
3335
- +
3336
- +static void
3337
- +_outCopyStmt(StringInfo str, const CopyStmt *node)
3338
- +{
3339
- + WRITE_NODE_TYPE("COPY");
3340
- +
3341
- + WRITE_NODE_FIELD(relation);
3342
- + WRITE_NODE_FIELD(query);
3343
- + WRITE_NODE_FIELD(attlist);
3344
- + WRITE_BOOL_FIELD(is_from);
3345
- + WRITE_BOOL_FIELD(is_program);
3346
- + WRITE_STRING_FIELD(filename);
3347
- + WRITE_NODE_FIELD(options);
3348
- +}
3349
- +
3350
- +static void
3351
- +_outCreateStmt(StringInfo str, const CreateStmt *node)
3352
- +{
3353
- + WRITE_NODE_TYPE("CREATESTMT");
3354
- +
3355
- + _outCreateStmtInfo(str, (const CreateStmt *) node);
3356
- +
3357
- +}
3358
- +
3359
- +static void
3360
- +_outDefineStmt(StringInfo str, const DefineStmt *node)
3361
- +{
3362
- + WRITE_NODE_TYPE("DEFINESTMT");
3363
- +
3364
- + WRITE_ENUM_FIELD(kind, ObjectType);
3365
- + WRITE_BOOL_FIELD(oldstyle);
3366
- + WRITE_NODE_FIELD(defnames);
3367
- + WRITE_NODE_FIELD(args);
3368
- + WRITE_NODE_FIELD(definition);
3369
- +}
3370
- +
3371
- +static void
3372
- +_outDropStmt(StringInfo str, const DropStmt *node)
3373
- +{
3374
- + WRITE_NODE_TYPE("DROP");
3375
- +
3376
- + WRITE_NODE_FIELD(objects);
3377
- + WRITE_NODE_FIELD(arguments);
3378
- + WRITE_ENUM_FIELD(removeType, ObjectType);
3379
- + WRITE_ENUM_FIELD(behavior, DropBehavior);
3380
- + WRITE_BOOL_FIELD(missing_ok);
3381
- + WRITE_BOOL_FIELD(concurrent);
3382
- +}
3383
- +
3384
- +static void
3385
- +_outTruncateStmt(StringInfo str, const TruncateStmt *node)
3386
- +{
3387
- + WRITE_NODE_TYPE("TRUNCATE");
3388
- +
3389
- + WRITE_NODE_FIELD(relations);
3390
- + WRITE_BOOL_FIELD(restart_seqs);
3391
- + WRITE_ENUM_FIELD(behavior, DropBehavior);
3392
- +}
3393
- +
3394
- +static void
3395
- +_outCommentStmt(StringInfo str, const CommentStmt *node)
3396
- +{
3397
- + WRITE_NODE_TYPE("COMMENTSTMT");
3398
- +
3399
- + WRITE_ENUM_FIELD(objtype, ObjectType);
3400
- + WRITE_NODE_FIELD(objname);
3401
- + WRITE_NODE_FIELD(objargs);
3402
- + WRITE_STRING_FIELD(comment);
3403
- +}
3404
- +
3405
- +static void
3406
- +_outFetchStmt(StringInfo str, const FetchStmt *node)
3407
- +{
3408
- + WRITE_NODE_TYPE("FETCHSTMT");
3409
- +
3410
- + WRITE_ENUM_FIELD(direction, FetchDirection);
3411
- + WRITE_LONG_FIELD(howMany);
3412
- + WRITE_STRING_FIELD(portalname);
3413
- + WRITE_BOOL_FIELD(ismove);
3414
- +}
3415
- +
3416
- +static void
3417
- +_outIndexStmt(StringInfo str, const IndexStmt *node)
3418
- +{
3419
- + WRITE_NODE_TYPE("INDEXSTMT");
3420
- +
3421
- + WRITE_STRING_FIELD(idxname);
3422
- + WRITE_NODE_FIELD(relation);
3423
- + WRITE_STRING_FIELD(accessMethod);
3424
- + WRITE_STRING_FIELD(tableSpace);
3425
- + WRITE_NODE_FIELD(indexParams);
3426
- + WRITE_NODE_FIELD(options);
3427
- + WRITE_NODE_FIELD(whereClause);
3428
- + WRITE_NODE_FIELD(excludeOpNames);
3429
- + WRITE_STRING_FIELD(idxcomment);
3430
- + WRITE_OID_FIELD(indexOid);
3431
- + WRITE_OID_FIELD(oldNode);
3432
- + WRITE_BOOL_FIELD(unique);
3433
- + WRITE_BOOL_FIELD(primary);
3434
- + WRITE_BOOL_FIELD(isconstraint);
3435
- + WRITE_BOOL_FIELD(deferrable);
3436
- + WRITE_BOOL_FIELD(initdeferred);
3437
- + WRITE_BOOL_FIELD(concurrent);
3438
- +}
3439
- +
3440
- +static void
3441
- +_outCreateFunctionStmt(StringInfo str, const CreateFunctionStmt *node)
3442
- +{
3443
- + WRITE_NODE_TYPE("CREATEFUNCTIONSTMT");
3444
- +
3445
- + WRITE_BOOL_FIELD(replace);
3446
- + WRITE_NODE_FIELD(funcname);
3447
- + WRITE_NODE_FIELD(parameters);
3448
- + WRITE_NODE_FIELD(returnType);
3449
- + WRITE_NODE_FIELD(options);
3450
- + WRITE_NODE_FIELD(withClause);
3451
- +}
3452
- +
3453
- +static void
3454
- +_outAlterFunctionStmt(StringInfo str, const AlterFunctionStmt *node)
3455
- +{
3456
- + WRITE_NODE_TYPE("ALTERFUNCTIONSTMT");
3457
- +
3458
- + WRITE_NODE_FIELD(func);
3459
- + WRITE_NODE_FIELD(actions);
3460
- +}
3461
- +
3462
- +static void
3463
- +_outDoStmt(StringInfo str, const DoStmt *node)
3464
- +{
3465
- + WRITE_NODE_TYPE("DOSTMT");
3466
- +
3467
- + WRITE_NODE_FIELD(args);
3468
- +}
3469
- +
3470
- +static void
3471
- +_outRenameStmt(StringInfo str, const RenameStmt *node)
3472
- +{
3473
- + WRITE_NODE_TYPE("RENAMESTMT");
3474
- +
3475
- + WRITE_ENUM_FIELD(renameType, ObjectType);
3476
- + WRITE_ENUM_FIELD(relationType, ObjectType);
3477
- + WRITE_NODE_FIELD(relation);
3478
- + WRITE_NODE_FIELD(object);
3479
- + WRITE_NODE_FIELD(objarg);
3480
- + WRITE_STRING_FIELD(subname);
3481
- + WRITE_STRING_FIELD(newname);
3482
- + WRITE_ENUM_FIELD(behavior, DropBehavior);
3483
- + WRITE_BOOL_FIELD(missing_ok);
3484
- +}
3485
- +
3486
- +static void
3487
- +_outRuleStmt(StringInfo str, const RuleStmt *node)
3488
- +{
3489
- + WRITE_NODE_TYPE("RULESTMT");
3490
- +
3491
- + WRITE_NODE_FIELD(relation);
3492
- + WRITE_STRING_FIELD(rulename);
3493
- + WRITE_NODE_FIELD(whereClause);
3494
- + WRITE_ENUM_FIELD(event, CmdType);
3495
- + WRITE_BOOL_FIELD(instead);
3496
- + WRITE_NODE_FIELD(actions);
3497
- + WRITE_BOOL_FIELD(replace);
3498
- +}
3499
- +
3500
- +static void
3501
- +_outNotifyStmt(StringInfo str, const NotifyStmt *node)
3502
- +{
3503
- + WRITE_NODE_TYPE("NOTIFYSTMT");
3504
- +
3505
- + WRITE_STRING_FIELD(conditionname);
3506
- + WRITE_STRING_FIELD(payload);
3507
- +}
3508
- +
3509
- +static void
3510
- +_outListenStmt(StringInfo str, const ListenStmt *node)
3511
- +{
3512
- + WRITE_NODE_TYPE("LISTENSTMT");
3513
- +
3514
- + WRITE_STRING_FIELD(conditionname);
3515
- +}
3516
- +
3517
- +static void
3518
- +_outUnlistenStmt(StringInfo str, const UnlistenStmt *node)
3519
- +{
3520
- + WRITE_NODE_TYPE("UNLISTENSTMT");
3521
- +
3522
- + WRITE_STRING_FIELD(conditionname);
3523
- +}
3524
- +
3525
- +static void
3526
- +_outTransactionStmt(StringInfo str, const TransactionStmt *node)
3527
- +{
3528
- + WRITE_NODE_TYPE("TRANSACTION");
3529
- +
3530
- + WRITE_ENUM_FIELD(kind, TransactionStmtKind);
3531
- + WRITE_NODE_FIELD(options);
3532
- + WRITE_STRING_FIELD(gid);
3533
- +}
3534
- +
3535
- +static void
3536
- +_outViewStmt(StringInfo str, const ViewStmt *node)
3537
- +{
3538
- + WRITE_NODE_TYPE("VIEWSTMT");
3539
- +
3540
- + WRITE_NODE_FIELD(view);
3541
- + WRITE_NODE_FIELD(aliases);
3542
- + WRITE_NODE_FIELD(query);
3543
- + WRITE_BOOL_FIELD(replace);
3544
- + WRITE_NODE_FIELD(options);
3545
- + WRITE_ENUM_FIELD(withCheckOption, ViewCheckOption);
3546
- +}
3547
- +
3548
- +static void
3549
- +_outLoadStmt(StringInfo str, const LoadStmt *node)
3550
- +{
3551
- + WRITE_NODE_TYPE("LOADSTMT");
3552
- +
3553
- + WRITE_STRING_FIELD(filename);
3554
- +}
3555
- +
3556
- +static void
3557
- +_outCreateDomainStmt(StringInfo str, const CreateDomainStmt *node)
3558
- +{
3559
- + WRITE_NODE_TYPE("CREATEDOMAINSTMT");
3560
- +
3561
- + WRITE_NODE_FIELD(domainname);
3562
- + WRITE_NODE_FIELD(typeName);
3563
- + WRITE_NODE_FIELD(collClause);
3564
- + WRITE_NODE_FIELD(constraints);
3565
- +}
3566
- +
3567
- +static void
3568
- +_outCreatedbStmt(StringInfo str, const CreatedbStmt *node)
3569
- +{
3570
- + WRITE_NODE_TYPE("CREATEDBSTMT");
3571
- +
3572
- + WRITE_STRING_FIELD(dbname);
3573
- + WRITE_NODE_FIELD(options);
3574
- +}
3575
- +
3576
- +static void
3577
- +_outDropdbStmt(StringInfo str, const DropdbStmt *node)
3578
- +{
3579
- + WRITE_NODE_TYPE("DROPDBSTMT");
3580
- +
3581
- + WRITE_STRING_FIELD(dbname);
3582
- + WRITE_BOOL_FIELD(missing_ok);
3583
- +}
3584
- +
3585
- +static void
3586
- +_outVacuumStmt(StringInfo str, const VacuumStmt *node)
3587
- +{
3588
- + WRITE_NODE_TYPE("VACUUM");
3589
- +
3590
- + WRITE_ENUM_FIELD(options, VacuumOption);
3591
- + WRITE_INT_FIELD(freeze_min_age);
3592
- + WRITE_INT_FIELD(freeze_table_age);
3593
- + WRITE_INT_FIELD(multixact_freeze_min_age);
3594
- + WRITE_INT_FIELD(multixact_freeze_table_age);
3595
- + WRITE_NODE_FIELD(relation);
3596
- + WRITE_NODE_FIELD(va_cols);
3597
- +}
3598
- +
3599
- +static void
3600
- +_outExplainStmt(StringInfo str, const ExplainStmt *node)
3601
- +{
3602
- + WRITE_NODE_TYPE("EXPLAIN");
3603
- +
3604
- + WRITE_NODE_FIELD(query);
3605
- + WRITE_NODE_FIELD(options);
3606
- +}
3607
- +
3608
- +static void
3609
- +_outCreateTableAsStmt(StringInfo str, const CreateTableAsStmt *node)
3610
- +{
3611
- + WRITE_NODE_TYPE("CREATE TABLE AS");
3612
- +
3613
- + WRITE_NODE_FIELD(query);
3614
- + WRITE_NODE_FIELD(into);
3615
- + WRITE_ENUM_FIELD(relkind, ObjectType);
3616
- + WRITE_BOOL_FIELD(is_select_into);
3617
- +}
3618
- +
3619
- +static void
3620
- +_outCreateSeqStmt(StringInfo str, const CreateSeqStmt *node)
3621
- +{
3622
- + WRITE_NODE_TYPE("CREATESEQSTMT");
3623
- +
3624
- + WRITE_NODE_FIELD(sequence);
3625
- + WRITE_NODE_FIELD(options);
3626
- + WRITE_OID_FIELD(ownerId);
3627
- +}
3628
- +
3629
- +static void
3630
- +_outAlterSeqStmt(StringInfo str, const AlterSeqStmt *node)
3631
- +{
3632
- + WRITE_NODE_TYPE("ALTERSEQSTMT");
3633
- +
3634
- + WRITE_NODE_FIELD(sequence);
3635
- + WRITE_NODE_FIELD(options);
3636
- + WRITE_BOOL_FIELD(missing_ok);
3637
- +}
3638
- +
3639
- +static void
3640
- +_outVariableSetStmt(StringInfo str, const VariableSetStmt *node)
3641
- +{
3642
- + WRITE_NODE_TYPE("SET");
3643
- +
3644
- + WRITE_ENUM_FIELD(kind, VariableSetKind);
3645
- + WRITE_STRING_FIELD(name);
3646
- + WRITE_NODE_FIELD(args);
3647
- + WRITE_BOOL_FIELD(is_local);
3648
- +}
3649
- +
3650
- +static void
3651
- +_outVariableShowStmt(StringInfo str, const VariableShowStmt *node)
3652
- +{
3653
- + WRITE_NODE_TYPE("SHOW");
3654
- +
3655
- + WRITE_STRING_FIELD(name);
3656
- +}
3657
- +
3658
- +static void
3659
- +_outDiscardStmt(StringInfo str, const DiscardStmt *node)
3660
- +{
3661
- + WRITE_NODE_TYPE("DISCARDSTMT");
3662
- +
3663
- + WRITE_ENUM_FIELD(target, DiscardMode);
3664
- +}
3665
- +
3666
- +static void
3667
- +_outCreateTrigStmt(StringInfo str, const CreateTrigStmt *node)
3668
- +{
3669
- + WRITE_NODE_TYPE("CREATETRIGSTMT");
3670
- +
3671
- + WRITE_STRING_FIELD(trigname);
3672
- + WRITE_NODE_FIELD(relation);
3673
- + WRITE_NODE_FIELD(funcname);
3674
- + WRITE_NODE_FIELD(args);
3675
- + WRITE_BOOL_FIELD(row);
3676
- + WRITE_INT_FIELD(timing);
3677
- + WRITE_INT_FIELD(events);
3678
- + WRITE_NODE_FIELD(columns);
3679
- + WRITE_NODE_FIELD(whenClause);
3680
- + WRITE_BOOL_FIELD(isconstraint);
3681
- + WRITE_BOOL_FIELD(deferrable);
3682
- + WRITE_BOOL_FIELD(initdeferred);
3683
- + WRITE_NODE_FIELD(constrrel);
3684
- +}
3685
- +
3686
- +static void
3687
- +_outCreatePLangStmt(StringInfo str, const CreatePLangStmt *node)
3688
- +{
3689
- + WRITE_NODE_TYPE("CREATEPLANGSTMT");
3690
- +
3691
- + WRITE_BOOL_FIELD(replace);
3692
- + WRITE_STRING_FIELD(plname);
3693
- + WRITE_NODE_FIELD(plhandler);
3694
- + WRITE_NODE_FIELD(plinline);
3695
- + WRITE_NODE_FIELD(plvalidator);
3696
- + WRITE_BOOL_FIELD(pltrusted);
3697
- +}
3698
- +
3699
- +static void
3700
- +_outCreateRoleStmt(StringInfo str, const CreateRoleStmt *node)
3701
- +{
3702
- + WRITE_NODE_TYPE("CREATEROLESTMT");
3703
- +
3704
- + WRITE_ENUM_FIELD(stmt_type, RoleStmtType);
3705
- + WRITE_STRING_FIELD(role);
3706
- + WRITE_NODE_FIELD(options);
3707
- +}
3708
- +
3709
- +static void
3710
- +_outAlterRoleStmt(StringInfo str, const AlterRoleStmt *node)
3711
- +{
3712
- + WRITE_NODE_TYPE("ALTERROLESTMT");
3713
- +
3714
- + WRITE_STRING_FIELD(role);
3715
- + WRITE_NODE_FIELD(options);
3716
- + WRITE_INT_FIELD(action);
3717
- +}
3718
- +
3719
- +static void
3720
- +_outDropRoleStmt(StringInfo str, const DropRoleStmt *node)
3721
- +{
3722
- + WRITE_NODE_TYPE("DROPROLESTMT");
3723
- +
3724
- + WRITE_NODE_FIELD(roles);
3725
- + WRITE_BOOL_FIELD(missing_ok);
3726
- +}
3727
- +
3728
- +static void
3729
- +_outLockStmt(StringInfo str, const LockStmt *node)
3730
- +{
3731
- + WRITE_NODE_TYPE("LOCK");
3732
- +
3733
- + WRITE_NODE_FIELD(relations);
3734
- + WRITE_INT_FIELD(mode);
3735
- + WRITE_BOOL_FIELD(nowait);
3736
- +}
3737
- +
3738
- +static void
3739
- +_outConstraintsSetStmt(StringInfo str, const ConstraintsSetStmt *node)
3740
- +{
3741
- + WRITE_NODE_TYPE("CONSTRAINTSSETSTMT");
3742
- +
3743
- + WRITE_NODE_FIELD(constraints);
3744
- + WRITE_BOOL_FIELD(deferred);
3745
- +}
3746
- +
3747
- +static void
3748
- +_outReindexStmt(StringInfo str, const ReindexStmt *node)
3749
- +{
3750
- + WRITE_NODE_TYPE("REINDEXSTMT");
3751
- +
3752
- + WRITE_ENUM_FIELD(kind, ObjectType);
3753
- + WRITE_NODE_FIELD(relation);
3754
- + WRITE_STRING_FIELD(name);
3755
- + WRITE_BOOL_FIELD(do_system);
3756
- + WRITE_BOOL_FIELD(do_user);
3757
- +}
3758
- +
3759
- +static void
3760
- +_outCheckPointStmt(StringInfo str, const CheckPointStmt *node)
3761
- +{
3762
- + WRITE_NODE_TYPE("CHECKPOINT");
3763
- +
3764
- +}
3765
- +
3766
- +static void
3767
- +_outCreateSchemaStmt(StringInfo str, const CreateSchemaStmt *node)
3768
- +{
3769
- + WRITE_NODE_TYPE("CREATE SCHEMA");
3770
- +
3771
- + WRITE_STRING_FIELD(schemaname);
3772
- + WRITE_STRING_FIELD(authid);
3773
- + WRITE_NODE_FIELD(schemaElts);
3774
- + WRITE_BOOL_FIELD(if_not_exists);
3775
- +}
3776
- +
3777
- +static void
3778
- +_outAlterDatabaseStmt(StringInfo str, const AlterDatabaseStmt *node)
3779
- +{
3780
- + WRITE_NODE_TYPE("ALTERDATABASESTMT");
3781
- +
3782
- + WRITE_STRING_FIELD(dbname);
3783
- + WRITE_NODE_FIELD(options);
3784
- +}
3785
- +
3786
- +static void
3787
- +_outAlterDatabaseSetStmt(StringInfo str, const AlterDatabaseSetStmt *node)
3788
- +{
3789
- + WRITE_NODE_TYPE("ALTERDATABASESETSTMT");
3790
- +
3791
- + WRITE_STRING_FIELD(dbname);
3792
- + WRITE_NODE_FIELD(setstmt);
3793
- +}
3794
- +
3795
- +static void
3796
- +_outAlterRoleSetStmt(StringInfo str, const AlterRoleSetStmt *node)
3797
- +{
3798
- + WRITE_NODE_TYPE("ALTERROLESETSTMT");
3799
- +
3800
- + WRITE_STRING_FIELD(role);
3801
- + WRITE_STRING_FIELD(database);
3802
- + WRITE_NODE_FIELD(setstmt);
3803
- +}
3804
- +
3805
- +static void
3806
- +_outCreateConversionStmt(StringInfo str, const CreateConversionStmt *node)
3807
- +{
3808
- + WRITE_NODE_TYPE("CREATECONVERSIONSTMT");
3809
- +
3810
- + WRITE_NODE_FIELD(conversion_name);
3811
- + WRITE_STRING_FIELD(for_encoding_name);
3812
- + WRITE_STRING_FIELD(to_encoding_name);
3813
- + WRITE_NODE_FIELD(func_name);
3814
- + WRITE_BOOL_FIELD(def);
3815
- +}
3816
- +
3817
- +static void
3818
- +_outCreateCastStmt(StringInfo str, const CreateCastStmt *node)
3819
- +{
3820
- + WRITE_NODE_TYPE("CREATECASTSTMT");
3821
- +
3822
- + WRITE_NODE_FIELD(sourcetype);
3823
- + WRITE_NODE_FIELD(targettype);
3824
- + WRITE_NODE_FIELD(func);
3825
- + WRITE_ENUM_FIELD(context, CoercionContext);
3826
- + WRITE_BOOL_FIELD(inout);
3827
- +}
3828
- +
3829
- +static void
3830
- +_outCreateOpClassStmt(StringInfo str, const CreateOpClassStmt *node)
3831
- +{
3832
- + WRITE_NODE_TYPE("CREATEOPCLASSSTMT");
3833
- +
3834
- + WRITE_NODE_FIELD(opclassname);
3835
- + WRITE_NODE_FIELD(opfamilyname);
3836
- + WRITE_STRING_FIELD(amname);
3837
- + WRITE_NODE_FIELD(datatype);
3838
- + WRITE_NODE_FIELD(items);
3839
- + WRITE_BOOL_FIELD(isDefault);
3840
- +}
3841
- +
3842
- +static void
3843
- +_outCreateOpFamilyStmt(StringInfo str, const CreateOpFamilyStmt *node)
3844
- +{
3845
- + WRITE_NODE_TYPE("CREATEOPFAMILYSTMT");
3846
- +
3847
- + WRITE_NODE_FIELD(opfamilyname);
3848
- + WRITE_STRING_FIELD(amname);
3849
- +}
3850
- +
3851
- +static void
3852
- +_outAlterOpFamilyStmt(StringInfo str, const AlterOpFamilyStmt *node)
3853
- +{
3854
- + WRITE_NODE_TYPE("ALTEROPFAMILYSTMT");
3855
- +
3856
- + WRITE_NODE_FIELD(opfamilyname);
3857
- + WRITE_STRING_FIELD(amname);
3858
- + WRITE_BOOL_FIELD(isDrop);
3859
- + WRITE_NODE_FIELD(items);
3860
- +}
3861
- +
3862
- +static void
3863
- +_outPrepareStmt(StringInfo str, const PrepareStmt *node)
3864
- +{
3865
- + WRITE_NODE_TYPE("PREPARESTMT");
3866
- +
3867
- + WRITE_STRING_FIELD(name);
3868
- + WRITE_NODE_FIELD(argtypes);
3869
- + WRITE_NODE_FIELD(query);
3870
- +}
3871
- +
3872
- +static void
3873
- +_outExecuteStmt(StringInfo str, const ExecuteStmt *node)
3874
- +{
3875
- + WRITE_NODE_TYPE("EXECUTESTMT");
3876
- +
3877
- + WRITE_STRING_FIELD(name);
3878
- + WRITE_NODE_FIELD(params);
3879
- +}
3880
- +
3881
- +static void
3882
- +_outDeallocateStmt(StringInfo str, const DeallocateStmt *node)
3883
- +{
3884
- + WRITE_NODE_TYPE("DEALLOCATESTMT");
3885
- +
3886
- + WRITE_STRING_FIELD(name);
3887
- +}
3888
- +
3889
- +static void
3890
- +_outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
3891
- +{
3892
- + WRITE_NODE_TYPE("DECLARECURSOR");
3893
- +
3894
- + WRITE_STRING_FIELD(portalname);
3895
- + WRITE_INT_FIELD(options);
3896
- + WRITE_NODE_FIELD(query);
3897
- +}
3898
- +
3899
- +static void
3900
- +_outCreateTableSpaceStmt(StringInfo str, const CreateTableSpaceStmt *node)
3901
- +{
3902
- + WRITE_NODE_TYPE("CREATETABLESPACESTMT");
3903
- +
3904
- + WRITE_STRING_FIELD(tablespacename);
3905
- + WRITE_STRING_FIELD(owner);
3906
- + WRITE_STRING_FIELD(location);
3907
- + WRITE_NODE_FIELD(options);
3908
- +}
3909
- +
3910
- +static void
3911
- +_outDropTableSpaceStmt(StringInfo str, const DropTableSpaceStmt *node)
3912
- +{
3913
- + WRITE_NODE_TYPE("DROPTABLESPACESTMT");
3914
- +
3915
- + WRITE_STRING_FIELD(tablespacename);
3916
- + WRITE_BOOL_FIELD(missing_ok);
3917
- +}
3918
- +
3919
- +static void
3920
- +_outAlterObjectSchemaStmt(StringInfo str, const AlterObjectSchemaStmt *node)
3921
- +{
3922
- + WRITE_NODE_TYPE("ALTEROBJECTSCHEMASTMT");
3923
- +
3924
- + WRITE_ENUM_FIELD(objectType, ObjectType);
3925
- + WRITE_NODE_FIELD(relation);
3926
- + WRITE_NODE_FIELD(object);
3927
- + WRITE_NODE_FIELD(objarg);
3928
- + WRITE_STRING_FIELD(newschema);
3929
- + WRITE_BOOL_FIELD(missing_ok);
3930
- +}
3931
- +
3932
- +static void
3933
- +_outAlterOwnerStmt(StringInfo str, const AlterOwnerStmt *node)
3934
- +{
3935
- + WRITE_NODE_TYPE("ALTEROWNERSTMT");
3936
- +
3937
- + WRITE_ENUM_FIELD(objectType, ObjectType);
3938
- + WRITE_NODE_FIELD(relation);
3939
- + WRITE_NODE_FIELD(object);
3940
- + WRITE_NODE_FIELD(objarg);
3941
- + WRITE_STRING_FIELD(newowner);
3942
- +}
3943
- +
3944
- +static void
3945
- +_outDropOwnedStmt(StringInfo str, const DropOwnedStmt *node)
3946
- +{
3947
- + WRITE_NODE_TYPE("DROPOWNEDSTMT");
3948
- +
3949
- + WRITE_NODE_FIELD(roles);
3950
- + WRITE_ENUM_FIELD(behavior, DropBehavior);
3951
- +}
3952
- +
3953
- +static void
3954
- +_outReassignOwnedStmt(StringInfo str, const ReassignOwnedStmt *node)
3955
- +{
3956
- + WRITE_NODE_TYPE("REASSIGNOWNEDSTMT");
3957
- +
3958
- + WRITE_NODE_FIELD(roles);
3959
- + WRITE_STRING_FIELD(newrole);
3960
- +}
3961
- +
3962
- +static void
3963
- +_outCompositeTypeStmt(StringInfo str, const CompositeTypeStmt *node)
3964
- +{
3965
- + WRITE_NODE_TYPE("COMPOSITETYPESTMT");
3966
- +
3967
- + WRITE_NODE_FIELD(typevar);
3968
- + WRITE_NODE_FIELD(coldeflist);
3969
- +}
3970
- +
3971
- +static void
3972
- +_outCreateEnumStmt(StringInfo str, const CreateEnumStmt *node)
3973
- +{
3974
- + WRITE_NODE_TYPE("CREATEENUMSTMT");
3975
- +
3976
- + WRITE_NODE_FIELD(typeName);
3977
- + WRITE_NODE_FIELD(vals);
3978
- +}
3979
- +
3980
- +static void
3981
- +_outCreateRangeStmt(StringInfo str, const CreateRangeStmt *node)
3982
- +{
3983
- + WRITE_NODE_TYPE("CREATERANGESTMT");
3984
- +
3985
- + WRITE_NODE_FIELD(typeName);
3986
- + WRITE_NODE_FIELD(params);
3987
- +}
3988
- +
3989
- +static void
3990
- +_outAlterEnumStmt(StringInfo str, const AlterEnumStmt *node)
3991
- +{
3992
- + WRITE_NODE_TYPE("ALTERENUMSTMT");
3993
- +
3994
- + WRITE_NODE_FIELD(typeName);
3995
- + WRITE_STRING_FIELD(newVal);
3996
- + WRITE_STRING_FIELD(newValNeighbor);
3997
- + WRITE_BOOL_FIELD(newValIsAfter);
3998
- + WRITE_BOOL_FIELD(skipIfExists);
3999
- +}
4000
- +
4001
- +static void
4002
- +_outAlterTSDictionaryStmt(StringInfo str, const AlterTSDictionaryStmt *node)
4003
- +{
4004
- + WRITE_NODE_TYPE("ALTERTSDICTIONARYSTMT");
4005
- +
4006
- + WRITE_NODE_FIELD(dictname);
4007
- + WRITE_NODE_FIELD(options);
4008
- +}
4009
- +
4010
- +static void
4011
- +_outAlterTSConfigurationStmt(StringInfo str, const AlterTSConfigurationStmt *node)
4012
- +{
4013
- + WRITE_NODE_TYPE("ALTERTSCONFIGURATIONSTMT");
4014
- +
4015
- + WRITE_NODE_FIELD(cfgname);
4016
- + WRITE_NODE_FIELD(tokentype);
4017
- + WRITE_NODE_FIELD(dicts);
4018
- + WRITE_BOOL_FIELD(override);
4019
- + WRITE_BOOL_FIELD(replace);
4020
- + WRITE_BOOL_FIELD(missing_ok);
4021
- +}
4022
- +
4023
- +static void
4024
- +_outCreateFdwStmt(StringInfo str, const CreateFdwStmt *node)
4025
- +{
4026
- + WRITE_NODE_TYPE("CREATEFDWSTMT");
4027
- +
4028
- + WRITE_STRING_FIELD(fdwname);
4029
- + WRITE_NODE_FIELD(func_options);
4030
- + WRITE_NODE_FIELD(options);
4031
- +}
4032
- +
4033
- +static void
4034
- +_outAlterFdwStmt(StringInfo str, const AlterFdwStmt *node)
4035
- +{
4036
- + WRITE_NODE_TYPE("ALTERFDWSTMT");
4037
- +
4038
- + WRITE_STRING_FIELD(fdwname);
4039
- + WRITE_NODE_FIELD(func_options);
4040
- + WRITE_NODE_FIELD(options);
4041
- +}
4042
- +
4043
- +static void
4044
- +_outCreateForeignServerStmt(StringInfo str, const CreateForeignServerStmt *node)
4045
- +{
4046
- + WRITE_NODE_TYPE("CREATEFOREIGNSERVERSTMT");
4047
- +
4048
- + WRITE_STRING_FIELD(servername);
4049
- + WRITE_STRING_FIELD(servertype);
4050
- + WRITE_STRING_FIELD(version);
4051
- + WRITE_STRING_FIELD(fdwname);
4052
- + WRITE_NODE_FIELD(options);
4053
- +}
4054
- +
4055
- +static void
4056
- +_outAlterForeignServerStmt(StringInfo str, const AlterForeignServerStmt *node)
4057
- +{
4058
- + WRITE_NODE_TYPE("ALTERFOREIGNSERVERSTMT");
4059
- +
4060
- + WRITE_STRING_FIELD(servername);
4061
- + WRITE_STRING_FIELD(version);
4062
- + WRITE_NODE_FIELD(options);
4063
- + WRITE_BOOL_FIELD(has_version);
4064
- +}
4065
- +
4066
- +static void
4067
- +_outCreateUserMappingStmt(StringInfo str, const CreateUserMappingStmt *node)
4068
- +{
4069
- + WRITE_NODE_TYPE("CREATEUSERMAPPINGSTMT");
4070
- +
4071
- + WRITE_STRING_FIELD(username);
4072
- + WRITE_STRING_FIELD(servername);
4073
- + WRITE_NODE_FIELD(options);
4074
- +}
4075
- +
4076
- +static void
4077
- +_outAlterUserMappingStmt(StringInfo str, const AlterUserMappingStmt *node)
4078
- +{
4079
- + WRITE_NODE_TYPE("ALTERUSERMAPPINGSTMT");
4080
- +
4081
- + WRITE_STRING_FIELD(username);
4082
- + WRITE_STRING_FIELD(servername);
4083
- + WRITE_NODE_FIELD(options);
4084
- +}
4085
- +
4086
- +static void
4087
- +_outDropUserMappingStmt(StringInfo str, const DropUserMappingStmt *node)
4088
- +{
4089
- + WRITE_NODE_TYPE("DROPUSERMAPPINGSTMT");
4090
- +
4091
- + WRITE_STRING_FIELD(username);
4092
- + WRITE_STRING_FIELD(servername);
4093
- + WRITE_BOOL_FIELD(missing_ok);
4094
- +}
4095
- +
4096
- +static void
4097
- +_outAlterTableSpaceOptionsStmt(StringInfo str, const AlterTableSpaceOptionsStmt *node)
4098
- +{
4099
- + WRITE_NODE_TYPE("ALTERTABLESPACEOPTIONSSTMT");
4100
- +
4101
- + WRITE_STRING_FIELD(tablespacename);
4102
- + WRITE_NODE_FIELD(options);
4103
- + WRITE_BOOL_FIELD(isReset);
4104
- +}
4105
- +
4106
- +static void
4107
- +_outAlterTableMoveAllStmt(StringInfo str, const AlterTableMoveAllStmt *node)
4108
- +{
4109
- + WRITE_NODE_TYPE("ALTERTABLEMOVEALLSTMT");
4110
- +
4111
- + WRITE_STRING_FIELD(orig_tablespacename);
4112
- + WRITE_ENUM_FIELD(objtype, ObjectType);
4113
- + WRITE_NODE_FIELD(roles);
4114
- + WRITE_STRING_FIELD(new_tablespacename);
4115
- + WRITE_BOOL_FIELD(nowait);
4116
- +}
4117
- +
4118
- +static void
4119
- +_outSecLabelStmt(StringInfo str, const SecLabelStmt *node)
4120
- +{
4121
- + WRITE_NODE_TYPE("SECLABELSTMT");
4122
- +
4123
- + WRITE_ENUM_FIELD(objtype, ObjectType);
4124
- + WRITE_NODE_FIELD(objname);
4125
- + WRITE_NODE_FIELD(objargs);
4126
- + WRITE_STRING_FIELD(provider);
4127
- + WRITE_STRING_FIELD(label);
4128
- +}
4129
- +
4130
- +static void
4131
- +_outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
4132
- +{
4133
- + WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
4134
- +
4135
- + _outCreateStmtInfo(str, (const CreateStmt *) node);
4136
- +
4137
- + WRITE_STRING_FIELD(servername);
4138
- + WRITE_NODE_FIELD(options);
4139
- +}
4140
- +
4141
- +static void
4142
- +_outCreateExtensionStmt(StringInfo str, const CreateExtensionStmt *node)
4143
- +{
4144
- + WRITE_NODE_TYPE("CREATEEXTENSIONSTMT");
4145
- +
4146
- + WRITE_STRING_FIELD(extname);
4147
- + WRITE_BOOL_FIELD(if_not_exists);
4148
- + WRITE_NODE_FIELD(options);
4149
- +}
4150
- +
4151
- +static void
4152
- +_outAlterExtensionStmt(StringInfo str, const AlterExtensionStmt *node)
4153
- +{
4154
- + WRITE_NODE_TYPE("ALTEREXTENSIONSTMT");
4155
- +
4156
- + WRITE_STRING_FIELD(extname);
4157
- + WRITE_NODE_FIELD(options);
4158
- +}
4159
- +
4160
- +static void
4161
- +_outAlterExtensionContentsStmt(StringInfo str, const AlterExtensionContentsStmt *node)
4162
- +{
4163
- + WRITE_NODE_TYPE("ALTEREXTENSIONCONTENTSSTMT");
4164
- +
4165
- + WRITE_STRING_FIELD(extname);
4166
- + WRITE_INT_FIELD(action);
4167
- + WRITE_ENUM_FIELD(objtype, ObjectType);
4168
- + WRITE_NODE_FIELD(objname);
4169
- + WRITE_NODE_FIELD(objargs);
4170
- +}
4171
- +
4172
- +static void
4173
- +_outCreateEventTrigStmt(StringInfo str, const CreateEventTrigStmt *node)
4174
- +{
4175
- + WRITE_NODE_TYPE("CREATEEVENTTRIGSTMT");
4176
- +
4177
- + WRITE_STRING_FIELD(trigname);
4178
- + WRITE_STRING_FIELD(eventname);
4179
- + WRITE_NODE_FIELD(whenclause);
4180
- + WRITE_NODE_FIELD(funcname);
4181
- +}
4182
- +
4183
- +static void
4184
- +_outAlterEventTrigStmt(StringInfo str, const AlterEventTrigStmt *node)
4185
- +{
4186
- + WRITE_NODE_TYPE("ALTEREVENTTRIGSTMT");
4187
- +
4188
- + WRITE_STRING_FIELD(trigname);
4189
- + WRITE_CHAR_FIELD(tgenabled);
4190
- +}
4191
- +
4192
- +static void
4193
- +_outRefreshMatViewStmt(StringInfo str, const RefreshMatViewStmt *node)
4194
- +{
4195
- + WRITE_NODE_TYPE("REFRESHMATVIEWSTMT");
4196
- +
4197
- + WRITE_BOOL_FIELD(concurrent);
4198
- + WRITE_BOOL_FIELD(skipData);
4199
- + WRITE_NODE_FIELD(relation);
4200
- +}
4201
- +
4202
- +static void
4203
- +_outReplicaIdentityStmt(StringInfo str, const ReplicaIdentityStmt *node)
4204
- +{
4205
- + WRITE_NODE_TYPE("REPLICAIDENTITYSTMT");
4206
- +
4207
- + WRITE_CHAR_FIELD(identity_type);
4208
- + WRITE_STRING_FIELD(name);
4209
- +}
4210
- +
4211
- +static void
4212
- +_outAlterSystemStmt(StringInfo str, const AlterSystemStmt *node)
4213
- +{
4214
- + WRITE_NODE_TYPE("ALTERSYSTEMSTMT");
4215
- +
4216
- + WRITE_NODE_FIELD(setstmt);
4217
- +}
4218
- +
4219
- +static void
4220
- +_outColumnRef(StringInfo str, const ColumnRef *node)
4221
- +{
4222
- + WRITE_NODE_TYPE("COLUMNREF");
4223
- +
4224
- + WRITE_NODE_FIELD(fields);
4225
- + WRITE_LOCATION_FIELD(location);
4226
- +}
4227
- +
4228
- +static void
4229
- +_outParamRef(StringInfo str, const ParamRef *node)
4230
- +{
4231
- + WRITE_NODE_TYPE("PARAMREF");
4232
- +
4233
- + WRITE_INT_FIELD(number);
4234
- + WRITE_LOCATION_FIELD(location);
4235
- +}
4236
- +
4237
- +static void
4238
- +_outFuncCall(StringInfo str, const FuncCall *node)
4239
- +{
4240
- + WRITE_NODE_TYPE("FUNCCALL");
4241
- +
4242
- + WRITE_NODE_FIELD(funcname);
4243
- + WRITE_NODE_FIELD(args);
4244
- + WRITE_NODE_FIELD(agg_order);
4245
- + WRITE_NODE_FIELD(agg_filter);
4246
- + WRITE_BOOL_FIELD(agg_within_group);
4247
- + WRITE_BOOL_FIELD(agg_star);
4248
- + WRITE_BOOL_FIELD(agg_distinct);
4249
- + WRITE_BOOL_FIELD(func_variadic);
4250
- + WRITE_NODE_FIELD(over);
4251
- + WRITE_LOCATION_FIELD(location);
4252
- +}
4253
- +
4254
- +static void
4255
- +_outA_Star(StringInfo str, const A_Star *node)
4256
- +{
4257
- + WRITE_NODE_TYPE("A_STAR");
4258
- +
4259
- +}
4260
- +
4261
- +static void
4262
- +_outA_Indices(StringInfo str, const A_Indices *node)
4263
- +{
4264
- + WRITE_NODE_TYPE("A_INDICES");
4265
- +
4266
- + WRITE_NODE_FIELD(lidx);
4267
- + WRITE_NODE_FIELD(uidx);
4268
- +}
4269
- +
4270
- +static void
4271
- +_outA_Indirection(StringInfo str, const A_Indirection *node)
4272
- +{
4273
- + WRITE_NODE_TYPE("A_INDIRECTION");
4274
- +
4275
- + WRITE_NODE_FIELD(arg);
4276
- + WRITE_NODE_FIELD(indirection);
4277
- +}
4278
- +
4279
- +static void
4280
- +_outA_ArrayExpr(StringInfo str, const A_ArrayExpr *node)
4281
- +{
4282
- + WRITE_NODE_TYPE("A_ARRAYEXPR");
4283
- +
4284
- + WRITE_NODE_FIELD(elements);
4285
- + WRITE_LOCATION_FIELD(location);
4286
- +}
4287
- +
4288
- +static void
4289
- +_outResTarget(StringInfo str, const ResTarget *node)
4290
- +{
4291
- + WRITE_NODE_TYPE("RESTARGET");
4292
- +
4293
- + WRITE_STRING_FIELD(name);
4294
- + WRITE_NODE_FIELD(indirection);
4295
- + WRITE_NODE_FIELD(val);
4296
- + WRITE_LOCATION_FIELD(location);
4297
- +}
4298
- +
4299
- +static void
4300
- +_outTypeCast(StringInfo str, const TypeCast *node)
4301
- +{
4302
- + WRITE_NODE_TYPE("TYPECAST");
4303
- +
4304
- + WRITE_NODE_FIELD(arg);
4305
- + WRITE_NODE_FIELD(typeName);
4306
- + WRITE_LOCATION_FIELD(location);
4307
- +}
4308
- +
4309
- +static void
4310
- +_outCollateClause(StringInfo str, const CollateClause *node)
4311
- +{
4312
- + WRITE_NODE_TYPE("COLLATECLAUSE");
4313
- +
4314
- + WRITE_NODE_FIELD(arg);
4315
- + WRITE_NODE_FIELD(collname);
4316
- + WRITE_LOCATION_FIELD(location);
4317
- +}
4318
- +
4319
- +static void
4320
- +_outSortBy(StringInfo str, const SortBy *node)
4321
- +{
4322
- + WRITE_NODE_TYPE("SORTBY");
4323
- +
4324
- + WRITE_NODE_FIELD(node);
4325
- + WRITE_ENUM_FIELD(sortby_dir, SortByDir);
4326
- + WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
4327
- + WRITE_NODE_FIELD(useOp);
4328
- + WRITE_LOCATION_FIELD(location);
4329
- +}
4330
- +
4331
- +static void
4332
- +_outWindowDef(StringInfo str, const WindowDef *node)
4333
- +{
4334
- + WRITE_NODE_TYPE("WINDOWDEF");
4335
- +
4336
- + WRITE_STRING_FIELD(name);
4337
- + WRITE_STRING_FIELD(refname);
4338
- + WRITE_NODE_FIELD(partitionClause);
4339
- + WRITE_NODE_FIELD(orderClause);
4340
- + WRITE_INT_FIELD(frameOptions);
4341
- + WRITE_NODE_FIELD(startOffset);
4342
- + WRITE_NODE_FIELD(endOffset);
4343
- + WRITE_LOCATION_FIELD(location);
4344
- +}
4345
- +
4346
- +static void
4347
- +_outRangeSubselect(StringInfo str, const RangeSubselect *node)
4348
- +{
4349
- + WRITE_NODE_TYPE("RANGESUBSELECT");
4350
- +
4351
- + WRITE_BOOL_FIELD(lateral);
4352
- + WRITE_NODE_FIELD(subquery);
4353
- + WRITE_NODE_FIELD(alias);
4354
- +}
4355
- +
4356
- +static void
4357
- +_outRangeFunction(StringInfo str, const RangeFunction *node)
4358
- +{
4359
- + WRITE_NODE_TYPE("RANGEFUNCTION");
4360
- +
4361
- + WRITE_BOOL_FIELD(lateral);
4362
- + WRITE_BOOL_FIELD(ordinality);
4363
- + WRITE_BOOL_FIELD(is_rowsfrom);
4364
- + WRITE_NODE_FIELD(functions);
4365
- + WRITE_NODE_FIELD(alias);
4366
- + WRITE_NODE_FIELD(coldeflist);
4367
- +}
4368
- +
4369
- +static void
4370
- +_outTypeName(StringInfo str, const TypeName *node)
4371
- +{
4372
- + WRITE_NODE_TYPE("TYPENAME");
4373
- +
4374
- + WRITE_NODE_FIELD(names);
4375
- + WRITE_OID_FIELD(typeOid);
4376
- + WRITE_BOOL_FIELD(setof);
4377
- + WRITE_BOOL_FIELD(pct_type);
4378
- + WRITE_NODE_FIELD(typmods);
4379
- + WRITE_INT_FIELD(typemod);
4380
- + WRITE_NODE_FIELD(arrayBounds);
4381
- + WRITE_LOCATION_FIELD(location);
4382
- +}
4383
- +
4384
- +static void
4385
- +_outColumnDef(StringInfo str, const ColumnDef *node)
4386
- +{
4387
- + WRITE_NODE_TYPE("COLUMNDEF");
4388
- +
4389
- + WRITE_STRING_FIELD(colname);
4390
- + WRITE_NODE_FIELD(typeName);
4391
- + WRITE_INT_FIELD(inhcount);
4392
- + WRITE_BOOL_FIELD(is_local);
4393
- + WRITE_BOOL_FIELD(is_not_null);
4394
- + WRITE_BOOL_FIELD(is_from_type);
4395
- + WRITE_CHAR_FIELD(storage);
4396
- + WRITE_NODE_FIELD(raw_default);
4397
- + WRITE_NODE_FIELD(cooked_default);
4398
- + WRITE_NODE_FIELD(collClause);
4399
- + WRITE_OID_FIELD(collOid);
4400
- + WRITE_NODE_FIELD(constraints);
4401
- + WRITE_NODE_FIELD(fdwoptions);
4402
- + WRITE_LOCATION_FIELD(location);
4403
- +}
4404
- +
4405
- +static void
4406
- +_outIndexElem(StringInfo str, const IndexElem *node)
4407
- +{
4408
- + WRITE_NODE_TYPE("INDEXELEM");
4409
- +
4410
- + WRITE_STRING_FIELD(name);
4411
- + WRITE_NODE_FIELD(expr);
4412
- + WRITE_STRING_FIELD(indexcolname);
4413
- + WRITE_NODE_FIELD(collation);
4414
- + WRITE_NODE_FIELD(opclass);
4415
- + WRITE_ENUM_FIELD(ordering, SortByDir);
4416
- + WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
4417
- +}
4418
- +
4419
- +static void
4420
- +_outDefElem(StringInfo str, const DefElem *node)
4421
- +{
4422
- + WRITE_NODE_TYPE("DEFELEM");
4423
- +
4424
- + WRITE_STRING_FIELD(defnamespace);
4425
- + WRITE_STRING_FIELD(defname);
4426
- + WRITE_NODE_FIELD(arg);
4427
- + WRITE_ENUM_FIELD(defaction, DefElemAction);
4428
- +}
4429
- +
4430
- +static void
4431
- +_outRangeTblFunction(StringInfo str, const RangeTblFunction *node)
4432
- +{
4433
- + WRITE_NODE_TYPE("RANGETBLFUNCTION");
4434
- +
4435
- + WRITE_NODE_FIELD(funcexpr);
4436
- + WRITE_INT_FIELD(funccolcount);
4437
- + WRITE_NODE_FIELD(funccolnames);
4438
- + WRITE_NODE_FIELD(funccoltypes);
4439
- + WRITE_NODE_FIELD(funccoltypmods);
4440
- + WRITE_NODE_FIELD(funccolcollations);
4441
- + WRITE_BITMAPSET_FIELD(funcparams);
4442
- +}
4443
- +
4444
- +static void
4445
- +_outWithCheckOption(StringInfo str, const WithCheckOption *node)
4446
- +{
4447
- + WRITE_NODE_TYPE("WITHCHECKOPTION");
4448
- +
4449
- + WRITE_STRING_FIELD(viewname);
4450
- + WRITE_NODE_FIELD(qual);
4451
- + WRITE_BOOL_FIELD(cascaded);
4452
- +}
4453
- +
4454
- +static void
4455
- +_outSortGroupClause(StringInfo str, const SortGroupClause *node)
4456
- +{
4457
- + WRITE_NODE_TYPE("SORTGROUPCLAUSE");
4458
- +
4459
- + WRITE_UINT_FIELD(tleSortGroupRef);
4460
- + WRITE_OID_FIELD(eqop);
4461
- + WRITE_OID_FIELD(sortop);
4462
- + WRITE_BOOL_FIELD(nulls_first);
4463
- + WRITE_BOOL_FIELD(hashable);
4464
- +}
4465
- +
4466
- +static void
4467
- +_outWindowClause(StringInfo str, const WindowClause *node)
4468
- +{
4469
- + WRITE_NODE_TYPE("WINDOWCLAUSE");
4470
- +
4471
- + WRITE_STRING_FIELD(name);
4472
- + WRITE_STRING_FIELD(refname);
4473
- + WRITE_NODE_FIELD(partitionClause);
4474
- + WRITE_NODE_FIELD(orderClause);
4475
- + WRITE_INT_FIELD(frameOptions);
4476
- + WRITE_NODE_FIELD(startOffset);
4477
- + WRITE_NODE_FIELD(endOffset);
4478
- + WRITE_UINT_FIELD(winref);
4479
- + WRITE_BOOL_FIELD(copiedOrder);
4480
- +}
4481
- +
4482
- +static void
4483
- +_outPrivGrantee(StringInfo str, const PrivGrantee *node)
4484
- +{
4485
- + WRITE_NODE_TYPE("PRIVGRANTEE");
4486
- +
4487
- + WRITE_STRING_FIELD(rolname);
4488
- +}
4489
- +
4490
- +static void
4491
- +_outFuncWithArgs(StringInfo str, const FuncWithArgs *node)
4492
- +{
4493
- + WRITE_NODE_TYPE("FUNCWITHARGS");
4494
- +
4495
- + WRITE_NODE_FIELD(funcname);
4496
- + WRITE_NODE_FIELD(funcargs);
4497
- +}
4498
- +
4499
- +static void
4500
- +_outAccessPriv(StringInfo str, const AccessPriv *node)
4501
- +{
4502
- + WRITE_NODE_TYPE("ACCESSPRIV");
4503
- +
4504
- + WRITE_STRING_FIELD(priv_name);
4505
- + WRITE_NODE_FIELD(cols);
4506
- +}
4507
- +
4508
- +static void
4509
- +_outCreateOpClassItem(StringInfo str, const CreateOpClassItem *node)
4510
- +{
4511
- + WRITE_NODE_TYPE("CREATEOPCLASSITEM");
4512
- +
4513
- + WRITE_INT_FIELD(itemtype);
4514
- + WRITE_NODE_FIELD(name);
4515
- + WRITE_NODE_FIELD(args);
4516
- + WRITE_INT_FIELD(number);
4517
- + WRITE_NODE_FIELD(order_family);
4518
- + WRITE_NODE_FIELD(class_args);
4519
- + WRITE_NODE_FIELD(storedtype);
4520
- +}
4521
- +
4522
- +static void
4523
- +_outTableLikeClause(StringInfo str, const TableLikeClause *node)
4524
- +{
4525
- + WRITE_NODE_TYPE("TABLELIKECLAUSE");
4526
- +
4527
- + WRITE_NODE_FIELD(relation);
4528
- + WRITE_UINT_FIELD(options);
4529
- +}
4530
- +
4531
- +static void
4532
- +_outFunctionParameter(StringInfo str, const FunctionParameter *node)
4533
- +{
4534
- + WRITE_NODE_TYPE("FUNCTIONPARAMETER");
4535
- +
4536
- + WRITE_STRING_FIELD(name);
4537
- + WRITE_NODE_FIELD(argType);
4538
- + WRITE_ENUM_FIELD(mode, FunctionParameterMode);
4539
- + WRITE_NODE_FIELD(defexpr);
4540
- +}
4541
- +
4542
- +static void
4543
- +_outLockingClause(StringInfo str, const LockingClause *node)
4544
- +{
4545
- + WRITE_NODE_TYPE("LOCKINGCLAUSE");
4546
- +
4547
- + WRITE_NODE_FIELD(lockedRels);
4548
- + WRITE_ENUM_FIELD(strength, LockClauseStrength);
4549
- + WRITE_BOOL_FIELD(noWait);
4550
- +}
4551
- +
4552
- +static void
4553
- +_outRowMarkClause(StringInfo str, const RowMarkClause *node)
4554
- +{
4555
- + WRITE_NODE_TYPE("ROWMARKCLAUSE");
4556
- +
4557
- + WRITE_UINT_FIELD(rti);
4558
- + WRITE_ENUM_FIELD(strength, LockClauseStrength);
4559
- + WRITE_BOOL_FIELD(noWait);
4560
- + WRITE_BOOL_FIELD(pushedDown);
4561
- +}
4562
- +
4563
- +static void
4564
- +_outXmlSerialize(StringInfo str, const XmlSerialize *node)
4565
- +{
4566
- + WRITE_NODE_TYPE("XMLSERIALIZE");
4567
- +
4568
- + WRITE_ENUM_FIELD(xmloption, XmlOptionType);
4569
- + WRITE_NODE_FIELD(expr);
4570
- + WRITE_NODE_FIELD(typeName);
4571
- + WRITE_LOCATION_FIELD(location);
4572
- +}
4573
- +
4574
- +static void
4575
- +_outWithClause(StringInfo str, const WithClause *node)
4576
- +{
4577
- + WRITE_NODE_TYPE("WITHCLAUSE");
4578
- +
4579
- + WRITE_NODE_FIELD(ctes);
4580
- + WRITE_BOOL_FIELD(recursive);
4581
- + WRITE_LOCATION_FIELD(location);
4582
- +}
4583
- +
4584
- +static void
4585
- +_outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
4586
- +{
4587
- + WRITE_NODE_TYPE("COMMONTABLEEXPR");
4588
- +
4589
- + WRITE_STRING_FIELD(ctename);
4590
- + WRITE_NODE_FIELD(aliascolnames);
4591
- + WRITE_NODE_FIELD(ctequery);
4592
- + WRITE_LOCATION_FIELD(location);
4593
- + WRITE_BOOL_FIELD(cterecursive);
4594
- + WRITE_INT_FIELD(cterefcount);
4595
- + WRITE_NODE_FIELD(ctecolnames);
4596
- + WRITE_NODE_FIELD(ctecoltypes);
4597
- + WRITE_NODE_FIELD(ctecoltypmods);
4598
- + WRITE_NODE_FIELD(ctecolcollations);
4599
- +}
4600
- +
4601
- +static void
4602
- +_outInlineCodeBlock(StringInfo str, const InlineCodeBlock *node)
4603
- +{
4604
- + WRITE_NODE_TYPE("INLINECODEBLOCK");
4605
- +
4606
- + WRITE_STRING_FIELD(source_text);
4607
- + WRITE_OID_FIELD(langOid);
4608
- + WRITE_BOOL_FIELD(langIsTrusted);
4609
- +}
4610
- +
4611
- diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
4612
- index 5dcc66f..c9ce432 100644
4613
- --- a/src/include/nodes/nodes.h
4614
- +++ b/src/include/nodes/nodes.h
4615
- @@ -504,6 +504,11 @@ extern PGDLLIMPORT Node *newNodeMacroHolder;
4616
- extern char *nodeToString(const void *obj);
4617
-
4618
- /*
4619
- +* nodes/outfuncs_json.c
4620
- +*/
4621
- +extern char *nodeToJSONString(const void *obj);
4622
- +
4623
- +/*
4624
- * nodes/{readfuncs.c,read.c}
4625
- */
4626
- extern void *stringToNode(char *str);