forked from launchql/libpg-query-node
-
Notifications
You must be signed in to change notification settings - Fork 5
/
ast.ts
6797 lines (6462 loc) · 218 KB
/
ast.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* This file is auto-generated by scripts/generateTypes.ts */
/**
* Grantable rights are encoded so that we can OR them together in a bitmask.
* The present representation of AclItem limits us to 32 distinct rights,
* even though AclMode is defined as uint64. See utils/acl.h.
*
* Caution: changing these codes breaks stored ACLs, hence forces initdb.
*/
export enum AclMode {
ACL_NO_RIGHTS = 0,
ACL_INSERT = 1 << 0,
ACL_SELECT = 1 << 1,
ACL_UPDATE = 1 << 2,
ACL_DELETE = 1 << 3,
ACL_TRUNCATE = 1 << 4,
ACL_REFERENCES = 1 << 5,
ACL_TRIGGER = 1 << 6,
ACL_EXECUTE = 1 << 7,
ACL_USAGE = 1 << 8,
ACL_CREATE = 1 << 9,
ACL_CREATE_TEMP = 1 << 10,
ACL_CONNECT = 1 << 11,
ACL_SET = 1 << 12,
ACL_ALTER_SYSTEM = 1 << 13,
}
/**
* DistinctExpr - expression node for "x IS DISTINCT FROM y"
*
* Except for the nodetag, this is represented identically to an OpExpr
* referencing the "=" operator for x and y.
* We use "=", not the more obvious "<>", because more datatypes have "="
* than "<>". This means the executor must invert the operator result.
* Note that the operator function won't be called at all if either input
* is NULL, since then the result can be determined directly.
*/
export type DistinctExpr = OpExpr
/**
* NullIfExpr - a NULLIF expression
*
* Like DistinctExpr, this is represented the same as an OpExpr referencing
* the "=" operator for x and y.
*/
export type NullIfExpr = OpExpr
/**
* Typedefs for identifying qualifier selectivities and plan costs as such.
* These are just plain "double"s, but declaring a variable as Selectivity
* or Cost makes the intent more obvious.
*
* These could have gone into plannodes.h or some such, but many files
* depend on them...
*/
export type Selectivity = number
export type Cost = number
export type Cardinality = number
export type ParamListInfo = ParamListInfoData
/**
* user defined attribute numbers start at 1. -ay 2/95
*/
export type AttrNumber = number
/**
* Pointer
* Variable holding address of any memory resident object.
*
* XXX Pointer arithmetic is done with this, so it can't be void *
* under "true" ANSI compilers.
*/
export type Pointer = string
/**
* Index
* Index into any memory resident array.
*
* Note:
* Indices are non negative.
*/
export type Index = number
/**
* Offset
* Offset into any memory resident array.
*
* Note:
* This differs from an Index in that an Index is always
* non negative, whereas Offset may be negative.
*/
export type Offset = number
/**
* regproc is the type name used in the include/catalog headers, but
* RegProcedure is the preferred name in C code.
*/
export type regproc = Oid
export type RegProcedure = regproc
export type TransactionId = number
export type LocalTransactionId = number
export type SubTransactionId = number
/** MultiXactId must be equivalent to TransactionId, to fit in t_xmax */
export type MultiXactId = TransactionId
export type MultiXactOffset = number
export type CommandId = number
/**
* Representation of a Name: effectively just a C string, but null-padded to
* exactly NAMEDATALEN bytes. The use of a struct is historical.
*/
export type Name = string
/**
* A Datum contains either a value of a pass-by-value type or a pointer to a
* value of a pass-by-reference type. Therefore, we require:
*
* sizeof(Datum) == sizeof(void *) == 4 or 8
*
* The functions below and the analogous functions for other types should be used to
* convert between a Datum and the appropriate C type.
*/
export type Datum = any
/**
* Object ID is a fundamental type in Postgres.
*/
export type Oid = number
export enum OverridingKind {
OVERRIDING_NOT_SET = 'OVERRIDING_NOT_SET',
OVERRIDING_USER_VALUE = 'OVERRIDING_USER_VALUE',
OVERRIDING_SYSTEM_VALUE = 'OVERRIDING_SYSTEM_VALUE',
}
/** Sort ordering options for ORDER BY and CREATE INDEX */
export enum SortByDir {
SORTBY_DEFAULT = 'SORTBY_DEFAULT',
SORTBY_ASC = 'SORTBY_ASC',
SORTBY_DESC = 'SORTBY_DESC',
/** not allowed in CREATE INDEX ... */
SORTBY_USING = 'SORTBY_USING',
}
export enum SortByNulls {
SORTBY_NULLS_DEFAULT = 'SORTBY_NULLS_DEFAULT',
SORTBY_NULLS_FIRST = 'SORTBY_NULLS_FIRST',
SORTBY_NULLS_LAST = 'SORTBY_NULLS_LAST',
}
/** Options for [ ALL | DISTINCT ] */
export enum SetQuantifier {
SET_QUANTIFIER_DEFAULT = 'SET_QUANTIFIER_DEFAULT',
SET_QUANTIFIER_ALL = 'SET_QUANTIFIER_ALL',
SET_QUANTIFIER_DISTINCT = 'SET_QUANTIFIER_DISTINCT',
}
/**
* A_Expr - infix, prefix, and postfix expressions
*/
export enum A_Expr_Kind {
/** normal operator */
AEXPR_OP = 'AEXPR_OP',
/** scalar op ANY (array) */
AEXPR_OP_ANY = 'AEXPR_OP_ANY',
/** scalar op ALL (array) */
AEXPR_OP_ALL = 'AEXPR_OP_ALL',
/** IS DISTINCT FROM - name must be "=" */
AEXPR_DISTINCT = 'AEXPR_DISTINCT',
/** IS NOT DISTINCT FROM - name must be "=" */
AEXPR_NOT_DISTINCT = 'AEXPR_NOT_DISTINCT',
/** NULLIF - name must be "=" */
AEXPR_NULLIF = 'AEXPR_NULLIF',
/** [NOT] IN - name must be "=" or "<>" */
AEXPR_IN = 'AEXPR_IN',
/** [NOT] LIKE - name must be "~~" or "!~~" */
AEXPR_LIKE = 'AEXPR_LIKE',
/** [NOT] ILIKE - name must be "~~*" or "!~~*" */
AEXPR_ILIKE = 'AEXPR_ILIKE',
/** [NOT] SIMILAR - name must be "~" or "!~" */
AEXPR_SIMILAR = 'AEXPR_SIMILAR',
/** name must be "BETWEEN" */
AEXPR_BETWEEN = 'AEXPR_BETWEEN',
/** name must be "NOT BETWEEN" */
AEXPR_NOT_BETWEEN = 'AEXPR_NOT_BETWEEN',
/** name must be "BETWEEN SYMMETRIC" */
AEXPR_BETWEEN_SYM = 'AEXPR_BETWEEN_SYM',
/** name must be "NOT BETWEEN SYMMETRIC" */
AEXPR_NOT_BETWEEN_SYM = 'AEXPR_NOT_BETWEEN_SYM',
}
/**
* RoleSpec - a role name or one of a few special values.
*/
export enum RoleSpecType {
/** role name is stored as a C string */
ROLESPEC_CSTRING = 'ROLESPEC_CSTRING',
/** role spec is CURRENT_ROLE */
ROLESPEC_CURRENT_ROLE = 'ROLESPEC_CURRENT_ROLE',
/** role spec is CURRENT_USER */
ROLESPEC_CURRENT_USER = 'ROLESPEC_CURRENT_USER',
/** role spec is SESSION_USER */
ROLESPEC_SESSION_USER = 'ROLESPEC_SESSION_USER',
/** role name is "public" */
ROLESPEC_PUBLIC = 'ROLESPEC_PUBLIC',
}
export enum TableLikeOption {
CREATE_TABLE_LIKE_COMMENTS = 'CREATE_TABLE_LIKE_COMMENTS',
CREATE_TABLE_LIKE_COMPRESSION = 'CREATE_TABLE_LIKE_COMPRESSION',
CREATE_TABLE_LIKE_CONSTRAINTS = 'CREATE_TABLE_LIKE_CONSTRAINTS',
CREATE_TABLE_LIKE_DEFAULTS = 'CREATE_TABLE_LIKE_DEFAULTS',
CREATE_TABLE_LIKE_GENERATED = 'CREATE_TABLE_LIKE_GENERATED',
CREATE_TABLE_LIKE_IDENTITY = 'CREATE_TABLE_LIKE_IDENTITY',
CREATE_TABLE_LIKE_INDEXES = 'CREATE_TABLE_LIKE_INDEXES',
CREATE_TABLE_LIKE_STATISTICS = 'CREATE_TABLE_LIKE_STATISTICS',
CREATE_TABLE_LIKE_STORAGE = 'CREATE_TABLE_LIKE_STORAGE',
CREATE_TABLE_LIKE_ALL = 'CREATE_TABLE_LIKE_ALL',
}
/**
* DefElem - a generic "name = value" option definition
*
* In some contexts the name can be qualified. Also, certain SQL commands
* allow a SET/ADD/DROP action to be attached to option settings, so it's
* convenient to carry a field for that too. (Note: currently, it is our
* practice that the grammar allows namespace and action only in statements
* where they are relevant; C code can just ignore those fields in other
* statements.)
*/
export enum DefElemAction {
/** no action given */
DEFELEM_UNSPEC = 'DEFELEM_UNSPEC',
DEFELEM_SET = 'DEFELEM_SET',
DEFELEM_ADD = 'DEFELEM_ADD',
DEFELEM_DROP = 'DEFELEM_DROP',
}
export enum PartitionStrategy {
PARTITION_STRATEGY_LIST = 'PARTITION_STRATEGY_LIST',
PARTITION_STRATEGY_RANGE = 'PARTITION_STRATEGY_RANGE',
PARTITION_STRATEGY_HASH = 'PARTITION_STRATEGY_HASH',
}
/**
* PartitionRangeDatum - one of the values in a range partition bound
*
* This can be MINVALUE, MAXVALUE or a specific bounded value.
*/
export enum PartitionRangeDatumKind {
PARTITION_RANGE_DATUM_MINVALUE = 'PARTITION_RANGE_DATUM_MINVALUE',
/** a specific (bounded) value */
PARTITION_RANGE_DATUM_VALUE = 'PARTITION_RANGE_DATUM_VALUE',
/** greater than any other value */
PARTITION_RANGE_DATUM_MAXVALUE = 'PARTITION_RANGE_DATUM_MAXVALUE',
}
/**--------------------
* RangeTblEntry -
* A range table is a List of RangeTblEntry nodes.
*
* A range table entry may represent a plain relation, a sub-select in
* FROM, or the result of a JOIN clause. (Only explicit JOIN syntax
* produces an RTE, not the implicit join resulting from multiple FROM
* items. This is because we only need the RTE to deal with SQL features
* like outer joins and join-output-column aliasing.) Other special
* RTE types also exist, as indicated by RTEKind.
*
* Note that we consider RTE_RELATION to cover anything that has a pg_class
* entry. relkind distinguishes the sub-cases.
*
* alias is an Alias node representing the AS alias-clause attached to the
* FROM expression, or NULL if no clause.
*
* eref is the table reference name and column reference names (either
* real or aliases). Note that system columns (OID etc) are not included
* in the column list.
* eref->aliasname is required to be present, and should generally be used
* to identify the RTE for error messages etc.
*
* In RELATION RTEs, the colnames in both alias and eref are indexed by
* physical attribute number; this means there must be colname entries for
* dropped columns. When building an RTE we insert empty strings ("") for
* dropped columns. Note however that a stored rule may have nonempty
* colnames for columns dropped since the rule was created (and for that
* matter the colnames might be out of date due to column renamings).
* The same comments apply to FUNCTION RTEs when a function's return type
* is a named composite type.
*
* In JOIN RTEs, the colnames in both alias and eref are one-to-one with
* joinaliasvars entries. A JOIN RTE will omit columns of its inputs when
* those columns are known to be dropped at parse time. Again, however,
* a stored rule might contain entries for columns dropped since the rule
* was created. (This is only possible for columns not actually referenced
* in the rule.) When loading a stored rule, we replace the joinaliasvars
* items for any such columns with null pointers. (We can't simply delete
* them from the joinaliasvars list, because that would affect the attnums
* of Vars referencing the rest of the list.)
*
* inh is true for relation references that should be expanded to include
* inheritance children, if the rel has any. This *must* be false for
* RTEs other than RTE_RELATION entries.
*
* inFromCl marks those range variables that are listed in the FROM clause.
* It's false for RTEs that are added to a query behind the scenes, such
* as the NEW and OLD variables for a rule, or the subqueries of a UNION.
* This flag is not used during parsing (except in transformLockingClause,
* q.v.); the parser now uses a separate "namespace" data structure to
* control visibility. But it is needed by ruleutils.c to determine
* whether RTEs should be shown in decompiled queries.
*
* securityQuals is a list of security barrier quals (boolean expressions),
* to be tested in the listed order before returning a row from the
* relation. It is always NIL in parser output. Entries are added by the
* rewriter to implement security-barrier views and/or row-level security.
* Note that the planner turns each boolean expression into an implicitly
* AND'ed sublist, as is its usual habit with qualification expressions.
*--------------------
*/
export enum RTEKind {
/** ordinary relation reference */
RTE_RELATION = 'RTE_RELATION',
/** subquery in FROM */
RTE_SUBQUERY = 'RTE_SUBQUERY',
/** join */
RTE_JOIN = 'RTE_JOIN',
/** function in FROM */
RTE_FUNCTION = 'RTE_FUNCTION',
/** TableFunc(.., column list) */
RTE_TABLEFUNC = 'RTE_TABLEFUNC',
/** VALUES (<exprlist>), (<exprlist>), ... */
RTE_VALUES = 'RTE_VALUES',
/** common table expr (WITH list element) */
RTE_CTE = 'RTE_CTE',
/** tuplestore, e.g. for AFTER triggers */
RTE_NAMEDTUPLESTORE = 'RTE_NAMEDTUPLESTORE',
/** RTE represents an empty FROM clause; such
* RTEs are added by the planner, they're not
* present during parsing or rewriting */
RTE_RESULT = 'RTE_RESULT',
}
/**
* WithCheckOption -
* representation of WITH CHECK OPTION checks to be applied to new tuples
* when inserting/updating an auto-updatable view, or RLS WITH CHECK
* policies to be applied when inserting/updating a relation with RLS.
*/
export enum WCOKind {
/** WCO on an auto-updatable view */
WCO_VIEW_CHECK = 'WCO_VIEW_CHECK',
/** RLS INSERT WITH CHECK policy */
WCO_RLS_INSERT_CHECK = 'WCO_RLS_INSERT_CHECK',
/** RLS UPDATE WITH CHECK policy */
WCO_RLS_UPDATE_CHECK = 'WCO_RLS_UPDATE_CHECK',
/** RLS ON CONFLICT DO UPDATE USING policy */
WCO_RLS_CONFLICT_CHECK = 'WCO_RLS_CONFLICT_CHECK',
/** RLS MERGE UPDATE USING policy */
WCO_RLS_MERGE_UPDATE_CHECK = 'WCO_RLS_MERGE_UPDATE_CHECK',
/** RLS MERGE DELETE USING policy */
WCO_RLS_MERGE_DELETE_CHECK = 'WCO_RLS_MERGE_DELETE_CHECK',
}
/**
* GroupingSet -
* representation of CUBE, ROLLUP and GROUPING SETS clauses
*
* In a Query with grouping sets, the groupClause contains a flat list of
* SortGroupClause nodes for each distinct expression used. The actual
* structure of the GROUP BY clause is given by the groupingSets tree.
*
* In the raw parser output, GroupingSet nodes (of all types except SIMPLE
* which is not used) are potentially mixed in with the expressions in the
* groupClause of the SelectStmt. (An expression can't contain a GroupingSet,
* but a list may mix GroupingSet and expression nodes.) At this stage, the
* content of each node is a list of expressions, some of which may be RowExprs
* which represent sublists rather than actual row constructors, and nested
* GroupingSet nodes where legal in the grammar. The structure directly
* reflects the query syntax.
*
* In parse analysis, the transformed expressions are used to build the tlist
* and groupClause list (of SortGroupClause nodes), and the groupingSets tree
* is eventually reduced to a fixed format:
*
* EMPTY nodes represent (), and obviously have no content
*
* SIMPLE nodes represent a list of one or more expressions to be treated as an
* atom by the enclosing structure; the content is an integer list of
* ressortgroupref values (see SortGroupClause)
*
* CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes.
*
* SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after
* parse analysis they cannot contain more SETS nodes; enough of the syntactic
* transforms of the spec have been applied that we no longer have arbitrarily
* deep nesting (though we still preserve the use of cube/rollup).
*
* Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY
* nodes at the leaves), then the groupClause will be empty, but this is still
* an aggregation query (similar to using aggs or HAVING without GROUP BY).
*
* As an example, the following clause:
*
* GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e)))
*
* looks like this after raw parsing:
*
* SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) )
*
* and parse analysis converts it to:
*
* SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
*/
export enum GroupingSetKind {
GROUPING_SET_EMPTY = 'GROUPING_SET_EMPTY',
GROUPING_SET_SIMPLE = 'GROUPING_SET_SIMPLE',
GROUPING_SET_ROLLUP = 'GROUPING_SET_ROLLUP',
GROUPING_SET_CUBE = 'GROUPING_SET_CUBE',
GROUPING_SET_SETS = 'GROUPING_SET_SETS',
}
/**
* CommonTableExpr -
* representation of WITH list element
*/
export enum CTEMaterialize {
/** no option specified */
CTEMaterializeDefault = 'CTEMaterializeDefault',
/** MATERIALIZED */
CTEMaterializeAlways = 'CTEMaterializeAlways',
/** NOT MATERIALIZED */
CTEMaterializeNever = 'CTEMaterializeNever',
}
/** ----------------------
* Select Statement
*
* A "simple" SELECT is represented in the output of gram.y by a single
* SelectStmt node; so is a VALUES construct. A query containing set
* operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt
* nodes, in which the leaf nodes are component SELECTs and the internal nodes
* represent UNION, INTERSECT, or EXCEPT operators. Using the same node
* type for both leaf and internal nodes allows gram.y to stick ORDER BY,
* LIMIT, etc, clause values into a SELECT statement without worrying
* whether it is a simple or compound SELECT.
* ----------------------
*/
export enum SetOperation {
SETOP_NONE = 'SETOP_NONE',
SETOP_UNION = 'SETOP_UNION',
SETOP_INTERSECT = 'SETOP_INTERSECT',
SETOP_EXCEPT = 'SETOP_EXCEPT',
}
/**
* When a command can act on several kinds of objects with only one
* parse structure required, use these constants to designate the
* object type. Note that commands typically don't support all the types.
*/
export enum ObjectType {
OBJECT_ACCESS_METHOD = 'OBJECT_ACCESS_METHOD',
OBJECT_AGGREGATE = 'OBJECT_AGGREGATE',
OBJECT_AMOP = 'OBJECT_AMOP',
OBJECT_AMPROC = 'OBJECT_AMPROC',
/** type's attribute, when distinct from column */
OBJECT_ATTRIBUTE = 'OBJECT_ATTRIBUTE',
OBJECT_CAST = 'OBJECT_CAST',
OBJECT_COLUMN = 'OBJECT_COLUMN',
OBJECT_COLLATION = 'OBJECT_COLLATION',
OBJECT_CONVERSION = 'OBJECT_CONVERSION',
OBJECT_DATABASE = 'OBJECT_DATABASE',
OBJECT_DEFAULT = 'OBJECT_DEFAULT',
OBJECT_DEFACL = 'OBJECT_DEFACL',
OBJECT_DOMAIN = 'OBJECT_DOMAIN',
OBJECT_DOMCONSTRAINT = 'OBJECT_DOMCONSTRAINT',
OBJECT_EVENT_TRIGGER = 'OBJECT_EVENT_TRIGGER',
OBJECT_EXTENSION = 'OBJECT_EXTENSION',
OBJECT_FDW = 'OBJECT_FDW',
OBJECT_FOREIGN_SERVER = 'OBJECT_FOREIGN_SERVER',
OBJECT_FOREIGN_TABLE = 'OBJECT_FOREIGN_TABLE',
OBJECT_FUNCTION = 'OBJECT_FUNCTION',
OBJECT_INDEX = 'OBJECT_INDEX',
OBJECT_LANGUAGE = 'OBJECT_LANGUAGE',
OBJECT_LARGEOBJECT = 'OBJECT_LARGEOBJECT',
OBJECT_MATVIEW = 'OBJECT_MATVIEW',
OBJECT_OPCLASS = 'OBJECT_OPCLASS',
OBJECT_OPERATOR = 'OBJECT_OPERATOR',
OBJECT_OPFAMILY = 'OBJECT_OPFAMILY',
OBJECT_PARAMETER_ACL = 'OBJECT_PARAMETER_ACL',
OBJECT_POLICY = 'OBJECT_POLICY',
OBJECT_PROCEDURE = 'OBJECT_PROCEDURE',
OBJECT_PUBLICATION = 'OBJECT_PUBLICATION',
OBJECT_PUBLICATION_NAMESPACE = 'OBJECT_PUBLICATION_NAMESPACE',
OBJECT_PUBLICATION_REL = 'OBJECT_PUBLICATION_REL',
OBJECT_ROLE = 'OBJECT_ROLE',
OBJECT_ROUTINE = 'OBJECT_ROUTINE',
OBJECT_RULE = 'OBJECT_RULE',
OBJECT_SCHEMA = 'OBJECT_SCHEMA',
OBJECT_SEQUENCE = 'OBJECT_SEQUENCE',
OBJECT_SUBSCRIPTION = 'OBJECT_SUBSCRIPTION',
OBJECT_STATISTIC_EXT = 'OBJECT_STATISTIC_EXT',
OBJECT_TABCONSTRAINT = 'OBJECT_TABCONSTRAINT',
OBJECT_TABLE = 'OBJECT_TABLE',
OBJECT_TABLESPACE = 'OBJECT_TABLESPACE',
OBJECT_TRANSFORM = 'OBJECT_TRANSFORM',
OBJECT_TRIGGER = 'OBJECT_TRIGGER',
OBJECT_TSCONFIGURATION = 'OBJECT_TSCONFIGURATION',
OBJECT_TSDICTIONARY = 'OBJECT_TSDICTIONARY',
OBJECT_TSPARSER = 'OBJECT_TSPARSER',
OBJECT_TSTEMPLATE = 'OBJECT_TSTEMPLATE',
OBJECT_TYPE = 'OBJECT_TYPE',
OBJECT_USER_MAPPING = 'OBJECT_USER_MAPPING',
OBJECT_VIEW = 'OBJECT_VIEW',
}
export enum DropBehavior {
/** drop fails if any dependent objects */
DROP_RESTRICT = 'DROP_RESTRICT',
/** remove dependent objects too */
DROP_CASCADE = 'DROP_CASCADE',
}
export enum AlterTableType {
/** add column */
AT_AddColumn = 'AT_AddColumn',
/** implicitly via CREATE OR REPLACE VIEW */
AT_AddColumnToView = 'AT_AddColumnToView',
/** alter column default */
AT_ColumnDefault = 'AT_ColumnDefault',
/** add a pre-cooked column default */
AT_CookedColumnDefault = 'AT_CookedColumnDefault',
/** alter column drop not null */
AT_DropNotNull = 'AT_DropNotNull',
/** alter column set not null */
AT_SetNotNull = 'AT_SetNotNull',
/** alter column drop expression */
AT_DropExpression = 'AT_DropExpression',
/** check column is already marked not null */
AT_CheckNotNull = 'AT_CheckNotNull',
/** alter column set statistics */
AT_SetStatistics = 'AT_SetStatistics',
/** alter column set ( options ) */
AT_SetOptions = 'AT_SetOptions',
/** alter column reset ( options ) */
AT_ResetOptions = 'AT_ResetOptions',
/** alter column set storage */
AT_SetStorage = 'AT_SetStorage',
/** alter column set compression */
AT_SetCompression = 'AT_SetCompression',
/** drop column */
AT_DropColumn = 'AT_DropColumn',
/** add index */
AT_AddIndex = 'AT_AddIndex',
/** internal to commands/tablecmds.c */
AT_ReAddIndex = 'AT_ReAddIndex',
/** add constraint */
AT_AddConstraint = 'AT_AddConstraint',
/** internal to commands/tablecmds.c */
AT_ReAddConstraint = 'AT_ReAddConstraint',
/** internal to commands/tablecmds.c */
AT_ReAddDomainConstraint = 'AT_ReAddDomainConstraint',
/** alter constraint */
AT_AlterConstraint = 'AT_AlterConstraint',
/** validate constraint */
AT_ValidateConstraint = 'AT_ValidateConstraint',
/** add constraint using existing index */
AT_AddIndexConstraint = 'AT_AddIndexConstraint',
/** drop constraint */
AT_DropConstraint = 'AT_DropConstraint',
/** internal to commands/tablecmds.c */
AT_ReAddComment = 'AT_ReAddComment',
/** alter column type */
AT_AlterColumnType = 'AT_AlterColumnType',
/** alter column OPTIONS (...) */
AT_AlterColumnGenericOptions = 'AT_AlterColumnGenericOptions',
/** change owner */
AT_ChangeOwner = 'AT_ChangeOwner',
/** CLUSTER ON */
AT_ClusterOn = 'AT_ClusterOn',
/** SET WITHOUT CLUSTER */
AT_DropCluster = 'AT_DropCluster',
/** SET LOGGED */
AT_SetLogged = 'AT_SetLogged',
/** SET UNLOGGED */
AT_SetUnLogged = 'AT_SetUnLogged',
/** SET WITHOUT OIDS */
AT_DropOids = 'AT_DropOids',
/** SET ACCESS METHOD */
AT_SetAccessMethod = 'AT_SetAccessMethod',
/** SET TABLESPACE */
AT_SetTableSpace = 'AT_SetTableSpace',
/** SET (...) -- AM specific parameters */
AT_SetRelOptions = 'AT_SetRelOptions',
/** RESET (...) -- AM specific parameters */
AT_ResetRelOptions = 'AT_ResetRelOptions',
/** replace reloption list in its entirety */
AT_ReplaceRelOptions = 'AT_ReplaceRelOptions',
/** ENABLE TRIGGER name */
AT_EnableTrig = 'AT_EnableTrig',
/** ENABLE ALWAYS TRIGGER name */
AT_EnableAlwaysTrig = 'AT_EnableAlwaysTrig',
/** ENABLE REPLICA TRIGGER name */
AT_EnableReplicaTrig = 'AT_EnableReplicaTrig',
/** DISABLE TRIGGER name */
AT_DisableTrig = 'AT_DisableTrig',
/** ENABLE TRIGGER ALL */
AT_EnableTrigAll = 'AT_EnableTrigAll',
/** DISABLE TRIGGER ALL */
AT_DisableTrigAll = 'AT_DisableTrigAll',
/** ENABLE TRIGGER USER */
AT_EnableTrigUser = 'AT_EnableTrigUser',
/** DISABLE TRIGGER USER */
AT_DisableTrigUser = 'AT_DisableTrigUser',
/** ENABLE RULE name */
AT_EnableRule = 'AT_EnableRule',
/** ENABLE ALWAYS RULE name */
AT_EnableAlwaysRule = 'AT_EnableAlwaysRule',
/** ENABLE REPLICA RULE name */
AT_EnableReplicaRule = 'AT_EnableReplicaRule',
/** DISABLE RULE name */
AT_DisableRule = 'AT_DisableRule',
/** INHERIT parent */
AT_AddInherit = 'AT_AddInherit',
/** NO INHERIT parent */
AT_DropInherit = 'AT_DropInherit',
/** OF <type_name> */
AT_AddOf = 'AT_AddOf',
/** NOT OF */
AT_DropOf = 'AT_DropOf',
/** REPLICA IDENTITY */
AT_ReplicaIdentity = 'AT_ReplicaIdentity',
/** ENABLE ROW SECURITY */
AT_EnableRowSecurity = 'AT_EnableRowSecurity',
/** DISABLE ROW SECURITY */
AT_DisableRowSecurity = 'AT_DisableRowSecurity',
/** FORCE ROW SECURITY */
AT_ForceRowSecurity = 'AT_ForceRowSecurity',
/** NO FORCE ROW SECURITY */
AT_NoForceRowSecurity = 'AT_NoForceRowSecurity',
/** OPTIONS (...) */
AT_GenericOptions = 'AT_GenericOptions',
/** ATTACH PARTITION */
AT_AttachPartition = 'AT_AttachPartition',
/** DETACH PARTITION */
AT_DetachPartition = 'AT_DetachPartition',
/** DETACH PARTITION FINALIZE */
AT_DetachPartitionFinalize = 'AT_DetachPartitionFinalize',
/** ADD IDENTITY */
AT_AddIdentity = 'AT_AddIdentity',
/** SET identity column options */
AT_SetIdentity = 'AT_SetIdentity',
/** DROP IDENTITY */
AT_DropIdentity = 'AT_DropIdentity',
/** internal to commands/tablecmds.c */
AT_ReAddStatistics = 'AT_ReAddStatistics',
}
/** ----------------------
* Grant|Revoke Statement
* ----------------------
*/
export enum GrantTargetType {
/** grant on specific named object(s) */
ACL_TARGET_OBJECT = 'ACL_TARGET_OBJECT',
/** grant on all objects in given schema(s) */
ACL_TARGET_ALL_IN_SCHEMA = 'ACL_TARGET_ALL_IN_SCHEMA',
/** ALTER DEFAULT PRIVILEGES */
ACL_TARGET_DEFAULTS = 'ACL_TARGET_DEFAULTS',
}
/** ----------------------
* SET Statement (includes RESET)
*
* "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we
* preserve the distinction in VariableSetKind for CreateCommandTag().
* ----------------------
*/
export enum VariableSetKind {
/** SET var = value */
VAR_SET_VALUE = 'VAR_SET_VALUE',
/** SET var TO DEFAULT */
VAR_SET_DEFAULT = 'VAR_SET_DEFAULT',
/** SET var FROM CURRENT */
VAR_SET_CURRENT = 'VAR_SET_CURRENT',
/** special case for SET TRANSACTION ... */
VAR_SET_MULTI = 'VAR_SET_MULTI',
/** RESET var */
VAR_RESET = 'VAR_RESET',
/** RESET ALL */
VAR_RESET_ALL = 'VAR_RESET_ALL',
}
/** ----------
* Definitions for constraints in CreateStmt
*
* Note that column defaults are treated as a type of constraint,
* even though that's a bit odd semantically.
*
* For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT)
* we may have the expression in either "raw" form (an untransformed
* parse tree) or "cooked" form (the nodeToString representation of
* an executable expression tree), depending on how this Constraint
* node was created (by parsing, or by inheritance from an existing
* relation). We should never have both in the same node!
*
* FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype
* and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are
* stored into pg_constraint.confmatchtype. Changing the code values may
* require an initdb!
*
* If skip_validation is true then we skip checking that the existing rows
* in the table satisfy the constraint, and just install the catalog entries
* for the constraint. A new FK constraint is marked as valid iff
* initially_valid is true. (Usually skip_validation and initially_valid
* are inverses, but we can set both true if the table is known empty.)
*
* Constraint attributes (DEFERRABLE etc) are initially represented as
* separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes
* a pass through the constraints list to insert the info into the appropriate
* Constraint node.
* ----------
*/
export enum ConstrType {
/** not standard SQL, but a lot of people
* expect it */
CONSTR_NULL = 'CONSTR_NULL',
CONSTR_NOTNULL = 'CONSTR_NOTNULL',
CONSTR_DEFAULT = 'CONSTR_DEFAULT',
CONSTR_IDENTITY = 'CONSTR_IDENTITY',
CONSTR_GENERATED = 'CONSTR_GENERATED',
CONSTR_CHECK = 'CONSTR_CHECK',
CONSTR_PRIMARY = 'CONSTR_PRIMARY',
CONSTR_UNIQUE = 'CONSTR_UNIQUE',
CONSTR_EXCLUSION = 'CONSTR_EXCLUSION',
CONSTR_FOREIGN = 'CONSTR_FOREIGN',
/** attributes for previous constraint node */
CONSTR_ATTR_DEFERRABLE = 'CONSTR_ATTR_DEFERRABLE',
CONSTR_ATTR_NOT_DEFERRABLE = 'CONSTR_ATTR_NOT_DEFERRABLE',
CONSTR_ATTR_DEFERRED = 'CONSTR_ATTR_DEFERRED',
CONSTR_ATTR_IMMEDIATE = 'CONSTR_ATTR_IMMEDIATE',
}
/** ----------------------
* Import Foreign Schema Statement
* ----------------------
*/
export enum ImportForeignSchemaType {
/** all relations wanted */
FDW_IMPORT_SCHEMA_ALL = 'FDW_IMPORT_SCHEMA_ALL',
/** include only listed tables in import */
FDW_IMPORT_SCHEMA_LIMIT_TO = 'FDW_IMPORT_SCHEMA_LIMIT_TO',
/** exclude listed tables from import */
FDW_IMPORT_SCHEMA_EXCEPT = 'FDW_IMPORT_SCHEMA_EXCEPT',
}
/** ----------------------
* Create/Alter/Drop Role Statements
*
* Note: these node types are also used for the backwards-compatible
* Create/Alter/Drop User/Group statements. In the ALTER and DROP cases
* there's really no need to distinguish what the original spelling was,
* but for CREATE we mark the type because the defaults vary.
* ----------------------
*/
export enum RoleStmtType {
ROLESTMT_ROLE = 'ROLESTMT_ROLE',
ROLESTMT_USER = 'ROLESTMT_USER',
ROLESTMT_GROUP = 'ROLESTMT_GROUP',
}
/** ----------------------
* Fetch Statement (also Move)
* ----------------------
*/
export enum FetchDirection {
/** for these, howMany is how many rows to fetch; FETCH_ALL means ALL */
FETCH_FORWARD = 'FETCH_FORWARD',
FETCH_BACKWARD = 'FETCH_BACKWARD',
/** for these, howMany indicates a position; only one row is fetched */
FETCH_ABSOLUTE = 'FETCH_ABSOLUTE',
FETCH_RELATIVE = 'FETCH_RELATIVE',
}
export enum FunctionParameterMode {
/** the assigned enum values appear in pg_proc, don't change 'em! */
/** input only */
FUNC_PARAM_IN = 'FUNC_PARAM_IN',
/** output only */
FUNC_PARAM_OUT = 'FUNC_PARAM_OUT',
/** both */
FUNC_PARAM_INOUT = 'FUNC_PARAM_INOUT',
/** variadic (always input) */
FUNC_PARAM_VARIADIC = 'FUNC_PARAM_VARIADIC',
/** table function output column */
FUNC_PARAM_TABLE = 'FUNC_PARAM_TABLE',
/** this is not used in pg_proc: */
/** default; effectively same as IN */
FUNC_PARAM_DEFAULT = 'FUNC_PARAM_DEFAULT',
}
/** ----------------------
* {Begin|Commit|Rollback} Transaction Statement
* ----------------------
*/
export enum TransactionStmtKind {
TRANS_STMT_BEGIN = 'TRANS_STMT_BEGIN',
/** semantically identical to BEGIN */
TRANS_STMT_START = 'TRANS_STMT_START',
TRANS_STMT_COMMIT = 'TRANS_STMT_COMMIT',
TRANS_STMT_ROLLBACK = 'TRANS_STMT_ROLLBACK',
TRANS_STMT_SAVEPOINT = 'TRANS_STMT_SAVEPOINT',
TRANS_STMT_RELEASE = 'TRANS_STMT_RELEASE',
TRANS_STMT_ROLLBACK_TO = 'TRANS_STMT_ROLLBACK_TO',
TRANS_STMT_PREPARE = 'TRANS_STMT_PREPARE',
TRANS_STMT_COMMIT_PREPARED = 'TRANS_STMT_COMMIT_PREPARED',
TRANS_STMT_ROLLBACK_PREPARED = 'TRANS_STMT_ROLLBACK_PREPARED',
}
/** ----------------------
* Create View Statement
* ----------------------
*/
export enum ViewCheckOption {
NO_CHECK_OPTION = 'NO_CHECK_OPTION',
LOCAL_CHECK_OPTION = 'LOCAL_CHECK_OPTION',
CASCADED_CHECK_OPTION = 'CASCADED_CHECK_OPTION',
}
/** ----------------------
* Discard Statement
* ----------------------
*/
export enum DiscardMode {
DISCARD_ALL = 'DISCARD_ALL',
DISCARD_PLANS = 'DISCARD_PLANS',
DISCARD_SEQUENCES = 'DISCARD_SEQUENCES',
DISCARD_TEMP = 'DISCARD_TEMP',
}
/** ----------------------
* REINDEX Statement
* ----------------------
*/
export enum ReindexObjectType {
/** index */
REINDEX_OBJECT_INDEX = 'REINDEX_OBJECT_INDEX',
/** table or materialized view */
REINDEX_OBJECT_TABLE = 'REINDEX_OBJECT_TABLE',
/** schema */
REINDEX_OBJECT_SCHEMA = 'REINDEX_OBJECT_SCHEMA',
/** system catalogs */
REINDEX_OBJECT_SYSTEM = 'REINDEX_OBJECT_SYSTEM',
/** database */
REINDEX_OBJECT_DATABASE = 'REINDEX_OBJECT_DATABASE',
}
/**
* TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default
*/
export enum AlterTSConfigType {
ALTER_TSCONFIG_ADD_MAPPING = 'ALTER_TSCONFIG_ADD_MAPPING',
ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN = 'ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN',
ALTER_TSCONFIG_REPLACE_DICT = 'ALTER_TSCONFIG_REPLACE_DICT',
ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN = 'ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN',
ALTER_TSCONFIG_DROP_MAPPING = 'ALTER_TSCONFIG_DROP_MAPPING',
}
/**
* Publication object type
*/
export enum PublicationObjSpecType {
/** A table */
PUBLICATIONOBJ_TABLE = 'PUBLICATIONOBJ_TABLE',
/** All tables in schema */
PUBLICATIONOBJ_TABLES_IN_SCHEMA = 'PUBLICATIONOBJ_TABLES_IN_SCHEMA',
/** All tables in first element of
* search_path */
PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA = 'PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA',
/** Continuation of previous type */
PUBLICATIONOBJ_CONTINUATION = 'PUBLICATIONOBJ_CONTINUATION',
}
export enum AlterPublicationAction {
/** add objects to publication */
AP_AddObjects = 'AP_AddObjects',
/** remove objects from publication */
AP_DropObjects = 'AP_DropObjects',
/** set list of objects */
AP_SetObjects = 'AP_SetObjects',
}
export enum AlterSubscriptionType {
ALTER_SUBSCRIPTION_OPTIONS = 'ALTER_SUBSCRIPTION_OPTIONS',
ALTER_SUBSCRIPTION_CONNECTION = 'ALTER_SUBSCRIPTION_CONNECTION',
ALTER_SUBSCRIPTION_SET_PUBLICATION = 'ALTER_SUBSCRIPTION_SET_PUBLICATION',
ALTER_SUBSCRIPTION_ADD_PUBLICATION = 'ALTER_SUBSCRIPTION_ADD_PUBLICATION',
ALTER_SUBSCRIPTION_DROP_PUBLICATION = 'ALTER_SUBSCRIPTION_DROP_PUBLICATION',
ALTER_SUBSCRIPTION_REFRESH = 'ALTER_SUBSCRIPTION_REFRESH',
ALTER_SUBSCRIPTION_ENABLED = 'ALTER_SUBSCRIPTION_ENABLED',
ALTER_SUBSCRIPTION_SKIP = 'ALTER_SUBSCRIPTION_SKIP',
}
export enum OnCommitAction {
/** No ON COMMIT clause (do nothing) */
ONCOMMIT_NOOP = 'ONCOMMIT_NOOP',
/** ON COMMIT PRESERVE ROWS (do nothing) */
ONCOMMIT_PRESERVE_ROWS = 'ONCOMMIT_PRESERVE_ROWS',
/** ON COMMIT DELETE ROWS */
ONCOMMIT_DELETE_ROWS = 'ONCOMMIT_DELETE_ROWS',
/** ON COMMIT DROP */
ONCOMMIT_DROP = 'ONCOMMIT_DROP',
}
/**
* Param
*
* paramkind specifies the kind of parameter. The possible values
* for this field are:
*
* PARAM_EXTERN: The parameter value is supplied from outside the plan.
* Such parameters are numbered from 1 to n.
*
* PARAM_EXEC: The parameter is an internal executor parameter, used
* for passing values into and out of sub-queries or from
* nestloop joins to their inner scans.
* For historical reasons, such parameters are numbered from 0.
* These numbers are independent of PARAM_EXTERN numbers.
*
* PARAM_SUBLINK: The parameter represents an output column of a SubLink
* node's sub-select. The column number is contained in the
* `paramid' field. (This type of Param is converted to
* PARAM_EXEC during planning.)
*
* PARAM_MULTIEXPR: Like PARAM_SUBLINK, the parameter represents an
* output column of a SubLink node's sub-select, but here, the
* SubLink is always a MULTIEXPR SubLink. The high-order 16 bits
* of the `paramid' field contain the SubLink's subLinkId, and
* the low-order 16 bits contain the column number. (This type
* of Param is also converted to PARAM_EXEC during planning.)
*/
export enum ParamKind {
PARAM_EXTERN = 'PARAM_EXTERN',
PARAM_EXEC = 'PARAM_EXEC',
PARAM_SUBLINK = 'PARAM_SUBLINK',
PARAM_MULTIEXPR = 'PARAM_MULTIEXPR',
}
/**
* CoercionContext - distinguishes the allowed set of type casts
*
* NB: ordering of the alternatives is significant; later (larger) values
* allow more casts than earlier ones.
*/
export enum CoercionContext {
/** coercion in context of expression */
COERCION_IMPLICIT = 'COERCION_IMPLICIT',
/** coercion in context of assignment */
COERCION_ASSIGNMENT = 'COERCION_ASSIGNMENT',
/** if no assignment cast, use CoerceViaIO */
COERCION_PLPGSQL = 'COERCION_PLPGSQL',
/** explicit cast operation */
COERCION_EXPLICIT = 'COERCION_EXPLICIT',
}
/**
* CoercionForm - how to display a FuncExpr or related node
*
* "Coercion" is a bit of a misnomer, since this value records other
* special syntaxes besides casts, but for now we'll keep this naming.
*
* NB: equal() ignores CoercionForm fields, therefore this *must* not carry
* any semantically significant information. We need that behavior so that
* the planner will consider equivalent implicit and explicit casts to be
* equivalent. In cases where those actually behave differently, the coercion
* function's arguments will be different.
*/
export enum CoercionForm {
/** display as a function call */
COERCE_EXPLICIT_CALL = 'COERCE_EXPLICIT_CALL',
/** display as an explicit cast */
COERCE_EXPLICIT_CAST = 'COERCE_EXPLICIT_CAST',
/** implicit cast, so hide it */
COERCE_IMPLICIT_CAST = 'COERCE_IMPLICIT_CAST',
/** display with SQL-mandated special syntax */
COERCE_SQL_SYNTAX = 'COERCE_SQL_SYNTAX',
}
/**
* BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
*