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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
|
/*--------------------------------------------------------------------------
*
* test_oat_hooks.c
* Code for testing mandatory access control (MAC) using object access hooks.
*
* Copyright (c) 2015-2022, PostgreSQL Global Development Group
*
* IDENTIFICATION
* src/test/modules/test_oat_hooks/test_oat_hooks.c
*
* -------------------------------------------------------------------------
*/
#include "postgres.h"
#include "access/parallel.h"
#include "catalog/dependency.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_proc.h"
#include "executor/executor.h"
#include "fmgr.h"
#include "miscadmin.h"
#include "tcop/utility.h"
PG_MODULE_MAGIC;
/*
* GUCs controlling which operations to deny
*/
static bool REGRESS_deny_set_variable = false;
static bool REGRESS_deny_alter_system = false;
static bool REGRESS_deny_object_access = false;
static bool REGRESS_deny_exec_perms = false;
static bool REGRESS_deny_utility_commands = false;
static bool REGRESS_audit = false;
/*
* GUCs for testing privileges on USERSET and SUSET variables,
* with and without privileges granted prior to module load.
*/
static bool REGRESS_userset_variable1 = false;
static bool REGRESS_userset_variable2 = false;
static bool REGRESS_suset_variable1 = false;
static bool REGRESS_suset_variable2 = false;
/* Saved hook values */
static object_access_hook_type next_object_access_hook = NULL;
static object_access_hook_type_str next_object_access_hook_str = NULL;
static ExecutorCheckPerms_hook_type next_exec_check_perms_hook = NULL;
static ProcessUtility_hook_type next_ProcessUtility_hook = NULL;
/* Test Object Access Type Hook hooks */
static void REGRESS_object_access_hook_str(ObjectAccessType access,
Oid classId, const char *objName,
int subId, void *arg);
static void REGRESS_object_access_hook(ObjectAccessType access, Oid classId,
Oid objectId, int subId, void *arg);
static bool REGRESS_exec_check_perms(List *rangeTabls, bool do_abort);
static void REGRESS_utility_command(PlannedStmt *pstmt,
const char *queryString, bool readOnlyTree,
ProcessUtilityContext context,
ParamListInfo params,
QueryEnvironment *queryEnv,
DestReceiver *dest, QueryCompletion *qc);
/* Helper functions */
static const char *nodetag_to_string(NodeTag tag);
static char *accesstype_to_string(ObjectAccessType access, int subId);
static char *accesstype_arg_to_string(ObjectAccessType access, void *arg);
void _PG_init(void);
/*
* Module load callback
*/
void
_PG_init(void)
{
/*
* test_oat_hooks.deny_set_variable = (on|off)
*/
DefineCustomBoolVariable("test_oat_hooks.deny_set_variable",
"Deny non-superuser set permissions",
NULL,
®RESS_deny_set_variable,
false,
PGC_SUSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
/*
* test_oat_hooks.deny_alter_system = (on|off)
*/
DefineCustomBoolVariable("test_oat_hooks.deny_alter_system",
"Deny non-superuser alter system set permissions",
NULL,
®RESS_deny_alter_system,
false,
PGC_SUSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
/*
* test_oat_hooks.deny_object_access = (on|off)
*/
DefineCustomBoolVariable("test_oat_hooks.deny_object_access",
"Deny non-superuser object access permissions",
NULL,
®RESS_deny_object_access,
false,
PGC_SUSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
/*
* test_oat_hooks.deny_exec_perms = (on|off)
*/
DefineCustomBoolVariable("test_oat_hooks.deny_exec_perms",
"Deny non-superuser exec permissions",
NULL,
®RESS_deny_exec_perms,
false,
PGC_SUSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
/*
* test_oat_hooks.deny_utility_commands = (on|off)
*/
DefineCustomBoolVariable("test_oat_hooks.deny_utility_commands",
"Deny non-superuser utility commands",
NULL,
®RESS_deny_utility_commands,
false,
PGC_SUSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
/*
* test_oat_hooks.audit = (on|off)
*/
DefineCustomBoolVariable("test_oat_hooks.audit",
"Turn on/off debug audit messages",
NULL,
®RESS_audit,
false,
PGC_SUSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
/*
* test_oat_hooks.user_var{1,2} = (on|off)
*/
DefineCustomBoolVariable("test_oat_hooks.user_var1",
"Dummy parameter settable by public",
NULL,
®RESS_userset_variable1,
false,
PGC_USERSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("test_oat_hooks.user_var2",
"Dummy parameter settable by public",
NULL,
®RESS_userset_variable2,
false,
PGC_USERSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
/*
* test_oat_hooks.super_var{1,2} = (on|off)
*/
DefineCustomBoolVariable("test_oat_hooks.super_var1",
"Dummy parameter settable by superuser",
NULL,
®RESS_suset_variable1,
false,
PGC_SUSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("test_oat_hooks.super_var2",
"Dummy parameter settable by superuser",
NULL,
®RESS_suset_variable2,
false,
PGC_SUSET,
GUC_NOT_IN_SAMPLE,
NULL,
NULL,
NULL);
MarkGUCPrefixReserved("test_oat_hooks");
/* Object access hook */
next_object_access_hook = object_access_hook;
object_access_hook = REGRESS_object_access_hook;
/* Object access hook str */
next_object_access_hook_str = object_access_hook_str;
object_access_hook_str = REGRESS_object_access_hook_str;
/* DML permission check */
next_exec_check_perms_hook = ExecutorCheckPerms_hook;
ExecutorCheckPerms_hook = REGRESS_exec_check_perms;
/* ProcessUtility hook */
next_ProcessUtility_hook = ProcessUtility_hook;
ProcessUtility_hook = REGRESS_utility_command;
}
static void
emit_audit_message(const char *type, const char *hook, char *action, char *objName)
{
/*
* Ensure that audit messages are not duplicated by only emitting them
* from a leader process, not a worker process. This makes the test
* results deterministic even if run with force_parallel_mode = regress.
*/
if (REGRESS_audit && !IsParallelWorker())
{
const char *who = superuser_arg(GetUserId()) ? "superuser" : "non-superuser";
if (objName)
ereport(NOTICE,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("in %s: %s %s %s [%s]", hook, who, type, action, objName)));
else
ereport(NOTICE,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("in %s: %s %s %s", hook, who, type, action)));
}
if (action)
pfree(action);
if (objName)
pfree(objName);
}
static void
audit_attempt(const char *hook, char *action, char *objName)
{
emit_audit_message("attempting", hook, action, objName);
}
static void
audit_success(const char *hook, char *action, char *objName)
{
emit_audit_message("finished", hook, action, objName);
}
static void
audit_failure(const char *hook, char *action, char *objName)
{
emit_audit_message("denied", hook, action, objName);
}
static void
REGRESS_object_access_hook_str(ObjectAccessType access, Oid classId, const char *objName, int subId, void *arg)
{
audit_attempt("object_access_hook_str",
accesstype_to_string(access, subId),
pstrdup(objName));
if (next_object_access_hook_str)
{
(*next_object_access_hook_str) (access, classId, objName, subId, arg);
}
switch (access)
{
case OAT_POST_ALTER:
if ((subId & ACL_SET) && (subId & ACL_ALTER_SYSTEM))
{
if (REGRESS_deny_set_variable && !superuser_arg(GetUserId()))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied: all privileges %s", objName)));
}
else if (subId & ACL_SET)
{
if (REGRESS_deny_set_variable && !superuser_arg(GetUserId()))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied: set %s", objName)));
}
else if (subId & ACL_ALTER_SYSTEM)
{
if (REGRESS_deny_alter_system && !superuser_arg(GetUserId()))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied: alter system set %s", objName)));
}
else
elog(ERROR, "Unknown ParameterAclRelationId subId: %d", subId);
break;
default:
break;
}
audit_success("object_access_hook_str",
accesstype_to_string(access, subId),
pstrdup(objName));
}
static void
REGRESS_object_access_hook(ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg)
{
audit_attempt("object access",
accesstype_to_string(access, 0),
accesstype_arg_to_string(access, arg));
if (REGRESS_deny_object_access && !superuser_arg(GetUserId()))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied: %s [%s]",
accesstype_to_string(access, 0),
accesstype_arg_to_string(access, arg))));
/* Forward to next hook in the chain */
if (next_object_access_hook)
(*next_object_access_hook) (access, classId, objectId, subId, arg);
audit_success("object access",
accesstype_to_string(access, 0),
accesstype_arg_to_string(access, arg));
}
static bool
REGRESS_exec_check_perms(List *rangeTabls, bool do_abort)
{
bool am_super = superuser_arg(GetUserId());
bool allow = true;
audit_attempt("executor check perms", pstrdup("execute"), NULL);
/* Perform our check */
allow = !REGRESS_deny_exec_perms || am_super;
if (do_abort && !allow)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied: %s", "execute")));
/* Forward to next hook in the chain */
if (next_exec_check_perms_hook &&
!(*next_exec_check_perms_hook) (rangeTabls, do_abort))
allow = false;
if (allow)
audit_success("executor check perms",
pstrdup("execute"),
NULL);
else
audit_failure("executor check perms",
pstrdup("execute"),
NULL);
return allow;
}
static void
REGRESS_utility_command(PlannedStmt *pstmt,
const char *queryString,
bool readOnlyTree,
ProcessUtilityContext context,
ParamListInfo params,
QueryEnvironment *queryEnv,
DestReceiver *dest,
QueryCompletion *qc)
{
Node *parsetree = pstmt->utilityStmt;
const char *action;
NodeTag tag = nodeTag(parsetree);
switch (tag)
{
case T_VariableSetStmt:
action = "set";
break;
case T_AlterSystemStmt:
action = "alter system";
break;
case T_LoadStmt:
action = "load";
break;
default:
action = nodetag_to_string(tag);
break;
}
audit_attempt("process utility",
pstrdup(action),
NULL);
/* Check permissions */
if (REGRESS_deny_utility_commands && !superuser_arg(GetUserId()))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied: %s", action)));
/* Forward to next hook in the chain */
if (next_ProcessUtility_hook)
(*next_ProcessUtility_hook) (pstmt, queryString, readOnlyTree,
context, params, queryEnv,
dest, qc);
else
standard_ProcessUtility(pstmt, queryString, readOnlyTree,
context, params, queryEnv,
dest, qc);
/* We're done */
audit_success("process utility",
pstrdup(action),
NULL);
}
static const char *
nodetag_to_string(NodeTag tag)
{
switch (tag)
{
case T_Invalid:
return "Invalid";
break;
case T_IndexInfo:
return "IndexInfo";
break;
case T_ExprContext:
return "ExprContext";
break;
case T_ProjectionInfo:
return "ProjectionInfo";
break;
case T_JunkFilter:
return "JunkFilter";
break;
case T_OnConflictSetState:
return "OnConflictSetState";
break;
case T_ResultRelInfo:
return "ResultRelInfo";
break;
case T_EState:
return "EState";
break;
case T_TupleTableSlot:
return "TupleTableSlot";
break;
case T_Plan:
return "Plan";
break;
case T_Result:
return "Result";
break;
case T_ProjectSet:
return "ProjectSet";
break;
case T_ModifyTable:
return "ModifyTable";
break;
case T_Append:
return "Append";
break;
case T_MergeAppend:
return "MergeAppend";
break;
case T_RecursiveUnion:
return "RecursiveUnion";
break;
case T_BitmapAnd:
return "BitmapAnd";
break;
case T_BitmapOr:
return "BitmapOr";
break;
case T_Scan:
return "Scan";
break;
case T_SeqScan:
return "SeqScan";
break;
case T_SampleScan:
return "SampleScan";
break;
case T_IndexScan:
return "IndexScan";
break;
case T_IndexOnlyScan:
return "IndexOnlyScan";
break;
case T_BitmapIndexScan:
return "BitmapIndexScan";
break;
case T_BitmapHeapScan:
return "BitmapHeapScan";
break;
case T_TidScan:
return "TidScan";
break;
case T_TidRangeScan:
return "TidRangeScan";
break;
case T_SubqueryScan:
return "SubqueryScan";
break;
case T_FunctionScan:
return "FunctionScan";
break;
case T_ValuesScan:
return "ValuesScan";
break;
case T_TableFuncScan:
return "TableFuncScan";
break;
case T_CteScan:
return "CteScan";
break;
case T_NamedTuplestoreScan:
return "NamedTuplestoreScan";
break;
case T_WorkTableScan:
return "WorkTableScan";
break;
case T_ForeignScan:
return "ForeignScan";
break;
case T_CustomScan:
return "CustomScan";
break;
case T_Join:
return "Join";
break;
case T_NestLoop:
return "NestLoop";
break;
case T_MergeJoin:
return "MergeJoin";
break;
case T_HashJoin:
return "HashJoin";
break;
case T_Material:
return "Material";
break;
case T_Memoize:
return "Memoize";
break;
case T_Sort:
return "Sort";
break;
case T_IncrementalSort:
return "IncrementalSort";
break;
case T_Group:
return "Group";
break;
case T_Agg:
return "Agg";
break;
case T_WindowAgg:
return "WindowAgg";
break;
case T_Unique:
return "Unique";
break;
case T_Gather:
return "Gather";
break;
case T_GatherMerge:
return "GatherMerge";
break;
case T_Hash:
return "Hash";
break;
case T_SetOp:
return "SetOp";
break;
case T_LockRows:
return "LockRows";
break;
case T_Limit:
return "Limit";
break;
case T_NestLoopParam:
return "NestLoopParam";
break;
case T_PlanRowMark:
return "PlanRowMark";
break;
case T_PartitionPruneInfo:
return "PartitionPruneInfo";
break;
case T_PartitionedRelPruneInfo:
return "PartitionedRelPruneInfo";
break;
case T_PartitionPruneStepOp:
return "PartitionPruneStepOp";
break;
case T_PartitionPruneStepCombine:
return "PartitionPruneStepCombine";
break;
case T_PlanInvalItem:
return "PlanInvalItem";
break;
case T_PlanState:
return "PlanState";
break;
case T_ResultState:
return "ResultState";
break;
case T_ProjectSetState:
return "ProjectSetState";
break;
case T_ModifyTableState:
return "ModifyTableState";
break;
case T_AppendState:
return "AppendState";
break;
case T_MergeAppendState:
return "MergeAppendState";
break;
case T_RecursiveUnionState:
return "RecursiveUnionState";
break;
case T_BitmapAndState:
return "BitmapAndState";
break;
case T_BitmapOrState:
return "BitmapOrState";
break;
case T_ScanState:
return "ScanState";
break;
case T_SeqScanState:
return "SeqScanState";
break;
case T_SampleScanState:
return "SampleScanState";
break;
case T_IndexScanState:
return "IndexScanState";
break;
case T_IndexOnlyScanState:
return "IndexOnlyScanState";
break;
case T_BitmapIndexScanState:
return "BitmapIndexScanState";
break;
case T_BitmapHeapScanState:
return "BitmapHeapScanState";
break;
case T_TidScanState:
return "TidScanState";
break;
case T_TidRangeScanState:
return "TidRangeScanState";
break;
case T_SubqueryScanState:
return "SubqueryScanState";
break;
case T_FunctionScanState:
return "FunctionScanState";
break;
case T_TableFuncScanState:
return "TableFuncScanState";
break;
case T_ValuesScanState:
return "ValuesScanState";
break;
case T_CteScanState:
return "CteScanState";
break;
case T_NamedTuplestoreScanState:
return "NamedTuplestoreScanState";
break;
case T_WorkTableScanState:
return "WorkTableScanState";
break;
case T_ForeignScanState:
return "ForeignScanState";
break;
case T_CustomScanState:
return "CustomScanState";
break;
case T_JoinState:
return "JoinState";
break;
case T_NestLoopState:
return "NestLoopState";
break;
case T_MergeJoinState:
return "MergeJoinState";
break;
case T_HashJoinState:
return "HashJoinState";
break;
case T_MaterialState:
return "MaterialState";
break;
case T_MemoizeState:
return "MemoizeState";
break;
case T_SortState:
return "SortState";
break;
case T_IncrementalSortState:
return "IncrementalSortState";
break;
case T_GroupState:
return "GroupState";
break;
case T_AggState:
return "AggState";
break;
case T_WindowAggState:
return "WindowAggState";
break;
case T_UniqueState:
return "UniqueState";
break;
case T_GatherState:
return "GatherState";
break;
case T_GatherMergeState:
return "GatherMergeState";
break;
case T_HashState:
return "HashState";
break;
case T_SetOpState:
return "SetOpState";
break;
case T_LockRowsState:
return "LockRowsState";
break;
case T_LimitState:
return "LimitState";
break;
case T_Alias:
return "Alias";
break;
case T_RangeVar:
return "RangeVar";
break;
case T_TableFunc:
return "TableFunc";
break;
case T_Var:
return "Var";
break;
case T_Const:
return "Const";
break;
case T_Param:
return "Param";
break;
case T_Aggref:
return "Aggref";
break;
case T_GroupingFunc:
return "GroupingFunc";
break;
case T_WindowFunc:
return "WindowFunc";
break;
case T_SubscriptingRef:
return "SubscriptingRef";
break;
case T_FuncExpr:
return "FuncExpr";
break;
case T_NamedArgExpr:
return "NamedArgExpr";
break;
case T_OpExpr:
return "OpExpr";
break;
case T_DistinctExpr:
return "DistinctExpr";
break;
case T_NullIfExpr:
return "NullIfExpr";
break;
case T_ScalarArrayOpExpr:
return "ScalarArrayOpExpr";
break;
case T_BoolExpr:
return "BoolExpr";
break;
case T_SubLink:
return "SubLink";
break;
case T_SubPlan:
return "SubPlan";
break;
case T_AlternativeSubPlan:
return "AlternativeSubPlan";
break;
case T_FieldSelect:
return "FieldSelect";
break;
case T_FieldStore:
return "FieldStore";
break;
case T_RelabelType:
return "RelabelType";
break;
case T_CoerceViaIO:
return "CoerceViaIO";
break;
case T_ArrayCoerceExpr:
return "ArrayCoerceExpr";
break;
case T_ConvertRowtypeExpr:
return "ConvertRowtypeExpr";
break;
case T_CollateExpr:
return "CollateExpr";
break;
case T_CaseExpr:
return "CaseExpr";
break;
case T_CaseWhen:
return "CaseWhen";
break;
case T_CaseTestExpr:
return "CaseTestExpr";
break;
case T_ArrayExpr:
return "ArrayExpr";
break;
case T_RowExpr:
return "RowExpr";
break;
case T_RowCompareExpr:
return "RowCompareExpr";
break;
case T_CoalesceExpr:
return "CoalesceExpr";
break;
case T_MinMaxExpr:
return "MinMaxExpr";
break;
case T_SQLValueFunction:
return "SQLValueFunction";
break;
case T_XmlExpr:
return "XmlExpr";
break;
case T_NullTest:
return "NullTest";
break;
case T_BooleanTest:
return "BooleanTest";
break;
case T_CoerceToDomain:
return "CoerceToDomain";
break;
case T_CoerceToDomainValue:
return "CoerceToDomainValue";
break;
case T_SetToDefault:
return "SetToDefault";
break;
case T_CurrentOfExpr:
return "CurrentOfExpr";
break;
case T_NextValueExpr:
return "NextValueExpr";
break;
case T_InferenceElem:
return "InferenceElem";
break;
case T_TargetEntry:
return "TargetEntry";
break;
case T_RangeTblRef:
return "RangeTblRef";
break;
case T_JoinExpr:
return "JoinExpr";
break;
case T_FromExpr:
return "FromExpr";
break;
case T_OnConflictExpr:
return "OnConflictExpr";
break;
case T_IntoClause:
return "IntoClause";
break;
case T_ExprState:
return "ExprState";
break;
case T_WindowFuncExprState:
return "WindowFuncExprState";
break;
case T_SetExprState:
return "SetExprState";
break;
case T_SubPlanState:
return "SubPlanState";
break;
case T_DomainConstraintState:
return "DomainConstraintState";
break;
case T_PlannerInfo:
return "PlannerInfo";
break;
case T_PlannerGlobal:
return "PlannerGlobal";
break;
case T_RelOptInfo:
return "RelOptInfo";
break;
case T_IndexOptInfo:
return "IndexOptInfo";
break;
case T_ForeignKeyOptInfo:
return "ForeignKeyOptInfo";
break;
case T_ParamPathInfo:
return "ParamPathInfo";
break;
case T_Path:
return "Path";
break;
case T_IndexPath:
return "IndexPath";
break;
case T_BitmapHeapPath:
return "BitmapHeapPath";
break;
case T_BitmapAndPath:
return "BitmapAndPath";
break;
case T_BitmapOrPath:
return "BitmapOrPath";
break;
case T_TidPath:
return "TidPath";
break;
case T_TidRangePath:
return "TidRangePath";
break;
case T_SubqueryScanPath:
return "SubqueryScanPath";
break;
case T_ForeignPath:
return "ForeignPath";
break;
case T_CustomPath:
return "CustomPath";
break;
case T_NestPath:
return "NestPath";
break;
case T_MergePath:
return "MergePath";
break;
case T_HashPath:
return "HashPath";
break;
case T_AppendPath:
return "AppendPath";
break;
case T_MergeAppendPath:
return "MergeAppendPath";
break;
case T_GroupResultPath:
return "GroupResultPath";
break;
case T_MaterialPath:
return "MaterialPath";
break;
case T_MemoizePath:
return "MemoizePath";
break;
case T_UniquePath:
return "UniquePath";
break;
case T_GatherPath:
return "GatherPath";
break;
case T_GatherMergePath:
return "GatherMergePath";
break;
case T_ProjectionPath:
return "ProjectionPath";
break;
case T_ProjectSetPath:
return "ProjectSetPath";
break;
case T_SortPath:
return "SortPath";
break;
case T_IncrementalSortPath:
return "IncrementalSortPath";
break;
case T_GroupPath:
return "GroupPath";
break;
case T_UpperUniquePath:
return "UpperUniquePath";
break;
case T_AggPath:
return "AggPath";
break;
case T_GroupingSetsPath:
return "GroupingSetsPath";
break;
case T_MinMaxAggPath:
return "MinMaxAggPath";
break;
case T_WindowAggPath:
return "WindowAggPath";
break;
case T_SetOpPath:
return "SetOpPath";
break;
case T_RecursiveUnionPath:
return "RecursiveUnionPath";
break;
case T_LockRowsPath:
return "LockRowsPath";
break;
case T_ModifyTablePath:
return "ModifyTablePath";
break;
case T_LimitPath:
return "LimitPath";
break;
case T_EquivalenceClass:
return "EquivalenceClass";
break;
case T_EquivalenceMember:
return "EquivalenceMember";
break;
case T_PathKey:
return "PathKey";
break;
case T_PathTarget:
return "PathTarget";
break;
case T_RestrictInfo:
return "RestrictInfo";
break;
case T_IndexClause:
return "IndexClause";
break;
case T_PlaceHolderVar:
return "PlaceHolderVar";
break;
case T_SpecialJoinInfo:
return "SpecialJoinInfo";
break;
case T_AppendRelInfo:
return "AppendRelInfo";
break;
case T_RowIdentityVarInfo:
return "RowIdentityVarInfo";
break;
case T_PlaceHolderInfo:
return "PlaceHolderInfo";
break;
case T_MinMaxAggInfo:
return "MinMaxAggInfo";
break;
case T_PlannerParamItem:
return "PlannerParamItem";
break;
case T_RollupData:
return "RollupData";
break;
case T_GroupingSetData:
return "GroupingSetData";
break;
case T_StatisticExtInfo:
return "StatisticExtInfo";
break;
case T_AllocSetContext:
return "AllocSetContext";
break;
case T_SlabContext:
return "SlabContext";
break;
case T_GenerationContext:
return "GenerationContext";
break;
case T_Integer:
return "Integer";
break;
case T_Float:
return "Float";
break;
case T_Boolean:
return "Boolean";
break;
case T_String:
return "String";
break;
case T_BitString:
return "BitString";
break;
case T_List:
return "List";
break;
case T_IntList:
return "IntList";
break;
case T_OidList:
return "OidList";
break;
case T_ExtensibleNode:
return "ExtensibleNode";
break;
case T_RawStmt:
return "RawStmt";
break;
case T_Query:
return "Query";
break;
case T_PlannedStmt:
return "PlannedStmt";
break;
case T_InsertStmt:
return "InsertStmt";
break;
case T_DeleteStmt:
return "DeleteStmt";
break;
case T_UpdateStmt:
return "UpdateStmt";
break;
case T_SelectStmt:
return "SelectStmt";
break;
case T_ReturnStmt:
return "ReturnStmt";
break;
case T_PLAssignStmt:
return "PLAssignStmt";
break;
case T_AlterTableStmt:
return "AlterTableStmt";
break;
case T_AlterTableCmd:
return "AlterTableCmd";
break;
case T_AlterDomainStmt:
return "AlterDomainStmt";
break;
case T_SetOperationStmt:
return "SetOperationStmt";
break;
case T_GrantStmt:
return "GrantStmt";
break;
case T_GrantRoleStmt:
return "GrantRoleStmt";
break;
case T_AlterDefaultPrivilegesStmt:
return "AlterDefaultPrivilegesStmt";
break;
case T_ClosePortalStmt:
return "ClosePortalStmt";
break;
case T_ClusterStmt:
return "ClusterStmt";
break;
case T_CopyStmt:
return "CopyStmt";
break;
case T_CreateStmt:
return "CreateStmt";
break;
case T_DefineStmt:
return "DefineStmt";
break;
case T_DropStmt:
return "DropStmt";
break;
case T_TruncateStmt:
return "TruncateStmt";
break;
case T_CommentStmt:
return "CommentStmt";
break;
case T_FetchStmt:
return "FetchStmt";
break;
case T_IndexStmt:
return "IndexStmt";
break;
case T_CreateFunctionStmt:
return "CreateFunctionStmt";
break;
case T_AlterFunctionStmt:
return "AlterFunctionStmt";
break;
case T_DoStmt:
return "DoStmt";
break;
case T_RenameStmt:
return "RenameStmt";
break;
case T_RuleStmt:
return "RuleStmt";
break;
case T_NotifyStmt:
return "NotifyStmt";
break;
case T_ListenStmt:
return "ListenStmt";
break;
case T_UnlistenStmt:
return "UnlistenStmt";
break;
case T_TransactionStmt:
return "TransactionStmt";
break;
case T_ViewStmt:
return "ViewStmt";
break;
case T_LoadStmt:
return "LoadStmt";
break;
case T_CreateDomainStmt:
return "CreateDomainStmt";
break;
case T_CreatedbStmt:
return "CreatedbStmt";
break;
case T_DropdbStmt:
return "DropdbStmt";
break;
case T_VacuumStmt:
return "VacuumStmt";
break;
case T_ExplainStmt:
return "ExplainStmt";
break;
case T_CreateTableAsStmt:
return "CreateTableAsStmt";
break;
case T_CreateSeqStmt:
return "CreateSeqStmt";
break;
case T_AlterSeqStmt:
return "AlterSeqStmt";
break;
case T_VariableSetStmt:
return "VariableSetStmt";
break;
case T_VariableShowStmt:
return "VariableShowStmt";
break;
case T_DiscardStmt:
return "DiscardStmt";
break;
case T_CreateTrigStmt:
return "CreateTrigStmt";
break;
case T_CreatePLangStmt:
return "CreatePLangStmt";
break;
case T_CreateRoleStmt:
return "CreateRoleStmt";
break;
case T_AlterRoleStmt:
return "AlterRoleStmt";
break;
case T_DropRoleStmt:
return "DropRoleStmt";
break;
case T_LockStmt:
return "LockStmt";
break;
case T_ConstraintsSetStmt:
return "ConstraintsSetStmt";
break;
case T_ReindexStmt:
return "ReindexStmt";
break;
case T_CheckPointStmt:
return "CheckPointStmt";
break;
case T_CreateSchemaStmt:
return "CreateSchemaStmt";
break;
case T_AlterDatabaseStmt:
return "AlterDatabaseStmt";
break;
case T_AlterDatabaseRefreshCollStmt:
return "AlterDatabaseRefreshCollStmt";
break;
case T_AlterDatabaseSetStmt:
return "AlterDatabaseSetStmt";
break;
case T_AlterRoleSetStmt:
return "AlterRoleSetStmt";
break;
case T_CreateConversionStmt:
return "CreateConversionStmt";
break;
case T_CreateCastStmt:
return "CreateCastStmt";
break;
case T_CreateOpClassStmt:
return "CreateOpClassStmt";
break;
case T_CreateOpFamilyStmt:
return "CreateOpFamilyStmt";
break;
case T_AlterOpFamilyStmt:
return "AlterOpFamilyStmt";
break;
case T_PrepareStmt:
return "PrepareStmt";
break;
case T_ExecuteStmt:
return "ExecuteStmt";
break;
case T_DeallocateStmt:
return "DeallocateStmt";
break;
case T_DeclareCursorStmt:
return "DeclareCursorStmt";
break;
case T_CreateTableSpaceStmt:
return "CreateTableSpaceStmt";
break;
case T_DropTableSpaceStmt:
return "DropTableSpaceStmt";
break;
case T_AlterObjectDependsStmt:
return "AlterObjectDependsStmt";
break;
case T_AlterObjectSchemaStmt:
return "AlterObjectSchemaStmt";
break;
case T_AlterOwnerStmt:
return "AlterOwnerStmt";
break;
case T_AlterOperatorStmt:
return "AlterOperatorStmt";
break;
case T_AlterTypeStmt:
return "AlterTypeStmt";
break;
case T_DropOwnedStmt:
return "DropOwnedStmt";
break;
case T_ReassignOwnedStmt:
return "ReassignOwnedStmt";
break;
case T_CompositeTypeStmt:
return "CompositeTypeStmt";
break;
case T_CreateEnumStmt:
return "CreateEnumStmt";
break;
case T_CreateRangeStmt:
return "CreateRangeStmt";
break;
case T_AlterEnumStmt:
return "AlterEnumStmt";
break;
case T_AlterTSDictionaryStmt:
return "AlterTSDictionaryStmt";
break;
case T_AlterTSConfigurationStmt:
return "AlterTSConfigurationStmt";
break;
case T_CreateFdwStmt:
return "CreateFdwStmt";
break;
case T_AlterFdwStmt:
return "AlterFdwStmt";
break;
case T_CreateForeignServerStmt:
return "CreateForeignServerStmt";
break;
case T_AlterForeignServerStmt:
return "AlterForeignServerStmt";
break;
case T_CreateUserMappingStmt:
return "CreateUserMappingStmt";
break;
case T_AlterUserMappingStmt:
return "AlterUserMappingStmt";
break;
case T_DropUserMappingStmt:
return "DropUserMappingStmt";
break;
case T_AlterTableSpaceOptionsStmt:
return "AlterTableSpaceOptionsStmt";
break;
case T_AlterTableMoveAllStmt:
return "AlterTableMoveAllStmt";
break;
case T_SecLabelStmt:
return "SecLabelStmt";
break;
case T_CreateForeignTableStmt:
return "CreateForeignTableStmt";
break;
case T_ImportForeignSchemaStmt:
return "ImportForeignSchemaStmt";
break;
case T_CreateExtensionStmt:
return "CreateExtensionStmt";
break;
case T_AlterExtensionStmt:
return "AlterExtensionStmt";
break;
case T_AlterExtensionContentsStmt:
return "AlterExtensionContentsStmt";
break;
case T_CreateEventTrigStmt:
return "CreateEventTrigStmt";
break;
case T_AlterEventTrigStmt:
return "AlterEventTrigStmt";
break;
case T_RefreshMatViewStmt:
return "RefreshMatViewStmt";
break;
case T_ReplicaIdentityStmt:
return "ReplicaIdentityStmt";
break;
case T_AlterSystemStmt:
return "AlterSystemStmt";
break;
case T_CreatePolicyStmt:
return "CreatePolicyStmt";
break;
case T_AlterPolicyStmt:
return "AlterPolicyStmt";
break;
case T_CreateTransformStmt:
return "CreateTransformStmt";
break;
case T_CreateAmStmt:
return "CreateAmStmt";
break;
case T_CreatePublicationStmt:
return "CreatePublicationStmt";
break;
case T_AlterPublicationStmt:
return "AlterPublicationStmt";
break;
case T_CreateSubscriptionStmt:
return "CreateSubscriptionStmt";
break;
case T_AlterSubscriptionStmt:
return "AlterSubscriptionStmt";
break;
case T_DropSubscriptionStmt:
return "DropSubscriptionStmt";
break;
case T_CreateStatsStmt:
return "CreateStatsStmt";
break;
case T_AlterCollationStmt:
return "AlterCollationStmt";
break;
case T_CallStmt:
return "CallStmt";
break;
case T_AlterStatsStmt:
return "AlterStatsStmt";
break;
case T_A_Expr:
return "A_Expr";
break;
case T_ColumnRef:
return "ColumnRef";
break;
case T_ParamRef:
return "ParamRef";
break;
case T_A_Const:
return "A_Const";
break;
case T_FuncCall:
return "FuncCall";
break;
case T_A_Star:
return "A_Star";
break;
case T_A_Indices:
return "A_Indices";
break;
case T_A_Indirection:
return "A_Indirection";
break;
case T_A_ArrayExpr:
return "A_ArrayExpr";
break;
case T_ResTarget:
return "ResTarget";
break;
case T_MultiAssignRef:
return "MultiAssignRef";
break;
case T_TypeCast:
return "TypeCast";
break;
case T_CollateClause:
return "CollateClause";
break;
case T_SortBy:
return "SortBy";
break;
case T_WindowDef:
return "WindowDef";
break;
case T_RangeSubselect:
return "RangeSubselect";
break;
case T_RangeFunction:
return "RangeFunction";
break;
case T_RangeTableSample:
return "RangeTableSample";
break;
case T_RangeTableFunc:
return "RangeTableFunc";
break;
case T_RangeTableFuncCol:
return "RangeTableFuncCol";
break;
case T_TypeName:
return "TypeName";
break;
case T_ColumnDef:
return "ColumnDef";
break;
case T_IndexElem:
return "IndexElem";
break;
case T_StatsElem:
return "StatsElem";
break;
case T_Constraint:
return "Constraint";
break;
case T_DefElem:
return "DefElem";
break;
case T_RangeTblEntry:
return "RangeTblEntry";
break;
case T_RangeTblFunction:
return "RangeTblFunction";
break;
case T_TableSampleClause:
return "TableSampleClause";
break;
case T_WithCheckOption:
return "WithCheckOption";
break;
case T_SortGroupClause:
return "SortGroupClause";
break;
case T_GroupingSet:
return "GroupingSet";
break;
case T_WindowClause:
return "WindowClause";
break;
case T_ObjectWithArgs:
return "ObjectWithArgs";
break;
case T_AccessPriv:
return "AccessPriv";
break;
case T_CreateOpClassItem:
return "CreateOpClassItem";
break;
case T_TableLikeClause:
return "TableLikeClause";
break;
case T_FunctionParameter:
return "FunctionParameter";
break;
case T_LockingClause:
return "LockingClause";
break;
case T_RowMarkClause:
return "RowMarkClause";
break;
case T_XmlSerialize:
return "XmlSerialize";
break;
case T_WithClause:
return "WithClause";
break;
case T_InferClause:
return "InferClause";
break;
case T_OnConflictClause:
return "OnConflictClause";
break;
case T_CTESearchClause:
return "CTESearchClause";
break;
case T_CTECycleClause:
return "CTECycleClause";
break;
case T_CommonTableExpr:
return "CommonTableExpr";
break;
case T_RoleSpec:
return "RoleSpec";
break;
case T_TriggerTransition:
return "TriggerTransition";
break;
case T_PartitionElem:
return "PartitionElem";
break;
case T_PartitionSpec:
return "PartitionSpec";
break;
case T_PartitionBoundSpec:
return "PartitionBoundSpec";
break;
case T_PartitionRangeDatum:
return "PartitionRangeDatum";
break;
case T_PartitionCmd:
return "PartitionCmd";
break;
case T_VacuumRelation:
return "VacuumRelation";
break;
case T_PublicationObjSpec:
return "PublicationObjSpec";
break;
case T_PublicationTable:
return "PublicationTable";
break;
case T_IdentifySystemCmd:
return "IdentifySystemCmd";
break;
case T_BaseBackupCmd:
return "BaseBackupCmd";
break;
case T_CreateReplicationSlotCmd:
return "CreateReplicationSlotCmd";
break;
case T_DropReplicationSlotCmd:
return "DropReplicationSlotCmd";
break;
case T_ReadReplicationSlotCmd:
return "ReadReplicationSlotCmd";
break;
case T_StartReplicationCmd:
return "StartReplicationCmd";
break;
case T_TimeLineHistoryCmd:
return "TimeLineHistoryCmd";
break;
case T_TriggerData:
return "TriggerData";
break;
case T_EventTriggerData:
return "EventTriggerData";
break;
case T_ReturnSetInfo:
return "ReturnSetInfo";
break;
case T_WindowObjectData:
return "WindowObjectData";
break;
case T_TIDBitmap:
return "TIDBitmap";
break;
case T_InlineCodeBlock:
return "InlineCodeBlock";
break;
case T_FdwRoutine:
return "FdwRoutine";
break;
case T_IndexAmRoutine:
return "IndexAmRoutine";
break;
case T_TableAmRoutine:
return "TableAmRoutine";
break;
case T_TsmRoutine:
return "TsmRoutine";
break;
case T_ForeignKeyCacheInfo:
return "ForeignKeyCacheInfo";
break;
case T_CallContext:
return "CallContext";
break;
case T_SupportRequestSimplify:
return "SupportRequestSimplify";
break;
case T_SupportRequestSelectivity:
return "SupportRequestSelectivity";
break;
case T_SupportRequestCost:
return "SupportRequestCost";
break;
case T_SupportRequestRows:
return "SupportRequestRows";
break;
case T_SupportRequestIndexCondition:
return "SupportRequestIndexCondition";
break;
default:
break;
}
return "UNRECOGNIZED NodeTag";
}
static char *
accesstype_to_string(ObjectAccessType access, int subId)
{
const char *type;
switch (access)
{
case OAT_POST_CREATE:
type = "create";
break;
case OAT_DROP:
type = "drop";
break;
case OAT_POST_ALTER:
type = "alter";
break;
case OAT_NAMESPACE_SEARCH:
type = "namespace search";
break;
case OAT_FUNCTION_EXECUTE:
type = "execute";
break;
case OAT_TRUNCATE:
type = "truncate";
break;
default:
type = "UNRECOGNIZED ObjectAccessType";
}
if ((subId & ACL_SET) && (subId & ACL_ALTER_SYSTEM))
return psprintf("%s (subId=0x%x, all privileges)", type, subId);
if (subId & ACL_SET)
return psprintf("%s (subId=0x%x, set)", type, subId);
if (subId & ACL_ALTER_SYSTEM)
return psprintf("%s (subId=0x%x, alter system)", type, subId);
return psprintf("%s (subId=0x%x)", type, subId);
}
static char *
accesstype_arg_to_string(ObjectAccessType access, void *arg)
{
if (arg == NULL)
return pstrdup("extra info null");
switch (access)
{
case OAT_POST_CREATE:
{
ObjectAccessPostCreate *pc_arg = (ObjectAccessPostCreate *) arg;
return pstrdup(pc_arg->is_internal ? "internal" : "explicit");
}
break;
case OAT_DROP:
{
ObjectAccessDrop *drop_arg = (ObjectAccessDrop *) arg;
return psprintf("%s%s%s%s%s%s",
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
? "internal action," : ""),
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
? "concurrent drop," : ""),
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
? "suppress notices," : ""),
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
? "keep original object," : ""),
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
? "keep extensions," : ""),
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
? "normal concurrent drop," : ""));
}
break;
case OAT_POST_ALTER:
{
ObjectAccessPostAlter *pa_arg = (ObjectAccessPostAlter *) arg;
return psprintf("%s %s auxiliary object",
(pa_arg->is_internal ? "internal" : "explicit"),
(OidIsValid(pa_arg->auxiliary_id) ? "with" : "without"));
}
break;
case OAT_NAMESPACE_SEARCH:
{
ObjectAccessNamespaceSearch *ns_arg = (ObjectAccessNamespaceSearch *) arg;
return psprintf("%s, %s",
(ns_arg->ereport_on_violation ? "report on violation" : "no report on violation"),
(ns_arg->result ? "allowed" : "denied"));
}
break;
case OAT_TRUNCATE:
case OAT_FUNCTION_EXECUTE:
/* hook takes no arg. */
return pstrdup("unexpected extra info pointer received");
default:
return pstrdup("cannot parse extra info for unrecognized access type");
}
return pstrdup("unknown");
}
|