pgpool2.git / summary / log / commit / refs
commit df277163720a248f108192329de58077cd35ea4e
Author: Bo Peng <pengbo@sraoss.co.jp>
Date: Fri Oct 03 10:29:19 2025 +0000
Feature: Import PostgreSQL 18 new parser.
Major changes of PostgreSQL 18 parser include:
- Allow generated columns to be virtual
- Add OLD/NEW support to RETURNING in DML queries
- Addition of various constraints (e.g. WITHOUT OVERLAPS, ENFORCED / NOT ENFORCED)
- etc.
src/include/parser/gramparse.h | 4 +-
src/include/parser/keywords.h | 4 +-
src/include/parser/kwlist.h | 9 +-
src/include/parser/kwlist_d.h | 894 ++++++++++++-----------
src/include/parser/makefuncs.h | 5 +-
src/include/parser/miscnodes.h | 53 ++
src/include/parser/nodes.h | 21 +-
src/include/parser/nodetags.h | 801 ++++++++++----------
src/include/parser/parsenodes.h | 177 ++++-
src/include/parser/parser.h | 4 +-
src/include/parser/pg_class.h | 11 +-
src/include/parser/pg_config_manual.h | 72 +-
src/include/parser/pg_list.h | 74 +-
src/include/parser/pg_trigger.h | 6 +-
src/include/parser/pg_wchar.h | 13 +-
src/include/parser/pool_parser.h | 23 +-
src/include/parser/primnodes.h | 120 ++-
src/include/parser/scanner.h | 6 +-
src/include/parser/scansup.h | 4 +-
src/include/parser/stringinfo.h | 33 +-
src/include/parser/unicode_east_asian_fw_table.h | 126 ++++
src/include/parser/unicode_nonspacing_table.h | 338 +++++++++
src/include/parser/value.h | 4 +-
src/main/pgpool_logger.c | 2 +-
src/parser/copyfuncs.c | 180 +++--
src/parser/gram.y | 737 ++++++++++++-------
src/parser/gram_minimal.y | 723 +++++++++++-------
src/parser/gram_template.y | 725 +++++++++++-------
src/parser/keywords.c | 4 +-
src/parser/kwlookup.c | 4 +-
src/parser/list.c | 4 +-
src/parser/makefuncs.c | 93 ++-
src/parser/outfuncs.c | 144 +++-
src/parser/parser.c | 4 +-
src/parser/scan.l | 72 +-
src/parser/scansup.c | 4 +-
src/parser/snprintf.c | 95 ++-
src/parser/stringinfo.c | 79 +-
src/parser/value.c | 4 +-
src/parser/wchar.c | 554 +++-----------
src/rewrite/pool_timestamp.c | 12 +-
src/tools/pgindent/enums.list | 2 +-
src/tools/pgindent/typedefs.list | 2 +-
43 files changed, 3818 insertions(+), 2428 deletions(-)
diff --git a/src/include/parser/gramparse.h b/src/include/parser/gramparse.h
index 9571a5ee3..c375cb860 100644
--- a/src/include/parser/gramparse.h
+++ b/src/include/parser/gramparse.h
@@ -8,8 +8,8 @@
* Definitions that are needed outside the core parser should be in parser.h.
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/parser/gramparse.h
diff --git a/src/include/parser/keywords.h b/src/include/parser/keywords.h
index 9a989763f..a56380499 100644
--- a/src/include/parser/keywords.h
+++ b/src/include/parser/keywords.h
@@ -4,8 +4,8 @@
* PostgreSQL's list of SQL keywords
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/common/keywords.h
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h
index bbf22fb52..098738447 100644
--- a/src/include/parser/kwlist.h
+++ b/src/include/parser/kwlist.h
@@ -7,8 +7,8 @@
* by the PG_KEYWORD macro, which is not defined in this file; it can
* be defined by the caller for special purposes.
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
@@ -154,6 +154,7 @@ PG_KEYWORD("enable", ENABLE_P, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("encoding", ENCODING, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("encrypted", ENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("end", END_P, RESERVED_KEYWORD, BARE_LABEL)
+PG_KEYWORD("enforced", ENFORCED, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("enum", ENUM_P, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("error", ERROR_P, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("escape", ESCAPE, UNRESERVED_KEYWORD, BARE_LABEL)
@@ -308,6 +309,7 @@ PG_KEYWORD("nullif", NULLIF, COL_NAME_KEYWORD, BARE_LABEL)
PG_KEYWORD("nulls", NULLS_P, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("numeric", NUMERIC, COL_NAME_KEYWORD, BARE_LABEL)
PG_KEYWORD("object", OBJECT_P, UNRESERVED_KEYWORD, BARE_LABEL)
+PG_KEYWORD("objects", OBJECTS_P, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("of", OF, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("off", OFF, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("offset", OFFSET, RESERVED_KEYWORD, AS_LABEL)
@@ -339,6 +341,7 @@ PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("passing", PASSING, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("password", PASSWORD, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("path", PATH, UNRESERVED_KEYWORD, BARE_LABEL)
+PG_KEYWORD("period", PERIOD, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("pgpool", PGPOOL, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("placing", PLACING, RESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("plan", PLAN, UNRESERVED_KEYWORD, BARE_LABEL)
@@ -364,7 +367,6 @@ PG_KEYWORD("range", RANGE, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("read", READ, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("real", REAL, COL_NAME_KEYWORD, BARE_LABEL)
PG_KEYWORD("reassign", REASSIGN, UNRESERVED_KEYWORD, BARE_LABEL)
-PG_KEYWORD("recheck", RECHECK, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("recursive", RECURSIVE, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("ref", REF_P, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("references", REFERENCES, RESERVED_KEYWORD, BARE_LABEL)
@@ -492,6 +494,7 @@ PG_KEYWORD("verbose", VERBOSE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
PG_KEYWORD("version", VERSION_P, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("view", VIEW, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("views", VIEWS, UNRESERVED_KEYWORD, BARE_LABEL)
+PG_KEYWORD("virtual", VIRTUAL, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("volatile", VOLATILE, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("when", WHEN, RESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("where", WHERE, RESERVED_KEYWORD, AS_LABEL)
diff --git a/src/include/parser/kwlist_d.h b/src/include/parser/kwlist_d.h
index 7c917a89a..023a3432a 100644
--- a/src/include/parser/kwlist_d.h
+++ b/src/include/parser/kwlist_d.h
@@ -3,7 +3,7 @@
* kwlist_d.h
* List of keywords represented as a ScanKeywordList.
*
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* NOTES
@@ -150,6 +150,7 @@ static const char ScanKeywords_kw_string[] =
"encoding\0"
"encrypted\0"
"end\0"
+ "enforced\0"
"enum\0"
"error\0"
"escape\0"
@@ -304,6 +305,7 @@ static const char ScanKeywords_kw_string[] =
"nulls\0"
"numeric\0"
"object\0"
+ "objects\0"
"of\0"
"off\0"
"offset\0"
@@ -335,6 +337,7 @@ static const char ScanKeywords_kw_string[] =
"passing\0"
"password\0"
"path\0"
+ "period\0"
"pgpool\0"
"placing\0"
"plan\0"
@@ -360,7 +363,6 @@ static const char ScanKeywords_kw_string[] =
"read\0"
"real\0"
"reassign\0"
- "recheck\0"
"recursive\0"
"ref\0"
"references\0"
@@ -488,6 +490,7 @@ static const char ScanKeywords_kw_string[] =
"version\0"
"view\0"
"views\0"
+ "virtual\0"
"volatile\0"
"when\0"
"where\0"
@@ -645,515 +648,518 @@ static const uint16 ScanKeywords_kw_offsets[] = {
1003,
1013,
1017,
- 1022,
- 1028,
- 1035,
- 1041,
- 1048,
- 1056,
- 1066,
- 1076,
- 1084,
- 1091,
- 1099,
- 1110,
- 1120,
+ 1026,
+ 1031,
+ 1037,
+ 1044,
+ 1050,
+ 1057,
+ 1065,
+ 1075,
+ 1085,
+ 1093,
+ 1100,
+ 1108,
+ 1119,
1129,
- 1137,
- 1143,
- 1150,
- 1156,
- 1163,
+ 1138,
+ 1146,
+ 1152,
+ 1159,
+ 1165,
1172,
- 1178,
- 1184,
- 1194,
- 1198,
- 1204,
- 1212,
- 1219,
- 1227,
- 1234,
- 1239,
- 1244,
+ 1181,
+ 1187,
+ 1193,
+ 1203,
+ 1207,
+ 1213,
+ 1221,
+ 1228,
+ 1236,
+ 1243,
+ 1248,
1253,
- 1263,
- 1273,
- 1280,
- 1286,
- 1294,
+ 1262,
+ 1272,
+ 1282,
+ 1289,
+ 1295,
1303,
- 1309,
+ 1312,
1318,
- 1325,
- 1333,
- 1340,
- 1347,
- 1352,
- 1357,
+ 1327,
+ 1334,
+ 1342,
+ 1349,
+ 1356,
+ 1361,
1366,
- 1369,
1375,
- 1385,
- 1395,
+ 1378,
+ 1384,
+ 1394,
1404,
- 1411,
- 1414,
- 1422,
- 1432,
- 1442,
- 1449,
- 1455,
- 1463,
- 1471,
+ 1413,
+ 1420,
+ 1423,
+ 1431,
+ 1441,
+ 1451,
+ 1458,
+ 1464,
+ 1472,
1480,
- 1490,
- 1497,
- 1503,
- 1509,
- 1515,
- 1527,
- 1534,
- 1542,
- 1546,
- 1554,
- 1564,
+ 1489,
+ 1499,
+ 1506,
+ 1512,
+ 1518,
+ 1524,
+ 1536,
+ 1543,
+ 1551,
+ 1555,
+ 1563,
1573,
- 1578,
- 1586,
- 1589,
- 1596,
- 1606,
- 1611,
- 1616,
- 1627,
- 1641,
- 1653,
- 1665,
- 1680,
- 1691,
- 1703,
- 1718,
- 1729,
- 1740,
- 1745,
+ 1582,
+ 1587,
+ 1595,
+ 1598,
+ 1605,
+ 1615,
+ 1620,
+ 1625,
+ 1636,
+ 1650,
+ 1662,
+ 1674,
+ 1689,
+ 1700,
+ 1712,
+ 1727,
+ 1738,
1749,
1754,
- 1760,
+ 1758,
+ 1763,
1769,
- 1775,
- 1780,
- 1788,
- 1796,
- 1806,
- 1812,
- 1817,
- 1823,
- 1828,
- 1834,
- 1841,
- 1846,
- 1852,
- 1862,
- 1877,
+ 1778,
+ 1784,
+ 1789,
+ 1797,
+ 1805,
+ 1815,
+ 1821,
+ 1826,
+ 1832,
+ 1837,
+ 1843,
+ 1850,
+ 1855,
+ 1861,
+ 1871,
1886,
- 1891,
- 1898,
- 1905,
- 1913,
- 1919,
- 1927,
- 1940,
+ 1895,
+ 1900,
+ 1907,
+ 1914,
+ 1922,
+ 1928,
+ 1936,
1949,
- 1955,
- 1968,
- 1975,
- 1982,
+ 1958,
+ 1964,
+ 1977,
+ 1984,
1991,
- 1996,
- 2002,
- 2007,
- 2012,
- 2018,
+ 2000,
+ 2005,
+ 2011,
+ 2016,
+ 2021,
2027,
- 2035,
- 2041,
- 2048,
- 2052,
+ 2036,
+ 2044,
+ 2050,
2057,
2061,
- 2065,
+ 2066,
2070,
- 2075,
- 2078,
- 2083,
- 2093,
- 2104,
- 2108,
- 2116,
- 2123,
- 2131,
- 2138,
- 2143,
- 2150,
- 2156,
- 2164,
- 2171,
- 2174,
- 2178,
- 2185,
- 2190,
- 2194,
- 2199,
+ 2074,
+ 2079,
+ 2084,
+ 2087,
+ 2092,
+ 2102,
+ 2113,
+ 2117,
+ 2125,
+ 2132,
+ 2140,
+ 2147,
+ 2152,
+ 2159,
+ 2165,
+ 2173,
+ 2180,
+ 2188,
+ 2191,
+ 2195,
2202,
2207,
+ 2211,
2216,
- 2223,
- 2231,
- 2234,
+ 2219,
+ 2224,
+ 2233,
2240,
+ 2248,
2251,
- 2258,
- 2262,
+ 2257,
2268,
- 2273,
- 2282,
+ 2275,
+ 2279,
+ 2285,
2290,
- 2301,
+ 2299,
2307,
- 2313,
- 2322,
- 2332,
+ 2318,
+ 2324,
+ 2330,
2339,
- 2347,
- 2357,
- 2365,
+ 2349,
+ 2356,
+ 2364,
2374,
- 2379,
- 2386,
- 2394,
- 2399,
- 2405,
- 2412,
- 2421,
- 2431,
- 2441,
- 2449,
- 2458,
- 2467,
- 2475,
- 2481,
- 2492,
- 2503,
- 2513,
- 2524,
- 2532,
- 2544,
- 2550,
- 2557,
- 2563,
+ 2382,
+ 2391,
+ 2396,
+ 2403,
+ 2410,
+ 2418,
+ 2423,
+ 2429,
+ 2436,
+ 2445,
+ 2455,
+ 2465,
+ 2473,
+ 2482,
+ 2491,
+ 2499,
+ 2505,
+ 2516,
+ 2527,
+ 2537,
+ 2548,
+ 2556,
2568,
- 2573,
- 2582,
- 2590,
- 2600,
- 2604,
- 2615,
- 2627,
- 2635,
+ 2574,
+ 2581,
+ 2587,
+ 2592,
+ 2597,
+ 2606,
+ 2616,
+ 2620,
+ 2631,
2643,
- 2652,
- 2660,
- 2667,
- 2678,
- 2686,
+ 2651,
+ 2659,
+ 2668,
+ 2676,
+ 2683,
2694,
- 2700,
- 2708,
- 2717,
+ 2702,
+ 2710,
+ 2716,
2724,
- 2734,
- 2742,
- 2749,
- 2755,
- 2760,
- 2769,
+ 2733,
+ 2740,
+ 2750,
+ 2758,
+ 2765,
+ 2771,
2776,
- 2784,
- 2793,
- 2797,
- 2802,
- 2807,
- 2817,
- 2824,
- 2831,
- 2839,
- 2846,
- 2853,
- 2860,
+ 2785,
+ 2792,
+ 2800,
+ 2809,
+ 2813,
+ 2818,
+ 2823,
+ 2833,
+ 2840,
+ 2847,
+ 2855,
+ 2862,
2869,
2876,
2885,
- 2895,
- 2908,
- 2915,
- 2923,
- 2936,
- 2940,
- 2946,
- 2951,
- 2957,
+ 2892,
+ 2901,
+ 2911,
+ 2924,
+ 2931,
+ 2939,
+ 2952,
+ 2956,
2962,
- 2970,
- 2977,
- 2982,
- 2991,
- 3000,
- 3005,
- 3012,
+ 2967,
+ 2973,
+ 2978,
+ 2986,
+ 2993,
+ 2998,
+ 3007,
3016,
- 3023,
- 3034,
- 3040,
+ 3021,
+ 3028,
+ 3032,
+ 3039,
3050,
- 3061,
- 3067,
- 3074,
- 3082,
- 3089,
- 3096,
- 3103,
- 3109,
- 3122,
- 3132,
- 3140,
- 3150,
+ 3056,
+ 3066,
+ 3077,
+ 3083,
+ 3090,
+ 3098,
+ 3105,
+ 3112,
+ 3119,
+ 3125,
+ 3138,
+ 3148,
3156,
- 3163,
- 3175,
- 3181,
- 3188,
- 3200,
- 3211,
- 3218,
- 3223,
- 3232,
- 3242,
- 3247,
- 3252,
- 3257,
- 3262,
- 3272,
- 3275,
- 3284,
- 3296,
- 3306,
+ 3166,
+ 3172,
+ 3179,
+ 3191,
+ 3197,
+ 3204,
+ 3216,
+ 3227,
+ 3234,
+ 3239,
+ 3248,
+ 3258,
+ 3263,
+ 3268,
+ 3273,
+ 3278,
+ 3288,
+ 3291,
+ 3300,
3312,
- 3320,
- 3325,
- 3330,
- 3339,
- 3347,
- 3352,
- 3358,
- 3366,
- 3376,
- 3388,
- 3402,
- 3414,
- 3420,
- 3427,
- 3435,
- 3444,
- 3453,
- 3459,
- 3466,
- 3471,
- 3477,
- 3484,
- 3490,
- 3499,
- 3509,
+ 3322,
+ 3328,
+ 3336,
+ 3341,
+ 3346,
+ 3355,
+ 3363,
+ 3368,
+ 3374,
+ 3382,
+ 3392,
+ 3404,
+ 3418,
+ 3430,
+ 3436,
+ 3443,
+ 3451,
+ 3460,
+ 3469,
+ 3475,
+ 3482,
+ 3487,
+ 3493,
+ 3500,
+ 3506,
3515,
- 3522,
- 3530,
- 3539,
- 3547,
+ 3525,
+ 3531,
+ 3538,
+ 3546,
3555,
3563,
- 3568,
- 3574,
- 3583,
- 3588,
- 3594,
- 3605,
+ 3571,
+ 3579,
+ 3584,
+ 3590,
+ 3598,
+ 3607,
3612,
- 3617,
- 3624,
- 3632,
- 3637,
- 3645,
- 3651,
- 3655,
+ 3618,
+ 3629,
+ 3636,
+ 3641,
+ 3648,
+ 3656,
+ 3661,
3669,
+ 3675,
3679,
- 3690,
- 3700,
- 3710,
+ 3693,
+ 3703,
+ 3714,
3724,
- 3733,
- 3739,
- 3747,
- 3760,
- 3769,
- 3774,
- 3778,
+ 3734,
+ 3748,
+ 3757,
+ 3763,
+ 3771,
+ 3784,
+ 3793,
+ 3798,
+ 3802,
};
-#define SCANKEYWORDS_NUM_KEYWORDS 492
+#define SCANKEYWORDS_NUM_KEYWORDS 495
static int
ScanKeywords_hash_func(const void *key, size_t keylen)
{
- static const int16 h[985] = {
- -2, 143, 32767, 200, 0, 0, 448, 302,
- 769, -52, 32767, 0, 32767, 0, 32767, 0,
- 281, 253, 248, 612, 32767, 8, -436, 0,
- 32767, 0, 32767, 354, -267, 362, 32767, 32767,
- 568, 32767, 0, 32767, 289, 32767, 75, 32767,
- 32767, 33, 32767, 165, 0, 32767, 32767, 32767,
- 32767, -97, 32767, 358, 78, -272, 73, 339,
- 2, 386, 43, 32767, 0, 32767, 508, -93,
- -589, -159, -10, 0, -8, 32767, -359, 32767,
- 288, -224, 58, 32767, -226, -10, 201, 32767,
- 347, 32767, 255, 0, 464, -8, 0, 32767,
- 225, 32767, -118, 32767, -658, 305, 297, -235,
- 32767, 177, -393, 0, -43, 136, 32767, 32767,
- 32767, 0, 270, -106, 190, 32767, 65, 32767,
- 32767, 32767, 32767, -77, 32767, 148, -179, 334,
- 0, 32767, 0, 32767, 32767, 280, 477, 346,
- 32767, 148, 335, 66, 265, -204, 32767, 9,
- -158, 32767, 372, 16, 32767, 227, -247, 0,
- 228, -598, 32767, 257, 32767, 32767, 32767, 32767,
- 32767, 402, 32767, 32767, 332, -42, 603, 32767,
- 32767, 32767, 971, -38, 32767, 242, 0, 221,
- -109, 459, 310, 126, 32767, 32767, 114, -410,
- 130, 0, 32767, 312, 32767, 313, 32767, 392,
- 516, 217, 32767, 0, 70, 32767, 478, 33,
- 32767, 303, 32767, 0, 59, 194, 32767, 32767,
- 0, 116, 0, 32767, 0, 32767, 32767, -325,
- 81, -325, 32767, 0, -204, 0, 0, 32767,
- 460, 32767, 0, 379, 375, 32767, 303, 159,
- 32767, -24, 32767, 32767, 32767, 511, 32767, -185,
- -622, 32767, 32767, 32767, 304, 1204, 0, 520,
- 542, 593, -52, 32767, 32767, 291, 32767, 344,
- 0, 31, -121, 0, 32767, 32767, 32767, 347,
- 0, 32767, 32767, -1259, 0, 32767, 32767, 32767,
- 480, 40, 153, 35, 582, 32767, 34, 115,
- 32767, -83, 32767, 32767, 36, 324, -434, 32767,
- 430, -24, -95, 32767, 32767, 32767, 172, -1264,
- -236, -110, 32767, 87, -227, 179, 305, 0,
- 32767, 32767, 32767, 32767, 32767, 32767, 0, 134,
- 32767, 299, 32767, 32767, 25, 0, 14, -38,
- 32767, 105, 392, 32767, 32767, 437, 32767, 32767,
- 446, 32767, 358, 264, 209, 32767, 238, 596,
- 156, -689, 32767, 435, 32767, 85, -9, -155,
- 414, 0, 65, 32767, 32767, -94, 354, 46,
- 69, -119, 185, 275, 1727, 32767, 32767, -99,
- 32767, 445, 32767, -975, -183, 32767, 32767, 479,
- 78, 32767, 0, 32767, 32767, 32767, 452, 252,
- 32767, 0, 378, 32767, 32767, -34, 88, 13,
- 32767, 32767, 32767, 32767, 107, 32767, 32767, -86,
- 298, 1307, 180, 32767, 32767, 32767, 32767, -150,
- 95, 0, 32767, 377, 32767, 182, 32767, -1192,
- 287, 32767, 0, 554, -1011, 32767, 346, 26,
- 0, 32767, 338, 426, 32767, 652, 240, -244,
- 0, 118, 32767, -203, 133, 32767, 79, 0,
- 94, 32767, 456, 32767, -657, 462, 32767, 266,
- 158, 781, 32767, -273, 32767, 351, 0, 32767,
- 392, 0, 89, 32767, 41, 370, 32767, 61,
- -148, 32767, 32767, -37, 32767, -76, 315, 32767,
- 32767, 32767, 358, 139, 56, 458, 32767, 415,
- 32767, 32767, 653, 32767, 32767, 32767, -236, 32767,
- 0, 0, 615, 32767, 0, 32767, 55, -912,
- 32767, 113, 206, 32767, 32767, 32767, 32767, 0,
- 32767, 96, 32767, 396, 175, 129, 32767, 32767,
- 138, -147, 32767, 32767, -157, 270, 32767, -460,
- 263, 448, 32767, 32767, 0, 371, 32767, 32767,
- 32767, 32767, -283, 32767, 32767, 197, 0, 32767,
- 374, 581, -549, 32767, 32767, 56, 32767, 0,
- 234, -115, 32767, -439, 466, 32767, 32767, 0,
- 388, 184, 32767, 32767, 83, 32767, 32767, 120,
- -277, 0, 32767, 0, 180, 32767, 0, 205,
- 32767, 32767, 219, 0, 32767, 32767, -32, 159,
- 32767, 204, 0, 826, 495, 32767, 190, 0,
- 400, 379, 32767, 32767, -108, 72, 459, 32767,
- 32767, 0, 92, 32767, 276, 133, 32767, 32767,
- 160, -36, 32767, 70, 871, 32767, 32767, -436,
- 32767, 32767, 980, 385, 0, 9, 32767, 327,
- 519, 0, 32767, 0, -31, 0, 11, 0,
- 32767, 412, 124, -121, 377, 0, 32767, 32767,
- 0, 137, 32767, 66, -123, 264, -50, 3,
- -190, 21, 32767, 267, 32767, 0, 0, 32767,
- 32767, 32767, 221, 32767, 32767, -301, 38, -319,
- 389, 32767, 32767, 275, 964, -30, 330, 172,
- 32767, 329, -299, 32767, 524, 341, 32767, 32767,
- 123, -76, 415, 151, 32767, 179, 0, -365,
- 32767, -268, 32767, -425, 203, 0, 146, 32767,
- 290, 32767, 259, 32767, 0, 1, 32767, 239,
- 160, 914, 39, 32767, -194, 104, 0, 0,
- 32767, 32767, 32767, 0, 32767, 32767, 10, 487,
- 0, 279, 32767, 223, 32767, 32767, 0, -286,
- -510, 151, 429, 32767, 0, 115, 32767, -66,
- 647, 291, 32767, -290, 32767, 0, -433, 0,
- 180, 32767, 116, 32767, 301, 32767, 282, 294,
- 0, 32767, -126, 0, -412, 0, 315, 32767,
- 400, 0, 32767, 32767, 32767, 109, -227, 0,
- -352, 32767, 112, 0, 471, 0, 32767, 32767,
- 461, 32767, 32767, 233, 32767, 32767, 406, 32767,
- 464, 32767, 118, 382, 0, 32767, 0, 32767,
- 32767, 541, -305, 814, 0, 268, 0, 403,
- 268, 372, 84, 32767, -91, 32767, 0, 32767,
- 208, 467, 0, 32767, 32767, 32767, -236, 32767,
- 32767, -53, -317, 32767, 338, 0, 0, 646,
- 32767, 78, 32767, 158, 399, 0, 32767, 0,
- -269, 32767, 32767, -213, -786, 32767, 162, 32767,
- 32767, -259, 401, 383, 453, 0, 32767, 0,
- -232, -159, 322, 32767, 32767, 203, 0, 32767,
- 183, 314, 32767, -86, 32767, 377, 195, 878,
- 93, -80, 212, 32767, 49, 32767, 614, 337,
- 32767, 318, -59, 285, 32767, 0, 32767, 0,
- 98, 17, 32767, 0, -192, 482, 0, 32767,
- 102, 32767, 331, 366, 0, -325, -143, 438,
- 465, 35, 472, 32767, 670, 32767, 0, 0,
- 32767, 32767, 32767, 0, 109, 226, 32767, 32767,
- 25, -227, 0, 0, 768, 32767, -363, 32767,
- 245, 129, 32767, 405, 95, 407, 345, 1494,
- 32767, 0, 473, 32767, 32767, 32767, 32767, 0,
- 0, 32767, 32767, 244, 32767, 82, 32767, 38,
- 32767, 97, -39, 397, 32767, 32767, 32767, 32767,
- 32767, 90, 605, 105, 32767, 0, 0, 0,
- 250, 32767, 372, 32767, 32767, 0, -434, 0,
- 32767, 216, 32767, 443, 32767, 185, 51, 367,
- 32767, 87, 0, 560, 0, 0, 0, 0,
- 349, -120, 32767, 32767, 408, 32767, 32767, 0,
- 32767, 0, 32767, 32767, 32767, 744, 250, -146,
- 32767, 142, 0, -492, 32767, 334, 441, 32767,
- 0
+ static const int16 h[991] = {
+ 32767, -121, 32767, -21, 32767, 32767, 32767, -435,
+ 391, 32767, 32767, 487, 377, 213, 32767, 32767,
+ 32767, 32767, 32767, 20, 32767, 32767, 1, -114,
+ 458, 375, 88, 535, 32767, 32767, 319, 387,
+ -180, 0, 0, 32767, -473, 163, 105, 0,
+ 32767, 32767, 32767, 21, 173, -212, 32767, 371,
+ 65, 125, 32767, 455, 32767, 370, -342, 830,
+ 32767, 176, 1114, -78, -161, 32767, 239, -903,
+ 32767, -653, 32767, -412, 149, 32767, 1137, 32767,
+ -618, 32767, 919, -333, 237, 20, 32767, 380,
+ 195, 32767, 152, 135, 264, 115, 95, 0,
+ 32767, 876, -342, 32767, 32767, 374, 956, 108,
+ -41, 0, -760, 32767, 32767, 0, 32767, 422,
+ 328, 32767, 32767, 32767, 60, -183, 32767, -630,
+ 32767, 266, -353, 503, 32767, -111, 32767, 32767,
+ 480, 171, -264, 32767, 193, 482, 73, 194,
+ 32767, 288, 32767, 176, 370, 32767, 32767, 0,
+ 234, 32767, 62, 229, 32767, 32767, 32767, 0,
+ 32767, 32767, 32767, 32767, 466, 32767, 56, 32767,
+ -77, 407, 395, 86, 0, 32767, 201, 562,
+ 0, -460, 0, 32767, 32767, 32767, 290, 32767,
+ 35, 32767, 1, 32767, 396, 70, 0, 97,
+ 434, 420, 272, 178, 32767, 32767, 29, 346,
+ 0, 382, 32767, 32767, 423, -1086, 32767, 378,
+ 32767, 429, 32767, -210, 0, 32767, 32767, 369,
+ -652, 328, 64, 418, 1112, 32767, 32767, 0,
+ 0, 216, 32767, 32767, -339, -659, 32767, 289,
+ 419, 47, 32767, 767, -622, 0, -293, 0,
+ 32767, 32767, -257, 0, 0, 32767, 0, 32767,
+ 32767, 441, 32767, 0, -279, 0, 38, -433,
+ 32767, 470, 32767, 0, 32767, 245, -162, 32767,
+ 32767, -238, 32767, 0, 32767, 32767, 77, 32767,
+ 32767, 103, 32767, 32767, 181, 342, 32767, 150,
+ 440, 12, 32767, 244, 32767, 0, -149, 835,
+ 32767, 390, 423, 189, 32767, 32767, 32767, 32767,
+ 32767, 0, 0, -138, 32767, 255, 32767, 282,
+ 32767, -740, -639, 48, -126, 32767, 32767, 32767,
+ 32767, 32767, 32767, 647, 46, 369, 32767, 0,
+ 32767, 32767, -206, 32767, 32767, -130, 32767, 96,
+ 32767, 0, -27, 32767, 356, 32767, 32767, -311,
+ 314, 13, -158, 32767, 32767, 0, 486, 52,
+ 32767, 437, -3, 308, -314, -94, 32767, 32767,
+ 32767, 32767, 0, 32767, 765, 270, 32767, 205,
+ 32767, 32767, 240, -328, -50, 70, 57, -99,
+ 95, 32767, 32767, 464, 32767, 32767, 32767, 203,
+ 445, 32767, 391, 32767, 141, -210, 172, -125,
+ 0, 32767, 130, 32767, -66, 32767, 32767, 0,
+ 393, 32767, 32767, 185, 0, 32767, 258, 40,
+ -799, 32767, 23, 32767, 87, 32767, 119, 32767,
+ 32767, -227, 138, 32767, 32767, 32767, 206, 344,
+ 1, 71, 32767, 0, 421, 32767, 32767, 32767,
+ -625, 32767, 32767, 38, 491, 32767, 32767, -984,
+ 198, 0, 455, -16, 56, 0, -717, 411,
+ 200, 0, 32767, 0, 32767, 188, 82, 32767,
+ 32767, 0, 32767, -80, 80, 32767, -675, 32767,
+ 378, 26, 0, 32767, 32767, 57, 0, 32767,
+ 633, 32767, 0, 32767, 307, 32767, 132, 32767,
+ 320, 220, 32767, 0, 264, 32767, 499, -7,
+ 139, 271, 32767, 357, 532, 168, 32767, 258,
+ 32767, 17, 219, -178, 299, 32767, 32767, -27,
+ 382, 32767, 32767, 32767, 32767, 32767, 637, 32767,
+ 32767, 329, -364, 32767, -16, 355, -197, 127,
+ 340, -434, 224, -3, -186, 0, 176, 156,
+ 32767, 32767, 105, 32767, 435, 34, 32767, 32767,
+ 568, -176, 0, -471, 333, 32767, 0, -218,
+ 32767, 254, 283, 0, 326, 32767, 32767, 32767,
+ 0, 32767, 32767, 99, -142, 0, 318, 303,
+ 360, 267, 32767, 344, 0, 32767, 32767, 32767,
+ 547, 32767, 32767, 334, 0, -59, 446, -366,
+ -253, 32767, -165, 32767, 32767, 32767, 427, -152,
+ 15, 32767, 32767, 0, 51, 32767, 98, 599,
+ 169, 31, 0, -116, 0, 0, 32767, -402,
+ 32767, 32767, 263, 32767, 32767, -205, -94, 0,
+ 280, 260, 32767, 32767, 1124, 32767, -543, 0,
+ 0, 32767, 32767, 32767, 32767, 32767, 773, 7,
+ 930, 288, -620, 32767, 132, 32767, 0, 0,
+ 58, 32767, 373, 848, 228, 112, -4, 32767,
+ 32767, -152, 651, 32767, 32767, 1013, -685, 240,
+ 242, -117, 38, 110, 32767, 0, 32767, -48,
+ 32767, -113, 32767, 0, 92, 1228, 0, 760,
+ 32767, 0, 32767, 0, 457, -144, 774, 198,
+ 32767, 32767, 32767, 351, 329, 292, 32767, 32767,
+ 118, 32767, 32767, 331, 80, 117, 815, 32767,
+ 0, 32767, 370, 32767, 32767, 0, 32767, -419,
+ 32767, 32767, 32767, 0, 32767, 32767, 32767, 193,
+ 0, 32767, 0, 32767, 32767, 32767, 870, 0,
+ 32767, -52, 454, 0, 32767, 64, 0, 310,
+ 0, -338, 32767, 119, 32767, 32767, -366, 32767,
+ 0, 159, 32767, 362, 66, 32767, 32767, 32767,
+ 0, -122, -39, 425, 361, 32767, -160, 420,
+ 163, 210, 32767, 32767, 32767, 32767, -642, 0,
+ -287, 0, 32767, 0, 401, 0, 221, 32767,
+ 238, 0, 525, 0, 91, 32767, 325, 32767,
+ 32767, -651, 129, 463, 0, 0, 32767, 172,
+ 287, 32767, 32767, -122, 0, 32767, 32767, 798,
+ 492, 109, -52, 0, 0, 6, 32767, 32767,
+ 32767, 474, 32767, 87, 32767, 32767, 31, 32767,
+ 451, 7, 252, 69, 32767, 6, -276, 97,
+ 32767, 32767, 32767, 32767, 32767, 141, 524, 32767,
+ 83, -304, 32767, 32767, 32767, 941, 32767, 32767,
+ 32767, 32767, 107, 32767, 32767, 32767, 32767, 32767,
+ 32767, 535, -733, 493, 32767, 554, -257, 18,
+ 173, -370, 191, 528, 406, 0, 468, 292,
+ 32767, -142, 417, 179, -27, 322, 32767, 504,
+ 32767, 433, 153, 182, 394, 32767, 32767, 32767,
+ 0, 32767, 177, 118, 32767, 32767, 83, 194,
+ 18, -781, 0, 322, 0, 19, 344, 32767,
+ 156, 118, 0, 32767, 372, 32767, 32767, 0,
+ 32767, -452, 366, 1133, -126, 834, 32767, 32767,
+ 32767, 1193, 162, 32767, 0, 0, -328, 360,
+ 353, -489, 0, 32767, 32767, 32767, 32767, 32767,
+ -237, 290, 32767, -780, 32767, -78, 32767, 0,
+ 137, 0, 94, 0, 344, 32767, 671, -164,
+ 422, 32767, 405, 32767, 57, 0, 141, 32767,
+ 32767, -16, 32767, 32767, -55, 46, 221, 32767,
+ 247, 32767, 0, 10, 32767, 401, 613, 32767,
+ 0, -244, 250, 32767, 223, 32767, 274, 32767,
+ 32767, 0, 124, 32767, 291, 303, -299, 234,
+ 38, 32767, 0, 32767, 181, 0, 536, 32767,
+ 23, -195, -192, 0, 1087, 32767, 60, 32767,
+ 177, 32767, 0, -646, 622, -36, 752, 46,
+ 0, 32767, 32767, 1067, 0, 32767, -187, 192,
+ 0, 32767, 32767, 425, 0, 32767, 879, 32767,
+ 32767, -129, 0, 32767, 190, 175, 254
};
const unsigned char *k = (const unsigned char *) key;
uint32 a = 0;
- uint32 b = 0;
+ uint32 b = 1;
while (keylen--)
{
unsigned char c = *k++ | 0x20;
a = a * 257 + c;
- b = b * 31 + c;
+ b = b * 127 + c;
}
- return h[a % 985] + h[b % 985];
+ return h[a % 991] + h[b % 991];
}
const ScanKeywordList ScanKeywords = {
diff --git a/src/include/parser/makefuncs.h b/src/include/parser/makefuncs.h
index 1086b1f55..0441c8e5d 100644
--- a/src/include/parser/makefuncs.h
+++ b/src/include/parser/makefuncs.h
@@ -4,8 +4,8 @@
* prototypes for the creator functions of various nodes
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/nodes/makefuncs.h
@@ -68,6 +68,7 @@ extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod,
Oid rcollid, CoercionForm rformat);
extern RangeVar *makeRangeVar(char *schemaname, char *relname, int location);
+extern Constraint *makeNotNullConstraint(String *colname);
extern TypeName *makeTypeName(char *typnam);
extern TypeName *makeTypeNameFromNameList(List *names);
diff --git a/src/include/parser/miscnodes.h b/src/include/parser/miscnodes.h
new file mode 100644
index 000000000..719cacff1
--- /dev/null
+++ b/src/include/parser/miscnodes.h
@@ -0,0 +1,53 @@
+/*-------------------------------------------------------------------------
+ *
+ * miscnodes.h
+ * Definitions for hard-to-classify node types.
+ *
+ * Node types declared here are not part of parse trees, plan trees,
+ * or execution state trees. We only assign them NodeTag values because
+ * IsA() tests provide a convenient way to disambiguate what kind of
+ * structure is being passed through assorted APIs, such as function
+ * "context" pointers.
+ *
+ *
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/miscnodes.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef MISCNODES_H
+#define MISCNODES_H
+
+#include "nodes.h"
+
+/*
+ * ErrorSaveContext -
+ * function call context node for handling of "soft" errors
+ *
+ * A caller wishing to trap soft errors must initialize a struct like this
+ * with all fields zero/NULL except for the NodeTag. Optionally, set
+ * details_wanted = true if more than the bare knowledge that a soft error
+ * occurred is required. The struct is then passed to a SQL-callable function
+ * via the FunctionCallInfo.context field; or below the level of SQL calls,
+ * it could be passed to a subroutine directly.
+ *
+ * After calling code that might report an error this way, check
+ * error_occurred to see if an error happened. If so, and if details_wanted
+ * is true, error_data has been filled with error details (stored in the
+ * callee's memory context!). The ErrorData can be modified (e.g. downgraded
+ * to a WARNING) and reported with ThrowErrorData(). FreeErrorData() can be
+ * called to release error_data, although that step is typically not necessary
+ * if the called code was run in a short-lived context.
+ */
+typedef struct ErrorSaveContext
+{
+ NodeTag type;
+ bool error_occurred; /* set to true if we detect a soft error */
+ bool details_wanted; /* does caller want more info than that? */
+ ErrorData *error_data; /* details of error, if so */
+} ErrorSaveContext;
+
+#endif /* MISCNODES_H */
diff --git a/src/include/parser/nodes.h b/src/include/parser/nodes.h
index d0d4f3cce..275694786 100644
--- a/src/include/parser/nodes.h
+++ b/src/include/parser/nodes.h
@@ -4,8 +4,8 @@
* Definitions for tagged nodes.
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/nodes/nodes.h
@@ -62,6 +62,7 @@ typedef enum NodeTag
* readfuncs.c.
*
* - custom_query_jumble: Has custom implementation in queryjumblefuncs.c.
+ * Also available as a node field attribute.
*
* - no_copy: Does not support copyObject() at all.
*
@@ -109,10 +110,15 @@ typedef enum NodeTag
* - equal_ignore_if_zero: Ignore the field for equality if it is zero.
* (Otherwise, compare normally.)
*
+ * - custom_query_jumble: Has custom implementation in queryjumblefuncs.c
+ * for the field of a node. Also available as a node attribute.
+ *
* - query_jumble_ignore: Ignore the field for the query jumbling. Note
* that typmod and collation information are usually irrelevant for the
* query jumbling.
*
+ * - query_jumble_squash: Squash multiple values during query jumbling.
+ *
* - query_jumble_location: Mark the field as a location to track. This is
* only allowed for integer fields that include "location" in their name.
*
@@ -210,7 +216,7 @@ extern char *bmsToString(const struct Bitmapset *bms);
* nodes/{readfuncs.c,read.c}
*/
extern void *stringToNode(const char *str);
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
extern void *stringToNodeWithLocations(const char *str);
#endif
extern struct Bitmapset *readBitmapset(void);
@@ -314,6 +320,7 @@ typedef enum JoinType
*/
JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */
JOIN_ANTI, /* 1 copy of each LHS row that has no match */
+ JOIN_RIGHT_SEMI, /* 1 copy of each RHS row that has match(es) */
JOIN_RIGHT_ANTI, /* 1 copy of each RHS row that has no match */
/*
@@ -330,10 +337,10 @@ typedef enum JoinType
/*
* OUTER joins are those for which pushed-down quals must behave differently
- * from the join's own quals. This is in fact everything except INNER and
- * SEMI joins. However, this macro must also exclude the JOIN_UNIQUE symbols
- * since those are temporary proxies for what will eventually be an INNER
- * join.
+ * from the join's own quals. This is in fact everything except INNER, SEMI
+ * and RIGHT_SEMI joins. However, this macro must also exclude the
+ * JOIN_UNIQUE symbols since those are temporary proxies for what will
+ * eventually be an INNER join.
*
* Note: semijoins are a hybrid case, but we choose to treat them as not
* being outer joins. This is okay principally because the SQL syntax makes
diff --git a/src/include/parser/nodetags.h b/src/include/parser/nodetags.h
index ee1fb29ce..312727639 100644
--- a/src/include/parser/nodetags.h
+++ b/src/include/parser/nodetags.h
@@ -3,7 +3,7 @@
* nodetags.h
* Generated node infrastructure code
*
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* NOTES
@@ -75,45 +75,45 @@
T_CurrentOfExpr = 58,
T_NextValueExpr = 59,
T_InferenceElem = 60,
- T_TargetEntry = 61,
- T_RangeTblRef = 62,
- T_JoinExpr = 63,
- T_FromExpr = 64,
- T_OnConflictExpr = 65,
- T_Query = 66,
- T_TypeName = 67,
- T_ColumnRef = 68,
- T_ParamRef = 69,
- T_A_Expr = 70,
- T_A_Const = 71,
- T_TypeCast = 72,
- T_CollateClause = 73,
- T_RoleSpec = 74,
- T_FuncCall = 75,
- T_A_Star = 76,
- T_A_Indices = 77,
- T_A_Indirection = 78,
- T_A_ArrayExpr = 79,
- T_ResTarget = 80,
- T_MultiAssignRef = 81,
- T_SortBy = 82,
- T_WindowDef = 83,
- T_RangeSubselect = 84,
- T_RangeFunction = 85,
- T_RangeTableFunc = 86,
- T_RangeTableFuncCol = 87,
- T_RangeTableSample = 88,
- T_ColumnDef = 89,
- T_TableLikeClause = 90,
- T_IndexElem = 91,
- T_DefElem = 92,
- T_LockingClause = 93,
- T_XmlSerialize = 94,
- T_PartitionElem = 95,
- T_PartitionSpec = 96,
- T_PartitionBoundSpec = 97,
- T_PartitionRangeDatum = 98,
- T_SinglePartitionSpec = 99,
+ T_ReturningExpr = 61,
+ T_TargetEntry = 62,
+ T_RangeTblRef = 63,
+ T_JoinExpr = 64,
+ T_FromExpr = 65,
+ T_OnConflictExpr = 66,
+ T_Query = 67,
+ T_TypeName = 68,
+ T_ColumnRef = 69,
+ T_ParamRef = 70,
+ T_A_Expr = 71,
+ T_A_Const = 72,
+ T_TypeCast = 73,
+ T_CollateClause = 74,
+ T_RoleSpec = 75,
+ T_FuncCall = 76,
+ T_A_Star = 77,
+ T_A_Indices = 78,
+ T_A_Indirection = 79,
+ T_A_ArrayExpr = 80,
+ T_ResTarget = 81,
+ T_MultiAssignRef = 82,
+ T_SortBy = 83,
+ T_WindowDef = 84,
+ T_RangeSubselect = 85,
+ T_RangeFunction = 86,
+ T_RangeTableFunc = 87,
+ T_RangeTableFuncCol = 88,
+ T_RangeTableSample = 89,
+ T_ColumnDef = 90,
+ T_TableLikeClause = 91,
+ T_IndexElem = 92,
+ T_DefElem = 93,
+ T_LockingClause = 94,
+ T_XmlSerialize = 95,
+ T_PartitionElem = 96,
+ T_PartitionSpec = 97,
+ T_PartitionBoundSpec = 98,
+ T_PartitionRangeDatum = 99,
T_PartitionCmd = 100,
T_RangeTblEntry = 101,
T_RTEPermissionInfo = 102,
@@ -131,361 +131,366 @@
T_CTECycleClause = 114,
T_CommonTableExpr = 115,
T_MergeWhenClause = 116,
- T_TriggerTransition = 117,
- T_JsonOutput = 118,
- T_JsonArgument = 119,
- T_JsonFuncExpr = 120,
- T_JsonTablePathSpec = 121,
- T_JsonTable = 122,
- T_JsonTableColumn = 123,
- T_JsonKeyValue = 124,
- T_JsonParseExpr = 125,
- T_JsonScalarExpr = 126,
- T_JsonSerializeExpr = 127,
- T_JsonObjectConstructor = 128,
- T_JsonArrayConstructor = 129,
- T_JsonArrayQueryConstructor = 130,
- T_JsonAggConstructor = 131,
- T_JsonObjectAgg = 132,
- T_JsonArrayAgg = 133,
- T_RawStmt = 134,
- T_InsertStmt = 135,
- T_DeleteStmt = 136,
- T_UpdateStmt = 137,
- T_MergeStmt = 138,
- T_SelectStmt = 139,
- T_SetOperationStmt = 140,
- T_ReturnStmt = 141,
- T_PLAssignStmt = 142,
- T_CreateSchemaStmt = 143,
- T_AlterTableStmt = 144,
- T_ReplicaIdentityStmt = 145,
- T_AlterTableCmd = 146,
- T_AlterCollationStmt = 147,
- T_AlterDomainStmt = 148,
- T_GrantStmt = 149,
- T_ObjectWithArgs = 150,
- T_AccessPriv = 151,
- T_GrantRoleStmt = 152,
- T_AlterDefaultPrivilegesStmt = 153,
- T_CopyStmt = 154,
- T_VariableSetStmt = 155,
- T_VariableShowStmt = 156,
- T_CreateStmt = 157,
- T_Constraint = 158,
- T_CreateTableSpaceStmt = 159,
- T_DropTableSpaceStmt = 160,
- T_AlterTableSpaceOptionsStmt = 161,
- T_AlterTableMoveAllStmt = 162,
- T_CreateExtensionStmt = 163,
- T_AlterExtensionStmt = 164,
- T_AlterExtensionContentsStmt = 165,
- T_CreateFdwStmt = 166,
- T_AlterFdwStmt = 167,
- T_CreateForeignServerStmt = 168,
- T_AlterForeignServerStmt = 169,
- T_CreateForeignTableStmt = 170,
- T_CreateUserMappingStmt = 171,
- T_AlterUserMappingStmt = 172,
- T_DropUserMappingStmt = 173,
- T_ImportForeignSchemaStmt = 174,
- T_CreatePolicyStmt = 175,
- T_AlterPolicyStmt = 176,
- T_CreateAmStmt = 177,
- T_CreateTrigStmt = 178,
- T_CreateEventTrigStmt = 179,
- T_AlterEventTrigStmt = 180,
- T_CreatePLangStmt = 181,
- T_CreateRoleStmt = 182,
- T_AlterRoleStmt = 183,
- T_AlterRoleSetStmt = 184,
- T_DropRoleStmt = 185,
- T_CreateSeqStmt = 186,
- T_AlterSeqStmt = 187,
- T_DefineStmt = 188,
- T_CreateDomainStmt = 189,
- T_CreateOpClassStmt = 190,
- T_CreateOpClassItem = 191,
- T_CreateOpFamilyStmt = 192,
- T_AlterOpFamilyStmt = 193,
- T_DropStmt = 194,
- T_TruncateStmt = 195,
- T_CommentStmt = 196,
- T_SecLabelStmt = 197,
- T_DeclareCursorStmt = 198,
- T_ClosePortalStmt = 199,
- T_FetchStmt = 200,
- T_IndexStmt = 201,
- T_CreateStatsStmt = 202,
- T_StatsElem = 203,
- T_AlterStatsStmt = 204,
- T_CreateFunctionStmt = 205,
- T_FunctionParameter = 206,
- T_AlterFunctionStmt = 207,
- T_DoStmt = 208,
- T_InlineCodeBlock = 209,
- T_CallStmt = 210,
- T_CallContext = 211,
- T_RenameStmt = 212,
- T_AlterObjectDependsStmt = 213,
- T_AlterObjectSchemaStmt = 214,
- T_AlterOwnerStmt = 215,
- T_AlterOperatorStmt = 216,
- T_AlterTypeStmt = 217,
- T_RuleStmt = 218,
- T_NotifyStmt = 219,
- T_ListenStmt = 220,
- T_UnlistenStmt = 221,
- T_TransactionStmt = 222,
- T_CompositeTypeStmt = 223,
- T_CreateEnumStmt = 224,
- T_CreateRangeStmt = 225,
- T_AlterEnumStmt = 226,
- T_ViewStmt = 227,
- T_LoadStmt = 228,
- T_CreatedbStmt = 229,
- T_AlterDatabaseStmt = 230,
- T_AlterDatabaseRefreshCollStmt = 231,
- T_AlterDatabaseSetStmt = 232,
- T_DropdbStmt = 233,
- T_AlterSystemStmt = 234,
- T_ClusterStmt = 235,
- T_VacuumStmt = 236,
- T_VacuumRelation = 237,
- T_ExplainStmt = 238,
- T_CreateTableAsStmt = 239,
- T_RefreshMatViewStmt = 240,
- T_CheckPointStmt = 241,
- T_DiscardStmt = 242,
- T_LockStmt = 243,
- T_ConstraintsSetStmt = 244,
- T_ReindexStmt = 245,
- T_CreateConversionStmt = 246,
- T_CreateCastStmt = 247,
- T_CreateTransformStmt = 248,
- T_PrepareStmt = 249,
- T_ExecuteStmt = 250,
- T_DeallocateStmt = 251,
- T_DropOwnedStmt = 252,
- T_ReassignOwnedStmt = 253,
- T_AlterTSDictionaryStmt = 254,
- T_AlterTSConfigurationStmt = 255,
- T_PublicationTable = 256,
- T_PublicationObjSpec = 257,
- T_CreatePublicationStmt = 258,
- T_AlterPublicationStmt = 259,
- T_CreateSubscriptionStmt = 260,
- T_AlterSubscriptionStmt = 261,
- T_DropSubscriptionStmt = 262,
- T_PlannerGlobal = 263,
- T_PlannerInfo = 264,
- T_RelOptInfo = 265,
- T_IndexOptInfo = 266,
- T_ForeignKeyOptInfo = 267,
- T_StatisticExtInfo = 268,
- T_JoinDomain = 269,
- T_EquivalenceClass = 270,
- T_EquivalenceMember = 271,
- T_PathKey = 272,
- T_GroupByOrdering = 273,
- T_PathTarget = 274,
- T_ParamPathInfo = 275,
- T_Path = 276,
- T_IndexPath = 277,
- T_IndexClause = 278,
- T_BitmapHeapPath = 279,
- T_BitmapAndPath = 280,
- T_BitmapOrPath = 281,
- T_TidPath = 282,
- T_TidRangePath = 283,
- T_SubqueryScanPath = 284,
- T_ForeignPath = 285,
- T_CustomPath = 286,
- T_AppendPath = 287,
- T_MergeAppendPath = 288,
- T_GroupResultPath = 289,
- T_MaterialPath = 290,
- T_MemoizePath = 291,
- T_UniquePath = 292,
- T_GatherPath = 293,
- T_GatherMergePath = 294,
- T_NestPath = 295,
- T_MergePath = 296,
- T_HashPath = 297,
- T_ProjectionPath = 298,
- T_ProjectSetPath = 299,
- T_SortPath = 300,
- T_IncrementalSortPath = 301,
- T_GroupPath = 302,
- T_UpperUniquePath = 303,
- T_AggPath = 304,
- T_GroupingSetData = 305,
- T_RollupData = 306,
- T_GroupingSetsPath = 307,
- T_MinMaxAggPath = 308,
- T_WindowAggPath = 309,
- T_SetOpPath = 310,
- T_RecursiveUnionPath = 311,
- T_LockRowsPath = 312,
- T_ModifyTablePath = 313,
- T_LimitPath = 314,
- T_RestrictInfo = 315,
- T_PlaceHolderVar = 316,
- T_SpecialJoinInfo = 317,
- T_OuterJoinClauseInfo = 318,
- T_AppendRelInfo = 319,
- T_RowIdentityVarInfo = 320,
- T_PlaceHolderInfo = 321,
- T_MinMaxAggInfo = 322,
- T_PlannerParamItem = 323,
- T_AggInfo = 324,
- T_AggTransInfo = 325,
- T_PlannedStmt = 326,
- T_Result = 327,
- T_ProjectSet = 328,
- T_ModifyTable = 329,
- T_Append = 330,
- T_MergeAppend = 331,
- T_RecursiveUnion = 332,
- T_BitmapAnd = 333,
- T_BitmapOr = 334,
- T_SeqScan = 335,
- T_SampleScan = 336,
- T_IndexScan = 337,
- T_IndexOnlyScan = 338,
- T_BitmapIndexScan = 339,
- T_BitmapHeapScan = 340,
- T_TidScan = 341,
- T_TidRangeScan = 342,
- T_SubqueryScan = 343,
- T_FunctionScan = 344,
- T_ValuesScan = 345,
- T_TableFuncScan = 346,
- T_CteScan = 347,
- T_NamedTuplestoreScan = 348,
- T_WorkTableScan = 349,
- T_ForeignScan = 350,
- T_CustomScan = 351,
- T_NestLoop = 352,
- T_NestLoopParam = 353,
- T_MergeJoin = 354,
- T_HashJoin = 355,
- T_Material = 356,
- T_Memoize = 357,
- T_Sort = 358,
- T_IncrementalSort = 359,
- T_Group = 360,
- T_Agg = 361,
- T_WindowAgg = 362,
- T_Unique = 363,
- T_Gather = 364,
- T_GatherMerge = 365,
- T_Hash = 366,
- T_SetOp = 367,
- T_LockRows = 368,
- T_Limit = 369,
- T_PlanRowMark = 370,
- T_PartitionPruneInfo = 371,
- T_PartitionedRelPruneInfo = 372,
- T_PartitionPruneStepOp = 373,
- T_PartitionPruneStepCombine = 374,
- T_PlanInvalItem = 375,
- T_ExprState = 376,
- T_IndexInfo = 377,
- T_ExprContext = 378,
- T_ReturnSetInfo = 379,
- T_ProjectionInfo = 380,
- T_JunkFilter = 381,
- T_OnConflictSetState = 382,
- T_MergeActionState = 383,
- T_ResultRelInfo = 384,
- T_EState = 385,
- T_WindowFuncExprState = 386,
- T_SetExprState = 387,
- T_SubPlanState = 388,
- T_DomainConstraintState = 389,
- T_ResultState = 390,
- T_ProjectSetState = 391,
- T_ModifyTableState = 392,
- T_AppendState = 393,
- T_MergeAppendState = 394,
- T_RecursiveUnionState = 395,
- T_BitmapAndState = 396,
- T_BitmapOrState = 397,
- T_ScanState = 398,
- T_SeqScanState = 399,
- T_SampleScanState = 400,
- T_IndexScanState = 401,
- T_IndexOnlyScanState = 402,
- T_BitmapIndexScanState = 403,
- T_BitmapHeapScanState = 404,
- T_TidScanState = 405,
- T_TidRangeScanState = 406,
- T_SubqueryScanState = 407,
- T_FunctionScanState = 408,
- T_ValuesScanState = 409,
- T_TableFuncScanState = 410,
- T_CteScanState = 411,
- T_NamedTuplestoreScanState = 412,
- T_WorkTableScanState = 413,
- T_ForeignScanState = 414,
- T_CustomScanState = 415,
- T_JoinState = 416,
- T_NestLoopState = 417,
- T_MergeJoinState = 418,
- T_HashJoinState = 419,
- T_MaterialState = 420,
- T_MemoizeState = 421,
- T_SortState = 422,
- T_IncrementalSortState = 423,
- T_GroupState = 424,
- T_AggState = 425,
- T_WindowAggState = 426,
- T_UniqueState = 427,
- T_GatherState = 428,
- T_GatherMergeState = 429,
- T_HashState = 430,
- T_SetOpState = 431,
- T_LockRowsState = 432,
- T_LimitState = 433,
- T_IndexAmRoutine = 434,
- T_TableAmRoutine = 435,
- T_TsmRoutine = 436,
- T_EventTriggerData = 437,
- T_TriggerData = 438,
- T_TupleTableSlot = 439,
- T_FdwRoutine = 440,
- T_Bitmapset = 441,
- T_ExtensibleNode = 442,
- T_ErrorSaveContext = 443,
- T_IdentifySystemCmd = 444,
- T_BaseBackupCmd = 445,
- T_CreateReplicationSlotCmd = 446,
- T_DropReplicationSlotCmd = 447,
- T_AlterReplicationSlotCmd = 448,
- T_StartReplicationCmd = 449,
- T_ReadReplicationSlotCmd = 450,
- T_TimeLineHistoryCmd = 451,
- T_UploadManifestCmd = 452,
- T_SupportRequestSimplify = 453,
- T_SupportRequestSelectivity = 454,
- T_SupportRequestCost = 455,
- T_SupportRequestRows = 456,
- T_SupportRequestIndexCondition = 457,
- T_SupportRequestWFuncMonotonic = 458,
- T_SupportRequestOptimizeWindowClause = 459,
- T_Integer = 460,
- T_Float = 461,
- T_Boolean = 462,
- T_String = 463,
- T_BitString = 464,
- T_ForeignKeyCacheInfo = 465,
- T_IntList = 466,
- T_OidList = 467,
- T_XidList = 468,
- T_AllocSetContext = 469,
- T_GenerationContext = 470,
- T_SlabContext = 471,
- T_BumpContext = 472,
- T_TIDBitmap = 473,
- T_WindowObjectData = 474,
+ T_ReturningOption = 117,
+ T_ReturningClause = 118,
+ T_TriggerTransition = 119,
+ T_JsonOutput = 120,
+ T_JsonArgument = 121,
+ T_JsonFuncExpr = 122,
+ T_JsonTablePathSpec = 123,
+ T_JsonTable = 124,
+ T_JsonTableColumn = 125,
+ T_JsonKeyValue = 126,
+ T_JsonParseExpr = 127,
+ T_JsonScalarExpr = 128,
+ T_JsonSerializeExpr = 129,
+ T_JsonObjectConstructor = 130,
+ T_JsonArrayConstructor = 131,
+ T_JsonArrayQueryConstructor = 132,
+ T_JsonAggConstructor = 133,
+ T_JsonObjectAgg = 134,
+ T_JsonArrayAgg = 135,
+ T_RawStmt = 136,
+ T_InsertStmt = 137,
+ T_DeleteStmt = 138,
+ T_UpdateStmt = 139,
+ T_MergeStmt = 140,
+ T_SelectStmt = 141,
+ T_SetOperationStmt = 142,
+ T_ReturnStmt = 143,
+ T_PLAssignStmt = 144,
+ T_CreateSchemaStmt = 145,
+ T_AlterTableStmt = 146,
+ T_AlterTableCmd = 147,
+ T_ATAlterConstraint = 148,
+ T_ReplicaIdentityStmt = 149,
+ T_AlterCollationStmt = 150,
+ T_AlterDomainStmt = 151,
+ T_GrantStmt = 152,
+ T_ObjectWithArgs = 153,
+ T_AccessPriv = 154,
+ T_GrantRoleStmt = 155,
+ T_AlterDefaultPrivilegesStmt = 156,
+ T_CopyStmt = 157,
+ T_VariableSetStmt = 158,
+ T_VariableShowStmt = 159,
+ T_CreateStmt = 160,
+ T_Constraint = 161,
+ T_CreateTableSpaceStmt = 162,
+ T_DropTableSpaceStmt = 163,
+ T_AlterTableSpaceOptionsStmt = 164,
+ T_AlterTableMoveAllStmt = 165,
+ T_CreateExtensionStmt = 166,
+ T_AlterExtensionStmt = 167,
+ T_AlterExtensionContentsStmt = 168,
+ T_CreateFdwStmt = 169,
+ T_AlterFdwStmt = 170,
+ T_CreateForeignServerStmt = 171,
+ T_AlterForeignServerStmt = 172,
+ T_CreateForeignTableStmt = 173,
+ T_CreateUserMappingStmt = 174,
+ T_AlterUserMappingStmt = 175,
+ T_DropUserMappingStmt = 176,
+ T_ImportForeignSchemaStmt = 177,
+ T_CreatePolicyStmt = 178,
+ T_AlterPolicyStmt = 179,
+ T_CreateAmStmt = 180,
+ T_CreateTrigStmt = 181,
+ T_CreateEventTrigStmt = 182,
+ T_AlterEventTrigStmt = 183,
+ T_CreatePLangStmt = 184,
+ T_CreateRoleStmt = 185,
+ T_AlterRoleStmt = 186,
+ T_AlterRoleSetStmt = 187,
+ T_DropRoleStmt = 188,
+ T_CreateSeqStmt = 189,
+ T_AlterSeqStmt = 190,
+ T_DefineStmt = 191,
+ T_CreateDomainStmt = 192,
+ T_CreateOpClassStmt = 193,
+ T_CreateOpClassItem = 194,
+ T_CreateOpFamilyStmt = 195,
+ T_AlterOpFamilyStmt = 196,
+ T_DropStmt = 197,
+ T_TruncateStmt = 198,
+ T_CommentStmt = 199,
+ T_SecLabelStmt = 200,
+ T_DeclareCursorStmt = 201,
+ T_ClosePortalStmt = 202,
+ T_FetchStmt = 203,
+ T_IndexStmt = 204,
+ T_CreateStatsStmt = 205,
+ T_StatsElem = 206,
+ T_AlterStatsStmt = 207,
+ T_CreateFunctionStmt = 208,
+ T_FunctionParameter = 209,
+ T_AlterFunctionStmt = 210,
+ T_DoStmt = 211,
+ T_InlineCodeBlock = 212,
+ T_CallStmt = 213,
+ T_CallContext = 214,
+ T_RenameStmt = 215,
+ T_AlterObjectDependsStmt = 216,
+ T_AlterObjectSchemaStmt = 217,
+ T_AlterOwnerStmt = 218,
+ T_AlterOperatorStmt = 219,
+ T_AlterTypeStmt = 220,
+ T_RuleStmt = 221,
+ T_NotifyStmt = 222,
+ T_ListenStmt = 223,
+ T_UnlistenStmt = 224,
+ T_TransactionStmt = 225,
+ T_CompositeTypeStmt = 226,
+ T_CreateEnumStmt = 227,
+ T_CreateRangeStmt = 228,
+ T_AlterEnumStmt = 229,
+ T_ViewStmt = 230,
+ T_LoadStmt = 231,
+ T_CreatedbStmt = 232,
+ T_AlterDatabaseStmt = 233,
+ T_AlterDatabaseRefreshCollStmt = 234,
+ T_AlterDatabaseSetStmt = 235,
+ T_DropdbStmt = 236,
+ T_AlterSystemStmt = 237,
+ T_ClusterStmt = 238,
+ T_VacuumStmt = 239,
+ T_VacuumRelation = 240,
+ T_ExplainStmt = 241,
+ T_CreateTableAsStmt = 242,
+ T_RefreshMatViewStmt = 243,
+ T_CheckPointStmt = 244,
+ T_DiscardStmt = 245,
+ T_LockStmt = 246,
+ T_ConstraintsSetStmt = 247,
+ T_ReindexStmt = 248,
+ T_CreateConversionStmt = 249,
+ T_CreateCastStmt = 250,
+ T_CreateTransformStmt = 251,
+ T_PrepareStmt = 252,
+ T_ExecuteStmt = 253,
+ T_DeallocateStmt = 254,
+ T_DropOwnedStmt = 255,
+ T_ReassignOwnedStmt = 256,
+ T_AlterTSDictionaryStmt = 257,
+ T_AlterTSConfigurationStmt = 258,
+ T_PublicationTable = 259,
+ T_PublicationObjSpec = 260,
+ T_CreatePublicationStmt = 261,
+ T_AlterPublicationStmt = 262,
+ T_CreateSubscriptionStmt = 263,
+ T_AlterSubscriptionStmt = 264,
+ T_DropSubscriptionStmt = 265,
+ T_PlannerGlobal = 266,
+ T_PlannerInfo = 267,
+ T_RelOptInfo = 268,
+ T_IndexOptInfo = 269,
+ T_ForeignKeyOptInfo = 270,
+ T_StatisticExtInfo = 271,
+ T_JoinDomain = 272,
+ T_EquivalenceClass = 273,
+ T_EquivalenceMember = 274,
+ T_PathKey = 275,
+ T_GroupByOrdering = 276,
+ T_PathTarget = 277,
+ T_ParamPathInfo = 278,
+ T_Path = 279,
+ T_IndexPath = 280,
+ T_IndexClause = 281,
+ T_BitmapHeapPath = 282,
+ T_BitmapAndPath = 283,
+ T_BitmapOrPath = 284,
+ T_TidPath = 285,
+ T_TidRangePath = 286,
+ T_SubqueryScanPath = 287,
+ T_ForeignPath = 288,
+ T_CustomPath = 289,
+ T_AppendPath = 290,
+ T_MergeAppendPath = 291,
+ T_GroupResultPath = 292,
+ T_MaterialPath = 293,
+ T_MemoizePath = 294,
+ T_UniquePath = 295,
+ T_GatherPath = 296,
+ T_GatherMergePath = 297,
+ T_NestPath = 298,
+ T_MergePath = 299,
+ T_HashPath = 300,
+ T_ProjectionPath = 301,
+ T_ProjectSetPath = 302,
+ T_SortPath = 303,
+ T_IncrementalSortPath = 304,
+ T_GroupPath = 305,
+ T_UpperUniquePath = 306,
+ T_AggPath = 307,
+ T_GroupingSetData = 308,
+ T_RollupData = 309,
+ T_GroupingSetsPath = 310,
+ T_MinMaxAggPath = 311,
+ T_WindowAggPath = 312,
+ T_SetOpPath = 313,
+ T_RecursiveUnionPath = 314,
+ T_LockRowsPath = 315,
+ T_ModifyTablePath = 316,
+ T_LimitPath = 317,
+ T_RestrictInfo = 318,
+ T_PlaceHolderVar = 319,
+ T_SpecialJoinInfo = 320,
+ T_OuterJoinClauseInfo = 321,
+ T_AppendRelInfo = 322,
+ T_RowIdentityVarInfo = 323,
+ T_PlaceHolderInfo = 324,
+ T_MinMaxAggInfo = 325,
+ T_PlannerParamItem = 326,
+ T_AggInfo = 327,
+ T_AggTransInfo = 328,
+ T_UniqueRelInfo = 329,
+ T_PlannedStmt = 330,
+ T_Result = 331,
+ T_ProjectSet = 332,
+ T_ModifyTable = 333,
+ T_Append = 334,
+ T_MergeAppend = 335,
+ T_RecursiveUnion = 336,
+ T_BitmapAnd = 337,
+ T_BitmapOr = 338,
+ T_SeqScan = 339,
+ T_SampleScan = 340,
+ T_IndexScan = 341,
+ T_IndexOnlyScan = 342,
+ T_BitmapIndexScan = 343,
+ T_BitmapHeapScan = 344,
+ T_TidScan = 345,
+ T_TidRangeScan = 346,
+ T_SubqueryScan = 347,
+ T_FunctionScan = 348,
+ T_ValuesScan = 349,
+ T_TableFuncScan = 350,
+ T_CteScan = 351,
+ T_NamedTuplestoreScan = 352,
+ T_WorkTableScan = 353,
+ T_ForeignScan = 354,
+ T_CustomScan = 355,
+ T_NestLoop = 356,
+ T_NestLoopParam = 357,
+ T_MergeJoin = 358,
+ T_HashJoin = 359,
+ T_Material = 360,
+ T_Memoize = 361,
+ T_Sort = 362,
+ T_IncrementalSort = 363,
+ T_Group = 364,
+ T_Agg = 365,
+ T_WindowAgg = 366,
+ T_Unique = 367,
+ T_Gather = 368,
+ T_GatherMerge = 369,
+ T_Hash = 370,
+ T_SetOp = 371,
+ T_LockRows = 372,
+ T_Limit = 373,
+ T_PlanRowMark = 374,
+ T_PartitionPruneInfo = 375,
+ T_PartitionedRelPruneInfo = 376,
+ T_PartitionPruneStepOp = 377,
+ T_PartitionPruneStepCombine = 378,
+ T_PlanInvalItem = 379,
+ T_ExprState = 380,
+ T_IndexInfo = 381,
+ T_ExprContext = 382,
+ T_ReturnSetInfo = 383,
+ T_ProjectionInfo = 384,
+ T_JunkFilter = 385,
+ T_OnConflictSetState = 386,
+ T_MergeActionState = 387,
+ T_ResultRelInfo = 388,
+ T_EState = 389,
+ T_WindowFuncExprState = 390,
+ T_SetExprState = 391,
+ T_SubPlanState = 392,
+ T_DomainConstraintState = 393,
+ T_ResultState = 394,
+ T_ProjectSetState = 395,
+ T_ModifyTableState = 396,
+ T_AppendState = 397,
+ T_MergeAppendState = 398,
+ T_RecursiveUnionState = 399,
+ T_BitmapAndState = 400,
+ T_BitmapOrState = 401,
+ T_ScanState = 402,
+ T_SeqScanState = 403,
+ T_SampleScanState = 404,
+ T_IndexScanState = 405,
+ T_IndexOnlyScanState = 406,
+ T_BitmapIndexScanState = 407,
+ T_BitmapHeapScanState = 408,
+ T_TidScanState = 409,
+ T_TidRangeScanState = 410,
+ T_SubqueryScanState = 411,
+ T_FunctionScanState = 412,
+ T_ValuesScanState = 413,
+ T_TableFuncScanState = 414,
+ T_CteScanState = 415,
+ T_NamedTuplestoreScanState = 416,
+ T_WorkTableScanState = 417,
+ T_ForeignScanState = 418,
+ T_CustomScanState = 419,
+ T_JoinState = 420,
+ T_NestLoopState = 421,
+ T_MergeJoinState = 422,
+ T_HashJoinState = 423,
+ T_MaterialState = 424,
+ T_MemoizeState = 425,
+ T_SortState = 426,
+ T_IncrementalSortState = 427,
+ T_GroupState = 428,
+ T_AggState = 429,
+ T_WindowAggState = 430,
+ T_UniqueState = 431,
+ T_GatherState = 432,
+ T_GatherMergeState = 433,
+ T_HashState = 434,
+ T_SetOpState = 435,
+ T_LockRowsState = 436,
+ T_LimitState = 437,
+ T_IndexAmRoutine = 438,
+ T_TableAmRoutine = 439,
+ T_TsmRoutine = 440,
+ T_EventTriggerData = 441,
+ T_TriggerData = 442,
+ T_TupleTableSlot = 443,
+ T_FdwRoutine = 444,
+ T_Bitmapset = 445,
+ T_ExtensibleNode = 446,
+ T_ErrorSaveContext = 447,
+ T_IdentifySystemCmd = 448,
+ T_BaseBackupCmd = 449,
+ T_CreateReplicationSlotCmd = 450,
+ T_DropReplicationSlotCmd = 451,
+ T_AlterReplicationSlotCmd = 452,
+ T_StartReplicationCmd = 453,
+ T_ReadReplicationSlotCmd = 454,
+ T_TimeLineHistoryCmd = 455,
+ T_UploadManifestCmd = 456,
+ T_SupportRequestSimplify = 457,
+ T_SupportRequestSelectivity = 458,
+ T_SupportRequestCost = 459,
+ T_SupportRequestRows = 460,
+ T_SupportRequestIndexCondition = 461,
+ T_SupportRequestWFuncMonotonic = 462,
+ T_SupportRequestOptimizeWindowClause = 463,
+ T_SupportRequestModifyInPlace = 464,
+ T_Integer = 465,
+ T_Float = 466,
+ T_Boolean = 467,
+ T_String = 468,
+ T_BitString = 469,
+ T_ForeignKeyCacheInfo = 470,
+ T_IntList = 471,
+ T_OidList = 472,
+ T_XidList = 473,
+ T_AllocSetContext = 474,
+ T_GenerationContext = 475,
+ T_SlabContext = 476,
+ T_BumpContext = 477,
+ T_TIDBitmap = 478,
+ T_WindowObjectData = 479,
diff --git a/src/include/parser/parsenodes.h b/src/include/parser/parsenodes.h
index cf0ee5bcd..7608230b9 100644
--- a/src/include/parser/parsenodes.h
+++ b/src/include/parser/parsenodes.h
@@ -12,8 +12,8 @@
* identifying statement boundaries in multi-statement source strings.
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/nodes/parsenodes.h
@@ -132,8 +132,13 @@ typedef struct Query
* query identifier (can be set by plugins); ignored for equal, as it
* might not be set; also not stored. This is the result of the query
* jumble, hence ignored.
+ *
+ * We store this as a signed value as this is the form it's displayed to
+ * users in places such as EXPLAIN and pg_stat_statements. Primarily this
+ * is done due to lack of an SQL type to represent the full range of
+ * uint64.
*/
- uint64 queryId pg_node_attr(equal_ignore, query_jumble_ignore, read_write_ignore, read_as(0));
+ int64 queryId pg_node_attr(equal_ignore, query_jumble_ignore, read_write_ignore, read_as(0));
/* do I set the command result tag? */
bool canSetTag pg_node_attr(query_jumble_ignore);
@@ -165,6 +170,8 @@ typedef struct Query
bool hasForUpdate pg_node_attr(query_jumble_ignore);
/* rewriter has applied some RLS policy */
bool hasRowSecurity pg_node_attr(query_jumble_ignore);
+ /* parser has added an RTE_GROUP RTE */
+ bool hasGroupRTE pg_node_attr(query_jumble_ignore);
/* is a RETURN statement */
bool isReturn pg_node_attr(query_jumble_ignore);
@@ -200,6 +207,15 @@ typedef struct Query
OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */
+ /*
+ * The following three fields describe the contents of the RETURNING list
+ * for INSERT/UPDATE/DELETE/MERGE. returningOldAlias and returningNewAlias
+ * are the alias names for OLD and NEW, which may be user-supplied values,
+ * the defaults "old" and "new", or NULL (if the default "old"/"new" is
+ * already in use as the alias for some other relation).
+ */
+ char *returningOldAlias pg_node_attr(query_jumble_ignore);
+ char *returningNewAlias pg_node_attr(query_jumble_ignore);
List *returningList; /* return-values list (of TargetEntry) */
List *groupClause; /* a list of SortGroupClause's */
@@ -340,6 +356,14 @@ typedef struct A_Expr
List *name; /* possibly-qualified name of operator */
Node *lexpr; /* left argument, or NULL if none */
Node *rexpr; /* right argument, or NULL if none */
+
+ /*
+ * If rexpr is a list of some kind, we separately track its starting and
+ * ending location; it's not the same as the starting and ending location
+ * of the token itself.
+ */
+ ParseLoc rexpr_list_start;
+ ParseLoc rexpr_list_end;
ParseLoc location; /* token location, or -1 if unknown */
} A_Expr;
@@ -495,6 +519,8 @@ typedef struct A_ArrayExpr
{
NodeTag type;
List *elements; /* array element expressions */
+ ParseLoc list_start; /* start of the element list */
+ ParseLoc list_end; /* end of the elements list */
ParseLoc location; /* token location, or -1 if unknown */
} A_ArrayExpr;
@@ -731,7 +757,7 @@ typedef struct ColumnDef
char *colname; /* name of column */
TypeName *typeName; /* type of column */
char *compression; /* compression method for column */
- int inhcount; /* number of times column is inherited */
+ int16 inhcount; /* number of times column is inherited */
bool is_local; /* column has local (non-inherited) def'n */
bool is_not_null; /* NOT NULL constraint specified? */
bool is_from_type; /* column definition came from table type */
@@ -942,16 +968,6 @@ typedef struct PartitionRangeDatum
ParseLoc location; /* token location, or -1 if unknown */
} PartitionRangeDatum;
-/*
- * PartitionDesc - used in reverted ALTER TABLE SPLIT PARTITION command
- *
- * Kept as a stub for nodetag ABI compatibility.
- */
-typedef struct SinglePartitionSpec
-{
- NodeTag type;
-} SinglePartitionSpec;
-
/*
* PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION commands
*/
@@ -1038,6 +1054,7 @@ typedef enum RTEKind
RTE_RESULT, /* RTE represents an empty FROM clause; such
* RTEs are added by the planner, they're not
* present during parsing or rewriting */
+ RTE_GROUP, /* the grouping step */
} RTEKind;
typedef struct RangeTblEntry
@@ -1053,8 +1070,13 @@ typedef struct RangeTblEntry
*/
/* user-written alias clause, if any */
Alias *alias pg_node_attr(query_jumble_ignore);
- /* expanded reference names */
- Alias *eref pg_node_attr(query_jumble_ignore);
+
+ /*
+ * Expanded reference names. This uses a custom query jumble function so
+ * that the table name is included in the computation, but not its list of
+ * columns.
+ */
+ Alias *eref pg_node_attr(custom_query_jumble);
RTEKind rtekind; /* see above */
@@ -1097,7 +1119,7 @@ typedef struct RangeTblEntry
* tables to be invalidated if the underlying table is altered.
*/
/* OID of the relation */
- Oid relid;
+ Oid relid pg_node_attr(query_jumble_ignore);
/* inheritance requested? */
bool inh;
/* relation kind (see pg_class.relkind) */
@@ -1244,6 +1266,12 @@ typedef struct RangeTblEntry
/* estimated or actual from caller */
Cardinality enrtuples pg_node_attr(query_jumble_ignore);
+ /*
+ * Fields valid for a GROUP RTE (else NIL):
+ */
+ /* list of grouping expressions */
+ List *groupexprs pg_node_attr(query_jumble_ignore);
+
/*
* Fields valid in all RTEs:
*/
@@ -1444,6 +1472,7 @@ typedef struct SortGroupClause
Index tleSortGroupRef; /* reference into targetlist */
Oid eqop; /* the equality operator ('=' op) */
Oid sortop; /* the ordering operator ('<' op), or 0 */
+ bool reverse_sort; /* is sortop a "greater than" operator? */
bool nulls_first; /* do NULLs come before normal values? */
/* can eqop be implemented by hashing? */
bool hashable pg_node_attr(query_jumble_ignore);
@@ -1731,6 +1760,41 @@ typedef struct MergeWhenClause
List *values; /* VALUES to INSERT, or NULL */
} MergeWhenClause;
+/*
+ * ReturningOptionKind -
+ * Possible kinds of option in RETURNING WITH(...) list
+ *
+ * Currently, this is used only for specifying OLD/NEW aliases.
+ */
+typedef enum ReturningOptionKind
+{
+ RETURNING_OPTION_OLD, /* specify alias for OLD in RETURNING */
+ RETURNING_OPTION_NEW, /* specify alias for NEW in RETURNING */
+} ReturningOptionKind;
+
+/*
+ * ReturningOption -
+ * An individual option in the RETURNING WITH(...) list
+ */
+typedef struct ReturningOption
+{
+ NodeTag type;
+ ReturningOptionKind option; /* specified option */
+ char *value; /* option's value */
+ ParseLoc location; /* token location, or -1 if unknown */
+} ReturningOption;
+
+/*
+ * ReturningClause -
+ * List of RETURNING expressions, together with any WITH(...) options
+ */
+typedef struct ReturningClause
+{
+ NodeTag type;
+ List *options; /* list of ReturningOption elements */
+ List *exprs; /* list of expressions to return */
+} ReturningClause;
+
/*
* TriggerTransition -
* representation of transition row or table naming clause
@@ -2048,7 +2112,7 @@ typedef struct InsertStmt
List *cols; /* optional: names of the target columns */
Node *selectStmt; /* the source SELECT/VALUES, or NULL */
OnConflictClause *onConflictClause; /* ON CONFLICT clause */
- List *returningList; /* list of expressions to return */
+ ReturningClause *returningClause; /* RETURNING clause */
WithClause *withClause; /* WITH clause */
OverridingKind override; /* OVERRIDING clause */
} InsertStmt;
@@ -2063,7 +2127,7 @@ typedef struct DeleteStmt
RangeVar *relation; /* relation to delete from */
List *usingClause; /* optional using clause for more tables */
Node *whereClause; /* qualifications */
- List *returningList; /* list of expressions to return */
+ ReturningClause *returningClause; /* RETURNING clause */
WithClause *withClause; /* WITH clause */
} DeleteStmt;
@@ -2078,7 +2142,7 @@ typedef struct UpdateStmt
List *targetList; /* the target list (of ResTarget) */
Node *whereClause; /* qualifications */
List *fromClause; /* optional from clause for more tables */
- List *returningList; /* list of expressions to return */
+ ReturningClause *returningClause; /* RETURNING clause */
WithClause *withClause; /* WITH clause */
} UpdateStmt;
@@ -2093,7 +2157,7 @@ typedef struct MergeStmt
Node *sourceRelation; /* source relation */
Node *joinCondition; /* join condition between source and target */
List *mergeWhenClauses; /* list of MergeWhenClause(es) */
- List *returningList; /* list of expressions to return */
+ ReturningClause *returningClause; /* RETURNING clause */
WithClause *withClause; /* WITH clause */
} MergeStmt;
@@ -2360,7 +2424,6 @@ typedef enum AlterTableType
AT_SetNotNull, /* alter column set not null */
AT_SetExpression, /* alter column set expression */
AT_DropExpression, /* alter column drop expression */
- AT_CheckNotNull, /* check column is already marked not null */
AT_SetStatistics, /* alter column set statistics */
AT_SetOptions, /* alter column set ( options ) */
AT_ResetOptions, /* alter column reset ( options ) */
@@ -2421,13 +2484,6 @@ typedef enum AlterTableType
AT_ReAddStatistics, /* internal to commands/tablecmds.c */
} AlterTableType;
-typedef struct ReplicaIdentityStmt
-{
- NodeTag type;
- char identity_type;
- char *name;
-} ReplicaIdentityStmt;
-
typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
{
NodeTag type;
@@ -2444,6 +2500,28 @@ typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
bool recurse; /* exec-time recursion */
} AlterTableCmd;
+/* Ad-hoc node for AT_AlterConstraint */
+typedef struct ATAlterConstraint
+{
+ NodeTag type;
+ char *conname; /* Constraint name */
+ bool alterEnforceability; /* changing enforceability properties? */
+ bool is_enforced; /* ENFORCED? */
+ bool alterDeferrability; /* changing deferrability properties? */
+ bool deferrable; /* DEFERRABLE? */
+ bool initdeferred; /* INITIALLY DEFERRED? */
+ bool alterInheritability; /* changing inheritability properties */
+ bool noinherit;
+} ATAlterConstraint;
+
+/* Ad-hoc node for AT_ReplicaIdentity */
+typedef struct ReplicaIdentityStmt
+{
+ NodeTag type;
+ char identity_type;
+ char *name;
+} ReplicaIdentityStmt;
+
/* ----------------------
* Alter Collation
@@ -2622,11 +2700,26 @@ typedef enum VariableSetKind
typedef struct VariableSetStmt
{
+ pg_node_attr(custom_query_jumble)
+
NodeTag type;
VariableSetKind kind;
- char *name; /* variable to be set */
- List *args; /* List of A_Const nodes */
- bool is_local; /* SET LOCAL? */
+ /* variable to be set */
+ char *name;
+ /* List of A_Const nodes */
+ List *args;
+
+ /*
+ * True if arguments should be accounted for in query jumbling. We use a
+ * separate flag rather than query_jumble_ignore on "args" as several
+ * grammar flavors of SET rely on a list of values that are parsed
+ * directly from the grammar's keywords.
+ */
+ bool jumble_args;
+ /* SET LOCAL? */
+ bool is_local;
+ /* token location, or -1 if unknown */
+ ParseLoc location pg_node_attr(query_jumble_location);
} VariableSetStmt;
/* ----------------------
@@ -2643,10 +2736,10 @@ typedef struct VariableShowStmt
* Create Table Statement
*
* NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are
- * intermixed in tableElts, and constraints is NIL. After parse analysis,
- * tableElts contains just ColumnDefs, and constraints contains just
- * Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present
- * implementation).
+ * intermixed in tableElts, and constraints and nnconstraints are NIL. After
+ * parse analysis, tableElts contains just ColumnDefs, nnconstraints contains
+ * Constraint nodes of CONSTR_NOTNULL type from various sources, and
+ * constraints contains just CONSTR_CHECK Constraint nodes.
* ----------------------
*/
@@ -2661,6 +2754,7 @@ typedef struct CreateStmt
PartitionSpec *partspec; /* PARTITION BY clause */
TypeName *ofTypename; /* OF typename */
List *constraints; /* constraints (list of Constraint nodes) */
+ List *nnconstraints; /* NOT NULL constraints (ditto) */
List *options; /* options from WITH clause */
OnCommitAction oncommit; /* what do we do at COMMIT? */
char *tablespacename; /* table space to use, or NULL */
@@ -2716,6 +2810,8 @@ typedef enum ConstrType /* types of constraints */
CONSTR_ATTR_NOT_DEFERRABLE,
CONSTR_ATTR_DEFERRED,
CONSTR_ATTR_IMMEDIATE,
+ CONSTR_ATTR_ENFORCED,
+ CONSTR_ATTR_NOT_ENFORCED,
} ConstrType;
/* Foreign key action codes */
@@ -2737,6 +2833,7 @@ typedef struct Constraint
char *conname; /* Constraint name, or NULL if unnamed */
bool deferrable; /* DEFERRABLE? */
bool initdeferred; /* INITIALLY DEFERRED? */
+ bool is_enforced; /* enforced constraint? */
bool skip_validation; /* skip validation of existing rows? */
bool initially_valid; /* mark the new constraint as valid? */
bool is_no_inherit; /* is constraint non-inheritable? */
@@ -2745,11 +2842,11 @@ typedef struct Constraint
char *cooked_expr; /* CHECK or DEFAULT expression, as
* nodeToString representation */
char generated_when; /* ALWAYS or BY DEFAULT */
- int inhcount; /* initial inheritance count to apply, for
- * "raw" NOT NULL constraints */
+ char generated_kind; /* STORED or VIRTUAL */
bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
List *keys; /* String nodes naming referenced key
* column(s); for UNIQUE/PK/NOT NULL */
+ bool without_overlaps; /* WITHOUT OVERLAPS specified */
List *including; /* String nodes naming referenced nonkey
* column(s); for UNIQUE/PK */
List *exclusions; /* list of (IndexElem, operator name) pairs;
@@ -2766,6 +2863,8 @@ typedef struct Constraint
RangeVar *pktable; /* Primary key table */
List *fk_attrs; /* Attributes of foreign key */
List *pk_attrs; /* Corresponding attrs in PK table */
+ bool fk_with_period; /* Last attribute of FK uses PERIOD */
+ bool pk_with_period; /* Last attribute of PK uses PERIOD */
char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
char fk_upd_action; /* ON UPDATE action */
char fk_del_action; /* ON DELETE action */
@@ -3373,6 +3472,7 @@ typedef struct IndexStmt
bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
bool primary; /* is index a primary key? */
bool isconstraint; /* is it for a pkey/unique constraint? */
+ bool iswithoutoverlaps; /* is the constraint WITHOUT OVERLAPS? */
bool deferrable; /* is the constraint DEFERRABLE? */
bool initdeferred; /* is the constraint INITIALLY DEFERRED? */
bool transformed; /* true when transformIndexStmt is finished */
@@ -3460,6 +3560,7 @@ typedef struct FunctionParameter
TypeName *argType; /* TypeName for parameter type */
FunctionParameterMode mode; /* IN/OUT/etc */
Node *defexpr; /* raw default expr, or NULL if not given */
+ ParseLoc location; /* token location, or -1 if unknown */
} FunctionParameter;
typedef struct AlterFunctionStmt
diff --git a/src/include/parser/parser.h b/src/include/parser/parser.h
index e412c438e..70a08f145 100644
--- a/src/include/parser/parser.h
+++ b/src/include/parser/parser.h
@@ -5,8 +5,8 @@
*
* This is the external API for the raw lexing/parsing functions.
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/parser/parser.h
diff --git a/src/include/parser/pg_class.h b/src/include/parser/pg_class.h
index 7ebf4c439..781ae00e9 100644
--- a/src/include/parser/pg_class.h
+++ b/src/include/parser/pg_class.h
@@ -4,8 +4,8 @@
* definition of the "relation" system catalog (pg_class)
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_class.h
@@ -22,7 +22,7 @@
#if 0 /* NOT_USED_IN_PGPOOL */
#include "catalog/genbki.h"
-#include "catalog/pg_class_d.h"
+#include "catalog/pg_class_d.h" /* IWYU pragma: export */
CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,RelationRelation_Rowtype_Id) BKI_SCHEMA_MACRO
{
@@ -63,6 +63,9 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat
/* # of all-visible blocks (not always up-to-date) */
int32 relallvisible BKI_DEFAULT(0);
+ /* # of all-frozen blocks (not always up-to-date) */
+ int32 relallfrozen BKI_DEFAULT(0);
+
/* OID of toast table; 0 if none */
Oid reltoastrelid BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_class);
@@ -227,7 +230,7 @@ MAKE_SYSCACHE(RELNAMENSP, pg_class_relname_nsp_index, 128);
(relkind) == RELKIND_TOASTVALUE || \
(relkind) == RELKIND_MATVIEW)
-extern int errdetail_relkind_not_supported(char relkind);
+extern int errdetail_relkind_not_supported(char relkind);
#endif /* NOT_USED_IN_PGPOOL */
diff --git a/src/include/parser/pg_config_manual.h b/src/include/parser/pg_config_manual.h
index f522dc2a0..cbea7dc1d 100644
--- a/src/include/parser/pg_config_manual.h
+++ b/src/include/parser/pg_config_manual.h
@@ -6,8 +6,8 @@
* for developers. If you edit any of these, be sure to do a *full*
* rebuild (and an initdb if noted).
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/pg_config_manual.h
@@ -104,21 +104,6 @@
#define USE_FLOAT8_BYVAL 1
#endif
-/*
- * When we don't have native spinlocks, we use semaphores to simulate them.
- * Decreasing this value reduces consumption of OS resources; increasing it
- * may improve performance, but supplying a real spinlock implementation is
- * probably far better.
- */
-#define NUM_SPINLOCK_SEMAPHORES 128
-
-/*
- * When we have neither spinlocks nor atomic operations support we're
- * implementing atomic operations on top of spinlock on top of semaphores. To
- * be safe against atomic operations while holding a spinlock separate
- * semaphores have to be used.
- */
-#define NUM_ATOMICS_SEMAPHORES 64
/*
* MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence,
@@ -172,9 +157,8 @@
/*
* USE_PREFETCH code should be compiled only if we have a way to implement
* prefetching. (This is decoupled from USE_POSIX_FADVISE because there
- * might in future be support for alternative low-level prefetch APIs.
- * If you change this, you probably need to adjust the error message in
- * check_effective_io_concurrency.)
+ * might in future be support for alternative low-level prefetch APIs,
+ * as well as platform-specific APIs defined elsewhere.)
*/
#ifdef USE_POSIX_FADVISE
#define USE_PREFETCH
@@ -316,10 +300,10 @@
/*
* For cache-invalidation debugging, define DISCARD_CACHES_ENABLED to enable
- * use of the debug_discard_caches GUC to aggressively flush syscache/relcache
- * entries whenever it's possible to deliver invalidations. See
- * AcceptInvalidationMessages() in src/backend/utils/cache/inval.c for
- * details.
+ * use of the debug_discard_caches GUC to aggressively flush
+ * syscache/relcache/relsynccache entries whenever it's possible to deliver
+ * invalidations. See AcceptInvalidationMessages() in
+ * src/backend/utils/cache/inval.c for details.
*
* USE_ASSERT_CHECKING builds default to enabling this. It's possible to use
* DISCARD_CACHES_ENABLED without a cassert build and the implied
@@ -354,31 +338,31 @@
/* #define RECOVER_RELATION_BUILD_MEMORY 1 */ /* Force enable */
/*
- * Define this to force all parse and plan trees to be passed through
- * copyObject(), to facilitate catching errors and omissions in
- * copyObject().
+ * Define DEBUG_NODE_TESTS_ENABLED to enable use of the GUCs
+ * debug_copy_parse_plan_trees, debug_write_read_parse_plan_trees, and
+ * debug_raw_expression_coverage_test, to test coverage of node support
+ * functions in src/backend/nodes/.
+ *
+ * USE_ASSERT_CHECKING builds default to enabling this.
*/
-/* #define COPY_PARSE_PLAN_TREES */
+/* #define DEBUG_NODE_TESTS_ENABLED */
-/*
- * Define this to force Bitmapset reallocation on each modification. Helps
- * to find dangling pointers to Bitmapset's.
- */
-/* #define REALLOCATE_BITMAPSETS */
+#if defined(USE_ASSERT_CHECKING) && !defined(DEBUG_NODE_TESTS_ENABLED)
+#define DEBUG_NODE_TESTS_ENABLED
+#endif
/*
- * Define this to force all parse and plan trees to be passed through
- * outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in
- * those modules.
+ * Backwards compatibility for the older compile-time-only node-tests macros.
*/
-/* #define WRITE_READ_PARSE_PLAN_TREES */
+#if !defined(DEBUG_NODE_TESTS_ENABLED) && (defined(COPY_PARSE_PLAN_TREES) || defined(WRITE_READ_PARSE_PLAN_TREES) || defined(RAW_EXPRESSION_COVERAGE_TEST))
+#define DEBUG_NODE_TESTS_ENABLED
+#endif
/*
- * Define this to force all raw parse trees for DML statements to be scanned
- * by raw_expression_tree_walker(), to facilitate catching errors and
- * omissions in that function.
+ * Define this to force Bitmapset reallocation on each modification. Helps
+ * to find dangling pointers to Bitmapset's.
*/
-/* #define RAW_EXPRESSION_COVERAGE_TEST */
+/* #define REALLOCATE_BITMAPSETS */
/*
* Define this to force all raw parse trees for DML statements to be scanned
@@ -398,12 +382,6 @@
*/
/* #define WAL_DEBUG */
-/*
- * Enable tracing of resource consumption during sort operations;
- * see also the trace_sort GUC var. For 8.1 this is enabled by default.
- */
-#define TRACE_SORT 1
-
/*
* Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
*/
diff --git a/src/include/parser/pg_list.h b/src/include/parser/pg_list.h
index 4a63a466d..99f334b84 100644
--- a/src/include/parser/pg_list.h
+++ b/src/include/parser/pg_list.h
@@ -29,8 +29,8 @@
* always be so; be careful to use the appropriate list type for your data.)
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/nodes/pg_list.h
@@ -493,7 +493,7 @@ for_each_cell_setup(const List *lst, const ListCell *initcell)
for (ForEachState var##__state = {(lst), 0}; \
(var##__state.l != NIL && \
var##__state.i < var##__state.l->length && \
- (var = func(&var##__state.l->elements[var##__state.i]), true)); \
+ (var = (type pointer) func(&var##__state.l->elements[var##__state.i]), true)); \
var##__state.i++)
/*
@@ -630,23 +630,23 @@ extern List *list_make5_impl(NodeTag t, ListCell datum1, ListCell datum2,
#define pg_nodiscard
#endif
-extern pg_nodiscard List *lappend(List *list, void *datum);
-extern pg_nodiscard List *lappend_int(List *list, int datum);
-extern pg_nodiscard List *lappend_oid(List *list, Oid datum);
-extern pg_nodiscard List *lappend_xid(List *list, TransactionId datum);
+pg_nodiscard extern List *lappend(List *list, void *datum);
+pg_nodiscard extern List *lappend_int(List *list, int datum);
+pg_nodiscard extern List *lappend_oid(List *list, Oid datum);
+pg_nodiscard extern List *lappend_xid(List *list, TransactionId datum);
-extern pg_nodiscard List *list_insert_nth(List *list, int pos, void *datum);
-extern pg_nodiscard List *list_insert_nth_int(List *list, int pos, int datum);
-extern pg_nodiscard List *list_insert_nth_oid(List *list, int pos, Oid datum);
+pg_nodiscard extern List *list_insert_nth(List *list, int pos, void *datum);
+pg_nodiscard extern List *list_insert_nth_int(List *list, int pos, int datum);
+pg_nodiscard extern List *list_insert_nth_oid(List *list, int pos, Oid datum);
-extern pg_nodiscard List *lcons(void *datum, List *list);
-extern pg_nodiscard List *lcons_int(int datum, List *list);
-extern pg_nodiscard List *lcons_oid(Oid datum, List *list);
+pg_nodiscard extern List *lcons(void *datum, List *list);
+pg_nodiscard extern List *lcons_int(int datum, List *list);
+pg_nodiscard extern List *lcons_oid(Oid datum, List *list);
-extern pg_nodiscard List *list_concat(List *list1, const List *list2);
-extern pg_nodiscard List *list_concat_copy(const List *list1, const List *list2);
+pg_nodiscard extern List *list_concat(List *list1, const List *list2);
+pg_nodiscard extern List *list_concat_copy(const List *list1, const List *list2);
-extern pg_nodiscard List *list_truncate(List *list, int new_size);
+pg_nodiscard extern List *list_truncate(List *list, int new_size);
extern bool list_member(const List *list, const void *datum);
extern bool list_member_ptr(const List *list, const void *datum);
@@ -654,15 +654,15 @@ extern bool list_member_int(const List *list, int datum);
extern bool list_member_oid(const List *list, Oid datum);
extern bool list_member_xid(const List *list, TransactionId datum);
-extern pg_nodiscard List *list_delete(List *list, void *datum);
-extern pg_nodiscard List *list_delete_ptr(List *list, void *datum);
-extern pg_nodiscard List *list_delete_int(List *list, int datum);
-extern pg_nodiscard List *list_delete_oid(List *list, Oid datum);
-extern pg_nodiscard List *list_delete_first(List *list);
-extern pg_nodiscard List *list_delete_last(List *list);
-extern pg_nodiscard List *list_delete_first_n(List *list, int n);
-extern pg_nodiscard List *list_delete_nth_cell(List *list, int n);
-extern pg_nodiscard List *list_delete_cell(List *list, ListCell *cell);
+pg_nodiscard extern List *list_delete(List *list, void *datum);
+pg_nodiscard extern List *list_delete_ptr(List *list, void *datum);
+pg_nodiscard extern List *list_delete_int(List *list, int datum);
+pg_nodiscard extern List *list_delete_oid(List *list, Oid datum);
+pg_nodiscard extern List *list_delete_first(List *list);
+pg_nodiscard extern List *list_delete_last(List *list);
+pg_nodiscard extern List *list_delete_first_n(List *list, int n);
+pg_nodiscard extern List *list_delete_nth_cell(List *list, int n);
+pg_nodiscard extern List *list_delete_cell(List *list, ListCell *cell);
extern List *list_union(const List *list1, const List *list2);
extern List *list_union_ptr(const List *list1, const List *list2);
@@ -679,25 +679,25 @@ extern List *list_difference_ptr(const List *list1, const List *list2);
extern List *list_difference_int(const List *list1, const List *list2);
extern List *list_difference_oid(const List *list1, const List *list2);
-extern pg_nodiscard List *list_append_unique(List *list, void *datum);
-extern pg_nodiscard List *list_append_unique_ptr(List *list, void *datum);
-extern pg_nodiscard List *list_append_unique_int(List *list, int datum);
-extern pg_nodiscard List *list_append_unique_oid(List *list, Oid datum);
+pg_nodiscard extern List *list_append_unique(List *list, void *datum);
+pg_nodiscard extern List *list_append_unique_ptr(List *list, void *datum);
+pg_nodiscard extern List *list_append_unique_int(List *list, int datum);
+pg_nodiscard extern List *list_append_unique_oid(List *list, Oid datum);
-extern pg_nodiscard List *list_concat_unique(List *list1, const List *list2);
-extern pg_nodiscard List *list_concat_unique_ptr(List *list1, const List *list2);
-extern pg_nodiscard List *list_concat_unique_int(List *list1, const List *list2);
-extern pg_nodiscard List *list_concat_unique_oid(List *list1, const List *list2);
+pg_nodiscard extern List *list_concat_unique(List *list1, const List *list2);
+pg_nodiscard extern List *list_concat_unique_ptr(List *list1, const List *list2);
+pg_nodiscard extern List *list_concat_unique_int(List *list1, const List *list2);
+pg_nodiscard extern List *list_concat_unique_oid(List *list1, const List *list2);
extern void list_deduplicate_oid(List *list);
extern void list_free(List *list);
extern void list_free_deep(List *list);
-extern pg_nodiscard List *list_copy(const List *oldlist);
-extern pg_nodiscard List *list_copy_head(const List *oldlist, int len);
-extern pg_nodiscard List *list_copy_tail(const List *oldlist, int nskip);
-extern pg_nodiscard List *list_copy_deep(const List *oldlist);
+pg_nodiscard extern List *list_copy(const List *oldlist);
+pg_nodiscard extern List *list_copy_head(const List *oldlist, int len);
+pg_nodiscard extern List *list_copy_tail(const List *oldlist, int nskip);
+pg_nodiscard extern List *list_copy_deep(const List *oldlist);
typedef int (*list_sort_comparator) (const ListCell *a, const ListCell *b);
extern void list_sort(List *list, list_sort_comparator cmp);
diff --git a/src/include/parser/pg_trigger.h b/src/include/parser/pg_trigger.h
index 745fe049a..daec329dd 100644
--- a/src/include/parser/pg_trigger.h
+++ b/src/include/parser/pg_trigger.h
@@ -4,8 +4,8 @@
* definition of the "trigger" system catalog (pg_trigger)
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_trigger.h
@@ -21,7 +21,7 @@
#if 0
#include "catalog/genbki.h"
-#include "catalog/pg_trigger_d.h"
+#include "catalog/pg_trigger_d.h" /* IWYU pragma: export */
/* ----------------
* pg_trigger definition. cpp turns this into
diff --git a/src/include/parser/pg_wchar.h b/src/include/parser/pg_wchar.h
index 59582d1ff..8612afd07 100644
--- a/src/include/parser/pg_wchar.h
+++ b/src/include/parser/pg_wchar.h
@@ -3,8 +3,8 @@
* pg_wchar.h
* multibyte-character support
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/mb/pg_wchar.h
@@ -663,7 +663,10 @@ extern int pg_valid_server_encoding_id(int encoding);
* (in addition to the ones just above). The constant tables declared
* earlier in this file are also available from libpgcommon.
*/
+extern void pg_encoding_set_invalid(int encoding, char *dst);
extern int pg_encoding_mblen(int encoding, const char *mbstr);
+extern int pg_encoding_mblen_or_incomplete(int encoding, const char *mbstr,
+ size_t remaining);
extern int pg_encoding_mblen_bounded(int encoding, const char *mbstr);
extern int pg_encoding_dsplen(int encoding, const char *mbstr);
extern int pg_encoding_verifymbchar(int encoding, const char *mbstr, int len);
@@ -768,9 +771,9 @@ extern void check_encoding_conversion_args(int src_encoding,
int expected_src_encoding,
int expected_dest_encoding);
-extern void report_invalid_encoding(int encoding, const char *mbstr, int len) pg_attribute_noreturn();
-extern void report_untranslatable_char(int src_encoding, int dest_encoding,
- const char *mbstr, int len) pg_attribute_noreturn();
+pg_noreturn extern void report_invalid_encoding(int encoding, const char *mbstr, int len);
+pg_noreturn extern void report_untranslatable_char(int src_encoding, int dest_encoding,
+ const char *mbstr, int len);
extern int local2local(const unsigned char *l, unsigned char *p, int len,
int src_encoding, int dest_encoding,
diff --git a/src/include/parser/pool_parser.h b/src/include/parser/pool_parser.h
index f10a9f8da..6ea19070f 100644
--- a/src/include/parser/pool_parser.h
+++ b/src/include/parser/pool_parser.h
@@ -66,6 +66,26 @@ typedef unsigned int Index;
*/
#define endof(array) (&(array)[lengthof(array)])
+/*
+ * pg_noreturn corresponds to the C11 noreturn/_Noreturn function specifier.
+ * We can't use the standard name "noreturn" because some third-party code
+ * uses __attribute__((noreturn)) in headers, which would get confused if
+ * "noreturn" is defined to "_Noreturn", as is done by <stdnoreturn.h>.
+ *
+ * In a declaration, function specifiers go before the function name. The
+ * common style is to put them before the return type. (The MSVC fallback has
+ * the same requirement. The GCC fallback is more flexible.)
+ */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+#define pg_noreturn _Noreturn
+#elif defined(__GNUC__) || defined(__SUNPRO_C)
+#define pg_noreturn __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define pg_noreturn __declspec(noreturn)
+#else
+#define pg_noreturn
+#endif
+
/* GCC and XLC support format attributes */
#if defined(__GNUC__) || defined(__IBMC__)
#define pg_attribute_format_arg(a) __attribute__((format_arg(a)))
@@ -78,16 +98,13 @@ typedef unsigned int Index;
/* GCC, Sunpro and XLC support aligned, packed and noreturn */
#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
-#define pg_attribute_noreturn() __attribute__((noreturn))
#define pg_attribute_packed() __attribute__((packed))
-#define HAVE_PG_ATTRIBUTE_NORETURN 1
#else
/*
* NB: aligned and packed are not given default definitions because they
* affect code functionality; they *must* be implemented by the compiler
* if they are to be used.
*/
-#define pg_attribute_noreturn()
#endif
/*
diff --git a/src/include/parser/primnodes.h b/src/include/parser/primnodes.h
index 09be5529b..6fce8be0c 100644
--- a/src/include/parser/primnodes.h
+++ b/src/include/parser/primnodes.h
@@ -6,8 +6,8 @@
* Currently, these are mostly nodes for executable expressions
* and join trees.
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/nodes/primnodes.h
@@ -171,8 +171,8 @@ typedef struct TableFunc
* For CREATE MATERIALIZED VIEW, viewQuery is the parsed-but-not-rewritten
* SELECT Query for the view; otherwise it's NULL. This is irrelevant in
* the query jumbling as CreateTableAsStmt already includes a reference to
- * its own Query, so ignore it. (Although it's actually Query*, we declare
- * it as Node* to avoid a forward reference.)
+ * its own Query, so ignore it. (We declare it as struct Query* to avoid a
+ * forward reference.)
*/
typedef struct IntoClause
{
@@ -185,7 +185,7 @@ typedef struct IntoClause
OnCommitAction onCommit; /* what do we do at COMMIT? */
char *tableSpaceName; /* table space to use, or NULL */
/* materialized view's SELECT query */
- Node *viewQuery pg_node_attr(query_jumble_ignore);
+ struct Query *viewQuery pg_node_attr(query_jumble_ignore);
bool skipData; /* true for WITH NO DATA */
} IntoClause;
@@ -242,6 +242,11 @@ typedef struct Expr
* Note that it affects the meaning of all of varno, varnullingrels, and
* varnosyn, all of which refer to the range table of that query level.
*
+ * varreturningtype is used for Vars that refer to the target relation in the
+ * RETURNING list of data-modifying queries. The default behavior is to
+ * return old values for DELETE and new values for INSERT and UPDATE, but it
+ * is also possible to explicitly request old or new values.
+ *
* In the parser, varnosyn and varattnosyn are either identical to
* varno/varattno, or they specify the column's position in an aliased JOIN
* RTE that hides the semantic referent RTE's refname. This is a syntactic
@@ -263,6 +268,14 @@ typedef struct Expr
#define PRS2_OLD_VARNO 1
#define PRS2_NEW_VARNO 2
+/* Returning behavior for Vars in RETURNING list */
+typedef enum VarReturningType
+{
+ VAR_RETURNING_DEFAULT, /* return OLD for DELETE, else return NEW */
+ VAR_RETURNING_OLD, /* return OLD for DELETE/UPDATE, else NULL */
+ VAR_RETURNING_NEW, /* return NEW for INSERT/UPDATE, else NULL */
+} VarReturningType;
+
typedef struct Var
{
Expr xpr;
@@ -298,6 +311,9 @@ typedef struct Var
*/
Index varlevelsup;
+ /* returning type of this var (see above) */
+ VarReturningType varreturningtype;
+
/*
* varnosyn/varattnosyn are ignored for equality, because Vars with
* different syntactic identifiers are semantically the same as long as
@@ -391,14 +407,16 @@ typedef enum ParamKind
typedef struct Param
{
+ pg_node_attr(custom_query_jumble)
+
Expr xpr;
ParamKind paramkind; /* kind of parameter. See above */
int paramid; /* numeric ID for parameter */
Oid paramtype; /* pg_type OID of parameter's datatype */
/* typmod value, if known */
- int32 paramtypmod pg_node_attr(query_jumble_ignore);
+ int32 paramtypmod;
/* OID of collation, or InvalidOid if none */
- Oid paramcollid pg_node_attr(query_jumble_ignore);
+ Oid paramcollid;
/* token location, or -1 if unknown */
ParseLoc location;
} Param;
@@ -1396,9 +1414,13 @@ typedef struct ArrayExpr
/* common type of array elements */
Oid element_typeid pg_node_attr(query_jumble_ignore);
/* the array elements or sub-arrays */
- List *elements;
+ List *elements pg_node_attr(query_jumble_squash);
/* true if elements are sub-arrays */
bool multidims pg_node_attr(query_jumble_ignore);
+ /* location of the start of the elements list */
+ ParseLoc list_start;
+ /* location of the end of the elements list */
+ ParseLoc list_end;
/* token location, or -1 if unknown */
ParseLoc location;
} ArrayExpr;
@@ -1454,6 +1476,34 @@ typedef struct RowExpr
ParseLoc location; /* token location, or -1 if unknown */
} RowExpr;
+/*
+ * CompareType - fundamental semantics of certain operators
+ *
+ * These enum symbols represent the fundamental semantics of certain operators
+ * that the system needs to have some hardcoded knowledge about. (For
+ * example, RowCompareExpr needs to know which operators can be determined to
+ * act like =, <>, <, etc.) Index access methods map (some of) strategy
+ * numbers to these values so that the system can know about the meaning of
+ * (some of) the operators without needing hardcoded knowledge of index AM's
+ * strategy numbering.
+ *
+ * XXX Currently, this mapping is not fully developed and most values are
+ * chosen to match btree strategy numbers, which is not going to work very
+ * well for other access methods.
+ */
+typedef enum CompareType
+{
+ COMPARE_INVALID = 0,
+ COMPARE_LT = 1, /* BTLessStrategyNumber */
+ COMPARE_LE = 2, /* BTLessEqualStrategyNumber */
+ COMPARE_EQ = 3, /* BTEqualStrategyNumber */
+ COMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */
+ COMPARE_GT = 5, /* BTGreaterStrategyNumber */
+ COMPARE_NE = 6, /* no such btree strategy */
+ COMPARE_OVERLAP,
+ COMPARE_CONTAINED_BY,
+} CompareType;
+
/*
* RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2)
*
@@ -1465,26 +1515,14 @@ typedef struct RowExpr
*
* A RowCompareExpr node is only generated for the < <= > >= cases;
* the = and <> cases are translated to simple AND or OR combinations
- * of the pairwise comparisons. However, we include = and <> in the
- * RowCompareType enum for the convenience of parser logic.
+ * of the pairwise comparisons.
*/
-typedef enum RowCompareType
-{
- /* Values of this enum are chosen to match btree strategy numbers */
- ROWCOMPARE_LT = 1, /* BTLessStrategyNumber */
- ROWCOMPARE_LE = 2, /* BTLessEqualStrategyNumber */
- ROWCOMPARE_EQ = 3, /* BTEqualStrategyNumber */
- ROWCOMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */
- ROWCOMPARE_GT = 5, /* BTGreaterStrategyNumber */
- ROWCOMPARE_NE = 6, /* no such btree strategy */
-} RowCompareType;
-
typedef struct RowCompareExpr
{
Expr xpr;
/* LT LE GE or GT, never EQ or NE */
- RowCompareType rctype;
+ CompareType cmptype;
/* OID list of pairwise comparison ops */
List *opnos pg_node_attr(query_jumble_ignore);
/* OID list of containing operator families */
@@ -1688,15 +1726,19 @@ typedef struct JsonReturning
* JsonValueExpr -
* representation of JSON value expression (expr [FORMAT JsonFormat])
*
- * The actual value is obtained by evaluating formatted_expr. raw_expr is
- * only there for displaying the original user-written expression and is not
- * evaluated by ExecInterpExpr() and eval_const_expressions_mutator().
+ * raw_expr is the user-specified value, while formatted_expr is the value
+ * obtained by coercing raw_expr to the type required by either the FORMAT
+ * clause or an enclosing node's RETURNING clause.
+ *
+ * When deparsing a JsonValueExpr, get_rule_expr() prints raw_expr. However,
+ * during the evaluation of a JsonValueExpr, the value of formatted_expr
+ * takes precedence over that of raw_expr.
*/
typedef struct JsonValueExpr
{
NodeTag type;
- Expr *raw_expr; /* raw expression */
- Expr *formatted_expr; /* formatted expression */
+ Expr *raw_expr; /* user-specified expression */
+ Expr *formatted_expr; /* coerced formatted expression */
JsonFormat *format; /* FORMAT clause, if specified */
} JsonValueExpr;
@@ -2143,6 +2185,30 @@ typedef struct InferenceElem
Oid inferopclass; /* OID of att opclass, or InvalidOid */
} InferenceElem;
+/*
+ * ReturningExpr - return OLD/NEW.(expression) in RETURNING list
+ *
+ * This is used when updating an auto-updatable view and returning a view
+ * column that is not simply a Var referring to the base relation. In such
+ * cases, OLD/NEW.viewcol can expand to an arbitrary expression, but the
+ * result is required to be NULL if the OLD/NEW row doesn't exist. To handle
+ * this, the rewriter wraps the expanded expression in a ReturningExpr, which
+ * is equivalent to "CASE WHEN (OLD/NEW row exists) THEN (expr) ELSE NULL".
+ *
+ * A similar situation can arise when rewriting the RETURNING clause of a
+ * rule, which may also contain arbitrary expressions.
+ *
+ * ReturningExpr nodes never appear in a parsed Query --- they are only ever
+ * inserted by the rewriter and the planner.
+ */
+typedef struct ReturningExpr
+{
+ Expr xpr;
+ int retlevelsup; /* > 0 if it belongs to outer query */
+ bool retold; /* true for OLD, false for NEW */
+ Expr *retexpr; /* expression to be returned */
+} ReturningExpr;
+
/*--------------------
* TargetEntry -
* a target entry (used in query target lists)
diff --git a/src/include/parser/scanner.h b/src/include/parser/scanner.h
index 8c78b0a57..69deaeb48 100644
--- a/src/include/parser/scanner.h
+++ b/src/include/parser/scanner.h
@@ -8,8 +8,8 @@
* higher-level API provided by parser.h.
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/parser/scanner.h
@@ -148,6 +148,6 @@ extern void setup_scanner_errposition_callback(ScannerCallbackState *scbstate,
core_yyscan_t yyscanner,
int location);
extern void cancel_scanner_errposition_callback(ScannerCallbackState *scbstate);
-extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner) pg_attribute_noreturn();
+pg_noreturn extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner);
#endif /* SCANNER_H */
diff --git a/src/include/parser/scansup.h b/src/include/parser/scansup.h
index 319b12800..ef5e618be 100644
--- a/src/include/parser/scansup.h
+++ b/src/include/parser/scansup.h
@@ -3,8 +3,8 @@
* scansup.h
* scanner support routines used by the core lexer
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/parser/scansup.h
diff --git a/src/include/parser/stringinfo.h b/src/include/parser/stringinfo.h
index 16515b0b1..1897c96bb 100644
--- a/src/include/parser/stringinfo.h
+++ b/src/include/parser/stringinfo.h
@@ -8,8 +8,8 @@
* (null-terminated text) or arbitrary binary data. All storage is allocated
* with palloc() (falling back to malloc in frontend code).
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/lib/stringinfo.h
@@ -104,11 +104,15 @@ typedef StringInfoData *StringInfo;
/*------------------------
- * There are four ways to create a StringInfo object initially:
+ * There are six ways to create a StringInfo object initially:
*
* StringInfo stringptr = makeStringInfo();
* Both the StringInfoData and the data buffer are palloc'd.
*
+ * StringInfo stringptr = makeStringInfoExt(initsize);
+ * Same as makeStringInfo except the data buffer is allocated
+ * with size 'initsize'.
+ *
* StringInfoData string;
* initStringInfo(&string);
* The data buffer is palloc'd but the StringInfoData is just local.
@@ -116,6 +120,11 @@ typedef StringInfoData *StringInfo;
* only live as long as the current routine.
*
* StringInfoData string;
+ * initStringInfoExt(&string, initsize);
+ * Same as initStringInfo except the data buffer is allocated
+ * with size 'initsize'.
+ *
+ * StringInfoData string;
* initReadOnlyStringInfo(&string, existingbuf, len);
* The StringInfoData's data field is set to point directly to the
* existing buffer and the StringInfoData's len is set to the given len.
@@ -149,12 +158,22 @@ typedef StringInfoData *StringInfo;
*-------------------------
*/
+#define STRINGINFO_DEFAULT_SIZE 1024 /* default initial allocation size */
+
/*------------------------
* makeStringInfo
* Create an empty 'StringInfoData' & return a pointer to it.
*/
extern StringInfo makeStringInfo(void);
+/*------------------------
+ * makeStringInfoExt
+ * Create an empty 'StringInfoData' & return a pointer to it.
+ * The data buffer is allocated with size 'initsize'.
+ * The valid range for 'initsize' is 1 to MaxAllocSize.
+ */
+extern StringInfo makeStringInfoExt(int initsize);
+
/*------------------------
* initStringInfo
* Initialize a StringInfoData struct (with previously undefined contents)
@@ -162,6 +181,14 @@ extern StringInfo makeStringInfo(void);
*/
extern void initStringInfo(StringInfo str);
+/*------------------------
+ * initStringInfoExt
+ * Initialize a StringInfoData struct (with previously undefined contents) to
+ * describe an empty string. The data buffer is allocated with size
+ * 'initsize'. The valid range for 'initsize' is 1 to MaxAllocSize.
+ */
+extern void initStringInfoExt(StringInfo str, int initsize);
+
/*------------------------
* initReadOnlyStringInfo
* Initialize a StringInfoData struct from an existing string without copying
diff --git a/src/include/parser/unicode_east_asian_fw_table.h b/src/include/parser/unicode_east_asian_fw_table.h
new file mode 100644
index 000000000..db8bd0ad8
--- /dev/null
+++ b/src/include/parser/unicode_east_asian_fw_table.h
@@ -0,0 +1,126 @@
+/* generated by src/common/unicode/generate-unicode_east_asian_fw_table.pl, do not edit */
+
+static const struct mbinterval east_asian_fw[] = {
+ {0x1100, 0x115F},
+ {0x231A, 0x231B},
+ {0x2329, 0x232A},
+ {0x23E9, 0x23EC},
+ {0x23F0, 0x23F0},
+ {0x23F3, 0x23F3},
+ {0x25FD, 0x25FE},
+ {0x2614, 0x2615},
+ {0x2630, 0x2637},
+ {0x2648, 0x2653},
+ {0x267F, 0x267F},
+ {0x268A, 0x268F},
+ {0x2693, 0x2693},
+ {0x26A1, 0x26A1},
+ {0x26AA, 0x26AB},
+ {0x26BD, 0x26BE},
+ {0x26C4, 0x26C5},
+ {0x26CE, 0x26CE},
+ {0x26D4, 0x26D4},
+ {0x26EA, 0x26EA},
+ {0x26F2, 0x26F3},
+ {0x26F5, 0x26F5},
+ {0x26FA, 0x26FA},
+ {0x26FD, 0x26FD},
+ {0x2705, 0x2705},
+ {0x270A, 0x270B},
+ {0x2728, 0x2728},
+ {0x274C, 0x274C},
+ {0x274E, 0x274E},
+ {0x2753, 0x2755},
+ {0x2757, 0x2757},
+ {0x2795, 0x2797},
+ {0x27B0, 0x27B0},
+ {0x27BF, 0x27BF},
+ {0x2B1B, 0x2B1C},
+ {0x2B50, 0x2B50},
+ {0x2B55, 0x2B55},
+ {0x2E80, 0x2E99},
+ {0x2E9B, 0x2EF3},
+ {0x2F00, 0x2FD5},
+ {0x2FF0, 0x303E},
+ {0x3041, 0x3096},
+ {0x3099, 0x30FF},
+ {0x3105, 0x312F},
+ {0x3131, 0x318E},
+ {0x3190, 0x31E5},
+ {0x31EF, 0x321E},
+ {0x3220, 0x3247},
+ {0x3250, 0xA48C},
+ {0xA490, 0xA4C6},
+ {0xA960, 0xA97C},
+ {0xAC00, 0xD7A3},
+ {0xF900, 0xFAFF},
+ {0xFE10, 0xFE19},
+ {0xFE30, 0xFE52},
+ {0xFE54, 0xFE66},
+ {0xFE68, 0xFE6B},
+ {0xFF01, 0xFF60},
+ {0xFFE0, 0xFFE6},
+ {0x16FE0, 0x16FE4},
+ {0x16FF0, 0x16FF1},
+ {0x17000, 0x187F7},
+ {0x18800, 0x18CD5},
+ {0x18CFF, 0x18D08},
+ {0x1AFF0, 0x1AFF3},
+ {0x1AFF5, 0x1AFFB},
+ {0x1AFFD, 0x1AFFE},
+ {0x1B000, 0x1B122},
+ {0x1B132, 0x1B132},
+ {0x1B150, 0x1B152},
+ {0x1B155, 0x1B155},
+ {0x1B164, 0x1B167},
+ {0x1B170, 0x1B2FB},
+ {0x1D300, 0x1D356},
+ {0x1D360, 0x1D376},
+ {0x1F004, 0x1F004},
+ {0x1F0CF, 0x1F0CF},
+ {0x1F18E, 0x1F18E},
+ {0x1F191, 0x1F19A},
+ {0x1F200, 0x1F202},
+ {0x1F210, 0x1F23B},
+ {0x1F240, 0x1F248},
+ {0x1F250, 0x1F251},
+ {0x1F260, 0x1F265},
+ {0x1F300, 0x1F320},
+ {0x1F32D, 0x1F335},
+ {0x1F337, 0x1F37C},
+ {0x1F37E, 0x1F393},
+ {0x1F3A0, 0x1F3CA},
+ {0x1F3CF, 0x1F3D3},
+ {0x1F3E0, 0x1F3F0},
+ {0x1F3F4, 0x1F3F4},
+ {0x1F3F8, 0x1F43E},
+ {0x1F440, 0x1F440},
+ {0x1F442, 0x1F4FC},
+ {0x1F4FF, 0x1F53D},
+ {0x1F54B, 0x1F54E},
+ {0x1F550, 0x1F567},
+ {0x1F57A, 0x1F57A},
+ {0x1F595, 0x1F596},
+ {0x1F5A4, 0x1F5A4},
+ {0x1F5FB, 0x1F64F},
+ {0x1F680, 0x1F6C5},
+ {0x1F6CC, 0x1F6CC},
+ {0x1F6D0, 0x1F6D2},
+ {0x1F6D5, 0x1F6D7},
+ {0x1F6DC, 0x1F6DF},
+ {0x1F6EB, 0x1F6EC},
+ {0x1F6F4, 0x1F6FC},
+ {0x1F7E0, 0x1F7EB},
+ {0x1F7F0, 0x1F7F0},
+ {0x1F90C, 0x1F93A},
+ {0x1F93C, 0x1F945},
+ {0x1F947, 0x1F9FF},
+ {0x1FA70, 0x1FA7C},
+ {0x1FA80, 0x1FA89},
+ {0x1FA8F, 0x1FAC6},
+ {0x1FACE, 0x1FADC},
+ {0x1FADF, 0x1FAE9},
+ {0x1FAF0, 0x1FAF8},
+ {0x20000, 0x2FFFD},
+ {0x30000, 0x3FFFD},
+};
diff --git a/src/include/parser/unicode_nonspacing_table.h b/src/include/parser/unicode_nonspacing_table.h
new file mode 100644
index 000000000..d67f5b3f2
--- /dev/null
+++ b/src/include/parser/unicode_nonspacing_table.h
@@ -0,0 +1,338 @@
+/* generated by src/common/unicode/generate-unicode_nonspacing_table.pl, do not edit */
+
+static const struct mbinterval nonspacing[] = {
+ {0x00AD, 0x00AD},
+ {0x0300, 0x036F},
+ {0x0483, 0x0489},
+ {0x0591, 0x05BD},
+ {0x05BF, 0x05BF},
+ {0x05C1, 0x05C2},
+ {0x05C4, 0x05C5},
+ {0x05C7, 0x05C7},
+ {0x0600, 0x0605},
+ {0x0610, 0x061A},
+ {0x061C, 0x061C},
+ {0x064B, 0x065F},
+ {0x0670, 0x0670},
+ {0x06D6, 0x06DD},
+ {0x06DF, 0x06E4},
+ {0x06E7, 0x06E8},
+ {0x06EA, 0x06ED},
+ {0x070F, 0x070F},
+ {0x0711, 0x0711},
+ {0x0730, 0x074A},
+ {0x07A6, 0x07B0},
+ {0x07EB, 0x07F3},
+ {0x07FD, 0x07FD},
+ {0x0816, 0x0819},
+ {0x081B, 0x0823},
+ {0x0825, 0x0827},
+ {0x0829, 0x082D},
+ {0x0859, 0x085B},
+ {0x0890, 0x089F},
+ {0x08CA, 0x0902},
+ {0x093A, 0x093A},
+ {0x093C, 0x093C},
+ {0x0941, 0x0948},
+ {0x094D, 0x094D},
+ {0x0951, 0x0957},
+ {0x0962, 0x0963},
+ {0x0981, 0x0981},
+ {0x09BC, 0x09BC},
+ {0x09C1, 0x09C4},
+ {0x09CD, 0x09CD},
+ {0x09E2, 0x09E3},
+ {0x09FE, 0x0A02},
+ {0x0A3C, 0x0A3C},
+ {0x0A41, 0x0A51},
+ {0x0A70, 0x0A71},
+ {0x0A75, 0x0A75},
+ {0x0A81, 0x0A82},
+ {0x0ABC, 0x0ABC},
+ {0x0AC1, 0x0AC8},
+ {0x0ACD, 0x0ACD},
+ {0x0AE2, 0x0AE3},
+ {0x0AFA, 0x0B01},
+ {0x0B3C, 0x0B3C},
+ {0x0B3F, 0x0B3F},
+ {0x0B41, 0x0B44},
+ {0x0B4D, 0x0B56},
+ {0x0B62, 0x0B63},
+ {0x0B82, 0x0B82},
+ {0x0BC0, 0x0BC0},
+ {0x0BCD, 0x0BCD},
+ {0x0C00, 0x0C00},
+ {0x0C04, 0x0C04},
+ {0x0C3C, 0x0C3C},
+ {0x0C3E, 0x0C40},
+ {0x0C46, 0x0C56},
+ {0x0C62, 0x0C63},
+ {0x0C81, 0x0C81},
+ {0x0CBC, 0x0CBC},
+ {0x0CBF, 0x0CBF},
+ {0x0CC6, 0x0CC6},
+ {0x0CCC, 0x0CCD},
+ {0x0CE2, 0x0CE3},
+ {0x0D00, 0x0D01},
+ {0x0D3B, 0x0D3C},
+ {0x0D41, 0x0D44},
+ {0x0D4D, 0x0D4D},
+ {0x0D62, 0x0D63},
+ {0x0D81, 0x0D81},
+ {0x0DCA, 0x0DCA},
+ {0x0DD2, 0x0DD6},
+ {0x0E31, 0x0E31},
+ {0x0E34, 0x0E3A},
+ {0x0E47, 0x0E4E},
+ {0x0EB1, 0x0EB1},
+ {0x0EB4, 0x0EBC},
+ {0x0EC8, 0x0ECE},
+ {0x0F18, 0x0F19},
+ {0x0F35, 0x0F35},
+ {0x0F37, 0x0F37},
+ {0x0F39, 0x0F39},
+ {0x0F71, 0x0F7E},
+ {0x0F80, 0x0F84},
+ {0x0F86, 0x0F87},
+ {0x0F8D, 0x0FBC},
+ {0x0FC6, 0x0FC6},
+ {0x102D, 0x1030},
+ {0x1032, 0x1037},
+ {0x1039, 0x103A},
+ {0x103D, 0x103E},
+ {0x1058, 0x1059},
+ {0x105E, 0x1060},
+ {0x1071, 0x1074},
+ {0x1082, 0x1082},
+ {0x1085, 0x1086},
+ {0x108D, 0x108D},
+ {0x109D, 0x109D},
+ {0x135D, 0x135F},
+ {0x1712, 0x1714},
+ {0x1732, 0x1733},
+ {0x1752, 0x1753},
+ {0x1772, 0x1773},
+ {0x17B4, 0x17B5},
+ {0x17B7, 0x17BD},
+ {0x17C6, 0x17C6},
+ {0x17C9, 0x17D3},
+ {0x17DD, 0x17DD},
+ {0x180B, 0x180F},
+ {0x1885, 0x1886},
+ {0x18A9, 0x18A9},
+ {0x1920, 0x1922},
+ {0x1927, 0x1928},
+ {0x1932, 0x1932},
+ {0x1939, 0x193B},
+ {0x1A17, 0x1A18},
+ {0x1A1B, 0x1A1B},
+ {0x1A56, 0x1A56},
+ {0x1A58, 0x1A60},
+ {0x1A62, 0x1A62},
+ {0x1A65, 0x1A6C},
+ {0x1A73, 0x1A7F},
+ {0x1AB0, 0x1B03},
+ {0x1B34, 0x1B34},
+ {0x1B36, 0x1B3A},
+ {0x1B3C, 0x1B3C},
+ {0x1B42, 0x1B42},
+ {0x1B6B, 0x1B73},
+ {0x1B80, 0x1B81},
+ {0x1BA2, 0x1BA5},
+ {0x1BA8, 0x1BA9},
+ {0x1BAB, 0x1BAD},
+ {0x1BE6, 0x1BE6},
+ {0x1BE8, 0x1BE9},
+ {0x1BED, 0x1BED},
+ {0x1BEF, 0x1BF1},
+ {0x1C2C, 0x1C33},
+ {0x1C36, 0x1C37},
+ {0x1CD0, 0x1CD2},
+ {0x1CD4, 0x1CE0},
+ {0x1CE2, 0x1CE8},
+ {0x1CED, 0x1CED},
+ {0x1CF4, 0x1CF4},
+ {0x1CF8, 0x1CF9},
+ {0x1DC0, 0x1DFF},
+ {0x200B, 0x200F},
+ {0x202A, 0x202E},
+ {0x2060, 0x206F},
+ {0x20D0, 0x20F0},
+ {0x2CEF, 0x2CF1},
+ {0x2D7F, 0x2D7F},
+ {0x2DE0, 0x2DFF},
+ {0x302A, 0x302D},
+ {0x3099, 0x309A},
+ {0xA66F, 0xA672},
+ {0xA674, 0xA67D},
+ {0xA69E, 0xA69F},
+ {0xA6F0, 0xA6F1},
+ {0xA802, 0xA802},
+ {0xA806, 0xA806},
+ {0xA80B, 0xA80B},
+ {0xA825, 0xA826},
+ {0xA82C, 0xA82C},
+ {0xA8C4, 0xA8C5},
+ {0xA8E0, 0xA8F1},
+ {0xA8FF, 0xA8FF},
+ {0xA926, 0xA92D},
+ {0xA947, 0xA951},
+ {0xA980, 0xA982},
+ {0xA9B3, 0xA9B3},
+ {0xA9B6, 0xA9B9},
+ {0xA9BC, 0xA9BD},
+ {0xA9E5, 0xA9E5},
+ {0xAA29, 0xAA2E},
+ {0xAA31, 0xAA32},
+ {0xAA35, 0xAA36},
+ {0xAA43, 0xAA43},
+ {0xAA4C, 0xAA4C},
+ {0xAA7C, 0xAA7C},
+ {0xAAB0, 0xAAB0},
+ {0xAAB2, 0xAAB4},
+ {0xAAB7, 0xAAB8},
+ {0xAABE, 0xAABF},
+ {0xAAC1, 0xAAC1},
+ {0xAAEC, 0xAAED},
+ {0xAAF6, 0xAAF6},
+ {0xABE5, 0xABE5},
+ {0xABE8, 0xABE8},
+ {0xABED, 0xABED},
+ {0xFB1E, 0xFB1E},
+ {0xFE00, 0xFE0F},
+ {0xFE20, 0xFE2F},
+ {0xFEFF, 0xFEFF},
+ {0xFFF9, 0xFFFB},
+ {0x101FD, 0x101FD},
+ {0x102E0, 0x102E0},
+ {0x10376, 0x1037A},
+ {0x10A01, 0x10A0F},
+ {0x10A38, 0x10A3F},
+ {0x10AE5, 0x10AE6},
+ {0x10D24, 0x10D27},
+ {0x10D69, 0x10D6D},
+ {0x10EAB, 0x10EAC},
+ {0x10EFC, 0x10EFF},
+ {0x10F46, 0x10F50},
+ {0x10F82, 0x10F85},
+ {0x11001, 0x11001},
+ {0x11038, 0x11046},
+ {0x11070, 0x11070},
+ {0x11073, 0x11074},
+ {0x1107F, 0x11081},
+ {0x110B3, 0x110B6},
+ {0x110B9, 0x110BA},
+ {0x110BD, 0x110BD},
+ {0x110C2, 0x110CD},
+ {0x11100, 0x11102},
+ {0x11127, 0x1112B},
+ {0x1112D, 0x11134},
+ {0x11173, 0x11173},
+ {0x11180, 0x11181},
+ {0x111B6, 0x111BE},
+ {0x111C9, 0x111CC},
+ {0x111CF, 0x111CF},
+ {0x1122F, 0x11231},
+ {0x11234, 0x11234},
+ {0x11236, 0x11237},
+ {0x1123E, 0x1123E},
+ {0x11241, 0x11241},
+ {0x112DF, 0x112DF},
+ {0x112E3, 0x112EA},
+ {0x11300, 0x11301},
+ {0x1133B, 0x1133C},
+ {0x11340, 0x11340},
+ {0x11366, 0x11374},
+ {0x113BB, 0x113C0},
+ {0x113CE, 0x113CE},
+ {0x113D0, 0x113D0},
+ {0x113D2, 0x113D2},
+ {0x113E1, 0x113E2},
+ {0x11438, 0x1143F},
+ {0x11442, 0x11444},
+ {0x11446, 0x11446},
+ {0x1145E, 0x1145E},
+ {0x114B3, 0x114B8},
+ {0x114BA, 0x114BA},
+ {0x114BF, 0x114C0},
+ {0x114C2, 0x114C3},
+ {0x115B2, 0x115B5},
+ {0x115BC, 0x115BD},
+ {0x115BF, 0x115C0},
+ {0x115DC, 0x115DD},
+ {0x11633, 0x1163A},
+ {0x1163D, 0x1163D},
+ {0x1163F, 0x11640},
+ {0x116AB, 0x116AB},
+ {0x116AD, 0x116AD},
+ {0x116B0, 0x116B5},
+ {0x116B7, 0x116B7},
+ {0x1171D, 0x1171D},
+ {0x1171F, 0x1171F},
+ {0x11722, 0x11725},
+ {0x11727, 0x1172B},
+ {0x1182F, 0x11837},
+ {0x11839, 0x1183A},
+ {0x1193B, 0x1193C},
+ {0x1193E, 0x1193E},
+ {0x11943, 0x11943},
+ {0x119D4, 0x119DB},
+ {0x119E0, 0x119E0},
+ {0x11A01, 0x11A0A},
+ {0x11A33, 0x11A38},
+ {0x11A3B, 0x11A3E},
+ {0x11A47, 0x11A47},
+ {0x11A51, 0x11A56},
+ {0x11A59, 0x11A5B},
+ {0x11A8A, 0x11A96},
+ {0x11A98, 0x11A99},
+ {0x11C30, 0x11C3D},
+ {0x11C3F, 0x11C3F},
+ {0x11C92, 0x11CA7},
+ {0x11CAA, 0x11CB0},
+ {0x11CB2, 0x11CB3},
+ {0x11CB5, 0x11CB6},
+ {0x11D31, 0x11D45},
+ {0x11D47, 0x11D47},
+ {0x11D90, 0x11D91},
+ {0x11D95, 0x11D95},
+ {0x11D97, 0x11D97},
+ {0x11EF3, 0x11EF4},
+ {0x11F00, 0x11F01},
+ {0x11F36, 0x11F3A},
+ {0x11F40, 0x11F40},
+ {0x11F42, 0x11F42},
+ {0x11F5A, 0x11F5A},
+ {0x13430, 0x13440},
+ {0x13447, 0x13455},
+ {0x1611E, 0x16129},
+ {0x1612D, 0x1612F},
+ {0x16AF0, 0x16AF4},
+ {0x16B30, 0x16B36},
+ {0x16F4F, 0x16F4F},
+ {0x16F8F, 0x16F92},
+ {0x16FE4, 0x16FE4},
+ {0x1BC9D, 0x1BC9E},
+ {0x1BCA0, 0x1BCA3},
+ {0x1CF00, 0x1CF46},
+ {0x1D167, 0x1D169},
+ {0x1D173, 0x1D182},
+ {0x1D185, 0x1D18B},
+ {0x1D1AA, 0x1D1AD},
+ {0x1D242, 0x1D244},
+ {0x1DA00, 0x1DA36},
+ {0x1DA3B, 0x1DA6C},
+ {0x1DA75, 0x1DA75},
+ {0x1DA84, 0x1DA84},
+ {0x1DA9B, 0x1DAAF},
+ {0x1E000, 0x1E02A},
+ {0x1E08F, 0x1E08F},
+ {0x1E130, 0x1E136},
+ {0x1E2AE, 0x1E2AE},
+ {0x1E2EC, 0x1E2EF},
+ {0x1E4EC, 0x1E4EF},
+ {0x1E5EE, 0x1E5EF},
+ {0x1E8D0, 0x1E8D6},
+ {0x1E944, 0x1E94A},
+ {0xE0001, 0xE01EF},
+};
diff --git a/src/include/parser/value.h b/src/include/parser/value.h
index f6fafb5c3..0734c4ea2 100644
--- a/src/include/parser/value.h
+++ b/src/include/parser/value.h
@@ -4,8 +4,8 @@
* interface for value nodes
*
*
- * Copyright (c) 2003-2024, PgPool Global Development Group
- * Copyright (c) 2003-2024, PostgreSQL Global Development Group
+ * Copyright (c) 2003-2025, PgPool Global Development Group
+ * Copyright (c) 2003-2025, PostgreSQL Global Development Group
*
* src/include/nodes/value.h
*
diff --git a/src/main/pgpool_logger.c b/src/main/pgpool_logger.c
index 9d127183a..89980c95b 100644
--- a/src/main/pgpool_logger.c
+++ b/src/main/pgpool_logger.c
@@ -113,7 +113,7 @@ static volatile sig_atomic_t got_SIGHUP = false;
static volatile sig_atomic_t rotation_requested = false;
-static void SysLoggerMain(int argc, char *argv[]) pg_attribute_noreturn();
+pg_noreturn static void SysLoggerMain(int argc, char *argv[]);
static void process_pipe_input(char *logbuffer, int *bytes_in_logbuffer);
static void flush_pipe_input(char *logbuffer, int *bytes_in_logbuffer);
static FILE *logfile_open(const char *filename, const char *mode,
diff --git a/src/parser/copyfuncs.c b/src/parser/copyfuncs.c
index 4571d4b17..934e9b85c 100644
--- a/src/parser/copyfuncs.c
+++ b/src/parser/copyfuncs.c
@@ -11,8 +11,8 @@
* be handled easily in a simple depth-first traversal.
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
@@ -52,7 +52,7 @@
/* Copy a field that is a pointer to a C string, or perhaps NULL */
#define COPY_STRING_FIELD(fldname) \
- (newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
+ (newnode->fldname = from->fldname ? pstrdup(from->fldname) : NULL)
/* Copy a field that is an inline array */
#define COPY_ARRAY_FIELD(fldname) \
@@ -90,6 +90,7 @@ _copyPlannedStmt(const PlannedStmt * from)
COPY_SCALAR_FIELD(commandType);
COPY_SCALAR_FIELD(queryId);
+ COPY_SCALAR_FIELD(planId);
COPY_SCALAR_FIELD(hasReturning);
COPY_SCALAR_FIELD(hasModifyingCTE);
COPY_SCALAR_FIELD(canSetTag);
@@ -98,7 +99,10 @@ _copyPlannedStmt(const PlannedStmt * from)
COPY_SCALAR_FIELD(parallelModeNeeded);
COPY_SCALAR_FIELD(jitFlags);
COPY_NODE_FIELD(planTree);
+ COPY_NODE_FIELD(partPruneInfos);
COPY_NODE_FIELD(rtable);
+ COPY_BITMAPSET_FIELD(unprunableRelids);
+ COPY_NODE_FIELD(permInfos);
COPY_NODE_FIELD(resultRelations);
COPY_NODE_FIELD(appendRelations);
COPY_NODE_FIELD(subplans);
@@ -123,6 +127,7 @@ _copyPlannedStmt(const PlannedStmt * from)
static void
CopyPlanFields(const Plan * from, Plan * newnode)
{
+ COPY_SCALAR_FIELD(plan.disabled_nodes);
COPY_SCALAR_FIELD(startup_cost);
COPY_SCALAR_FIELD(total_cost);
COPY_SCALAR_FIELD(plan_rows);
@@ -218,6 +223,8 @@ _copyModifyTable(const ModifyTable * from)
COPY_NODE_FIELD(resultRelations);
COPY_NODE_FIELD(updateColnosLists);
COPY_NODE_FIELD(withCheckOptionLists);
+ COPY_STRING_FIELD(returningOldAlias);
+ COPY_STRING_FIELD(returningNewAlias);
COPY_NODE_FIELD(returningLists);
COPY_NODE_FIELD(fdwPrivLists);
COPY_BITMAPSET_FIELD(fdwDirectModifyPlans);
@@ -256,7 +263,7 @@ _copyAppend(const Append * from)
COPY_NODE_FIELD(appendplans);
COPY_SCALAR_FIELD(nasyncplans);
COPY_SCALAR_FIELD(first_partial_plan);
- COPY_NODE_FIELD(part_prune_info);
+ COPY_SCALAR_FIELD(part_prune_index);
return newnode;
}
@@ -284,7 +291,7 @@ _copyMergeAppend(const MergeAppend * from)
COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
COPY_POINTER_FIELD(collations, from->numCols * sizeof(Oid));
COPY_POINTER_FIELD(nullsFirst, from->numCols * sizeof(bool));
- COPY_NODE_FIELD(part_prune_info);
+ COPY_SCALAR_FIELD(part_prune_index);
return newnode;
}
@@ -903,11 +910,11 @@ _copyMergeJoin(const MergeJoin * from)
*/
COPY_SCALAR_FIELD(skip_mark_restore);
COPY_NODE_FIELD(mergeclauses);
- numCols = list_length(from->mergeclauses);
- COPY_POINTER_FIELD(mergeFamilies, numCols * sizeof(Oid));
- COPY_POINTER_FIELD(mergeCollations, numCols * sizeof(Oid));
- COPY_POINTER_FIELD(mergeStrategies, numCols * sizeof(int));
- COPY_POINTER_FIELD(mergeNullsFirst, numCols * sizeof(bool));
+ COPY_POINTER_FIELD(mergeFamilies, list_length(from->mergeclauses) * sizeof(Oid));
+ COPY_POINTER_FIELD(mergeCollations, list_length(from->mergeclauses) * sizeof(Oid));
+ COPY_POINTER_FIELD(mergeStrategies, list_length(from->mergeclauses) * sizeof(int));
+ COPY_POINTER_FIELD(mergeReversals, list_length(from->mergeclauses) * sizeof(bool));
+ COPY_POINTER_FIELD(mergeNullsFirst, list_length(from->mergeclauses) * sizeof(bool));
return newnode;
}
@@ -1093,6 +1100,7 @@ _copyWindowAgg(const WindowAgg * from)
CopyPlanFields((const Plan *) from, (Plan *) newnode);
+ COPY_STRING_FIELD(winname);
COPY_SCALAR_FIELD(winref);
COPY_SCALAR_FIELD(partNumCols);
COPY_POINTER_FIELD(partColIdx, from->partNumCols * sizeof(AttrNumber));
@@ -1185,11 +1193,10 @@ _copySetOp(const SetOp * from)
COPY_SCALAR_FIELD(cmd);
COPY_SCALAR_FIELD(strategy);
COPY_SCALAR_FIELD(numCols);
- COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber));
- COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid));
- COPY_POINTER_FIELD(dupCollations, from->numCols * sizeof(Oid));
- COPY_SCALAR_FIELD(flagColIdx);
- COPY_SCALAR_FIELD(firstFlag);
+ COPY_POINTER_FIELD(cmpColIdx, from->numCols * sizeof(AttrNumber));
+ COPY_POINTER_FIELD(cmpOperators, from->numCols * sizeof(Oid));
+ COPY_POINTER_FIELD(cmpCollations, from->numCols * sizeof(Oid));
+ COPY_POINTER_FIELD(cmpNullsFirst, from->numCols * sizeof(bool));
COPY_SCALAR_FIELD(numGroups);
return newnode;
@@ -1283,6 +1290,7 @@ _copyPartitionPruneInfo(const PartitionPruneInfo * from)
{
PartitionPruneInfo *newnode = makeNode(PartitionPruneInfo);
+ COPY_BITMAPSET_FIELD(relids);
COPY_NODE_FIELD(prune_infos);
COPY_BITMAPSET_FIELD(other_subplans);
@@ -1299,6 +1307,7 @@ _copyPartitionedRelPruneInfo(const PartitionedRelPruneInfo * from)
COPY_SCALAR_FIELD(nparts);
COPY_POINTER_FIELD(subplan_map, from->nparts * sizeof(int));
COPY_POINTER_FIELD(subpart_map, from->nparts * sizeof(int));
+ COPY_POINTER_FIELD(leafpart_rti_map, from->nparts * sizeof(int));
COPY_POINTER_FIELD(relid_map, from->nparts * sizeof(Oid));
COPY_NODE_FIELD(initial_prunning_steps);
COPY_NODE_FIELD(exec_prunning_steps);
@@ -1461,7 +1470,9 @@ _copyVar(const Var *from)
COPY_SCALAR_FIELD(vartype);
COPY_SCALAR_FIELD(vartypmod);
COPY_SCALAR_FIELD(varcollid);
+ COPY_BITMAPSET_FIELD(varnullingrels);
COPY_SCALAR_FIELD(varlevelsup);
+ COPY_SCALAR_FIELD(varreturningtype);
COPY_SCALAR_FIELD(varnosyn);
COPY_SCALAR_FIELD(varattnosyn);
COPY_LOCATION_FIELD(location);
@@ -2014,6 +2025,8 @@ _copyArrayExpr(const ArrayExpr *from)
COPY_SCALAR_FIELD(element_typeid);
COPY_NODE_FIELD(elements);
COPY_SCALAR_FIELD(multidims);
+ COPY_LOCATION_FIELD(list_start);
+ COPY_LOCATION_FIELD(list_end);
COPY_LOCATION_FIELD(location);
return newnode;
@@ -2044,7 +2057,7 @@ _copyRowCompareExpr(const RowCompareExpr *from)
{
RowCompareExpr *newnode = makeNode(RowCompareExpr);
- COPY_SCALAR_FIELD(rctype);
+ COPY_SCALAR_FIELD(cmptype);
COPY_NODE_FIELD(opnos);
COPY_NODE_FIELD(opfamilies);
COPY_NODE_FIELD(inputcollids);
@@ -2406,6 +2419,18 @@ _copyInferenceElem(const InferenceElem *from)
return newnode;
}
+static ReturningExpr *
+_copyReturningExpr(const ReturningExpr *from)
+{
+ ReturningExpr *newnode = makeNode(ReturningExpr);
+
+ COPY_SCALAR_FIELD(retlevelsup);
+ COPY_SCALAR_FIELD(retold);
+ COPY_NODE_FIELD(retexpr);
+
+ return newnode;
+}
+
/*
* _copyTargetEntry
*/
@@ -2513,7 +2538,7 @@ _copyPathKey(const PathKey * from)
/* EquivalenceClasses are never moved, so just shallow-copy the pointer */
COPY_SCALAR_FIELD(pk_eclass);
COPY_SCALAR_FIELD(pk_opfamily);
- COPY_SCALAR_FIELD(pk_strategy);
+ COPY_SCALAR_FIELD(pk_cmptype);
COPY_SCALAR_FIELD(pk_nulls_first);
return newnode;
@@ -2695,6 +2720,7 @@ _copyRangeTblEntry(const RangeTblEntry *from)
COPY_NODE_FIELD(colcollations);
COPY_STRING_FIELD(enrname);
COPY_SCALAR_FIELD(enrtuples);
+ COPY_NODE_FIELD(groupexprs);
COPY_SCALAR_FIELD(lateral);
COPY_SCALAR_FIELD(inFromCl);
COPY_NODE_FIELD(securityQuals);
@@ -2752,6 +2778,7 @@ _copySortGroupClause(const SortGroupClause *from)
COPY_SCALAR_FIELD(tleSortGroupRef);
COPY_SCALAR_FIELD(eqop);
COPY_SCALAR_FIELD(sortop);
+ COPY_SCALAR_FIELD(reverse_sort);
COPY_SCALAR_FIELD(nulls_first);
COPY_SCALAR_FIELD(hashable);
@@ -2922,6 +2949,8 @@ _copyA_Expr(const A_Expr *from)
COPY_NODE_FIELD(name);
COPY_NODE_FIELD(lexpr);
COPY_NODE_FIELD(rexpr);
+ COPY_LOCATION_FIELD(rexpr_list_start);
+ COPY_LOCATION_FIELD(rexpr_list_end);
COPY_LOCATION_FIELD(location);
return newnode;
@@ -3045,6 +3074,8 @@ _copyA_ArrayExpr(const A_ArrayExpr *from)
A_ArrayExpr *newnode = makeNode(A_ArrayExpr);
COPY_NODE_FIELD(elements);
+ COPY_LOCATION_FIELD(list_start);
+ COPY_LOCATION_FIELD(list_end);
COPY_LOCATION_FIELD(location);
return newnode;
@@ -3284,15 +3315,17 @@ _copyConstraint(const Constraint *from)
COPY_STRING_FIELD(conname);
COPY_SCALAR_FIELD(deferrable);
COPY_SCALAR_FIELD(initdeferred);
+ COPY_SCALAR_FIELD(is_enforced);
COPY_SCALAR_FIELD(skip_validation);
COPY_SCALAR_FIELD(initially_valid);
COPY_SCALAR_FIELD(is_no_inherit);
COPY_NODE_FIELD(raw_expr);
COPY_STRING_FIELD(cooked_expr);
COPY_SCALAR_FIELD(generated_when);
- COPY_SCALAR_FIELD(inhcount);
+ COPY_SCALAR_FIELD(generated_kind);
COPY_SCALAR_FIELD(nulls_not_distinct);
COPY_NODE_FIELD(keys);
+ COPY_SCALAR_FIELD(without_overlaps);
COPY_NODE_FIELD(including);
COPY_NODE_FIELD(exclusions);
COPY_NODE_FIELD(options);
@@ -3304,6 +3337,8 @@ _copyConstraint(const Constraint *from)
COPY_NODE_FIELD(pktable);
COPY_NODE_FIELD(fk_attrs);
COPY_NODE_FIELD(pk_attrs);
+ COPY_SCALAR_FIELD(fk_with_period);
+ COPY_SCALAR_FIELD(pk_with_period);
COPY_SCALAR_FIELD(fk_matchtype);
COPY_SCALAR_FIELD(fk_upd_action);
COPY_SCALAR_FIELD(fk_del_action);
@@ -3366,6 +3401,29 @@ _copyRoleSpec(const RoleSpec *from)
return newnode;
}
+static ReturningOption *
+_copyReturningOption(const ReturningOption *from)
+{
+ ReturningOption *newnode = makeNode(ReturningOption);
+
+ COPY_SCALAR_FIELD(option);
+ COPY_STRING_FIELD(value);
+ COPY_LOCATION_FIELD(location);
+
+ return newnode;
+}
+
+static ReturningClause *
+_copyReturningClause(const ReturningClause *from)
+{
+ ReturningClause *newnode = makeNode(ReturningClause);
+
+ COPY_NODE_FIELD(options);
+ COPY_NODE_FIELD(exprs);
+
+ return newnode;
+}
+
static TriggerTransition *
_copyTriggerTransition(const TriggerTransition *from)
{
@@ -3618,6 +3676,7 @@ _copyQuery(const Query *from)
COPY_SCALAR_FIELD(hasModifyingCTE);
COPY_SCALAR_FIELD(hasForUpdate);
COPY_SCALAR_FIELD(hasRowSecurity);
+ COPY_SCALAR_FIELD(hasGroupRTE);
COPY_SCALAR_FIELD(isReturn);
COPY_NODE_FIELD(cteList);
COPY_NODE_FIELD(rtable);
@@ -3629,6 +3688,8 @@ _copyQuery(const Query *from)
COPY_NODE_FIELD(targetList);
COPY_SCALAR_FIELD(override);
COPY_NODE_FIELD(onConflict);
+ COPY_STRING_FIELD(returningOldAlias);
+ COPY_STRING_FIELD(returningNewAlias);
COPY_NODE_FIELD(returningList);
COPY_NODE_FIELD(groupClause);
COPY_SCALAR_FIELD(groupDistinct);
@@ -3671,7 +3732,7 @@ _copyInsertStmt(const InsertStmt *from)
COPY_NODE_FIELD(cols);
COPY_NODE_FIELD(selectStmt);
COPY_NODE_FIELD(onConflictClause);
- COPY_NODE_FIELD(returningList);
+ COPY_NODE_FIELD(returningClause);
COPY_NODE_FIELD(withClause);
COPY_SCALAR_FIELD(override);
@@ -3686,7 +3747,7 @@ _copyDeleteStmt(const DeleteStmt *from)
COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(usingClause);
COPY_NODE_FIELD(whereClause);
- COPY_NODE_FIELD(returningList);
+ COPY_NODE_FIELD(returningClause);
COPY_NODE_FIELD(withClause);
return newnode;
@@ -3701,7 +3762,7 @@ _copyUpdateStmt(const UpdateStmt *from)
COPY_NODE_FIELD(targetList);
COPY_NODE_FIELD(whereClause);
COPY_NODE_FIELD(fromClause);
- COPY_NODE_FIELD(returningList);
+ COPY_NODE_FIELD(returningClause);
COPY_NODE_FIELD(withClause);
return newnode;
@@ -3716,7 +3777,7 @@ _copyMergeStmt(const MergeStmt *from)
COPY_NODE_FIELD(sourceRelation);
COPY_NODE_FIELD(joinCondition);
COPY_NODE_FIELD(mergeWhenClauses);
- COPY_NODE_FIELD(returningList);
+ COPY_NODE_FIELD(returningClause);
COPY_NODE_FIELD(withClause);
return newnode;
@@ -3822,6 +3883,34 @@ _copyAlterTableCmd(const AlterTableCmd *from)
return newnode;
}
+static ATAlterConstraint *
+_copyATAlterConstraint(const ATAlterConstraint *from)
+{
+ ATAlterConstraint *newnode = makeNode(ATAlterConstraint);
+
+ COPY_STRING_FIELD(conname);
+ COPY_SCALAR_FIELD(alterEnforceability);
+ COPY_SCALAR_FIELD(is_enforced);
+ COPY_SCALAR_FIELD(alterDeferrability);
+ COPY_SCALAR_FIELD(deferrable);
+ COPY_SCALAR_FIELD(initdeferred);
+ COPY_SCALAR_FIELD(alterInheritability);
+ COPY_SCALAR_FIELD(noinherit);
+
+ return newnode;
+}
+
+static ReplicaIdentityStmt *
+_copyReplicaIdentityStmt(const ReplicaIdentityStmt *from)
+{
+ ReplicaIdentityStmt *newnode = makeNode(ReplicaIdentityStmt);
+
+ COPY_SCALAR_FIELD(identity_type);
+ COPY_STRING_FIELD(name);
+
+ return newnode;
+}
+
static AlterCollationStmt *
_copyAlterCollationStmt(const AlterCollationStmt *from)
{
@@ -3994,6 +4083,7 @@ CopyCreateStmtFields(const CreateStmt *from, CreateStmt *newnode)
COPY_NODE_FIELD(partbound);
COPY_NODE_FIELD(ofTypename);
COPY_NODE_FIELD(constraints);
+ COPY_NODE_FIELD(nnconstraints);
COPY_NODE_FIELD(options);
COPY_SCALAR_FIELD(oncommit);
COPY_STRING_FIELD(tablespacename);
@@ -4126,6 +4216,7 @@ _copyIndexStmt(const IndexStmt *from)
COPY_SCALAR_FIELD(nulls_not_distinct);
COPY_SCALAR_FIELD(primary);
COPY_SCALAR_FIELD(isconstraint);
+ COPY_SCALAR_FIELD(iswithoutoverlaps);
COPY_SCALAR_FIELD(deferrable);
COPY_SCALAR_FIELD(initdeferred);
COPY_SCALAR_FIELD(transformed);
@@ -4189,6 +4280,7 @@ _copyFunctionParameter(const FunctionParameter *from)
COPY_NODE_FIELD(argType);
COPY_SCALAR_FIELD(mode);
COPY_NODE_FIELD(defexpr);
+ COPY_LOCATION_FIELD(location);
return newnode;
}
@@ -4613,17 +4705,6 @@ _copyRefreshMatViewStmt(const RefreshMatViewStmt *from)
return newnode;
}
-static ReplicaIdentityStmt *
-_copyReplicaIdentityStmt(const ReplicaIdentityStmt *from)
-{
- ReplicaIdentityStmt *newnode = makeNode(ReplicaIdentityStmt);
-
- COPY_SCALAR_FIELD(identity_type);
- COPY_STRING_FIELD(name);
-
- return newnode;
-}
-
static AlterSystemStmt *
_copyAlterSystemStmt(const AlterSystemStmt *from)
{
@@ -4669,7 +4750,9 @@ _copyVariableSetStmt(const VariableSetStmt *from)
COPY_SCALAR_FIELD(kind);
COPY_STRING_FIELD(name);
COPY_NODE_FIELD(args);
+ COPY_SCALAR_FIELD(jumble_args);
COPY_SCALAR_FIELD(is_local);
+ COPY_LOCATION_FIELD(location);
return newnode;
}
@@ -5279,15 +5362,6 @@ _copyPartitionRangeDatum(const PartitionRangeDatum *from)
return newnode;
}
-static SinglePartitionSpec *
-_copySinglePartitionSpec(const SinglePartitionSpec *from)
-{
- SinglePartitionSpec *newnode = makeNode(SinglePartitionSpec);
-
-
- return newnode;
-}
-
static PartitionCmd *
_copyPartitionCmd(const PartitionCmd *from)
{
@@ -5479,6 +5553,7 @@ _copyForeignKeyCacheInfo(const ForeignKeyCacheInfo * from)
COPY_SCALAR_FIELD(conrelid);
COPY_SCALAR_FIELD(confrelid);
COPY_SCALAR_FIELD(nkeys);
+ COPY_SCALAR_FIELD(conenforced);
COPY_ARRAY_FIELD(conkey);
COPY_ARRAY_FIELD(confkey);
COPY_ARRAY_FIELD(conpfeqop);
@@ -5855,6 +5930,9 @@ copyObjectImpl(const void *from)
case T_InferenceElem:
retval = _copyInferenceElem(from);
break;
+ case T_ReturningExpr:
+ retval = _copyReturningExpr(from);
+ break;
case T_TargetEntry:
retval = _copyTargetEntry(from);
break;
@@ -5985,6 +6063,12 @@ copyObjectImpl(const void *from)
case T_AlterTableCmd:
retval = _copyAlterTableCmd(from);
break;
+ case T_ATAlterConstraint:
+ retval = _copyATAlterConstraint(from);
+ break;
+ case T_ReplicaIdentityStmt:
+ retval = _copyReplicaIdentityStmt(from);
+ break;
case T_AlterCollationStmt:
retval = _copyAlterCollationStmt(from);
break;
@@ -6156,9 +6240,6 @@ copyObjectImpl(const void *from)
case T_RefreshMatViewStmt:
retval = _copyRefreshMatViewStmt(from);
break;
- case T_ReplicaIdentityStmt:
- retval = _copyReplicaIdentityStmt(from);
- break;
case T_AlterSystemStmt:
retval = _copyAlterSystemStmt(from);
break;
@@ -6444,6 +6525,12 @@ copyObjectImpl(const void *from)
case T_MergeWhenClause:
retval = _copyMergeWhenClause(from);
break;
+ case T_ReturningOption:
+ retval = _copyReturningOption(from);
+ break;
+ case T_ReturningClause:
+ retval = _copyReturningClause(from);
+ break;
case T_ObjectWithArgs:
retval = _copyObjectWithArgs(from);
break;
@@ -6519,9 +6606,6 @@ copyObjectImpl(const void *from)
case T_PartitionRangeDatum:
retval = _copyPartitionRangeDatum(from);
break;
- case T_SinglePartitionSpec:
- retval = _copySinglePartitionSpec(from);
- break;
case T_PartitionCmd:
retval = _copyPartitionCmd(from);
break;
diff --git a/src/parser/gram.y b/src/parser/gram.y
index 61663cce2..b6a4f618f 100644
--- a/src/parser/gram.y
+++ b/src/parser/gram.y
@@ -6,8 +6,8 @@
* gram.y
* POSTGRESQL BISON rules/actions
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -89,6 +89,8 @@
#define ATTRIBUTE_IDENTITY_ALWAYS 'a'
#define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd'
+#define ATTRIBUTE_GENERATED_STORED 's'
+#define ATTRIBUTE_GENERATED_VIRTUAL 'v'
/*
* Definition taken from
* postgreSQL source code file: src/include/utils/xml.h
@@ -102,39 +104,25 @@ typedef enum
} XmlStandaloneType;
/*
- * Location tracking support --- simpler than bison's default, since we only
- * want to track the start position not the end position of each nonterminal.
+ * Location tracking support. Unlike bison's default, we only want
+ * to track the start position not the end position of each nonterminal.
+ * Nonterminals that reduce to empty receive position "-1". Since a
+ * production's leading RHS nonterminal(s) may have reduced to empty,
+ * we have to scan to find the first one that's not -1.
*/
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
- if ((N) > 0) \
- (Current) = (Rhs)[1]; \
- else \
- (Current) = (-1); \
+ (Current) = (-1); \
+ for (int _i = 1; _i <= (N); _i++) \
+ { \
+ if ((Rhs)[_i] >= 0) \
+ { \
+ (Current) = (Rhs)[_i]; \
+ break; \
+ } \
+ } \
} while (0)
-/*
- * The above macro assigns -1 (unknown) as the parse location of any
- * nonterminal that was reduced from an empty rule, or whose leftmost
- * component was reduced from an empty rule. This is problematic
- * for nonterminals defined like
- * OptFooList: / * EMPTY * / { ... } | OptFooList Foo { ... } ;
- * because we'll set -1 as the location during the first reduction and then
- * copy it during each subsequent reduction, leaving us with -1 for the
- * location even when the list is not empty. To fix that, do this in the
- * action for the nonempty rule(s):
- * if (@$ < 0) @$ = @2;
- * (Although we have many nonterminals that follow this pattern, we only
- * bother with fixing @$ like this when the nonterminal's parse location
- * is actually referenced in some rule.)
- *
- * A cleaner answer would be to make YYLLOC_DEFAULT scan all the Rhs
- * locations until it's found one that's not -1. Then we'd get a correct
- * location for any nonterminal that isn't entirely empty. But this way
- * would add overhead to every rule reduction, and so far there's not been
- * a compelling reason to pay that overhead.
- */
-
/*
* Bison doesn't allocate anything that needs to live across parser calls,
* so we can easily have it use palloc instead of malloc. This prevents
@@ -158,12 +146,15 @@ typedef struct ImportQual
List *table_names;
} ImportQual;
-/* Private struct for the result of opt_select_limit production */
+/* Private struct for the result of select_limit & limit_clause productions */
typedef struct SelectLimit
{
Node *limitOffset;
Node *limitCount;
- LimitOption limitOption;
+ LimitOption limitOption; /* indicates presence of WITH TIES */
+ ParseLoc offsetLoc; /* location of OFFSET token, if present */
+ ParseLoc countLoc; /* location of LIMIT/FETCH token, if present */
+ ParseLoc optionLoc; /* location of WITH TIES, if present */
} SelectLimit;
/* Private struct for the result of group_clause production */
@@ -193,6 +184,8 @@ typedef struct KeyActions
#define CAS_INITIALLY_DEFERRED 0x08
#define CAS_NOT_VALID 0x10
#define CAS_NO_INHERIT 0x20
+#define CAS_NOT_ENFORCED 0x40
+#define CAS_ENFORCED 0x80
#define parser_yyerror(msg) scanner_yyerror(msg, yyscanner)
@@ -228,12 +221,12 @@ static void doNegateFloat(Float *v);
static Node *makeAndExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeOrExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeNotExpr(Node *expr, int location);
-static Node *makeAArrayExpr(List *elements, int location);
+static Node *makeAArrayExpr(List *elements, int location, int end_location);
static Node *makeSQLValueFunction(SQLValueFunctionOp op, int32 typmod,
int location);
static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args,
List *args, int location);
-static List *mergeTableFuncParameters(List *func_args, List *columns);
+static List *mergeTableFuncParameters(List *func_args, List *columns, core_yyscan_t yyscanner);
static TypeName *TableFuncTypeName(List *columns);
static RangeVar *makeRangeVarFromAnyName(List *names, int position, core_yyscan_t yyscanner);
static RangeVar *makeRangeVarFromQualifiedName(char *name, List *namelist, int location,
@@ -242,9 +235,10 @@ static void SplitColQualList(List *qualList,
List **constraintList, CollateClause **collClause,
core_yyscan_t yyscanner);
static void processCASbits(int cas_bits, int location, const char *constrType,
- bool *deferrable, bool *initdeferred, bool *not_valid,
- bool *no_inherit, core_yyscan_t yyscanner);
-static PartitionStrategy parsePartitionStrategy(char *strategy);
+ bool *deferrable, bool *initdeferred, bool *is_enforced,
+ bool *not_valid, bool *no_inherit, core_yyscan_t yyscanner);
+static PartitionStrategy parsePartitionStrategy(char *strategy, int location,
+ core_yyscan_t yyscanner);
static void preprocess_pubobj_list(List *pubobjspec_list,
core_yyscan_t yyscanner);
static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
@@ -310,6 +304,8 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
MergeWhenClause *mergewhen;
struct KeyActions *keyactions;
struct KeyAction *keyaction;
+ ReturningClause *retclause;
+ ReturningOptionKind retoptionkind;
}
%type <node> stmt toplevel_stmt schema_stmt routine_body_stmt
@@ -480,7 +476,8 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
opclass_purpose opt_opfamily transaction_mode_list_or_empty
OptTableFuncElementList TableFuncElementList opt_type_modifiers
prep_type_clause
- execute_param_clause using_clause returning_clause
+ execute_param_clause using_clause
+ returning_with_clause returning_options
opt_enum_val_list enum_val_list table_func_column_list
create_generic_options alter_generic_options
relation_expr_list dostmt_opt_list
@@ -489,6 +486,9 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
vacuum_relation_list opt_vacuum_relation_list
drop_option_list pub_obj_list
+%type <retclause> returning_clause
+%type <node> returning_option
+%type <retoptionkind> returning_option_kind
%type <node> opt_routine_body
%type <groupclause> group_clause
%type <list> group_by_list
@@ -527,7 +527,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
%type <boolean> opt_instead
%type <boolean> opt_unique opt_verbose opt_full
-%type <boolean> opt_freeze opt_analyze opt_default opt_recheck
+%type <boolean> opt_freeze opt_analyze opt_default
%type <defelt> opt_binary copy_delimiter
%type <boolean> copy_from opt_program
@@ -557,14 +557,15 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
SetResetClause FunctionSetResetClause
%type <node> TableElement TypedTableElement ConstraintElem DomainConstraintElem TableFuncElement
-%type <node> columnDef columnOptions
+%type <node> columnDef columnOptions optionalPeriodName
%type <defelt> def_elem reloption_elem old_aggr_elem operator_def_elem
%type <node> def_arg columnElem where_clause where_or_current_clause
a_expr b_expr c_expr AexprConst indirection_el opt_slice_bound
- columnref in_expr having_clause func_table xmltable array_expr
+ columnref having_clause func_table xmltable array_expr
OptWhereClause operator_def_arg
+%type <list> opt_column_and_period_list
%type <list> rowsfrom_item rowsfrom_list opt_col_def_list
-%type <boolean> opt_ordinality
+%type <boolean> opt_ordinality opt_without_overlaps
%type <list> ExclusionConstraintList ExclusionConstraintElem
%type <list> func_arg_list func_arg_list_opt
%type <node> func_arg_expr
@@ -673,7 +674,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
%type <str> opt_existing_window_name
%type <boolean> opt_if_not_exists
%type <boolean> opt_unique_null_treatment
-%type <ival> generated_when override_kind
+%type <ival> generated_when override_kind opt_virtual_or_stored
%type <partspec> PartitionSpec OptPartitionSpec
%type <partelem> part_elem
%type <list> part_params
@@ -756,9 +757,9 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
DETACH DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P
DOUBLE_P DROP
- EACH ELSE EMPTY_P ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ERROR_P ESCAPE
- EVENT EXCEPT EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN EXPRESSION
- EXTENSION EXTERNAL EXTRACT
+ EACH ELSE EMPTY_P ENABLE_P ENCODING ENCRYPTED END_P ENFORCED ENUM_P ERROR_P
+ ESCAPE EVENT EXCEPT EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN
+ EXPRESSION EXTENSION EXTERNAL EXTRACT
FALSE_P FAMILY FETCH FILTER FINALIZE FIRST_P FLOAT_P FOLLOWING FOR
FORCE FOREIGN FORMAT FORWARD FREEZE FROM FULL FUNCTION FUNCTIONS
@@ -789,18 +790,18 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF
NULLS_P NUMERIC
- OBJECT_P OF OFF OFFSET OIDS OLD OMIT ON ONLY OPERATOR OPTION OPTIONS OR
+ OBJECT_P OBJECTS_P OF OFF OFFSET OIDS OLD OMIT ON ONLY OPERATOR OPTION OPTIONS OR
ORDER ORDINALITY OTHERS OUT_P OUTER_P
OVER OVERLAPS OVERLAY OVERRIDING OWNED OWNER
PARALLEL PARAMETER PARSER PARTIAL PARTITION PASSING PASSWORD PATH PGPOOL
- PLACING PLAN PLANS POLICY
+ PERIOD PLACING PLAN PLANS POLICY
POSITION PRECEDING PRECISION PRESERVE PREPARE PREPARED PRIMARY
PRIOR PRIVILEGES PROCEDURAL PROCEDURE PROCEDURES PROGRAM PUBLICATION
QUOTE QUOTES
- RANGE READ REAL REASSIGN RECHECK RECURSIVE REF_P REFERENCES REFERENCING
+ RANGE READ REAL REASSIGN RECURSIVE REF_P REFERENCES REFERENCING
REFRESH REINDEX RELATIVE_P RELEASE RENAME REPEATABLE REPLACE REPLICA
RESET RESTART RESTRICT RETURN RETURNING RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
ROUTINE ROUTINES ROW ROWS RULE
@@ -821,7 +822,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
UNLISTEN UNLOGGED UNTIL UPDATE USER USING
VACUUM VALID VALIDATE VALIDATOR VALUE_P VALUES VARCHAR VARIADIC VARYING
- VERBOSE VERSION_P VIEW VIEWS VOLATILE
+ VERBOSE VERSION_P VIEW VIEWS VIRTUAL VOLATILE
WHEN WHERE WHITESPACE_P WINDOW WITH WITHIN WITHOUT WORK WRAPPER WRITE
@@ -962,7 +963,7 @@ parse_toplevel:
| MODE_PLPGSQL_EXPR PLpgSQL_Expr
{
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt($2, 0));
+ list_make1(makeRawStmt($2, @2));
}
| MODE_PLPGSQL_ASSIGN1 PLAssignStmt
{
@@ -970,7 +971,7 @@ parse_toplevel:
n->nnames = 1;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
| MODE_PLPGSQL_ASSIGN2 PLAssignStmt
{
@@ -978,7 +979,7 @@ parse_toplevel:
n->nnames = 2;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
| MODE_PLPGSQL_ASSIGN3 PLAssignStmt
{
@@ -986,19 +987,15 @@ parse_toplevel:
n->nnames = 3;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
;
/*
* At top level, we wrap each stmt with a RawStmt node carrying start location
- * and length of the stmt's text. Notice that the start loc/len are driven
- * entirely from semicolon locations (@2). It would seem natural to use
- * @1 or @3 to get the true start location of a stmt, but that doesn't work
- * for statements that can start with empty nonterminals (opt_with_clause is
- * the main offender here); as noted in the comments for YYLLOC_DEFAULT,
- * we'd get -1 for the location in such cases.
- * We also take care to discard empty statements entirely.
+ * and length of the stmt's text.
+ * We also take care to discard empty statements entirely (which among other
+ * things dodges the problem of assigning them a location).
*/
stmtmulti: stmtmulti ';' toplevel_stmt
{
@@ -1008,14 +1005,14 @@ stmtmulti: stmtmulti ';' toplevel_stmt
updateRawStmtEnd(llast_node(RawStmt, $1), @2);
}
if ($3 != NULL)
- $$ = lappend($1, makeRawStmt($3, @2 + 1));
+ $$ = lappend($1, makeRawStmt($3, @3));
else
$$ = $1;
}
| toplevel_stmt
{
if ($1 != NULL)
- $$ = list_make1(makeRawStmt($1, 0));
+ $$ = list_make1(makeRawStmt($1, @1));
else
$$ = NIL;
}
@@ -1616,8 +1613,6 @@ CreateSchemaStmt:
OptSchemaEltList:
OptSchemaEltList schema_stmt
{
- if (@$ < 0) /* see comments for YYLLOC_DEFAULT */
- @$ = @2;
$$ = lappend($1, $2);
}
| /* EMPTY */
@@ -1655,13 +1650,6 @@ VariableSetStmt:
n->is_local = false;
$$ = (Node *) n;
}
- | PGPOOL set_rest_more
- {
- VariableSetStmt *n = $2;
- n->type = T_PgpoolQueryCacheStmt; /* Hack to keep changes minimum */
- n->is_local = false;
- $$ = (Node *) n;
- }
| SET set_rest
{
VariableSetStmt *n = $2;
@@ -1693,6 +1681,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION";
n->args = $2;
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
| SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
@@ -1702,6 +1692,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "SESSION CHARACTERISTICS";
n->args = $5;
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
| set_rest_more
@@ -1715,6 +1707,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name '=' var_list
@@ -1724,6 +1717,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name TO DEFAULT
@@ -1732,6 +1726,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| var_name '=' DEFAULT
@@ -1740,6 +1735,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
;
@@ -1752,6 +1748,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_CURRENT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes mandated by SQL standard: */
@@ -1761,6 +1758,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "timezone";
+ n->location = -1;
+ n->jumble_args = true;
if ($3 != NULL)
n->args = list_make1($3);
else
@@ -1782,6 +1781,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "search_path";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| NAMES opt_encoding
@@ -1790,6 +1790,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "client_encoding";
+ n->location = @2;
if ($2 != NULL)
n->args = list_make1(makeStringConst($2, @2));
else
@@ -1803,6 +1804,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "role";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| SESSION AUTHORIZATION NonReservedWord_or_Sconst
@@ -1812,6 +1814,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "session_authorization";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
| SESSION AUTHORIZATION DEFAULT
@@ -1820,6 +1823,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_DEFAULT;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
| XML_P OPTION document_or_content
@@ -1829,6 +1833,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "xmloption";
n->args = list_make1(makeStringConst($3 == XMLOPTION_DOCUMENT ? "DOCUMENT" : "CONTENT", @3));
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes invented by PostgreSQL: */
@@ -1839,13 +1845,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION SNAPSHOT";
n->args = list_make1(makeStringConst($3, @3));
- $$ = n;
- }
- /* PGPOOL CACHE DELETE */
- | SET CACHE DELETE_P Sconst
- {
- VariableSetStmt *n = makeNode(VariableSetStmt);
- n->name = $4; /* query to delete query cache */
+ n->location = @3;
$$ = n;
}
;
@@ -1959,6 +1959,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "timezone";
+ n->location = -1;
$$ = n;
}
| TRANSACTION ISOLATION LEVEL
@@ -1967,6 +1968,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "transaction_isolation";
+ n->location = -1;
$$ = n;
}
| SESSION AUTHORIZATION
@@ -1975,6 +1977,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
;
@@ -1986,6 +1989,7 @@ generic_reset:
n->kind = VAR_RESET;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| ALL
@@ -1993,6 +1997,7 @@ generic_reset:
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_RESET_ALL;
+ n->location = -1;
$$ = n;
}
;
@@ -2715,15 +2720,45 @@ alter_table_cmd:
| ALTER CONSTRAINT name ConstraintAttributeSpec
{
AlterTableCmd *n = makeNode(AlterTableCmd);
- Constraint *c = makeNode(Constraint);
+ ATAlterConstraint *c = makeNode(ATAlterConstraint);
+
n->subtype = AT_AlterConstraint;
n->def = (Node *) c;
- c->contype = CONSTR_FOREIGN; /* others not supported, yet */
c->conname = $3;
- processCASbits($4, @4, "ALTER CONSTRAINT statement",
+ if ($4 & (CAS_NOT_ENFORCED | CAS_ENFORCED))
+ c->alterEnforceability = true;
+ if ($4 & (CAS_DEFERRABLE | CAS_NOT_DEFERRABLE |
+ CAS_INITIALLY_DEFERRED | CAS_INITIALLY_IMMEDIATE))
+ c->alterDeferrability = true;
+ if ($4 & CAS_NO_INHERIT)
+ c->alterInheritability = true;
+ /* handle unsupported case with specific error message */
+ if ($4 & CAS_NOT_VALID)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("constraints cannot be altered to be NOT VALID"),
+ parser_errposition(@4)));
+ processCASbits($4, @4, "FOREIGN KEY",
&c->deferrable,
&c->initdeferred,
- NULL, NULL, yyscanner);
+ &c->is_enforced,
+ NULL,
+ &c->noinherit,
+ yyscanner);
+ $$ = (Node *) n;
+ }
+ /* ALTER TABLE <name> ALTER CONSTRAINT INHERIT */
+ | ALTER CONSTRAINT name INHERIT
+ {
+ AlterTableCmd *n = makeNode(AlterTableCmd);
+ ATAlterConstraint *c = makeNode(ATAlterConstraint);
+
+ n->subtype = AT_AlterConstraint;
+ n->def = (Node *) c;
+ c->conname = $3;
+ c->alterInheritability = true;
+ c->noinherit = false;
+
$$ = (Node *) n;
}
/* ALTER TABLE <name> VALIDATE CONSTRAINT ... */
@@ -3214,11 +3249,13 @@ PartitionBoundSpec:
if (n->modulus == -1)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("modulus for hash partition must be specified")));
+ errmsg("modulus for hash partition must be specified"),
+ parser_errposition(@3)));
if (n->remainder == -1)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("remainder for hash partition must be specified")));
+ errmsg("remainder for hash partition must be specified"),
+ parser_errposition(@3)));
n->location = @3;
@@ -3970,12 +4007,16 @@ ColConstraint:
* or be part of a_expr NOT LIKE or similar constructs).
*/
ColConstraintElem:
- NOT NULL_P
+ NOT NULL_P opt_no_inherit
{
Constraint *n = makeNode(Constraint);
n->contype = CONSTR_NOTNULL;
n->location = @1;
+ n->is_no_inherit = $3;
+ n->is_enforced = true;
+ n->skip_validation = false;
+ n->initially_valid = true;
$$ = (Node *) n;
}
| NULL_P
@@ -4020,6 +4061,7 @@ ColConstraintElem:
n->is_no_inherit = $5;
n->raw_expr = $3;
n->cooked_expr = NULL;
+ n->is_enforced = true;
n->skip_validation = false;
n->initially_valid = true;
$$ = (Node *) n;
@@ -4046,7 +4088,7 @@ ColConstraintElem:
n->location = @1;
$$ = (Node *) n;
}
- | GENERATED generated_when AS '(' a_expr ')' STORED
+ | GENERATED generated_when AS '(' a_expr ')' opt_virtual_or_stored
{
Constraint *n = makeNode(Constraint);
@@ -4054,6 +4096,7 @@ ColConstraintElem:
n->generated_when = $2;
n->raw_expr = $5;
n->cooked_expr = NULL;
+ n->generated_kind = $7;
n->location = @1;
/*
@@ -4083,6 +4126,7 @@ ColConstraintElem:
n->fk_upd_action = ($5)->updateAction->action;
n->fk_del_action = ($5)->deleteAction->action;
n->fk_del_set_cols = ($5)->deleteAction->cols;
+ n->is_enforced = true;
n->skip_validation = false;
n->initially_valid = true;
$$ = (Node *) n;
@@ -4100,6 +4144,12 @@ generated_when:
| BY DEFAULT { $$ = ATTRIBUTE_IDENTITY_BY_DEFAULT; }
;
+opt_virtual_or_stored:
+ STORED { $$ = ATTRIBUTE_GENERATED_STORED; }
+ | VIRTUAL { $$ = ATTRIBUTE_GENERATED_VIRTUAL; }
+ | /*EMPTY*/ { $$ = ATTRIBUTE_GENERATED_VIRTUAL; }
+ ;
+
/*
* ConstraintAttr represents constraint attributes, which we parse as if
* they were independent constraint clauses, in order to avoid shift/reduce
@@ -4148,6 +4198,22 @@ ConstraintAttr:
n->location = @1;
$$ = (Node *) n;
}
+ | ENFORCED
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_ATTR_ENFORCED;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
+ | NOT ENFORCED
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_ATTR_NOT_ENFORCED;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
;
@@ -4209,12 +4275,25 @@ ConstraintElem:
n->raw_expr = $3;
n->cooked_expr = NULL;
processCASbits($5, @5, "CHECK",
- NULL, NULL, &n->skip_validation,
+ NULL, NULL, &n->is_enforced, &n->skip_validation,
+ &n->is_no_inherit, yyscanner);
+ n->initially_valid = !n->skip_validation;
+ $$ = (Node *) n;
+ }
+ | NOT NULL_P ColId ConstraintAttributeSpec
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_NOTNULL;
+ n->location = @1;
+ n->keys = list_make1(makeString($3));
+ processCASbits($4, @4, "NOT NULL",
+ NULL, NULL, NULL, &n->skip_validation,
&n->is_no_inherit, yyscanner);
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
}
- | UNIQUE opt_unique_null_treatment '(' columnList ')' opt_c_include opt_definition OptConsTableSpace
+ | UNIQUE opt_unique_null_treatment '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace
ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
@@ -4223,13 +4302,14 @@ ConstraintElem:
n->location = @1;
n->nulls_not_distinct = !$2;
n->keys = $4;
- n->including = $6;
- n->options = $7;
+ n->without_overlaps = $5;
+ n->including = $7;
+ n->options = $8;
n->indexname = NULL;
- n->indexspace = $8;
- processCASbits($9, @9, "UNIQUE",
+ n->indexspace = $9;
+ processCASbits($10, @10, "UNIQUE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| UNIQUE ExistingIndex ConstraintAttributeSpec
@@ -4245,10 +4325,10 @@ ConstraintElem:
n->indexspace = NULL;
processCASbits($3, @3, "UNIQUE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
- | PRIMARY KEY '(' columnList ')' opt_c_include opt_definition OptConsTableSpace
+ | PRIMARY KEY '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace
ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
@@ -4256,13 +4336,14 @@ ConstraintElem:
n->contype = CONSTR_PRIMARY;
n->location = @1;
n->keys = $4;
- n->including = $6;
- n->options = $7;
+ n->without_overlaps = $5;
+ n->including = $7;
+ n->options = $8;
n->indexname = NULL;
- n->indexspace = $8;
- processCASbits($9, @9, "PRIMARY KEY",
+ n->indexspace = $9;
+ processCASbits($10, @10, "PRIMARY KEY",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| PRIMARY KEY ExistingIndex ConstraintAttributeSpec
@@ -4278,7 +4359,7 @@ ConstraintElem:
n->indexspace = NULL;
processCASbits($4, @4, "PRIMARY KEY",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| EXCLUDE access_method_clause '(' ExclusionConstraintList ')'
@@ -4298,26 +4379,36 @@ ConstraintElem:
n->where_clause = $9;
processCASbits($10, @10, "EXCLUDE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
- | FOREIGN KEY '(' columnList ')' REFERENCES qualified_name
- opt_column_list key_match key_actions ConstraintAttributeSpec
+ | FOREIGN KEY '(' columnList optionalPeriodName ')' REFERENCES qualified_name
+ opt_column_and_period_list key_match key_actions ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
n->contype = CONSTR_FOREIGN;
n->location = @1;
- n->pktable = $7;
+ n->pktable = $8;
n->fk_attrs = $4;
- n->pk_attrs = $8;
- n->fk_matchtype = $9;
- n->fk_upd_action = ($10)->updateAction->action;
- n->fk_del_action = ($10)->deleteAction->action;
- n->fk_del_set_cols = ($10)->deleteAction->cols;
- processCASbits($11, @11, "FOREIGN KEY",
+ if ($5)
+ {
+ n->fk_attrs = lappend(n->fk_attrs, $5);
+ n->fk_with_period = true;
+ }
+ n->pk_attrs = linitial($9);
+ if (lsecond($9))
+ {
+ n->pk_attrs = lappend(n->pk_attrs, lsecond($9));
+ n->pk_with_period = true;
+ }
+ n->fk_matchtype = $10;
+ n->fk_upd_action = ($11)->updateAction->action;
+ n->fk_del_action = ($11)->deleteAction->action;
+ n->fk_del_set_cols = ($11)->deleteAction->cols;
+ processCASbits($12, @12, "FOREIGN KEY",
&n->deferrable, &n->initdeferred,
- &n->skip_validation, NULL,
+ &n->is_enforced, &n->skip_validation, NULL,
yyscanner);
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
@@ -4357,8 +4448,9 @@ DomainConstraintElem:
n->raw_expr = $3;
n->cooked_expr = NULL;
processCASbits($5, @5, "CHECK",
- NULL, NULL, &n->skip_validation,
+ NULL, NULL, NULL, &n->skip_validation,
&n->is_no_inherit, yyscanner);
+ n->is_enforced = true;
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
}
@@ -4369,10 +4461,10 @@ DomainConstraintElem:
n->contype = CONSTR_NOTNULL;
n->location = @1;
n->keys = list_make1(makeString("value"));
- /* no NOT VALID support yet */
+ /* no NOT VALID, NO INHERIT support */
processCASbits($3, @3, "NOT NULL",
NULL, NULL, NULL,
- &n->is_no_inherit, yyscanner);
+ NULL, NULL, yyscanner);
n->initially_valid = true;
$$ = (Node *) n;
}
@@ -4382,6 +4474,11 @@ opt_no_inherit: NO INHERIT { $$ = true; }
| /* EMPTY */ { $$ = false; }
;
+opt_without_overlaps:
+ WITHOUT OVERLAPS { $$ = true; }
+ | /*EMPTY*/ { $$ = false; }
+ ;
+
opt_column_list:
'(' columnList ')' { $$ = $2; }
| /*EMPTY*/ { $$ = NIL; }
@@ -4392,6 +4489,16 @@ columnList:
| columnList ',' columnElem { $$ = lappend($1, $3); }
;
+optionalPeriodName:
+ ',' PERIOD columnElem { $$ = $3; }
+ | /*EMPTY*/ { $$ = NULL; }
+ ;
+
+opt_column_and_period_list:
+ '(' columnList optionalPeriodName ')' { $$ = list_make2($2, $3); }
+ | /*EMPTY*/ { $$ = list_make2(NIL, NULL); }
+ ;
+
columnElem: ColId
{
$$ = (Node *) makeString($1);
@@ -4571,7 +4678,7 @@ PartitionSpec: PARTITION BY ColId '(' part_params ')'
{
PartitionSpec *n = makeNode(PartitionSpec);
- n->strategy = parsePartitionStrategy($3);
+ n->strategy = parsePartitionStrategy($3, @3, yyscanner);
n->partParams = $5;
n->location = @1;
@@ -4981,6 +5088,10 @@ SeqOptElem: AS SimpleTypename
{
$$ = makeDefElem("increment", (Node *) $3, @1);
}
+ | LOGGED
+ {
+ $$ = makeDefElem("logged", NULL, @1);
+ }
| MAXVALUE NumericOnly
{
$$ = makeDefElem("maxvalue", (Node *) $2, @1);
@@ -5003,7 +5114,6 @@ SeqOptElem: AS SimpleTypename
}
| SEQUENCE NAME_P any_name
{
- /* not documented, only used by pg_dump */
$$ = makeDefElem("sequence_name", (Node *) $3, @1);
}
| START opt_with NumericOnly
@@ -5018,6 +5128,10 @@ SeqOptElem: AS SimpleTypename
{
$$ = makeDefElem("restart", (Node *) $3, @1);
}
+ | UNLOGGED
+ {
+ $$ = makeDefElem("unlogged", NULL, @1);
+ }
;
opt_by: BY
@@ -5998,7 +6112,8 @@ CreateTrigStmt:
if (n->replace) /* not supported, see CreateTrigger */
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("CREATE OR REPLACE CONSTRAINT TRIGGER is not supported")));
+ errmsg("CREATE OR REPLACE CONSTRAINT TRIGGER is not supported"),
+ parser_errposition(@1)));
n->isconstraint = true;
n->trigname = $5;
n->relation = $9;
@@ -6012,7 +6127,7 @@ CreateTrigStmt:
n->transitionRels = NIL;
processCASbits($11, @11, "TRIGGER",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
n->constrrel = $10;
$$ = (Node *) n;
}
@@ -6181,7 +6296,8 @@ ConstraintAttributeSpec:
parser_errposition(@2)));
/* generic message for other conflicts */
if ((newspec & (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE)) == (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE) ||
- (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED))
+ (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED) ||
+ (newspec & (CAS_NOT_ENFORCED | CAS_ENFORCED)) == (CAS_NOT_ENFORCED | CAS_ENFORCED))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting constraint properties"),
@@ -6197,6 +6313,8 @@ ConstraintAttributeElem:
| INITIALLY DEFERRED { $$ = CAS_INITIALLY_DEFERRED; }
| NOT VALID { $$ = CAS_NOT_VALID; }
| NO INHERIT { $$ = CAS_NO_INHERIT; }
+ | NOT ENFORCED { $$ = CAS_NOT_ENFORCED; }
+ | ENFORCED { $$ = CAS_ENFORCED; }
;
@@ -6283,7 +6401,8 @@ CreateAssertionStmt:
{
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("CREATE ASSERTION is not yet implemented")));
+ errmsg("CREATE ASSERTION is not yet implemented"),
+ parser_errposition(@1)));
$$ = NULL;
}
@@ -6643,7 +6762,7 @@ opclass_item_list:
;
opclass_item:
- OPERATOR Iconst any_operator opclass_purpose opt_recheck
+ OPERATOR Iconst any_operator opclass_purpose
{
CreateOpClassItem *n = makeNode(CreateOpClassItem);
ObjectWithArgs *owa = makeNode(ObjectWithArgs);
@@ -6657,7 +6776,6 @@ opclass_item:
$$ = (Node *) n;
}
| OPERATOR Iconst operator_with_argtypes opclass_purpose
- opt_recheck
{
CreateOpClassItem *n = makeNode(CreateOpClassItem);
@@ -6709,23 +6827,6 @@ opclass_purpose: FOR SEARCH { $$ = NIL; }
| /*EMPTY*/ { $$ = NIL; }
;
-opt_recheck: RECHECK
- {
- /*
- * RECHECK no longer does anything in opclass definitions,
- * but we still accept it to ease porting of old database
- * dumps.
- */
- ereport(NOTICE,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("RECHECK is no longer required"),
- errhint("Update your data type."),
- parser_errposition(@1)));
- $$ = true;
- }
- | /*EMPTY*/ { $$ = false; }
- ;
-
CreateOpFamilyStmt:
CREATE OPERATOR FAMILY any_name USING name
@@ -8145,6 +8246,7 @@ defacl_privilege_target:
| SEQUENCES { $$ = OBJECT_SEQUENCE; }
| TYPES_P { $$ = OBJECT_TYPE; }
| SCHEMAS { $$ = OBJECT_SCHEMA; }
+ | LARGE_P OBJECTS_P { $$ = OBJECT_LARGEOBJECT; }
;
@@ -8344,7 +8446,7 @@ CreateFunctionStmt:
n->is_procedure = false;
n->replace = $2;
n->funcname = $4;
- n->parameters = mergeTableFuncParameters($5, $9);
+ n->parameters = mergeTableFuncParameters($5, $9, yyscanner);
n->returnType = TableFuncTypeName($9);
n->returnType->location = @7;
n->options = $11;
@@ -8477,6 +8579,7 @@ func_arg:
n->argType = $3;
n->mode = $1;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| param_name arg_class func_type
@@ -8487,6 +8590,7 @@ func_arg:
n->argType = $3;
n->mode = $2;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| param_name func_type
@@ -8497,6 +8601,7 @@ func_arg:
n->argType = $2;
n->mode = FUNC_PARAM_DEFAULT;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| arg_class func_type
@@ -8507,6 +8612,7 @@ func_arg:
n->argType = $2;
n->mode = $1;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| func_type
@@ -8517,6 +8623,7 @@ func_arg:
n->argType = $1;
n->mode = FUNC_PARAM_DEFAULT;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
;
@@ -8853,6 +8960,7 @@ table_func_column: param_name func_type
n->argType = $2;
n->mode = FUNC_PARAM_TABLE;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
;
@@ -11977,7 +12085,7 @@ opt_name_list:
;
vacuum_relation:
- qualified_name opt_name_list
+ relation_expr opt_name_list
{
$$ = (Node *) makeVacuumRelation($1, InvalidOid, $2);
}
@@ -12200,7 +12308,7 @@ InsertStmt:
{
$5->relation = $4;
$5->onConflictClause = $6;
- $5->returningList = $7;
+ $5->returningClause = $7;
$5->withClause = $1;
$$ = (Node *) $5;
}
@@ -12333,8 +12441,45 @@ opt_conf_expr:
;
returning_clause:
- RETURNING target_list { $$ = $2; }
- | /* EMPTY */ { $$ = NIL; }
+ RETURNING returning_with_clause target_list
+ {
+ ReturningClause *n = makeNode(ReturningClause);
+
+ n->options = $2;
+ n->exprs = $3;
+ $$ = n;
+ }
+ | /* EMPTY */
+ {
+ $$ = NULL;
+ }
+ ;
+
+returning_with_clause:
+ WITH '(' returning_options ')' { $$ = $3; }
+ | /* EMPTY */ { $$ = NIL; }
+ ;
+
+returning_options:
+ returning_option { $$ = list_make1($1); }
+ | returning_options ',' returning_option { $$ = lappend($1, $3); }
+ ;
+
+returning_option:
+ returning_option_kind AS ColId
+ {
+ ReturningOption *n = makeNode(ReturningOption);
+
+ n->option = $1;
+ n->value = $3;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
+ ;
+
+returning_option_kind:
+ OLD { $$ = RETURNING_OPTION_OLD; }
+ | NEW { $$ = RETURNING_OPTION_NEW; }
;
@@ -12353,7 +12498,7 @@ DeleteStmt: opt_with_clause DELETE_P FROM relation_expr_opt_alias
n->relation = $4;
n->usingClause = $5;
n->whereClause = $6;
- n->returningList = $7;
+ n->returningClause = $7;
n->withClause = $1;
$$ = (Node *) n;
}
@@ -12427,7 +12572,7 @@ UpdateStmt: opt_with_clause UPDATE relation_expr_opt_alias
n->targetList = $5;
n->fromClause = $6;
n->whereClause = $7;
- n->returningList = $8;
+ n->returningClause = $8;
n->withClause = $1;
$$ = (Node *) n;
}
@@ -12504,7 +12649,7 @@ MergeStmt:
m->sourceRelation = $6;
m->joinCondition = $8;
m->mergeWhenClauses = $9;
- m->returningList = $10;
+ m->returningClause = $10;
$$ = (Node *) m;
}
@@ -13183,11 +13328,13 @@ select_limit:
{
$$ = $1;
($$)->limitOffset = $2;
+ ($$)->offsetLoc = @2;
}
| offset_clause limit_clause
{
$$ = $2;
($$)->limitOffset = $1;
+ ($$)->offsetLoc = @1;
}
| limit_clause
{
@@ -13200,6 +13347,9 @@ select_limit:
n->limitOffset = $1;
n->limitCount = NULL;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = @1;
+ n->countLoc = -1;
+ n->optionLoc = -1;
$$ = n;
}
;
@@ -13217,6 +13367,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $2;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| LIMIT select_limit_value ',' select_offset_value
@@ -13242,6 +13395,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $3;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| FETCH first_or_next select_fetch_first_value row_or_rows WITH TIES
@@ -13251,6 +13407,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $3;
n->limitOption = LIMIT_OPTION_WITH_TIES;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = @5;
$$ = n;
}
| FETCH first_or_next row_or_rows ONLY
@@ -13260,6 +13419,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = makeIntConst(1, -1);
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| FETCH first_or_next row_or_rows WITH TIES
@@ -13269,6 +13431,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = makeIntConst(1, -1);
n->limitOption = LIMIT_OPTION_WITH_TIES;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = @4;
$$ = n;
}
;
@@ -14113,7 +14278,7 @@ xmltable_column_el:
parser_errposition(defel->location)));
fc->colexpr = defel->arg;
}
- else if (strcmp(defel->defname, "is_not_null") == 0)
+ else if (strcmp(defel->defname, "__pg__is_not_null") == 0)
{
if (nullability_seen)
ereport(ERROR,
@@ -14156,13 +14321,20 @@ xmltable_column_option_list:
xmltable_column_option_el:
IDENT b_expr
- { $$ = makeDefElem($1, $2, @1); }
+ {
+ if (strcmp($1, "__pg__is_not_null") == 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("option name \"%s\" cannot be used in XMLTABLE", $1),
+ parser_errposition(@1)));
+ $$ = makeDefElem($1, $2, @1);
+ }
| DEFAULT b_expr
{ $$ = makeDefElem("default", $2, @1); }
| NOT NULL_P
- { $$ = makeDefElem("is_not_null", (Node *) makeBoolean(true), @1); }
+ { $$ = makeDefElem("__pg__is_not_null", (Node *) makeBoolean(true), @1); }
| NULL_P
- { $$ = makeDefElem("is_not_null", (Node *) makeBoolean(false), @1); }
+ { $$ = makeDefElem("__pg__is_not_null", (Node *) makeBoolean(false), @1); }
| PATH b_expr
{ $$ = makeDefElem("path", $2, @1); }
;
@@ -15163,49 +15335,50 @@ a_expr: c_expr { $$ = $1; }
(Node *) list_make2($5, $7),
@2);
}
- | a_expr IN_P in_expr
+ | a_expr IN_P select_with_parens
{
- /* in_expr returns a SubLink or a list of a_exprs */
- if (IsA($3, SubLink))
- {
- /* generate foo = ANY (subquery) */
- SubLink *n = (SubLink *) $3;
+ /* generate foo = ANY (subquery) */
+ SubLink *n = makeNode(SubLink);
- n->subLinkType = ANY_SUBLINK;
- n->subLinkId = 0;
- n->testexpr = $1;
- n->operName = NIL; /* show it's IN not = ANY */
- n->location = @2;
- $$ = (Node *) n;
- }
- else
- {
- /* generate scalar IN expression */
- $$ = (Node *) makeSimpleA_Expr(AEXPR_IN, "=", $1, $3, @2);
- }
+ n->subselect = $3;
+ n->subLinkType = ANY_SUBLINK;
+ n->subLinkId = 0;
+ n->testexpr = $1;
+ n->operName = NIL; /* show it's IN not = ANY */
+ n->location = @2;
+ $$ = (Node *) n;
}
- | a_expr NOT_LA IN_P in_expr %prec NOT_LA
+ | a_expr IN_P '(' expr_list ')'
{
- /* in_expr returns a SubLink or a list of a_exprs */
- if (IsA($4, SubLink))
- {
- /* generate NOT (foo = ANY (subquery)) */
- /* Make an = ANY node */
- SubLink *n = (SubLink *) $4;
-
- n->subLinkType = ANY_SUBLINK;
- n->subLinkId = 0;
- n->testexpr = $1;
- n->operName = NIL; /* show it's IN not = ANY */
- n->location = @2;
- /* Stick a NOT on top; must have same parse location */
- $$ = makeNotExpr((Node *) n, @2);
- }
- else
- {
- /* generate scalar NOT IN expression */
- $$ = (Node *) makeSimpleA_Expr(AEXPR_IN, "<>", $1, $4, @2);
- }
+ /* generate scalar IN expression */
+ A_Expr *n = makeSimpleA_Expr(AEXPR_IN, "=", $1, (Node *) $4, @2);
+
+ n->rexpr_list_start = @3;
+ n->rexpr_list_end = @5;
+ $$ = (Node *) n;
+ }
+ | a_expr NOT_LA IN_P select_with_parens %prec NOT_LA
+ {
+ /* generate NOT (foo = ANY (subquery)) */
+ SubLink *n = makeNode(SubLink);
+
+ n->subselect = $4;
+ n->subLinkType = ANY_SUBLINK;
+ n->subLinkId = 0;
+ n->testexpr = $1;
+ n->operName = NIL; /* show it's IN not = ANY */
+ n->location = @2;
+ /* Stick a NOT on top; must have same parse location */
+ $$ = makeNotExpr((Node *) n, @2);
+ }
+ | a_expr NOT_LA IN_P '(' expr_list ')'
+ {
+ /* generate scalar NOT IN expression */
+ A_Expr *n = makeSimpleA_Expr(AEXPR_IN, "<>", $1, (Node *) $5, @2);
+
+ n->rexpr_list_start = @4;
+ n->rexpr_list_end = @6;
+ $$ = (Node *) n;
}
| a_expr subquery_Op sub_type select_with_parens %prec Op
{
@@ -16640,15 +16813,15 @@ type_list: Typename { $$ = list_make1($1); }
array_expr: '[' expr_list ']'
{
- $$ = makeAArrayExpr($2, @1);
+ $$ = makeAArrayExpr($2, @1, @3);
}
| '[' array_expr_list ']'
{
- $$ = makeAArrayExpr($2, @1);
+ $$ = makeAArrayExpr($2, @1, @3);
}
| '[' ']'
{
- $$ = makeAArrayExpr(NIL, @1);
+ $$ = makeAArrayExpr(NIL, @1, @2);
}
;
@@ -16770,17 +16943,6 @@ trim_list: a_expr FROM expr_list { $$ = lappend($3, $1); }
| expr_list { $$ = $1; }
;
-in_expr: select_with_parens
- {
- SubLink *n = makeNode(SubLink);
-
- n->subselect = $1;
- /* other fields will be filled later */
- $$ = (Node *) n;
- }
- | '(' expr_list ')' { $$ = (Node *) $2; }
- ;
-
/*
* Define SQL-style CASE clause.
* - Full specification
@@ -16981,7 +17143,8 @@ json_format_clause:
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized JSON encoding: %s", $4)));
+ errmsg("unrecognized JSON encoding: %s", $4),
+ parser_errposition(@4)));
$$ = (Node *) makeJsonFormat(JS_FORMAT_JSON, encoding, @1);
}
@@ -17483,7 +17646,8 @@ PLpgSQL_Expr: opt_distinct_clause opt_target_list
$9->limitOption == LIMIT_OPTION_WITH_TIES)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("WITH TIES cannot be specified without ORDER BY clause")));
+ errmsg("WITH TIES cannot be specified without ORDER BY clause"),
+ parser_errposition($9->optionLoc)));
n->limitOption = $9->limitOption;
}
n->lockingClause = $10;
@@ -17667,6 +17831,7 @@ unreserved_keyword:
| ENABLE_P
| ENCODING
| ENCRYPTED
+ | ENFORCED
| ENUM_P
| ERROR_P
| ESCAPE
@@ -17762,6 +17927,7 @@ unreserved_keyword:
| NOWAIT
| NULLS_P
| OBJECT_P
+ | OBJECTS_P
| OF
| OFF
| OIDS
@@ -17784,6 +17950,7 @@ unreserved_keyword:
| PASSING
| PASSWORD
| PATH
+ | PERIOD
| PLAN
| PLANS
| POLICY
@@ -17803,7 +17970,6 @@ unreserved_keyword:
| RANGE
| READ
| REASSIGN
- | RECHECK
| RECURSIVE
| REF_P
| REFERENCING
@@ -17900,6 +18066,7 @@ unreserved_keyword:
| VERSION_P
| VIEW
| VIEWS
+ | VIRTUAL
| VOLATILE
| WHITESPACE_P
| WITHIN
@@ -18244,6 +18411,7 @@ bare_label_keyword:
| ENCODING
| ENCRYPTED
| END_P
+ | ENFORCED
| ENUM_P
| ERROR_P
| ESCAPE
@@ -18382,6 +18550,7 @@ bare_label_keyword:
| NULLS_P
| NUMERIC
| OBJECT_P
+ | OBJECTS_P
| OF
| OFF
| OIDS
@@ -18408,6 +18577,7 @@ bare_label_keyword:
| PASSING
| PASSWORD
| PATH
+ | PERIOD
| PLACING
| PLAN
| PLANS
@@ -18431,7 +18601,6 @@ bare_label_keyword:
| READ
| REAL
| REASSIGN
- | RECHECK
| RECURSIVE
| REF_P
| REFERENCES
@@ -18554,6 +18723,7 @@ bare_label_keyword:
| VERSION_P
| VIEW
| VIEWS
+ | VIRTUAL
| VOLATILE
| WHEN
| WHITESPACE_P
@@ -18621,10 +18791,10 @@ makeColumnRef(char *colname, List *indirection,
int location, core_yyscan_t yyscanner)
{
/*
- * Generate a ColumnRef node, with an A_Indirection node added if there
- * is any subscripting in the specified indirection list. However,
- * any field selection at the start of the indirection list must be
- * transposed into the "fields" part of the ColumnRef node.
+ * Generate a ColumnRef node, with an A_Indirection node added if there is
+ * any subscripting in the specified indirection list. However, any field
+ * selection at the start of the indirection list must be transposed into
+ * the "fields" part of the ColumnRef node.
*/
ColumnRef *c = makeNode(ColumnRef);
int nfields = 0;
@@ -18696,7 +18866,7 @@ makeIntConst(int val, int location)
n->val.ival.ival = val;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
@@ -18708,42 +18878,42 @@ makeFloatConst(char *str, int location)
n->val.fval.fval = str;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
makeBoolAConst(bool state, int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->val.boolval.type = T_Boolean;
n->val.boolval.boolval = state;
n->location = location;
- return (Node *) n;
+ return (Node *) n;
}
static Node *
makeBitStringConst(char *str, int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->val.bsval.type = T_BitString;
n->val.bsval.bsval = str;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
makeNullAConst(int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->isnull = true;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
@@ -18827,7 +18997,7 @@ check_func_name(List *names, core_yyscan_t yyscanner)
static List *
check_indirection(List *indirection, core_yyscan_t yyscanner)
{
- ListCell *l;
+ ListCell *l;
foreach(l, indirection)
{
@@ -18882,7 +19052,7 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
core_yyscan_t yyscanner)
{
FunctionParameter *lastd = (FunctionParameter *) llast(directargs);
- Integer *ndirectargs;
+ Integer *ndirectargs;
/* No restriction unless last direct arg is VARIADIC */
if (lastd->mode == FUNC_PARAM_VARIADIC)
@@ -18890,15 +19060,15 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
FunctionParameter *firsto = (FunctionParameter *) linitial(orderedargs);
/*
- * We ignore the names, though the aggr_arg production allows them;
- * it doesn't allow default values, so those need not be checked.
+ * We ignore the names, though the aggr_arg production allows them; it
+ * doesn't allow default values, so those need not be checked.
*/
if (list_length(orderedargs) != 1 ||
firsto->mode != FUNC_PARAM_VARIADIC)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("an ordered-set aggregate with a VARIADIC direct argument must have one VARIADIC aggregated argument of the same data type"),
- parser_errposition(exprLocation((Node *) firsto))));
+ parser_errposition(firsto->location)));
/* OK, drop the duplicate VARIADIC argument from the internal form */
orderedargs = NIL;
@@ -18946,7 +19116,7 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple OFFSET clauses not allowed"),
- parser_errposition(exprLocation(limitClause->limitOffset))));
+ parser_errposition(limitClause->offsetLoc)));
stmt->limitOffset = limitClause->limitOffset;
}
if (limitClause && limitClause->limitCount)
@@ -18955,19 +19125,18 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple LIMIT clauses not allowed"),
- parser_errposition(exprLocation(limitClause->limitCount))));
+ parser_errposition(limitClause->countLoc)));
stmt->limitCount = limitClause->limitCount;
}
if (limitClause)
{
- if (stmt->limitOption)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("multiple limit options not allowed")));
+ /* If there was a conflict, we must have detected it above */
+ Assert(!stmt->limitOption);
if (!stmt->sortClause && limitClause->limitOption == LIMIT_OPTION_WITH_TIES)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("WITH TIES cannot be specified without ORDER BY clause")));
+ errmsg("WITH TIES cannot be specified without ORDER BY clause"),
+ parser_errposition(limitClause->optionLoc)));
if (limitClause->limitOption == LIMIT_OPTION_WITH_TIES && stmt->lockingClause)
{
ListCell *lc;
@@ -18980,7 +19149,8 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("%s and %s options cannot be used together",
- "SKIP LOCKED", "WITH TIES")));
+ "SKIP LOCKED", "WITH TIES"),
+ parser_errposition(limitClause->optionLoc)));
}
}
stmt->limitOption = limitClause->limitOption;
@@ -19047,7 +19217,7 @@ doNegate(Node *n, int location)
{
if (IsA(n, A_Const))
{
- A_Const *con = (A_Const *) n;
+ A_Const *con = (A_Const *) n;
/* report the constant's location as that of the '-' sign */
con->location = location;
@@ -19075,7 +19245,7 @@ doNegateFloat(Float *v)
if (*oldval == '+')
oldval++;
if (*oldval == '-')
- v->fval = oldval+1; /* just strip the '-' */
+ v->fval = oldval + 1; /* just strip the '-' */
else
v->fval = psprintf("-%s", oldval);
}
@@ -19121,12 +19291,14 @@ makeNotExpr(Node *expr, int location)
}
static Node *
-makeAArrayExpr(List *elements, int location)
+makeAArrayExpr(List *elements, int location, int location_end)
{
A_ArrayExpr *n = makeNode(A_ArrayExpr);
n->elements = elements;
n->location = location;
+ n->list_start = location;
+ n->list_end = location_end;
return (Node *) n;
}
@@ -19146,10 +19318,11 @@ static Node *
makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
int location)
{
- XmlExpr *x = makeNode(XmlExpr);
+ XmlExpr *x = makeNode(XmlExpr);
x->op = op;
x->name = name;
+
/*
* named_args is a list of ResTarget; it'll be split apart into separate
* expression and name lists in transformXmlExpr().
@@ -19159,7 +19332,7 @@ makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
x->args = args;
/* xmloption, if relevant, must be filled in by caller */
/* type and typmod will be filled in during parse analysis */
- x->type = InvalidOid; /* marks the node as not analyzed */
+ x->type = InvalidOid; /* marks the node as not analyzed */
x->location = location;
return (Node *) x;
}
@@ -19168,7 +19341,7 @@ makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
* Merge the input and output parameters of a table function.
*/
static List *
-mergeTableFuncParameters(List *func_args, List *columns)
+mergeTableFuncParameters(List *func_args, List *columns, core_yyscan_t yyscanner)
{
ListCell *lc;
@@ -19182,7 +19355,8 @@ mergeTableFuncParameters(List *func_args, List *columns)
p->mode != FUNC_PARAM_VARIADIC)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("OUT and INOUT arguments aren't allowed in TABLE functions")));
+ errmsg("OUT and INOUT arguments aren't allowed in TABLE functions"),
+ parser_errposition(p->location)));
}
return list_concat(func_args, columns);
@@ -19283,7 +19457,7 @@ makeRangeVarFromQualifiedName(char *name, List *namelist, int location,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("improper qualified name (too many dotted names): %s",
NameListToString(lcons(makeString(name), namelist))),
- parser_errposition(location)));
+ parser_errposition(location)));
break;
}
@@ -19334,8 +19508,8 @@ SplitColQualList(List *qualList,
*/
static void
processCASbits(int cas_bits, int location, const char *constrType,
- bool *deferrable, bool *initdeferred, bool *not_valid,
- bool *no_inherit, core_yyscan_t yyscanner)
+ bool *deferrable, bool *initdeferred, bool *is_enforced,
+ bool *not_valid, bool *no_inherit, core_yyscan_t yyscanner)
{
/* defaults */
if (deferrable)
@@ -19344,6 +19518,8 @@ processCASbits(int cas_bits, int location, const char *constrType,
*initdeferred = false;
if (not_valid)
*not_valid = false;
+ if (is_enforced)
+ *is_enforced = true;
if (cas_bits & (CAS_DEFERRABLE | CAS_INITIALLY_DEFERRED))
{
@@ -19352,7 +19528,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked DEFERRABLE",
constrType),
parser_errposition(location)));
@@ -19365,7 +19541,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked DEFERRABLE",
constrType),
parser_errposition(location)));
@@ -19378,7 +19554,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked NOT VALID",
constrType),
parser_errposition(location)));
@@ -19391,11 +19567,46 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked NO INHERIT",
constrType),
parser_errposition(location)));
}
+
+ if (cas_bits & CAS_NOT_ENFORCED)
+ {
+ if (is_enforced)
+ *is_enforced = false;
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ /* translator: %s is CHECK, UNIQUE, or similar */
+ errmsg("%s constraints cannot be marked NOT ENFORCED",
+ constrType),
+ parser_errposition(location)));
+
+ /*
+ * NB: The validated status is irrelevant when the constraint is set to
+ * NOT ENFORCED, but for consistency, it should be set accordingly.
+ * This ensures that if the constraint is later changed to ENFORCED, it
+ * will automatically be in the correct NOT VALIDATED state.
+ */
+ if (not_valid)
+ *not_valid = true;
+ }
+
+ if (cas_bits & CAS_ENFORCED)
+ {
+ if (is_enforced)
+ *is_enforced = true;
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ /* translator: %s is CHECK, UNIQUE, or similar */
+ errmsg("%s constraints cannot be marked ENFORCED",
+ constrType),
+ parser_errposition(location)));
+ }
}
/*
@@ -19403,7 +19614,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
* PartitionStrategy representation, or die trying.
*/
static PartitionStrategy
-parsePartitionStrategy(char *strategy)
+parsePartitionStrategy(char *strategy, int location, core_yyscan_t yyscanner)
{
if (pg_strcasecmp(strategy, "list") == 0)
return PARTITION_STRATEGY_LIST;
@@ -19414,9 +19625,9 @@ parsePartitionStrategy(char *strategy)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized partitioning strategy \"%s\"",
- strategy)));
- return PARTITION_STRATEGY_LIST; /* keep compiler quiet */
+ errmsg("unrecognized partitioning strategy \"%s\"", strategy),
+ parser_errposition(location)));
+ return PARTITION_STRATEGY_LIST; /* keep compiler quiet */
}
@@ -19487,8 +19698,8 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
parser_errposition(pubobj->location)));
/*
- * We can distinguish between the different type of schema
- * objects based on whether name and pubtable is set.
+ * We can distinguish between the different type of schema objects
+ * based on whether name and pubtable is set.
*/
if (pubobj->name)
pubobj->pubobjtype = PUBLICATIONOBJ_TABLES_IN_SCHEMA;
@@ -19543,11 +19754,13 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
w->ctes = list_make1(cte);
w->location = -1;
- /* create target list for the new SELECT from the alias list of the
- * recursive view specification */
- foreach (lc, aliases)
+ /*
+ * create target list for the new SELECT from the alias list of the
+ * recursive view specification
+ */
+ foreach(lc, aliases)
{
- ResTarget *rt = makeNode(ResTarget);
+ ResTarget *rt = makeNode(ResTarget);
rt->name = NULL;
rt->indirection = NIL;
@@ -19557,8 +19770,10 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
tl = lappend(tl, rt);
}
- /* create new SELECT combining WITH clause, target list, and fake FROM
- * clause */
+ /*
+ * create new SELECT combining WITH clause, target list, and fake FROM
+ * clause
+ */
s->withClause = w;
s->targetList = tl;
s->fromClause = list_make1(makeRangeVar(NULL, relname, -1));
diff --git a/src/parser/gram_minimal.y b/src/parser/gram_minimal.y
index e11074e1f..5c71b4cae 100644
--- a/src/parser/gram_minimal.y
+++ b/src/parser/gram_minimal.y
@@ -6,8 +6,8 @@
* gram.y
* POSTGRESQL BISON rules/actions
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -89,6 +89,8 @@
#define ATTRIBUTE_IDENTITY_ALWAYS 'a'
#define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd'
+#define ATTRIBUTE_GENERATED_STORED 's'
+#define ATTRIBUTE_GENERATED_VIRTUAL 'v'
/*
* Definition taken from
* postgreSQL source code file: src/include/utils/xml.h
@@ -102,39 +104,25 @@ typedef enum
} XmlStandaloneType;
/*
- * Location tracking support --- simpler than bison's default, since we only
- * want to track the start position not the end position of each nonterminal.
+ * Location tracking support. Unlike bison's default, we only want
+ * to track the start position not the end position of each nonterminal.
+ * Nonterminals that reduce to empty receive position "-1". Since a
+ * production's leading RHS nonterminal(s) may have reduced to empty,
+ * we have to scan to find the first one that's not -1.
*/
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
- if ((N) > 0) \
- (Current) = (Rhs)[1]; \
- else \
- (Current) = (-1); \
+ (Current) = (-1); \
+ for (int _i = 1; _i <= (N); _i++) \
+ { \
+ if ((Rhs)[_i] >= 0) \
+ { \
+ (Current) = (Rhs)[_i]; \
+ break; \
+ } \
+ } \
} while (0)
-/*
- * The above macro assigns -1 (unknown) as the parse location of any
- * nonterminal that was reduced from an empty rule, or whose leftmost
- * component was reduced from an empty rule. This is problematic
- * for nonterminals defined like
- * OptFooList: / * EMPTY * / { ... } | OptFooList Foo { ... } ;
- * because we'll set -1 as the location during the first reduction and then
- * copy it during each subsequent reduction, leaving us with -1 for the
- * location even when the list is not empty. To fix that, do this in the
- * action for the nonempty rule(s):
- * if (@$ < 0) @$ = @2;
- * (Although we have many nonterminals that follow this pattern, we only
- * bother with fixing @$ like this when the nonterminal's parse location
- * is actually referenced in some rule.)
- *
- * A cleaner answer would be to make YYLLOC_DEFAULT scan all the Rhs
- * locations until it's found one that's not -1. Then we'd get a correct
- * location for any nonterminal that isn't entirely empty. But this way
- * would add overhead to every rule reduction, and so far there's not been
- * a compelling reason to pay that overhead.
- */
-
/*
* Bison doesn't allocate anything that needs to live across parser calls,
* so we can easily have it use palloc instead of malloc. This prevents
@@ -158,12 +146,15 @@ typedef struct ImportQual
List *table_names;
} ImportQual;
-/* Private struct for the result of opt_select_limit production */
+/* Private struct for the result of select_limit & limit_clause productions */
typedef struct SelectLimit
{
Node *limitOffset;
Node *limitCount;
- LimitOption limitOption;
+ LimitOption limitOption; /* indicates presence of WITH TIES */
+ ParseLoc offsetLoc; /* location of OFFSET token, if present */
+ ParseLoc countLoc; /* location of LIMIT/FETCH token, if present */
+ ParseLoc optionLoc; /* location of WITH TIES, if present */
} SelectLimit;
/* Private struct for the result of group_clause production */
@@ -193,6 +184,8 @@ typedef struct KeyActions
#define CAS_INITIALLY_DEFERRED 0x08
#define CAS_NOT_VALID 0x10
#define CAS_NO_INHERIT 0x20
+#define CAS_NOT_ENFORCED 0x40
+#define CAS_ENFORCED 0x80
#define parser_yyerror(msg) scanner_yyerror(msg, yyscanner)
@@ -228,12 +221,12 @@ static void doNegateFloat(Float *v);
static Node *makeAndExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeOrExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeNotExpr(Node *expr, int location);
-static Node *makeAArrayExpr(List *elements, int location);
+static Node *makeAArrayExpr(List *elements, int location, int end_location);
static Node *makeSQLValueFunction(SQLValueFunctionOp op, int32 typmod,
int location);
static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args,
List *args, int location);
-static List *mergeTableFuncParameters(List *func_args, List *columns);
+static List *mergeTableFuncParameters(List *func_args, List *columns, core_yyscan_t yyscanner);
static TypeName *TableFuncTypeName(List *columns);
static RangeVar *makeRangeVarFromAnyName(List *names, int position, core_yyscan_t yyscanner);
static RangeVar *makeRangeVarFromQualifiedName(char *name, List *namelist, int location,
@@ -242,9 +235,10 @@ static void SplitColQualList(List *qualList,
List **constraintList, CollateClause **collClause,
core_yyscan_t yyscanner);
static void processCASbits(int cas_bits, int location, const char *constrType,
- bool *deferrable, bool *initdeferred, bool *not_valid,
- bool *no_inherit, core_yyscan_t yyscanner);
-static PartitionStrategy parsePartitionStrategy(char *strategy);
+ bool *deferrable, bool *initdeferred, bool *is_enforced,
+ bool *not_valid, bool *no_inherit, core_yyscan_t yyscanner);
+static PartitionStrategy parsePartitionStrategy(char *strategy, int location,
+ core_yyscan_t yyscanner);
static void preprocess_pubobj_list(List *pubobjspec_list,
core_yyscan_t yyscanner);
static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
@@ -310,6 +304,8 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
MergeWhenClause *mergewhen;
struct KeyActions *keyactions;
struct KeyAction *keyaction;
+ ReturningClause *retclause;
+ ReturningOptionKind retoptionkind;
}
%type <node> stmt toplevel_stmt schema_stmt routine_body_stmt
@@ -482,7 +478,8 @@ UpdateStmtShort
opclass_purpose opt_opfamily transaction_mode_list_or_empty
OptTableFuncElementList TableFuncElementList opt_type_modifiers
prep_type_clause
- execute_param_clause using_clause returning_clause
+ execute_param_clause using_clause
+ returning_with_clause returning_options
opt_enum_val_list enum_val_list table_func_column_list
create_generic_options alter_generic_options
relation_expr_list dostmt_opt_list
@@ -491,6 +488,9 @@ UpdateStmtShort
vacuum_relation_list opt_vacuum_relation_list
drop_option_list pub_obj_list
+%type <retclause> returning_clause
+%type <node> returning_option
+%type <retoptionkind> returning_option_kind
%type <node> opt_routine_body
%type <groupclause> group_clause
%type <list> group_by_list
@@ -529,7 +529,7 @@ UpdateStmtShort
%type <boolean> opt_instead
%type <boolean> opt_unique opt_verbose opt_full
-%type <boolean> opt_freeze opt_analyze opt_default opt_recheck
+%type <boolean> opt_freeze opt_analyze opt_default
%type <defelt> opt_binary copy_delimiter
%type <boolean> copy_from opt_program
@@ -559,14 +559,15 @@ UpdateStmtShort
SetResetClause FunctionSetResetClause
%type <node> TableElement TypedTableElement ConstraintElem DomainConstraintElem TableFuncElement
-%type <node> columnDef columnOptions
+%type <node> columnDef columnOptions optionalPeriodName
%type <defelt> def_elem reloption_elem old_aggr_elem operator_def_elem
%type <node> def_arg columnElem where_clause where_or_current_clause
a_expr b_expr c_expr AexprConst indirection_el opt_slice_bound
- columnref in_expr having_clause func_table xmltable array_expr
+ columnref having_clause func_table xmltable array_expr
OptWhereClause operator_def_arg
+%type <list> opt_column_and_period_list
%type <list> rowsfrom_item rowsfrom_list opt_col_def_list
-%type <boolean> opt_ordinality
+%type <boolean> opt_ordinality opt_without_overlaps
%type <list> ExclusionConstraintList ExclusionConstraintElem
%type <list> func_arg_list func_arg_list_opt
%type <node> func_arg_expr
@@ -675,7 +676,7 @@ UpdateStmtShort
%type <str> opt_existing_window_name
%type <boolean> opt_if_not_exists
%type <boolean> opt_unique_null_treatment
-%type <ival> generated_when override_kind
+%type <ival> generated_when override_kind opt_virtual_or_stored
%type <partspec> PartitionSpec OptPartitionSpec
%type <partelem> part_elem
%type <list> part_params
@@ -758,9 +759,9 @@ UpdateStmtShort
DETACH DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P
DOUBLE_P DROP
- EACH ELSE EMPTY_P ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ERROR_P ESCAPE
- EVENT EXCEPT EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN EXPRESSION
- EXTENSION EXTERNAL EXTRACT
+ EACH ELSE EMPTY_P ENABLE_P ENCODING ENCRYPTED END_P ENFORCED ENUM_P ERROR_P
+ ESCAPE EVENT EXCEPT EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN
+ EXPRESSION EXTENSION EXTERNAL EXTRACT
FALSE_P FAMILY FETCH FILTER FINALIZE FIRST_P FLOAT_P FOLLOWING FOR
FORCE FOREIGN FORMAT FORWARD FREEZE FROM FULL FUNCTION FUNCTIONS
@@ -791,18 +792,18 @@ UpdateStmtShort
NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF
NULLS_P NUMERIC
- OBJECT_P OF OFF OFFSET OIDS OLD OMIT ON ONLY OPERATOR OPTION OPTIONS OR
+ OBJECT_P OBJECTS_P OF OFF OFFSET OIDS OLD OMIT ON ONLY OPERATOR OPTION OPTIONS OR
ORDER ORDINALITY OTHERS OUT_P OUTER_P
OVER OVERLAPS OVERLAY OVERRIDING OWNED OWNER
PARALLEL PARAMETER PARSER PARTIAL PARTITION PASSING PASSWORD PATH PGPOOL
- PLACING PLAN PLANS POLICY
+ PERIOD PLACING PLAN PLANS POLICY
POSITION PRECEDING PRECISION PRESERVE PREPARE PREPARED PRIMARY
PRIOR PRIVILEGES PROCEDURAL PROCEDURE PROCEDURES PROGRAM PUBLICATION
QUOTE QUOTES
- RANGE READ REAL REASSIGN RECHECK RECURSIVE REF_P REFERENCES REFERENCING
+ RANGE READ REAL REASSIGN RECURSIVE REF_P REFERENCES REFERENCING
REFRESH REINDEX RELATIVE_P RELEASE RENAME REPEATABLE REPLACE REPLICA
RESET RESTART RESTRICT RETURN RETURNING RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
ROUTINE ROUTINES ROW ROWS RULE
@@ -823,7 +824,7 @@ UpdateStmtShort
UNLISTEN UNLOGGED UNTIL UPDATE USER USING
VACUUM VALID VALIDATE VALIDATOR VALUE_P VALUES VARCHAR VARIADIC VARYING
- VERBOSE VERSION_P VIEW VIEWS VOLATILE
+ VERBOSE VERSION_P VIEW VIEWS VIRTUAL VOLATILE
WHEN WHERE WHITESPACE_P WINDOW WITH WITHIN WITHOUT WORK WRAPPER WRITE
@@ -964,7 +965,7 @@ parse_toplevel:
| MODE_PLPGSQL_EXPR PLpgSQL_Expr
{
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt($2, 0));
+ list_make1(makeRawStmt($2, @2));
}
| MODE_PLPGSQL_ASSIGN1 PLAssignStmt
{
@@ -972,7 +973,7 @@ parse_toplevel:
n->nnames = 1;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
| MODE_PLPGSQL_ASSIGN2 PLAssignStmt
{
@@ -980,7 +981,7 @@ parse_toplevel:
n->nnames = 2;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
| MODE_PLPGSQL_ASSIGN3 PLAssignStmt
{
@@ -988,19 +989,15 @@ parse_toplevel:
n->nnames = 3;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
;
/*
* At top level, we wrap each stmt with a RawStmt node carrying start location
- * and length of the stmt's text. Notice that the start loc/len are driven
- * entirely from semicolon locations (@2). It would seem natural to use
- * @1 or @3 to get the true start location of a stmt, but that doesn't work
- * for statements that can start with empty nonterminals (opt_with_clause is
- * the main offender here); as noted in the comments for YYLLOC_DEFAULT,
- * we'd get -1 for the location in such cases.
- * We also take care to discard empty statements entirely.
+ * and length of the stmt's text.
+ * We also take care to discard empty statements entirely (which among other
+ * things dodges the problem of assigning them a location).
*/
stmtmulti: stmtmulti ';' toplevel_stmt
{
@@ -1010,14 +1007,14 @@ stmtmulti: stmtmulti ';' toplevel_stmt
updateRawStmtEnd(llast_node(RawStmt, $1), @2);
}
if ($3 != NULL)
- $$ = lappend($1, makeRawStmt($3, @2 + 1));
+ $$ = lappend($1, makeRawStmt($3, @3));
else
$$ = $1;
}
| toplevel_stmt
{
if ($1 != NULL)
- $$ = list_make1(makeRawStmt($1, 0));
+ $$ = list_make1(makeRawStmt($1, @1));
else
$$ = NIL;
}
@@ -1618,8 +1615,6 @@ CreateSchemaStmt:
OptSchemaEltList:
OptSchemaEltList schema_stmt
{
- if (@$ < 0) /* see comments for YYLLOC_DEFAULT */
- @$ = @2;
$$ = lappend($1, $2);
}
| /* EMPTY */
@@ -1688,6 +1683,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION";
n->args = $2;
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
| SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
@@ -1697,6 +1694,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "SESSION CHARACTERISTICS";
n->args = $5;
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
| set_rest_more
@@ -1710,6 +1709,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name '=' var_list
@@ -1719,6 +1719,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name TO DEFAULT
@@ -1727,6 +1728,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| var_name '=' DEFAULT
@@ -1735,6 +1737,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
;
@@ -1747,6 +1750,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_CURRENT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes mandated by SQL standard: */
@@ -1756,6 +1760,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "timezone";
+ n->location = -1;
+ n->jumble_args = true;
if ($3 != NULL)
n->args = list_make1($3);
else
@@ -1777,6 +1783,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "search_path";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| NAMES opt_encoding
@@ -1785,6 +1792,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "client_encoding";
+ n->location = @2;
if ($2 != NULL)
n->args = list_make1(makeStringConst($2, @2));
else
@@ -1798,6 +1806,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "role";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| SESSION AUTHORIZATION NonReservedWord_or_Sconst
@@ -1807,6 +1816,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "session_authorization";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
| SESSION AUTHORIZATION DEFAULT
@@ -1815,6 +1825,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_DEFAULT;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
| XML_P OPTION document_or_content
@@ -1824,6 +1835,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "xmloption";
n->args = list_make1(makeStringConst($3 == XMLOPTION_DOCUMENT ? "DOCUMENT" : "CONTENT", @3));
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes invented by PostgreSQL: */
@@ -1834,6 +1847,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION SNAPSHOT";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
;
@@ -1947,6 +1961,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "timezone";
+ n->location = -1;
$$ = n;
}
| TRANSACTION ISOLATION LEVEL
@@ -1955,6 +1970,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "transaction_isolation";
+ n->location = -1;
$$ = n;
}
| SESSION AUTHORIZATION
@@ -1963,6 +1979,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
;
@@ -1974,6 +1991,7 @@ generic_reset:
n->kind = VAR_RESET;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| ALL
@@ -1981,6 +1999,7 @@ generic_reset:
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_RESET_ALL;
+ n->location = -1;
$$ = n;
}
;
@@ -2703,15 +2722,45 @@ alter_table_cmd:
| ALTER CONSTRAINT name ConstraintAttributeSpec
{
AlterTableCmd *n = makeNode(AlterTableCmd);
- Constraint *c = makeNode(Constraint);
+ ATAlterConstraint *c = makeNode(ATAlterConstraint);
+
n->subtype = AT_AlterConstraint;
n->def = (Node *) c;
- c->contype = CONSTR_FOREIGN; /* others not supported, yet */
c->conname = $3;
- processCASbits($4, @4, "ALTER CONSTRAINT statement",
+ if ($4 & (CAS_NOT_ENFORCED | CAS_ENFORCED))
+ c->alterEnforceability = true;
+ if ($4 & (CAS_DEFERRABLE | CAS_NOT_DEFERRABLE |
+ CAS_INITIALLY_DEFERRED | CAS_INITIALLY_IMMEDIATE))
+ c->alterDeferrability = true;
+ if ($4 & CAS_NO_INHERIT)
+ c->alterInheritability = true;
+ /* handle unsupported case with specific error message */
+ if ($4 & CAS_NOT_VALID)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("constraints cannot be altered to be NOT VALID"),
+ parser_errposition(@4)));
+ processCASbits($4, @4, "FOREIGN KEY",
&c->deferrable,
&c->initdeferred,
- NULL, NULL, yyscanner);
+ &c->is_enforced,
+ NULL,
+ &c->noinherit,
+ yyscanner);
+ $$ = (Node *) n;
+ }
+ /* ALTER TABLE <name> ALTER CONSTRAINT INHERIT */
+ | ALTER CONSTRAINT name INHERIT
+ {
+ AlterTableCmd *n = makeNode(AlterTableCmd);
+ ATAlterConstraint *c = makeNode(ATAlterConstraint);
+
+ n->subtype = AT_AlterConstraint;
+ n->def = (Node *) c;
+ c->conname = $3;
+ c->alterInheritability = true;
+ c->noinherit = false;
+
$$ = (Node *) n;
}
/* ALTER TABLE <name> VALIDATE CONSTRAINT ... */
@@ -3202,11 +3251,13 @@ PartitionBoundSpec:
if (n->modulus == -1)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("modulus for hash partition must be specified")));
+ errmsg("modulus for hash partition must be specified"),
+ parser_errposition(@3)));
if (n->remainder == -1)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("remainder for hash partition must be specified")));
+ errmsg("remainder for hash partition must be specified"),
+ parser_errposition(@3)));
n->location = @3;
@@ -3958,12 +4009,16 @@ ColConstraint:
* or be part of a_expr NOT LIKE or similar constructs).
*/
ColConstraintElem:
- NOT NULL_P
+ NOT NULL_P opt_no_inherit
{
Constraint *n = makeNode(Constraint);
n->contype = CONSTR_NOTNULL;
n->location = @1;
+ n->is_no_inherit = $3;
+ n->is_enforced = true;
+ n->skip_validation = false;
+ n->initially_valid = true;
$$ = (Node *) n;
}
| NULL_P
@@ -4008,6 +4063,7 @@ ColConstraintElem:
n->is_no_inherit = $5;
n->raw_expr = $3;
n->cooked_expr = NULL;
+ n->is_enforced = true;
n->skip_validation = false;
n->initially_valid = true;
$$ = (Node *) n;
@@ -4034,7 +4090,7 @@ ColConstraintElem:
n->location = @1;
$$ = (Node *) n;
}
- | GENERATED generated_when AS '(' a_expr ')' STORED
+ | GENERATED generated_when AS '(' a_expr ')' opt_virtual_or_stored
{
Constraint *n = makeNode(Constraint);
@@ -4042,6 +4098,7 @@ ColConstraintElem:
n->generated_when = $2;
n->raw_expr = $5;
n->cooked_expr = NULL;
+ n->generated_kind = $7;
n->location = @1;
/*
@@ -4071,6 +4128,7 @@ ColConstraintElem:
n->fk_upd_action = ($5)->updateAction->action;
n->fk_del_action = ($5)->deleteAction->action;
n->fk_del_set_cols = ($5)->deleteAction->cols;
+ n->is_enforced = true;
n->skip_validation = false;
n->initially_valid = true;
$$ = (Node *) n;
@@ -4088,6 +4146,12 @@ generated_when:
| BY DEFAULT { $$ = ATTRIBUTE_IDENTITY_BY_DEFAULT; }
;
+opt_virtual_or_stored:
+ STORED { $$ = ATTRIBUTE_GENERATED_STORED; }
+ | VIRTUAL { $$ = ATTRIBUTE_GENERATED_VIRTUAL; }
+ | /*EMPTY*/ { $$ = ATTRIBUTE_GENERATED_VIRTUAL; }
+ ;
+
/*
* ConstraintAttr represents constraint attributes, which we parse as if
* they were independent constraint clauses, in order to avoid shift/reduce
@@ -4136,6 +4200,22 @@ ConstraintAttr:
n->location = @1;
$$ = (Node *) n;
}
+ | ENFORCED
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_ATTR_ENFORCED;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
+ | NOT ENFORCED
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_ATTR_NOT_ENFORCED;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
;
@@ -4197,12 +4277,25 @@ ConstraintElem:
n->raw_expr = $3;
n->cooked_expr = NULL;
processCASbits($5, @5, "CHECK",
- NULL, NULL, &n->skip_validation,
+ NULL, NULL, &n->is_enforced, &n->skip_validation,
&n->is_no_inherit, yyscanner);
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
}
- | UNIQUE opt_unique_null_treatment '(' columnList ')' opt_c_include opt_definition OptConsTableSpace
+ | NOT NULL_P ColId ConstraintAttributeSpec
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_NOTNULL;
+ n->location = @1;
+ n->keys = list_make1(makeString($3));
+ processCASbits($4, @4, "NOT NULL",
+ NULL, NULL, NULL, &n->skip_validation,
+ &n->is_no_inherit, yyscanner);
+ n->initially_valid = !n->skip_validation;
+ $$ = (Node *) n;
+ }
+ | UNIQUE opt_unique_null_treatment '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace
ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
@@ -4211,13 +4304,14 @@ ConstraintElem:
n->location = @1;
n->nulls_not_distinct = !$2;
n->keys = $4;
- n->including = $6;
- n->options = $7;
+ n->without_overlaps = $5;
+ n->including = $7;
+ n->options = $8;
n->indexname = NULL;
- n->indexspace = $8;
- processCASbits($9, @9, "UNIQUE",
+ n->indexspace = $9;
+ processCASbits($10, @10, "UNIQUE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| UNIQUE ExistingIndex ConstraintAttributeSpec
@@ -4233,10 +4327,10 @@ ConstraintElem:
n->indexspace = NULL;
processCASbits($3, @3, "UNIQUE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
- | PRIMARY KEY '(' columnList ')' opt_c_include opt_definition OptConsTableSpace
+ | PRIMARY KEY '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace
ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
@@ -4244,13 +4338,14 @@ ConstraintElem:
n->contype = CONSTR_PRIMARY;
n->location = @1;
n->keys = $4;
- n->including = $6;
- n->options = $7;
+ n->without_overlaps = $5;
+ n->including = $7;
+ n->options = $8;
n->indexname = NULL;
- n->indexspace = $8;
- processCASbits($9, @9, "PRIMARY KEY",
+ n->indexspace = $9;
+ processCASbits($10, @10, "PRIMARY KEY",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| PRIMARY KEY ExistingIndex ConstraintAttributeSpec
@@ -4266,7 +4361,7 @@ ConstraintElem:
n->indexspace = NULL;
processCASbits($4, @4, "PRIMARY KEY",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| EXCLUDE access_method_clause '(' ExclusionConstraintList ')'
@@ -4286,26 +4381,36 @@ ConstraintElem:
n->where_clause = $9;
processCASbits($10, @10, "EXCLUDE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
- | FOREIGN KEY '(' columnList ')' REFERENCES qualified_name
- opt_column_list key_match key_actions ConstraintAttributeSpec
+ | FOREIGN KEY '(' columnList optionalPeriodName ')' REFERENCES qualified_name
+ opt_column_and_period_list key_match key_actions ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
n->contype = CONSTR_FOREIGN;
n->location = @1;
- n->pktable = $7;
+ n->pktable = $8;
n->fk_attrs = $4;
- n->pk_attrs = $8;
- n->fk_matchtype = $9;
- n->fk_upd_action = ($10)->updateAction->action;
- n->fk_del_action = ($10)->deleteAction->action;
- n->fk_del_set_cols = ($10)->deleteAction->cols;
- processCASbits($11, @11, "FOREIGN KEY",
+ if ($5)
+ {
+ n->fk_attrs = lappend(n->fk_attrs, $5);
+ n->fk_with_period = true;
+ }
+ n->pk_attrs = linitial($9);
+ if (lsecond($9))
+ {
+ n->pk_attrs = lappend(n->pk_attrs, lsecond($9));
+ n->pk_with_period = true;
+ }
+ n->fk_matchtype = $10;
+ n->fk_upd_action = ($11)->updateAction->action;
+ n->fk_del_action = ($11)->deleteAction->action;
+ n->fk_del_set_cols = ($11)->deleteAction->cols;
+ processCASbits($12, @12, "FOREIGN KEY",
&n->deferrable, &n->initdeferred,
- &n->skip_validation, NULL,
+ &n->is_enforced, &n->skip_validation, NULL,
yyscanner);
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
@@ -4345,8 +4450,9 @@ DomainConstraintElem:
n->raw_expr = $3;
n->cooked_expr = NULL;
processCASbits($5, @5, "CHECK",
- NULL, NULL, &n->skip_validation,
+ NULL, NULL, NULL, &n->skip_validation,
&n->is_no_inherit, yyscanner);
+ n->is_enforced = true;
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
}
@@ -4357,10 +4463,10 @@ DomainConstraintElem:
n->contype = CONSTR_NOTNULL;
n->location = @1;
n->keys = list_make1(makeString("value"));
- /* no NOT VALID support yet */
+ /* no NOT VALID, NO INHERIT support */
processCASbits($3, @3, "NOT NULL",
NULL, NULL, NULL,
- &n->is_no_inherit, yyscanner);
+ NULL, NULL, yyscanner);
n->initially_valid = true;
$$ = (Node *) n;
}
@@ -4370,6 +4476,11 @@ opt_no_inherit: NO INHERIT { $$ = true; }
| /* EMPTY */ { $$ = false; }
;
+opt_without_overlaps:
+ WITHOUT OVERLAPS { $$ = true; }
+ | /*EMPTY*/ { $$ = false; }
+ ;
+
opt_column_list:
'(' columnList ')' { $$ = $2; }
| /*EMPTY*/ { $$ = NIL; }
@@ -4380,6 +4491,16 @@ columnList:
| columnList ',' columnElem { $$ = lappend($1, $3); }
;
+optionalPeriodName:
+ ',' PERIOD columnElem { $$ = $3; }
+ | /*EMPTY*/ { $$ = NULL; }
+ ;
+
+opt_column_and_period_list:
+ '(' columnList optionalPeriodName ')' { $$ = list_make2($2, $3); }
+ | /*EMPTY*/ { $$ = list_make2(NIL, NULL); }
+ ;
+
columnElem: ColId
{
$$ = (Node *) makeString($1);
@@ -4559,7 +4680,7 @@ PartitionSpec: PARTITION BY ColId '(' part_params ')'
{
PartitionSpec *n = makeNode(PartitionSpec);
- n->strategy = parsePartitionStrategy($3);
+ n->strategy = parsePartitionStrategy($3, @3, yyscanner);
n->partParams = $5;
n->location = @1;
@@ -4969,6 +5090,10 @@ SeqOptElem: AS SimpleTypename
{
$$ = makeDefElem("increment", (Node *) $3, @1);
}
+ | LOGGED
+ {
+ $$ = makeDefElem("logged", NULL, @1);
+ }
| MAXVALUE NumericOnly
{
$$ = makeDefElem("maxvalue", (Node *) $2, @1);
@@ -4991,7 +5116,6 @@ SeqOptElem: AS SimpleTypename
}
| SEQUENCE NAME_P any_name
{
- /* not documented, only used by pg_dump */
$$ = makeDefElem("sequence_name", (Node *) $3, @1);
}
| START opt_with NumericOnly
@@ -5006,6 +5130,10 @@ SeqOptElem: AS SimpleTypename
{
$$ = makeDefElem("restart", (Node *) $3, @1);
}
+ | UNLOGGED
+ {
+ $$ = makeDefElem("unlogged", NULL, @1);
+ }
;
opt_by: BY
@@ -5986,7 +6114,8 @@ CreateTrigStmt:
if (n->replace) /* not supported, see CreateTrigger */
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("CREATE OR REPLACE CONSTRAINT TRIGGER is not supported")));
+ errmsg("CREATE OR REPLACE CONSTRAINT TRIGGER is not supported"),
+ parser_errposition(@1)));
n->isconstraint = true;
n->trigname = $5;
n->relation = $9;
@@ -6000,7 +6129,7 @@ CreateTrigStmt:
n->transitionRels = NIL;
processCASbits($11, @11, "TRIGGER",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
n->constrrel = $10;
$$ = (Node *) n;
}
@@ -6169,7 +6298,8 @@ ConstraintAttributeSpec:
parser_errposition(@2)));
/* generic message for other conflicts */
if ((newspec & (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE)) == (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE) ||
- (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED))
+ (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED) ||
+ (newspec & (CAS_NOT_ENFORCED | CAS_ENFORCED)) == (CAS_NOT_ENFORCED | CAS_ENFORCED))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting constraint properties"),
@@ -6185,6 +6315,8 @@ ConstraintAttributeElem:
| INITIALLY DEFERRED { $$ = CAS_INITIALLY_DEFERRED; }
| NOT VALID { $$ = CAS_NOT_VALID; }
| NO INHERIT { $$ = CAS_NO_INHERIT; }
+ | NOT ENFORCED { $$ = CAS_NOT_ENFORCED; }
+ | ENFORCED { $$ = CAS_ENFORCED; }
;
@@ -6271,7 +6403,8 @@ CreateAssertionStmt:
{
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("CREATE ASSERTION is not yet implemented")));
+ errmsg("CREATE ASSERTION is not yet implemented"),
+ parser_errposition(@1)));
$$ = NULL;
}
@@ -6631,7 +6764,7 @@ opclass_item_list:
;
opclass_item:
- OPERATOR Iconst any_operator opclass_purpose opt_recheck
+ OPERATOR Iconst any_operator opclass_purpose
{
CreateOpClassItem *n = makeNode(CreateOpClassItem);
ObjectWithArgs *owa = makeNode(ObjectWithArgs);
@@ -6645,7 +6778,6 @@ opclass_item:
$$ = (Node *) n;
}
| OPERATOR Iconst operator_with_argtypes opclass_purpose
- opt_recheck
{
CreateOpClassItem *n = makeNode(CreateOpClassItem);
@@ -6697,23 +6829,6 @@ opclass_purpose: FOR SEARCH { $$ = NIL; }
| /*EMPTY*/ { $$ = NIL; }
;
-opt_recheck: RECHECK
- {
- /*
- * RECHECK no longer does anything in opclass definitions,
- * but we still accept it to ease porting of old database
- * dumps.
- */
- ereport(NOTICE,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("RECHECK is no longer required"),
- errhint("Update your data type."),
- parser_errposition(@1)));
- $$ = true;
- }
- | /*EMPTY*/ { $$ = false; }
- ;
-
CreateOpFamilyStmt:
CREATE OPERATOR FAMILY any_name USING name
@@ -8133,6 +8248,7 @@ defacl_privilege_target:
| SEQUENCES { $$ = OBJECT_SEQUENCE; }
| TYPES_P { $$ = OBJECT_TYPE; }
| SCHEMAS { $$ = OBJECT_SCHEMA; }
+ | LARGE_P OBJECTS_P { $$ = OBJECT_LARGEOBJECT; }
;
@@ -8332,7 +8448,7 @@ CreateFunctionStmt:
n->is_procedure = false;
n->replace = $2;
n->funcname = $4;
- n->parameters = mergeTableFuncParameters($5, $9);
+ n->parameters = mergeTableFuncParameters($5, $9, yyscanner);
n->returnType = TableFuncTypeName($9);
n->returnType->location = @7;
n->options = $11;
@@ -8465,6 +8581,7 @@ func_arg:
n->argType = $3;
n->mode = $1;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| param_name arg_class func_type
@@ -8475,6 +8592,7 @@ func_arg:
n->argType = $3;
n->mode = $2;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| param_name func_type
@@ -8485,6 +8603,7 @@ func_arg:
n->argType = $2;
n->mode = FUNC_PARAM_DEFAULT;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| arg_class func_type
@@ -8495,6 +8614,7 @@ func_arg:
n->argType = $2;
n->mode = $1;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| func_type
@@ -8505,6 +8625,7 @@ func_arg:
n->argType = $1;
n->mode = FUNC_PARAM_DEFAULT;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
;
@@ -8841,6 +8962,7 @@ table_func_column: param_name func_type
n->argType = $2;
n->mode = FUNC_PARAM_TABLE;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
;
@@ -11965,7 +12087,7 @@ opt_name_list:
;
vacuum_relation:
- qualified_name opt_name_list
+ relation_expr opt_name_list
{
$$ = (Node *) makeVacuumRelation($1, InvalidOid, $2);
}
@@ -12188,7 +12310,7 @@ InsertStmt:
{
$5->relation = $4;
$5->onConflictClause = $6;
- $5->returningList = $7;
+ $5->returningClause = $7;
$5->withClause = $1;
$$ = (Node *) $5;
}
@@ -12335,8 +12457,45 @@ opt_conf_expr:
;
returning_clause:
- RETURNING target_list { $$ = $2; }
- | /* EMPTY */ { $$ = NIL; }
+ RETURNING returning_with_clause target_list
+ {
+ ReturningClause *n = makeNode(ReturningClause);
+
+ n->options = $2;
+ n->exprs = $3;
+ $$ = n;
+ }
+ | /* EMPTY */
+ {
+ $$ = NULL;
+ }
+ ;
+
+returning_with_clause:
+ WITH '(' returning_options ')' { $$ = $3; }
+ | /* EMPTY */ { $$ = NIL; }
+ ;
+
+returning_options:
+ returning_option { $$ = list_make1($1); }
+ | returning_options ',' returning_option { $$ = lappend($1, $3); }
+ ;
+
+returning_option:
+ returning_option_kind AS ColId
+ {
+ ReturningOption *n = makeNode(ReturningOption);
+
+ n->option = $1;
+ n->value = $3;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
+ ;
+
+returning_option_kind:
+ OLD { $$ = RETURNING_OPTION_OLD; }
+ | NEW { $$ = RETURNING_OPTION_NEW; }
;
@@ -12355,7 +12514,7 @@ DeleteStmt: opt_with_clause DELETE_P FROM relation_expr_opt_alias
n->relation = $4;
n->usingClause = $5;
n->whereClause = $6;
- n->returningList = $7;
+ n->returningClause = $7;
n->withClause = $1;
$$ = (Node *) n;
}
@@ -12429,7 +12588,7 @@ UpdateStmt: opt_with_clause UPDATE relation_expr_opt_alias
n->targetList = $5;
n->fromClause = $6;
n->whereClause = $7;
- n->returningList = $8;
+ n->returningClause = $8;
n->withClause = $1;
$$ = (Node *) n;
}
@@ -12441,7 +12600,7 @@ UpdateStmtShort: opt_with_clause UPDATE relation_expr_opt_alias
n->targetList = NULL;
n->fromClause = NULL;
n->whereClause = NULL;
- n->returningList = NULL;
+ n->returningClause = NULL;
n->withClause = $1;
$$ = (Node *)n;
pg_yyget_extra(yyscanner)->parsetree = list_make1(makeRawStmt($$, 0));
@@ -12520,7 +12679,7 @@ MergeStmt:
m->sourceRelation = $6;
m->joinCondition = $8;
m->mergeWhenClauses = $9;
- m->returningList = $10;
+ m->returningClause = $10;
$$ = (Node *) m;
}
@@ -13199,11 +13358,13 @@ select_limit:
{
$$ = $1;
($$)->limitOffset = $2;
+ ($$)->offsetLoc = @2;
}
| offset_clause limit_clause
{
$$ = $2;
($$)->limitOffset = $1;
+ ($$)->offsetLoc = @1;
}
| limit_clause
{
@@ -13216,6 +13377,9 @@ select_limit:
n->limitOffset = $1;
n->limitCount = NULL;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = @1;
+ n->countLoc = -1;
+ n->optionLoc = -1;
$$ = n;
}
;
@@ -13233,6 +13397,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $2;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| LIMIT select_limit_value ',' select_offset_value
@@ -13258,6 +13425,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $3;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| FETCH first_or_next select_fetch_first_value row_or_rows WITH TIES
@@ -13267,6 +13437,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $3;
n->limitOption = LIMIT_OPTION_WITH_TIES;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = @5;
$$ = n;
}
| FETCH first_or_next row_or_rows ONLY
@@ -13276,6 +13449,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = makeIntConst(1, -1);
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| FETCH first_or_next row_or_rows WITH TIES
@@ -13285,6 +13461,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = makeIntConst(1, -1);
n->limitOption = LIMIT_OPTION_WITH_TIES;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = @4;
$$ = n;
}
;
@@ -14129,7 +14308,7 @@ xmltable_column_el:
parser_errposition(defel->location)));
fc->colexpr = defel->arg;
}
- else if (strcmp(defel->defname, "is_not_null") == 0)
+ else if (strcmp(defel->defname, "__pg__is_not_null") == 0)
{
if (nullability_seen)
ereport(ERROR,
@@ -14172,13 +14351,20 @@ xmltable_column_option_list:
xmltable_column_option_el:
IDENT b_expr
- { $$ = makeDefElem($1, $2, @1); }
+ {
+ if (strcmp($1, "__pg__is_not_null") == 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("option name \"%s\" cannot be used in XMLTABLE", $1),
+ parser_errposition(@1)));
+ $$ = makeDefElem($1, $2, @1);
+ }
| DEFAULT b_expr
{ $$ = makeDefElem("default", $2, @1); }
| NOT NULL_P
- { $$ = makeDefElem("is_not_null", (Node *) makeBoolean(true), @1); }
+ { $$ = makeDefElem("__pg__is_not_null", (Node *) makeBoolean(true), @1); }
| NULL_P
- { $$ = makeDefElem("is_not_null", (Node *) makeBoolean(false), @1); }
+ { $$ = makeDefElem("__pg__is_not_null", (Node *) makeBoolean(false), @1); }
| PATH b_expr
{ $$ = makeDefElem("path", $2, @1); }
;
@@ -15179,49 +15365,50 @@ a_expr: c_expr { $$ = $1; }
(Node *) list_make2($5, $7),
@2);
}
- | a_expr IN_P in_expr
+ | a_expr IN_P select_with_parens
{
- /* in_expr returns a SubLink or a list of a_exprs */
- if (IsA($3, SubLink))
- {
- /* generate foo = ANY (subquery) */
- SubLink *n = (SubLink *) $3;
+ /* generate foo = ANY (subquery) */
+ SubLink *n = makeNode(SubLink);
- n->subLinkType = ANY_SUBLINK;
- n->subLinkId = 0;
- n->testexpr = $1;
- n->operName = NIL; /* show it's IN not = ANY */
- n->location = @2;
- $$ = (Node *) n;
- }
- else
- {
- /* generate scalar IN expression */
- $$ = (Node *) makeSimpleA_Expr(AEXPR_IN, "=", $1, $3, @2);
- }
+ n->subselect = $3;
+ n->subLinkType = ANY_SUBLINK;
+ n->subLinkId = 0;
+ n->testexpr = $1;
+ n->operName = NIL; /* show it's IN not = ANY */
+ n->location = @2;
+ $$ = (Node *) n;
}
- | a_expr NOT_LA IN_P in_expr %prec NOT_LA
+ | a_expr IN_P '(' expr_list ')'
{
- /* in_expr returns a SubLink or a list of a_exprs */
- if (IsA($4, SubLink))
- {
- /* generate NOT (foo = ANY (subquery)) */
- /* Make an = ANY node */
- SubLink *n = (SubLink *) $4;
-
- n->subLinkType = ANY_SUBLINK;
- n->subLinkId = 0;
- n->testexpr = $1;
- n->operName = NIL; /* show it's IN not = ANY */
- n->location = @2;
- /* Stick a NOT on top; must have same parse location */
- $$ = makeNotExpr((Node *) n, @2);
- }
- else
- {
- /* generate scalar NOT IN expression */
- $$ = (Node *) makeSimpleA_Expr(AEXPR_IN, "<>", $1, $4, @2);
- }
+ /* generate scalar IN expression */
+ A_Expr *n = makeSimpleA_Expr(AEXPR_IN, "=", $1, (Node *) $4, @2);
+
+ n->rexpr_list_start = @3;
+ n->rexpr_list_end = @5;
+ $$ = (Node *) n;
+ }
+ | a_expr NOT_LA IN_P select_with_parens %prec NOT_LA
+ {
+ /* generate NOT (foo = ANY (subquery)) */
+ SubLink *n = makeNode(SubLink);
+
+ n->subselect = $4;
+ n->subLinkType = ANY_SUBLINK;
+ n->subLinkId = 0;
+ n->testexpr = $1;
+ n->operName = NIL; /* show it's IN not = ANY */
+ n->location = @2;
+ /* Stick a NOT on top; must have same parse location */
+ $$ = makeNotExpr((Node *) n, @2);
+ }
+ | a_expr NOT_LA IN_P '(' expr_list ')'
+ {
+ /* generate scalar NOT IN expression */
+ A_Expr *n = makeSimpleA_Expr(AEXPR_IN, "<>", $1, (Node *) $5, @2);
+
+ n->rexpr_list_start = @4;
+ n->rexpr_list_end = @6;
+ $$ = (Node *) n;
}
| a_expr subquery_Op sub_type select_with_parens %prec Op
{
@@ -16656,15 +16843,15 @@ type_list: Typename { $$ = list_make1($1); }
array_expr: '[' expr_list ']'
{
- $$ = makeAArrayExpr($2, @1);
+ $$ = makeAArrayExpr($2, @1, @3);
}
| '[' array_expr_list ']'
{
- $$ = makeAArrayExpr($2, @1);
+ $$ = makeAArrayExpr($2, @1, @3);
}
| '[' ']'
{
- $$ = makeAArrayExpr(NIL, @1);
+ $$ = makeAArrayExpr(NIL, @1, @2);
}
;
@@ -16786,17 +16973,6 @@ trim_list: a_expr FROM expr_list { $$ = lappend($3, $1); }
| expr_list { $$ = $1; }
;
-in_expr: select_with_parens
- {
- SubLink *n = makeNode(SubLink);
-
- n->subselect = $1;
- /* other fields will be filled later */
- $$ = (Node *) n;
- }
- | '(' expr_list ')' { $$ = (Node *) $2; }
- ;
-
/*
* Define SQL-style CASE clause.
* - Full specification
@@ -16997,7 +17173,8 @@ json_format_clause:
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized JSON encoding: %s", $4)));
+ errmsg("unrecognized JSON encoding: %s", $4),
+ parser_errposition(@4)));
$$ = (Node *) makeJsonFormat(JS_FORMAT_JSON, encoding, @1);
}
@@ -17499,7 +17676,8 @@ PLpgSQL_Expr: opt_distinct_clause opt_target_list
$9->limitOption == LIMIT_OPTION_WITH_TIES)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("WITH TIES cannot be specified without ORDER BY clause")));
+ errmsg("WITH TIES cannot be specified without ORDER BY clause"),
+ parser_errposition($9->optionLoc)));
n->limitOption = $9->limitOption;
}
n->lockingClause = $10;
@@ -17683,6 +17861,7 @@ unreserved_keyword:
| ENABLE_P
| ENCODING
| ENCRYPTED
+ | ENFORCED
| ENUM_P
| ERROR_P
| ESCAPE
@@ -17778,6 +17957,7 @@ unreserved_keyword:
| NOWAIT
| NULLS_P
| OBJECT_P
+ | OBJECTS_P
| OF
| OFF
| OIDS
@@ -17800,6 +17980,7 @@ unreserved_keyword:
| PASSING
| PASSWORD
| PATH
+ | PERIOD
| PLAN
| PLANS
| POLICY
@@ -17819,7 +18000,6 @@ unreserved_keyword:
| RANGE
| READ
| REASSIGN
- | RECHECK
| RECURSIVE
| REF_P
| REFERENCING
@@ -17916,6 +18096,7 @@ unreserved_keyword:
| VERSION_P
| VIEW
| VIEWS
+ | VIRTUAL
| VOLATILE
| WHITESPACE_P
| WITHIN
@@ -18260,6 +18441,7 @@ bare_label_keyword:
| ENCODING
| ENCRYPTED
| END_P
+ | ENFORCED
| ENUM_P
| ERROR_P
| ESCAPE
@@ -18398,6 +18580,7 @@ bare_label_keyword:
| NULLS_P
| NUMERIC
| OBJECT_P
+ | OBJECTS_P
| OF
| OFF
| OIDS
@@ -18424,6 +18607,7 @@ bare_label_keyword:
| PASSING
| PASSWORD
| PATH
+ | PERIOD
| PLACING
| PLAN
| PLANS
@@ -18447,7 +18631,6 @@ bare_label_keyword:
| READ
| REAL
| REASSIGN
- | RECHECK
| RECURSIVE
| REF_P
| REFERENCES
@@ -18570,6 +18753,7 @@ bare_label_keyword:
| VERSION_P
| VIEW
| VIEWS
+ | VIRTUAL
| VOLATILE
| WHEN
| WHITESPACE_P
@@ -18637,10 +18821,10 @@ makeColumnRef(char *colname, List *indirection,
int location, core_yyscan_t yyscanner)
{
/*
- * Generate a ColumnRef node, with an A_Indirection node added if there
- * is any subscripting in the specified indirection list. However,
- * any field selection at the start of the indirection list must be
- * transposed into the "fields" part of the ColumnRef node.
+ * Generate a ColumnRef node, with an A_Indirection node added if there is
+ * any subscripting in the specified indirection list. However, any field
+ * selection at the start of the indirection list must be transposed into
+ * the "fields" part of the ColumnRef node.
*/
ColumnRef *c = makeNode(ColumnRef);
int nfields = 0;
@@ -18695,42 +18879,42 @@ makeFloatConst(char *str, int location)
n->val.fval.fval = str;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
makeBoolAConst(bool state, int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->val.boolval.type = T_Boolean;
n->val.boolval.boolval = state;
n->location = location;
- return (Node *) n;
+ return (Node *) n;
}
static Node *
makeBitStringConst(char *str, int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->val.bsval.type = T_BitString;
n->val.bsval.bsval = str;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
makeNullAConst(int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->isnull = true;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
@@ -18814,7 +18998,7 @@ check_func_name(List *names, core_yyscan_t yyscanner)
static List *
check_indirection(List *indirection, core_yyscan_t yyscanner)
{
- ListCell *l;
+ ListCell *l;
foreach(l, indirection)
{
@@ -18869,7 +19053,7 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
core_yyscan_t yyscanner)
{
FunctionParameter *lastd = (FunctionParameter *) llast(directargs);
- Integer *ndirectargs;
+ Integer *ndirectargs;
/* No restriction unless last direct arg is VARIADIC */
if (lastd->mode == FUNC_PARAM_VARIADIC)
@@ -18877,15 +19061,15 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
FunctionParameter *firsto = (FunctionParameter *) linitial(orderedargs);
/*
- * We ignore the names, though the aggr_arg production allows them;
- * it doesn't allow default values, so those need not be checked.
+ * We ignore the names, though the aggr_arg production allows them; it
+ * doesn't allow default values, so those need not be checked.
*/
if (list_length(orderedargs) != 1 ||
firsto->mode != FUNC_PARAM_VARIADIC)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("an ordered-set aggregate with a VARIADIC direct argument must have one VARIADIC aggregated argument of the same data type"),
- parser_errposition(exprLocation((Node *) firsto))));
+ parser_errposition(firsto->location)));
/* OK, drop the duplicate VARIADIC argument from the internal form */
orderedargs = NIL;
@@ -18933,7 +19117,7 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple OFFSET clauses not allowed"),
- parser_errposition(exprLocation(limitClause->limitOffset))));
+ parser_errposition(limitClause->offsetLoc)));
stmt->limitOffset = limitClause->limitOffset;
}
if (limitClause && limitClause->limitCount)
@@ -18942,19 +19126,18 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple LIMIT clauses not allowed"),
- parser_errposition(exprLocation(limitClause->limitCount))));
+ parser_errposition(limitClause->countLoc)));
stmt->limitCount = limitClause->limitCount;
}
if (limitClause)
{
- if (stmt->limitOption)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("multiple limit options not allowed")));
+ /* If there was a conflict, we must have detected it above */
+ Assert(!stmt->limitOption);
if (!stmt->sortClause && limitClause->limitOption == LIMIT_OPTION_WITH_TIES)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("WITH TIES cannot be specified without ORDER BY clause")));
+ errmsg("WITH TIES cannot be specified without ORDER BY clause"),
+ parser_errposition(limitClause->optionLoc)));
if (limitClause->limitOption == LIMIT_OPTION_WITH_TIES && stmt->lockingClause)
{
ListCell *lc;
@@ -18967,7 +19150,8 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("%s and %s options cannot be used together",
- "SKIP LOCKED", "WITH TIES")));
+ "SKIP LOCKED", "WITH TIES"),
+ parser_errposition(limitClause->optionLoc)));
}
}
stmt->limitOption = limitClause->limitOption;
@@ -19013,7 +19197,7 @@ doNegate(Node *n, int location)
{
if (IsA(n, A_Const))
{
- A_Const *con = (A_Const *) n;
+ A_Const *con = (A_Const *) n;
/* report the constant's location as that of the '-' sign */
con->location = location;
@@ -19041,7 +19225,7 @@ doNegateFloat(Float *v)
if (*oldval == '+')
oldval++;
if (*oldval == '-')
- v->fval = oldval+1; /* just strip the '-' */
+ v->fval = oldval + 1; /* just strip the '-' */
else
v->fval = psprintf("-%s", oldval);
}
@@ -19087,12 +19271,14 @@ makeNotExpr(Node *expr, int location)
}
static Node *
-makeAArrayExpr(List *elements, int location)
+makeAArrayExpr(List *elements, int location, int location_end)
{
A_ArrayExpr *n = makeNode(A_ArrayExpr);
n->elements = elements;
n->location = location;
+ n->list_start = location;
+ n->list_end = location_end;
return (Node *) n;
}
@@ -19112,10 +19298,11 @@ static Node *
makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
int location)
{
- XmlExpr *x = makeNode(XmlExpr);
+ XmlExpr *x = makeNode(XmlExpr);
x->op = op;
x->name = name;
+
/*
* named_args is a list of ResTarget; it'll be split apart into separate
* expression and name lists in transformXmlExpr().
@@ -19125,7 +19312,7 @@ makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
x->args = args;
/* xmloption, if relevant, must be filled in by caller */
/* type and typmod will be filled in during parse analysis */
- x->type = InvalidOid; /* marks the node as not analyzed */
+ x->type = InvalidOid; /* marks the node as not analyzed */
x->location = location;
return (Node *) x;
}
@@ -19134,7 +19321,7 @@ makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
* Merge the input and output parameters of a table function.
*/
static List *
-mergeTableFuncParameters(List *func_args, List *columns)
+mergeTableFuncParameters(List *func_args, List *columns, core_yyscan_t yyscanner)
{
ListCell *lc;
@@ -19148,7 +19335,8 @@ mergeTableFuncParameters(List *func_args, List *columns)
p->mode != FUNC_PARAM_VARIADIC)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("OUT and INOUT arguments aren't allowed in TABLE functions")));
+ errmsg("OUT and INOUT arguments aren't allowed in TABLE functions"),
+ parser_errposition(p->location)));
}
return list_concat(func_args, columns);
@@ -19249,7 +19437,7 @@ makeRangeVarFromQualifiedName(char *name, List *namelist, int location,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("improper qualified name (too many dotted names): %s",
NameListToString(lcons(makeString(name), namelist))),
- parser_errposition(location)));
+ parser_errposition(location)));
break;
}
@@ -19300,8 +19488,8 @@ SplitColQualList(List *qualList,
*/
static void
processCASbits(int cas_bits, int location, const char *constrType,
- bool *deferrable, bool *initdeferred, bool *not_valid,
- bool *no_inherit, core_yyscan_t yyscanner)
+ bool *deferrable, bool *initdeferred, bool *is_enforced,
+ bool *not_valid, bool *no_inherit, core_yyscan_t yyscanner)
{
/* defaults */
if (deferrable)
@@ -19310,6 +19498,8 @@ processCASbits(int cas_bits, int location, const char *constrType,
*initdeferred = false;
if (not_valid)
*not_valid = false;
+ if (is_enforced)
+ *is_enforced = true;
if (cas_bits & (CAS_DEFERRABLE | CAS_INITIALLY_DEFERRED))
{
@@ -19318,7 +19508,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked DEFERRABLE",
constrType),
parser_errposition(location)));
@@ -19331,7 +19521,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked DEFERRABLE",
constrType),
parser_errposition(location)));
@@ -19344,7 +19534,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked NOT VALID",
constrType),
parser_errposition(location)));
@@ -19357,11 +19547,46 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked NO INHERIT",
constrType),
parser_errposition(location)));
}
+
+ if (cas_bits & CAS_NOT_ENFORCED)
+ {
+ if (is_enforced)
+ *is_enforced = false;
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ /* translator: %s is CHECK, UNIQUE, or similar */
+ errmsg("%s constraints cannot be marked NOT ENFORCED",
+ constrType),
+ parser_errposition(location)));
+
+ /*
+ * NB: The validated status is irrelevant when the constraint is set to
+ * NOT ENFORCED, but for consistency, it should be set accordingly.
+ * This ensures that if the constraint is later changed to ENFORCED, it
+ * will automatically be in the correct NOT VALIDATED state.
+ */
+ if (not_valid)
+ *not_valid = true;
+ }
+
+ if (cas_bits & CAS_ENFORCED)
+ {
+ if (is_enforced)
+ *is_enforced = true;
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ /* translator: %s is CHECK, UNIQUE, or similar */
+ errmsg("%s constraints cannot be marked ENFORCED",
+ constrType),
+ parser_errposition(location)));
+ }
}
/*
@@ -19369,7 +19594,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
* PartitionStrategy representation, or die trying.
*/
static PartitionStrategy
-parsePartitionStrategy(char *strategy)
+parsePartitionStrategy(char *strategy, int location, core_yyscan_t yyscanner)
{
if (pg_strcasecmp(strategy, "list") == 0)
return PARTITION_STRATEGY_LIST;
@@ -19380,9 +19605,9 @@ parsePartitionStrategy(char *strategy)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized partitioning strategy \"%s\"",
- strategy)));
- return PARTITION_STRATEGY_LIST; /* keep compiler quiet */
+ errmsg("unrecognized partitioning strategy \"%s\"", strategy),
+ parser_errposition(location)));
+ return PARTITION_STRATEGY_LIST; /* keep compiler quiet */
}
@@ -19453,8 +19678,8 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
parser_errposition(pubobj->location)));
/*
- * We can distinguish between the different type of schema
- * objects based on whether name and pubtable is set.
+ * We can distinguish between the different type of schema objects
+ * based on whether name and pubtable is set.
*/
if (pubobj->name)
pubobj->pubobjtype = PUBLICATIONOBJ_TABLES_IN_SCHEMA;
@@ -19509,11 +19734,13 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
w->ctes = list_make1(cte);
w->location = -1;
- /* create target list for the new SELECT from the alias list of the
- * recursive view specification */
- foreach (lc, aliases)
+ /*
+ * create target list for the new SELECT from the alias list of the
+ * recursive view specification
+ */
+ foreach(lc, aliases)
{
- ResTarget *rt = makeNode(ResTarget);
+ ResTarget *rt = makeNode(ResTarget);
rt->name = NULL;
rt->indirection = NIL;
@@ -19523,8 +19750,10 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
tl = lappend(tl, rt);
}
- /* create new SELECT combining WITH clause, target list, and fake FROM
- * clause */
+ /*
+ * create new SELECT combining WITH clause, target list, and fake FROM
+ * clause
+ */
s->withClause = w;
s->targetList = tl;
s->fromClause = list_make1(makeRangeVar(NULL, relname, -1));
diff --git a/src/parser/gram_template.y b/src/parser/gram_template.y
index fdb4e8106..94017e3cb 100644
--- a/src/parser/gram_template.y
+++ b/src/parser/gram_template.y
@@ -6,8 +6,8 @@
* gram.y
* POSTGRESQL BISON rules/actions
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -89,6 +89,8 @@
#define ATTRIBUTE_IDENTITY_ALWAYS 'a'
#define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd'
+#define ATTRIBUTE_GENERATED_STORED 's'
+#define ATTRIBUTE_GENERATED_VIRTUAL 'v'
/*
* Definition taken from
* postgreSQL source code file: src/include/utils/xml.h
@@ -102,39 +104,25 @@ typedef enum
} XmlStandaloneType;
/*
- * Location tracking support --- simpler than bison's default, since we only
- * want to track the start position not the end position of each nonterminal.
+ * Location tracking support. Unlike bison's default, we only want
+ * to track the start position not the end position of each nonterminal.
+ * Nonterminals that reduce to empty receive position "-1". Since a
+ * production's leading RHS nonterminal(s) may have reduced to empty,
+ * we have to scan to find the first one that's not -1.
*/
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
- if ((N) > 0) \
- (Current) = (Rhs)[1]; \
- else \
- (Current) = (-1); \
+ (Current) = (-1); \
+ for (int _i = 1; _i <= (N); _i++) \
+ { \
+ if ((Rhs)[_i] >= 0) \
+ { \
+ (Current) = (Rhs)[_i]; \
+ break; \
+ } \
+ } \
} while (0)
-/*
- * The above macro assigns -1 (unknown) as the parse location of any
- * nonterminal that was reduced from an empty rule, or whose leftmost
- * component was reduced from an empty rule. This is problematic
- * for nonterminals defined like
- * OptFooList: / * EMPTY * / { ... } | OptFooList Foo { ... } ;
- * because we'll set -1 as the location during the first reduction and then
- * copy it during each subsequent reduction, leaving us with -1 for the
- * location even when the list is not empty. To fix that, do this in the
- * action for the nonempty rule(s):
- * if (@$ < 0) @$ = @2;
- * (Although we have many nonterminals that follow this pattern, we only
- * bother with fixing @$ like this when the nonterminal's parse location
- * is actually referenced in some rule.)
- *
- * A cleaner answer would be to make YYLLOC_DEFAULT scan all the Rhs
- * locations until it's found one that's not -1. Then we'd get a correct
- * location for any nonterminal that isn't entirely empty. But this way
- * would add overhead to every rule reduction, and so far there's not been
- * a compelling reason to pay that overhead.
- */
-
/*
* Bison doesn't allocate anything that needs to live across parser calls,
* so we can easily have it use palloc instead of malloc. This prevents
@@ -158,12 +146,15 @@ typedef struct ImportQual
List *table_names;
} ImportQual;
-/* Private struct for the result of opt_select_limit production */
+/* Private struct for the result of select_limit & limit_clause productions */
typedef struct SelectLimit
{
Node *limitOffset;
Node *limitCount;
- LimitOption limitOption;
+ LimitOption limitOption; /* indicates presence of WITH TIES */
+ ParseLoc offsetLoc; /* location of OFFSET token, if present */
+ ParseLoc countLoc; /* location of LIMIT/FETCH token, if present */
+ ParseLoc optionLoc; /* location of WITH TIES, if present */
} SelectLimit;
/* Private struct for the result of group_clause production */
@@ -193,6 +184,8 @@ typedef struct KeyActions
#define CAS_INITIALLY_DEFERRED 0x08
#define CAS_NOT_VALID 0x10
#define CAS_NO_INHERIT 0x20
+#define CAS_NOT_ENFORCED 0x40
+#define CAS_ENFORCED 0x80
#define parser_yyerror(msg) scanner_yyerror(msg, yyscanner)
@@ -233,12 +226,12 @@ static void doNegateFloat(Float *v);
static Node *makeAndExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeOrExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeNotExpr(Node *expr, int location);
-static Node *makeAArrayExpr(List *elements, int location);
+static Node *makeAArrayExpr(List *elements, int location, int end_location);
static Node *makeSQLValueFunction(SQLValueFunctionOp op, int32 typmod,
int location);
static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args,
List *args, int location);
-static List *mergeTableFuncParameters(List *func_args, List *columns);
+static List *mergeTableFuncParameters(List *func_args, List *columns, core_yyscan_t yyscanner);
static TypeName *TableFuncTypeName(List *columns);
static RangeVar *makeRangeVarFromAnyName(List *names, int position, core_yyscan_t yyscanner);
static RangeVar *makeRangeVarFromQualifiedName(char *name, List *namelist, int location,
@@ -247,9 +240,10 @@ static void SplitColQualList(List *qualList,
List **constraintList, CollateClause **collClause,
core_yyscan_t yyscanner);
static void processCASbits(int cas_bits, int location, const char *constrType,
- bool *deferrable, bool *initdeferred, bool *not_valid,
- bool *no_inherit, core_yyscan_t yyscanner);
-static PartitionStrategy parsePartitionStrategy(char *strategy);
+ bool *deferrable, bool *initdeferred, bool *is_enforced,
+ bool *not_valid, bool *no_inherit, core_yyscan_t yyscanner);
+static PartitionStrategy parsePartitionStrategy(char *strategy, int location,
+ core_yyscan_t yyscanner);
static void preprocess_pubobj_list(List *pubobjspec_list,
core_yyscan_t yyscanner);
static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
@@ -319,6 +313,8 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
MergeWhenClause *mergewhen;
struct KeyActions *keyactions;
struct KeyAction *keyaction;
+ ReturningClause *retclause;
+ ReturningOptionKind retoptionkind;
}
%type <node> stmt toplevel_stmt schema_stmt routine_body_stmt
@@ -495,7 +491,8 @@ UpdateStmtShort
opclass_purpose opt_opfamily transaction_mode_list_or_empty
OptTableFuncElementList TableFuncElementList opt_type_modifiers
prep_type_clause
- execute_param_clause using_clause returning_clause
+ execute_param_clause using_clause
+ returning_with_clause returning_options
opt_enum_val_list enum_val_list table_func_column_list
create_generic_options alter_generic_options
relation_expr_list dostmt_opt_list
@@ -504,6 +501,9 @@ UpdateStmtShort
vacuum_relation_list opt_vacuum_relation_list
drop_option_list pub_obj_list
+%type <retclause> returning_clause
+%type <node> returning_option
+%type <retoptionkind> returning_option_kind
%type <node> opt_routine_body
%type <groupclause> group_clause
%type <list> group_by_list
@@ -542,7 +542,7 @@ UpdateStmtShort
%type <boolean> opt_instead
%type <boolean> opt_unique opt_verbose opt_full
-%type <boolean> opt_freeze opt_analyze opt_default opt_recheck
+%type <boolean> opt_freeze opt_analyze opt_default
%type <defelt> opt_binary copy_delimiter
%type <boolean> copy_from opt_program
@@ -572,14 +572,15 @@ UpdateStmtShort
SetResetClause FunctionSetResetClause
%type <node> TableElement TypedTableElement ConstraintElem DomainConstraintElem TableFuncElement
-%type <node> columnDef columnOptions
+%type <node> columnDef columnOptions optionalPeriodName
%type <defelt> def_elem reloption_elem old_aggr_elem operator_def_elem
%type <node> def_arg columnElem where_clause where_or_current_clause
a_expr b_expr c_expr AexprConst indirection_el opt_slice_bound
- columnref in_expr having_clause func_table xmltable array_expr
+ columnref having_clause func_table xmltable array_expr
OptWhereClause operator_def_arg
+%type <list> opt_column_and_period_list
%type <list> rowsfrom_item rowsfrom_list opt_col_def_list
-%type <boolean> opt_ordinality
+%type <boolean> opt_ordinality opt_without_overlaps
%type <list> ExclusionConstraintList ExclusionConstraintElem
%type <list> func_arg_list func_arg_list_opt
%type <node> func_arg_expr
@@ -688,7 +689,7 @@ UpdateStmtShort
%type <str> opt_existing_window_name
%type <boolean> opt_if_not_exists
%type <boolean> opt_unique_null_treatment
-%type <ival> generated_when override_kind
+%type <ival> generated_when override_kind opt_virtual_or_stored
%type <partspec> PartitionSpec OptPartitionSpec
%type <partelem> part_elem
%type <list> part_params
@@ -771,9 +772,9 @@ UpdateStmtShort
DETACH DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P
DOUBLE_P DROP
- EACH ELSE EMPTY_P ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ERROR_P ESCAPE
- EVENT EXCEPT EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN EXPRESSION
- EXTENSION EXTERNAL EXTRACT
+ EACH ELSE EMPTY_P ENABLE_P ENCODING ENCRYPTED END_P ENFORCED ENUM_P ERROR_P
+ ESCAPE EVENT EXCEPT EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN
+ EXPRESSION EXTENSION EXTERNAL EXTRACT
FALSE_P FAMILY FETCH FILTER FINALIZE FIRST_P FLOAT_P FOLLOWING FOR
FORCE FOREIGN FORMAT FORWARD FREEZE FROM FULL FUNCTION FUNCTIONS
@@ -804,18 +805,18 @@ UpdateStmtShort
NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF
NULLS_P NUMERIC
- OBJECT_P OF OFF OFFSET OIDS OLD OMIT ON ONLY OPERATOR OPTION OPTIONS OR
+ OBJECT_P OBJECTS_P OF OFF OFFSET OIDS OLD OMIT ON ONLY OPERATOR OPTION OPTIONS OR
ORDER ORDINALITY OTHERS OUT_P OUTER_P
OVER OVERLAPS OVERLAY OVERRIDING OWNED OWNER
PARALLEL PARAMETER PARSER PARTIAL PARTITION PASSING PASSWORD PATH PGPOOL
- PLACING PLAN PLANS POLICY
+ PERIOD PLACING PLAN PLANS POLICY
POSITION PRECEDING PRECISION PRESERVE PREPARE PREPARED PRIMARY
PRIOR PRIVILEGES PROCEDURAL PROCEDURE PROCEDURES PROGRAM PUBLICATION
QUOTE QUOTES
- RANGE READ REAL REASSIGN RECHECK RECURSIVE REF_P REFERENCES REFERENCING
+ RANGE READ REAL REASSIGN RECURSIVE REF_P REFERENCES REFERENCING
REFRESH REINDEX RELATIVE_P RELEASE RENAME REPEATABLE REPLACE REPLICA
RESET RESTART RESTRICT RETURN RETURNING RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
ROUTINE ROUTINES ROW ROWS RULE
@@ -836,7 +837,7 @@ UpdateStmtShort
UNLISTEN UNLOGGED UNTIL UPDATE USER USING
VACUUM VALID VALIDATE VALIDATOR VALUE_P VALUES VARCHAR VARIADIC VARYING
- VERBOSE VERSION_P VIEW VIEWS VOLATILE
+ VERBOSE VERSION_P VIEW VIEWS VIRTUAL VOLATILE
WHEN WHERE WHITESPACE_P WINDOW WITH WITHIN WITHOUT WORK WRAPPER WRITE
@@ -977,7 +978,7 @@ parse_toplevel:
| MODE_PLPGSQL_EXPR PLpgSQL_Expr
{
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt($2, 0));
+ list_make1(makeRawStmt($2, @2));
}
| MODE_PLPGSQL_ASSIGN1 PLAssignStmt
{
@@ -985,7 +986,7 @@ parse_toplevel:
n->nnames = 1;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
| MODE_PLPGSQL_ASSIGN2 PLAssignStmt
{
@@ -993,7 +994,7 @@ parse_toplevel:
n->nnames = 2;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
| MODE_PLPGSQL_ASSIGN3 PLAssignStmt
{
@@ -1001,19 +1002,15 @@ parse_toplevel:
n->nnames = 3;
pg_yyget_extra(yyscanner)->parsetree =
- list_make1(makeRawStmt((Node *) n, 0));
+ list_make1(makeRawStmt((Node *) n, @2));
}
;
/*
* At top level, we wrap each stmt with a RawStmt node carrying start location
- * and length of the stmt's text. Notice that the start loc/len are driven
- * entirely from semicolon locations (@2). It would seem natural to use
- * @1 or @3 to get the true start location of a stmt, but that doesn't work
- * for statements that can start with empty nonterminals (opt_with_clause is
- * the main offender here); as noted in the comments for YYLLOC_DEFAULT,
- * we'd get -1 for the location in such cases.
- * We also take care to discard empty statements entirely.
+ * and length of the stmt's text.
+ * We also take care to discard empty statements entirely (which among other
+ * things dodges the problem of assigning them a location).
*/
stmtmulti: stmtmulti ';' toplevel_stmt
{
@@ -1023,14 +1020,14 @@ stmtmulti: stmtmulti ';' toplevel_stmt
updateRawStmtEnd(llast_node(RawStmt, $1), @2);
}
if ($3 != NULL)
- $$ = lappend($1, makeRawStmt($3, @2 + 1));
+ $$ = lappend($1, makeRawStmt($3, @3));
else
$$ = $1;
}
| toplevel_stmt
{
if ($1 != NULL)
- $$ = list_make1(makeRawStmt($1, 0));
+ $$ = list_make1(makeRawStmt($1, @1));
else
$$ = NIL;
}
@@ -1639,8 +1636,6 @@ CreateSchemaStmt:
OptSchemaEltList:
OptSchemaEltList schema_stmt
{
- if (@$ < 0) /* see comments for YYLLOC_DEFAULT */
- @$ = @2;
$$ = lappend($1, $2);
}
| /* EMPTY */
@@ -1709,6 +1704,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION";
n->args = $2;
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
| SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
@@ -1718,6 +1715,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "SESSION CHARACTERISTICS";
n->args = $5;
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
| set_rest_more
@@ -1731,6 +1730,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name '=' var_list
@@ -1740,6 +1740,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name TO DEFAULT
@@ -1748,6 +1749,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| var_name '=' DEFAULT
@@ -1756,6 +1758,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
;
@@ -1768,6 +1771,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_CURRENT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes mandated by SQL standard: */
@@ -1777,6 +1781,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "timezone";
+ n->location = -1;
+ n->jumble_args = true;
if ($3 != NULL)
n->args = list_make1($3);
else
@@ -1798,6 +1804,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "search_path";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| NAMES opt_encoding
@@ -1806,6 +1813,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "client_encoding";
+ n->location = @2;
if ($2 != NULL)
n->args = list_make1(makeStringConst($2, @2));
else
@@ -1819,6 +1827,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "role";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| SESSION AUTHORIZATION NonReservedWord_or_Sconst
@@ -1828,6 +1837,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "session_authorization";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
| SESSION AUTHORIZATION DEFAULT
@@ -1836,6 +1846,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_DEFAULT;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
| XML_P OPTION document_or_content
@@ -1845,6 +1856,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "xmloption";
n->args = list_make1(makeStringConst($3 == XMLOPTION_DOCUMENT ? "DOCUMENT" : "CONTENT", @3));
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes invented by PostgreSQL: */
@@ -1855,6 +1868,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION SNAPSHOT";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
;
@@ -1968,6 +1982,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "timezone";
+ n->location = -1;
$$ = n;
}
| TRANSACTION ISOLATION LEVEL
@@ -1976,6 +1991,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "transaction_isolation";
+ n->location = -1;
$$ = n;
}
| SESSION AUTHORIZATION
@@ -1984,6 +2000,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
;
@@ -1995,6 +2012,7 @@ generic_reset:
n->kind = VAR_RESET;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| ALL
@@ -2002,6 +2020,7 @@ generic_reset:
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_RESET_ALL;
+ n->location = -1;
$$ = n;
}
;
@@ -2724,15 +2743,45 @@ alter_table_cmd:
| ALTER CONSTRAINT name ConstraintAttributeSpec
{
AlterTableCmd *n = makeNode(AlterTableCmd);
- Constraint *c = makeNode(Constraint);
+ ATAlterConstraint *c = makeNode(ATAlterConstraint);
+
n->subtype = AT_AlterConstraint;
n->def = (Node *) c;
- c->contype = CONSTR_FOREIGN; /* others not supported, yet */
c->conname = $3;
- processCASbits($4, @4, "ALTER CONSTRAINT statement",
+ if ($4 & (CAS_NOT_ENFORCED | CAS_ENFORCED))
+ c->alterEnforceability = true;
+ if ($4 & (CAS_DEFERRABLE | CAS_NOT_DEFERRABLE |
+ CAS_INITIALLY_DEFERRED | CAS_INITIALLY_IMMEDIATE))
+ c->alterDeferrability = true;
+ if ($4 & CAS_NO_INHERIT)
+ c->alterInheritability = true;
+ /* handle unsupported case with specific error message */
+ if ($4 & CAS_NOT_VALID)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("constraints cannot be altered to be NOT VALID"),
+ parser_errposition(@4)));
+ processCASbits($4, @4, "FOREIGN KEY",
&c->deferrable,
&c->initdeferred,
- NULL, NULL, yyscanner);
+ &c->is_enforced,
+ NULL,
+ &c->noinherit,
+ yyscanner);
+ $$ = (Node *) n;
+ }
+ /* ALTER TABLE <name> ALTER CONSTRAINT INHERIT */
+ | ALTER CONSTRAINT name INHERIT
+ {
+ AlterTableCmd *n = makeNode(AlterTableCmd);
+ ATAlterConstraint *c = makeNode(ATAlterConstraint);
+
+ n->subtype = AT_AlterConstraint;
+ n->def = (Node *) c;
+ c->conname = $3;
+ c->alterInheritability = true;
+ c->noinherit = false;
+
$$ = (Node *) n;
}
/* ALTER TABLE <name> VALIDATE CONSTRAINT ... */
@@ -3223,11 +3272,13 @@ PartitionBoundSpec:
if (n->modulus == -1)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("modulus for hash partition must be specified")));
+ errmsg("modulus for hash partition must be specified"),
+ parser_errposition(@3)));
if (n->remainder == -1)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("remainder for hash partition must be specified")));
+ errmsg("remainder for hash partition must be specified"),
+ parser_errposition(@3)));
n->location = @3;
@@ -3979,12 +4030,16 @@ ColConstraint:
* or be part of a_expr NOT LIKE or similar constructs).
*/
ColConstraintElem:
- NOT NULL_P
+ NOT NULL_P opt_no_inherit
{
Constraint *n = makeNode(Constraint);
n->contype = CONSTR_NOTNULL;
n->location = @1;
+ n->is_no_inherit = $3;
+ n->is_enforced = true;
+ n->skip_validation = false;
+ n->initially_valid = true;
$$ = (Node *) n;
}
| NULL_P
@@ -4029,6 +4084,7 @@ ColConstraintElem:
n->is_no_inherit = $5;
n->raw_expr = $3;
n->cooked_expr = NULL;
+ n->is_enforced = true;
n->skip_validation = false;
n->initially_valid = true;
$$ = (Node *) n;
@@ -4055,7 +4111,7 @@ ColConstraintElem:
n->location = @1;
$$ = (Node *) n;
}
- | GENERATED generated_when AS '(' a_expr ')' STORED
+ | GENERATED generated_when AS '(' a_expr ')' opt_virtual_or_stored
{
Constraint *n = makeNode(Constraint);
@@ -4063,6 +4119,7 @@ ColConstraintElem:
n->generated_when = $2;
n->raw_expr = $5;
n->cooked_expr = NULL;
+ n->generated_kind = $7;
n->location = @1;
/*
@@ -4092,6 +4149,7 @@ ColConstraintElem:
n->fk_upd_action = ($5)->updateAction->action;
n->fk_del_action = ($5)->deleteAction->action;
n->fk_del_set_cols = ($5)->deleteAction->cols;
+ n->is_enforced = true;
n->skip_validation = false;
n->initially_valid = true;
$$ = (Node *) n;
@@ -4109,6 +4167,12 @@ generated_when:
| BY DEFAULT { $$ = ATTRIBUTE_IDENTITY_BY_DEFAULT; }
;
+opt_virtual_or_stored:
+ STORED { $$ = ATTRIBUTE_GENERATED_STORED; }
+ | VIRTUAL { $$ = ATTRIBUTE_GENERATED_VIRTUAL; }
+ | /*EMPTY*/ { $$ = ATTRIBUTE_GENERATED_VIRTUAL; }
+ ;
+
/*
* ConstraintAttr represents constraint attributes, which we parse as if
* they were independent constraint clauses, in order to avoid shift/reduce
@@ -4157,6 +4221,22 @@ ConstraintAttr:
n->location = @1;
$$ = (Node *) n;
}
+ | ENFORCED
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_ATTR_ENFORCED;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
+ | NOT ENFORCED
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_ATTR_NOT_ENFORCED;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
;
@@ -4218,12 +4298,25 @@ ConstraintElem:
n->raw_expr = $3;
n->cooked_expr = NULL;
processCASbits($5, @5, "CHECK",
- NULL, NULL, &n->skip_validation,
+ NULL, NULL, &n->is_enforced, &n->skip_validation,
&n->is_no_inherit, yyscanner);
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
}
- | UNIQUE opt_unique_null_treatment '(' columnList ')' opt_c_include opt_definition OptConsTableSpace
+ | NOT NULL_P ColId ConstraintAttributeSpec
+ {
+ Constraint *n = makeNode(Constraint);
+
+ n->contype = CONSTR_NOTNULL;
+ n->location = @1;
+ n->keys = list_make1(makeString($3));
+ processCASbits($4, @4, "NOT NULL",
+ NULL, NULL, NULL, &n->skip_validation,
+ &n->is_no_inherit, yyscanner);
+ n->initially_valid = !n->skip_validation;
+ $$ = (Node *) n;
+ }
+ | UNIQUE opt_unique_null_treatment '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace
ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
@@ -4232,13 +4325,14 @@ ConstraintElem:
n->location = @1;
n->nulls_not_distinct = !$2;
n->keys = $4;
- n->including = $6;
- n->options = $7;
+ n->without_overlaps = $5;
+ n->including = $7;
+ n->options = $8;
n->indexname = NULL;
- n->indexspace = $8;
- processCASbits($9, @9, "UNIQUE",
+ n->indexspace = $9;
+ processCASbits($10, @10, "UNIQUE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| UNIQUE ExistingIndex ConstraintAttributeSpec
@@ -4254,10 +4348,10 @@ ConstraintElem:
n->indexspace = NULL;
processCASbits($3, @3, "UNIQUE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
- | PRIMARY KEY '(' columnList ')' opt_c_include opt_definition OptConsTableSpace
+ | PRIMARY KEY '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace
ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
@@ -4265,13 +4359,14 @@ ConstraintElem:
n->contype = CONSTR_PRIMARY;
n->location = @1;
n->keys = $4;
- n->including = $6;
- n->options = $7;
+ n->without_overlaps = $5;
+ n->including = $7;
+ n->options = $8;
n->indexname = NULL;
- n->indexspace = $8;
- processCASbits($9, @9, "PRIMARY KEY",
+ n->indexspace = $9;
+ processCASbits($10, @10, "PRIMARY KEY",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| PRIMARY KEY ExistingIndex ConstraintAttributeSpec
@@ -4287,7 +4382,7 @@ ConstraintElem:
n->indexspace = NULL;
processCASbits($4, @4, "PRIMARY KEY",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
| EXCLUDE access_method_clause '(' ExclusionConstraintList ')'
@@ -4307,26 +4402,36 @@ ConstraintElem:
n->where_clause = $9;
processCASbits($10, @10, "EXCLUDE",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
$$ = (Node *) n;
}
- | FOREIGN KEY '(' columnList ')' REFERENCES qualified_name
- opt_column_list key_match key_actions ConstraintAttributeSpec
+ | FOREIGN KEY '(' columnList optionalPeriodName ')' REFERENCES qualified_name
+ opt_column_and_period_list key_match key_actions ConstraintAttributeSpec
{
Constraint *n = makeNode(Constraint);
n->contype = CONSTR_FOREIGN;
n->location = @1;
- n->pktable = $7;
+ n->pktable = $8;
n->fk_attrs = $4;
- n->pk_attrs = $8;
- n->fk_matchtype = $9;
- n->fk_upd_action = ($10)->updateAction->action;
- n->fk_del_action = ($10)->deleteAction->action;
- n->fk_del_set_cols = ($10)->deleteAction->cols;
- processCASbits($11, @11, "FOREIGN KEY",
+ if ($5)
+ {
+ n->fk_attrs = lappend(n->fk_attrs, $5);
+ n->fk_with_period = true;
+ }
+ n->pk_attrs = linitial($9);
+ if (lsecond($9))
+ {
+ n->pk_attrs = lappend(n->pk_attrs, lsecond($9));
+ n->pk_with_period = true;
+ }
+ n->fk_matchtype = $10;
+ n->fk_upd_action = ($11)->updateAction->action;
+ n->fk_del_action = ($11)->deleteAction->action;
+ n->fk_del_set_cols = ($11)->deleteAction->cols;
+ processCASbits($12, @12, "FOREIGN KEY",
&n->deferrable, &n->initdeferred,
- &n->skip_validation, NULL,
+ &n->is_enforced, &n->skip_validation, NULL,
yyscanner);
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
@@ -4366,8 +4471,9 @@ DomainConstraintElem:
n->raw_expr = $3;
n->cooked_expr = NULL;
processCASbits($5, @5, "CHECK",
- NULL, NULL, &n->skip_validation,
+ NULL, NULL, NULL, &n->skip_validation,
&n->is_no_inherit, yyscanner);
+ n->is_enforced = true;
n->initially_valid = !n->skip_validation;
$$ = (Node *) n;
}
@@ -4378,10 +4484,10 @@ DomainConstraintElem:
n->contype = CONSTR_NOTNULL;
n->location = @1;
n->keys = list_make1(makeString("value"));
- /* no NOT VALID support yet */
+ /* no NOT VALID, NO INHERIT support */
processCASbits($3, @3, "NOT NULL",
NULL, NULL, NULL,
- &n->is_no_inherit, yyscanner);
+ NULL, NULL, yyscanner);
n->initially_valid = true;
$$ = (Node *) n;
}
@@ -4391,6 +4497,11 @@ opt_no_inherit: NO INHERIT { $$ = true; }
| /* EMPTY */ { $$ = false; }
;
+opt_without_overlaps:
+ WITHOUT OVERLAPS { $$ = true; }
+ | /*EMPTY*/ { $$ = false; }
+ ;
+
opt_column_list:
'(' columnList ')' { $$ = $2; }
| /*EMPTY*/ { $$ = NIL; }
@@ -4401,6 +4512,16 @@ columnList:
| columnList ',' columnElem { $$ = lappend($1, $3); }
;
+optionalPeriodName:
+ ',' PERIOD columnElem { $$ = $3; }
+ | /*EMPTY*/ { $$ = NULL; }
+ ;
+
+opt_column_and_period_list:
+ '(' columnList optionalPeriodName ')' { $$ = list_make2($2, $3); }
+ | /*EMPTY*/ { $$ = list_make2(NIL, NULL); }
+ ;
+
columnElem: ColId
{
$$ = (Node *) makeString($1);
@@ -4580,7 +4701,7 @@ PartitionSpec: PARTITION BY ColId '(' part_params ')'
{
PartitionSpec *n = makeNode(PartitionSpec);
- n->strategy = parsePartitionStrategy($3);
+ n->strategy = parsePartitionStrategy($3, @3, yyscanner);
n->partParams = $5;
n->location = @1;
@@ -4990,6 +5111,10 @@ SeqOptElem: AS SimpleTypename
{
$$ = makeDefElem("increment", (Node *) $3, @1);
}
+ | LOGGED
+ {
+ $$ = makeDefElem("logged", NULL, @1);
+ }
| MAXVALUE NumericOnly
{
$$ = makeDefElem("maxvalue", (Node *) $2, @1);
@@ -5012,7 +5137,6 @@ SeqOptElem: AS SimpleTypename
}
| SEQUENCE NAME_P any_name
{
- /* not documented, only used by pg_dump */
$$ = makeDefElem("sequence_name", (Node *) $3, @1);
}
| START opt_with NumericOnly
@@ -5027,6 +5151,10 @@ SeqOptElem: AS SimpleTypename
{
$$ = makeDefElem("restart", (Node *) $3, @1);
}
+ | UNLOGGED
+ {
+ $$ = makeDefElem("unlogged", NULL, @1);
+ }
;
opt_by: BY
@@ -6007,7 +6135,8 @@ CreateTrigStmt:
if (n->replace) /* not supported, see CreateTrigger */
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("CREATE OR REPLACE CONSTRAINT TRIGGER is not supported")));
+ errmsg("CREATE OR REPLACE CONSTRAINT TRIGGER is not supported"),
+ parser_errposition(@1)));
n->isconstraint = true;
n->trigname = $5;
n->relation = $9;
@@ -6021,7 +6150,7 @@ CreateTrigStmt:
n->transitionRels = NIL;
processCASbits($11, @11, "TRIGGER",
&n->deferrable, &n->initdeferred, NULL,
- NULL, yyscanner);
+ NULL, NULL, yyscanner);
n->constrrel = $10;
$$ = (Node *) n;
}
@@ -6190,7 +6319,8 @@ ConstraintAttributeSpec:
parser_errposition(@2)));
/* generic message for other conflicts */
if ((newspec & (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE)) == (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE) ||
- (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED))
+ (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED) ||
+ (newspec & (CAS_NOT_ENFORCED | CAS_ENFORCED)) == (CAS_NOT_ENFORCED | CAS_ENFORCED))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting constraint properties"),
@@ -6206,6 +6336,8 @@ ConstraintAttributeElem:
| INITIALLY DEFERRED { $$ = CAS_INITIALLY_DEFERRED; }
| NOT VALID { $$ = CAS_NOT_VALID; }
| NO INHERIT { $$ = CAS_NO_INHERIT; }
+ | NOT ENFORCED { $$ = CAS_NOT_ENFORCED; }
+ | ENFORCED { $$ = CAS_ENFORCED; }
;
@@ -6292,7 +6424,8 @@ CreateAssertionStmt:
{
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("CREATE ASSERTION is not yet implemented")));
+ errmsg("CREATE ASSERTION is not yet implemented"),
+ parser_errposition(@1)));
$$ = NULL;
}
@@ -6652,7 +6785,7 @@ opclass_item_list:
;
opclass_item:
- OPERATOR Iconst any_operator opclass_purpose opt_recheck
+ OPERATOR Iconst any_operator opclass_purpose
{
CreateOpClassItem *n = makeNode(CreateOpClassItem);
ObjectWithArgs *owa = makeNode(ObjectWithArgs);
@@ -6666,7 +6799,6 @@ opclass_item:
$$ = (Node *) n;
}
| OPERATOR Iconst operator_with_argtypes opclass_purpose
- opt_recheck
{
CreateOpClassItem *n = makeNode(CreateOpClassItem);
@@ -6718,23 +6850,6 @@ opclass_purpose: FOR SEARCH { $$ = NIL; }
| /*EMPTY*/ { $$ = NIL; }
;
-opt_recheck: RECHECK
- {
- /*
- * RECHECK no longer does anything in opclass definitions,
- * but we still accept it to ease porting of old database
- * dumps.
- */
- ereport(NOTICE,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("RECHECK is no longer required"),
- errhint("Update your data type."),
- parser_errposition(@1)));
- $$ = true;
- }
- | /*EMPTY*/ { $$ = false; }
- ;
-
CreateOpFamilyStmt:
CREATE OPERATOR FAMILY any_name USING name
@@ -8154,6 +8269,7 @@ defacl_privilege_target:
| SEQUENCES { $$ = OBJECT_SEQUENCE; }
| TYPES_P { $$ = OBJECT_TYPE; }
| SCHEMAS { $$ = OBJECT_SCHEMA; }
+ | LARGE_P OBJECTS_P { $$ = OBJECT_LARGEOBJECT; }
;
@@ -8353,7 +8469,7 @@ CreateFunctionStmt:
n->is_procedure = false;
n->replace = $2;
n->funcname = $4;
- n->parameters = mergeTableFuncParameters($5, $9);
+ n->parameters = mergeTableFuncParameters($5, $9, yyscanner);
n->returnType = TableFuncTypeName($9);
n->returnType->location = @7;
n->options = $11;
@@ -8486,6 +8602,7 @@ func_arg:
n->argType = $3;
n->mode = $1;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| param_name arg_class func_type
@@ -8496,6 +8613,7 @@ func_arg:
n->argType = $3;
n->mode = $2;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| param_name func_type
@@ -8506,6 +8624,7 @@ func_arg:
n->argType = $2;
n->mode = FUNC_PARAM_DEFAULT;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| arg_class func_type
@@ -8516,6 +8635,7 @@ func_arg:
n->argType = $2;
n->mode = $1;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
| func_type
@@ -8526,6 +8646,7 @@ func_arg:
n->argType = $1;
n->mode = FUNC_PARAM_DEFAULT;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
;
@@ -8862,6 +8983,7 @@ table_func_column: param_name func_type
n->argType = $2;
n->mode = FUNC_PARAM_TABLE;
n->defexpr = NULL;
+ n->location = @1;
$$ = n;
}
;
@@ -11986,7 +12108,7 @@ opt_name_list:
;
vacuum_relation:
- qualified_name opt_name_list
+ relation_expr opt_name_list
{
$$ = (Node *) makeVacuumRelation($1, InvalidOid, $2);
}
@@ -12209,7 +12331,7 @@ InsertStmt:
{
$5->relation = $4;
$5->onConflictClause = $6;
- $5->returningList = $7;
+ $5->returningClause = $7;
$5->withClause = $1;
$$ = (Node *) $5;
}
@@ -12358,8 +12480,45 @@ opt_conf_expr:
;
returning_clause:
- RETURNING target_list { $$ = $2; }
- | /* EMPTY */ { $$ = NIL; }
+ RETURNING returning_with_clause target_list
+ {
+ ReturningClause *n = makeNode(ReturningClause);
+
+ n->options = $2;
+ n->exprs = $3;
+ $$ = n;
+ }
+ | /* EMPTY */
+ {
+ $$ = NULL;
+ }
+ ;
+
+returning_with_clause:
+ WITH '(' returning_options ')' { $$ = $3; }
+ | /* EMPTY */ { $$ = NIL; }
+ ;
+
+returning_options:
+ returning_option { $$ = list_make1($1); }
+ | returning_options ',' returning_option { $$ = lappend($1, $3); }
+ ;
+
+returning_option:
+ returning_option_kind AS ColId
+ {
+ ReturningOption *n = makeNode(ReturningOption);
+
+ n->option = $1;
+ n->value = $3;
+ n->location = @1;
+ $$ = (Node *) n;
+ }
+ ;
+
+returning_option_kind:
+ OLD { $$ = RETURNING_OPTION_OLD; }
+ | NEW { $$ = RETURNING_OPTION_NEW; }
;
@@ -12378,7 +12537,7 @@ DeleteStmt: opt_with_clause DELETE_P FROM relation_expr_opt_alias
n->relation = $4;
n->usingClause = $5;
n->whereClause = $6;
- n->returningList = $7;
+ n->returningClause = $7;
n->withClause = $1;
$$ = (Node *) n;
}
@@ -12452,7 +12611,7 @@ UpdateStmt: opt_with_clause UPDATE relation_expr_opt_alias
n->targetList = $5;
n->fromClause = $6;
n->whereClause = $7;
- n->returningList = $8;
+ n->returningClause = $8;
n->withClause = $1;
$$ = (Node *) n;
}
@@ -12465,7 +12624,7 @@ UpdateStmtShort: opt_with_clause UPDATE relation_expr_opt_alias
n->targetList = NULL;
n->fromClause = NULL;
n->whereClause = NULL;
- n->returningList = NULL;
+ n->returningClause = NULL;
n->withClause = $1;
$$ = (Node *)n;
pg_yyget_extra(yyscanner)->parsetree = list_make1(makeRawStmt($$, 0));
@@ -12545,7 +12704,7 @@ MergeStmt:
m->sourceRelation = $6;
m->joinCondition = $8;
m->mergeWhenClauses = $9;
- m->returningList = $10;
+ m->returningClause = $10;
$$ = (Node *) m;
}
@@ -13224,11 +13383,13 @@ select_limit:
{
$$ = $1;
($$)->limitOffset = $2;
+ ($$)->offsetLoc = @2;
}
| offset_clause limit_clause
{
$$ = $2;
($$)->limitOffset = $1;
+ ($$)->offsetLoc = @1;
}
| limit_clause
{
@@ -13241,6 +13402,9 @@ select_limit:
n->limitOffset = $1;
n->limitCount = NULL;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = @1;
+ n->countLoc = -1;
+ n->optionLoc = -1;
$$ = n;
}
;
@@ -13258,6 +13422,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $2;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| LIMIT select_limit_value ',' select_offset_value
@@ -13283,6 +13450,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $3;
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| FETCH first_or_next select_fetch_first_value row_or_rows WITH TIES
@@ -13292,6 +13462,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = $3;
n->limitOption = LIMIT_OPTION_WITH_TIES;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = @5;
$$ = n;
}
| FETCH first_or_next row_or_rows ONLY
@@ -13301,6 +13474,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = makeIntConst(1, -1);
n->limitOption = LIMIT_OPTION_COUNT;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = -1;
$$ = n;
}
| FETCH first_or_next row_or_rows WITH TIES
@@ -13310,6 +13486,9 @@ limit_clause:
n->limitOffset = NULL;
n->limitCount = makeIntConst(1, -1);
n->limitOption = LIMIT_OPTION_WITH_TIES;
+ n->offsetLoc = -1;
+ n->countLoc = @1;
+ n->optionLoc = @4;
$$ = n;
}
;
@@ -14154,7 +14333,7 @@ xmltable_column_el:
parser_errposition(defel->location)));
fc->colexpr = defel->arg;
}
- else if (strcmp(defel->defname, "is_not_null") == 0)
+ else if (strcmp(defel->defname, "__pg__is_not_null") == 0)
{
if (nullability_seen)
ereport(ERROR,
@@ -14197,13 +14376,20 @@ xmltable_column_option_list:
xmltable_column_option_el:
IDENT b_expr
- { $$ = makeDefElem($1, $2, @1); }
+ {
+ if (strcmp($1, "__pg__is_not_null") == 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("option name \"%s\" cannot be used in XMLTABLE", $1),
+ parser_errposition(@1)));
+ $$ = makeDefElem($1, $2, @1);
+ }
| DEFAULT b_expr
{ $$ = makeDefElem("default", $2, @1); }
| NOT NULL_P
- { $$ = makeDefElem("is_not_null", (Node *) makeBoolean(true), @1); }
+ { $$ = makeDefElem("__pg__is_not_null", (Node *) makeBoolean(true), @1); }
| NULL_P
- { $$ = makeDefElem("is_not_null", (Node *) makeBoolean(false), @1); }
+ { $$ = makeDefElem("__pg__is_not_null", (Node *) makeBoolean(false), @1); }
| PATH b_expr
{ $$ = makeDefElem("path", $2, @1); }
;
@@ -15204,49 +15390,50 @@ a_expr: c_expr { $$ = $1; }
(Node *) list_make2($5, $7),
@2);
}
- | a_expr IN_P in_expr
+ | a_expr IN_P select_with_parens
{
- /* in_expr returns a SubLink or a list of a_exprs */
- if (IsA($3, SubLink))
- {
- /* generate foo = ANY (subquery) */
- SubLink *n = (SubLink *) $3;
+ /* generate foo = ANY (subquery) */
+ SubLink *n = makeNode(SubLink);
- n->subLinkType = ANY_SUBLINK;
- n->subLinkId = 0;
- n->testexpr = $1;
- n->operName = NIL; /* show it's IN not = ANY */
- n->location = @2;
- $$ = (Node *) n;
- }
- else
- {
- /* generate scalar IN expression */
- $$ = (Node *) makeSimpleA_Expr(AEXPR_IN, "=", $1, $3, @2);
- }
+ n->subselect = $3;
+ n->subLinkType = ANY_SUBLINK;
+ n->subLinkId = 0;
+ n->testexpr = $1;
+ n->operName = NIL; /* show it's IN not = ANY */
+ n->location = @2;
+ $$ = (Node *) n;
}
- | a_expr NOT_LA IN_P in_expr %prec NOT_LA
+ | a_expr IN_P '(' expr_list ')'
{
- /* in_expr returns a SubLink or a list of a_exprs */
- if (IsA($4, SubLink))
- {
- /* generate NOT (foo = ANY (subquery)) */
- /* Make an = ANY node */
- SubLink *n = (SubLink *) $4;
-
- n->subLinkType = ANY_SUBLINK;
- n->subLinkId = 0;
- n->testexpr = $1;
- n->operName = NIL; /* show it's IN not = ANY */
- n->location = @2;
- /* Stick a NOT on top; must have same parse location */
- $$ = makeNotExpr((Node *) n, @2);
- }
- else
- {
- /* generate scalar NOT IN expression */
- $$ = (Node *) makeSimpleA_Expr(AEXPR_IN, "<>", $1, $4, @2);
- }
+ /* generate scalar IN expression */
+ A_Expr *n = makeSimpleA_Expr(AEXPR_IN, "=", $1, (Node *) $4, @2);
+
+ n->rexpr_list_start = @3;
+ n->rexpr_list_end = @5;
+ $$ = (Node *) n;
+ }
+ | a_expr NOT_LA IN_P select_with_parens %prec NOT_LA
+ {
+ /* generate NOT (foo = ANY (subquery)) */
+ SubLink *n = makeNode(SubLink);
+
+ n->subselect = $4;
+ n->subLinkType = ANY_SUBLINK;
+ n->subLinkId = 0;
+ n->testexpr = $1;
+ n->operName = NIL; /* show it's IN not = ANY */
+ n->location = @2;
+ /* Stick a NOT on top; must have same parse location */
+ $$ = makeNotExpr((Node *) n, @2);
+ }
+ | a_expr NOT_LA IN_P '(' expr_list ')'
+ {
+ /* generate scalar NOT IN expression */
+ A_Expr *n = makeSimpleA_Expr(AEXPR_IN, "<>", $1, (Node *) $5, @2);
+
+ n->rexpr_list_start = @4;
+ n->rexpr_list_end = @6;
+ $$ = (Node *) n;
}
| a_expr subquery_Op sub_type select_with_parens %prec Op
{
@@ -16681,15 +16868,15 @@ type_list: Typename { $$ = list_make1($1); }
array_expr: '[' expr_list ']'
{
- $$ = makeAArrayExpr($2, @1);
+ $$ = makeAArrayExpr($2, @1, @3);
}
| '[' array_expr_list ']'
{
- $$ = makeAArrayExpr($2, @1);
+ $$ = makeAArrayExpr($2, @1, @3);
}
| '[' ']'
{
- $$ = makeAArrayExpr(NIL, @1);
+ $$ = makeAArrayExpr(NIL, @1, @2);
}
;
@@ -16811,17 +16998,6 @@ trim_list: a_expr FROM expr_list { $$ = lappend($3, $1); }
| expr_list { $$ = $1; }
;
-in_expr: select_with_parens
- {
- SubLink *n = makeNode(SubLink);
-
- n->subselect = $1;
- /* other fields will be filled later */
- $$ = (Node *) n;
- }
- | '(' expr_list ')' { $$ = (Node *) $2; }
- ;
-
/*
* Define SQL-style CASE clause.
* - Full specification
@@ -17022,7 +17198,8 @@ json_format_clause:
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized JSON encoding: %s", $4)));
+ errmsg("unrecognized JSON encoding: %s", $4),
+ parser_errposition(@4)));
$$ = (Node *) makeJsonFormat(JS_FORMAT_JSON, encoding, @1);
}
@@ -17524,7 +17701,8 @@ PLpgSQL_Expr: opt_distinct_clause opt_target_list
$9->limitOption == LIMIT_OPTION_WITH_TIES)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("WITH TIES cannot be specified without ORDER BY clause")));
+ errmsg("WITH TIES cannot be specified without ORDER BY clause"),
+ parser_errposition($9->optionLoc)));
n->limitOption = $9->limitOption;
}
n->lockingClause = $10;
@@ -17708,6 +17886,7 @@ unreserved_keyword:
| ENABLE_P
| ENCODING
| ENCRYPTED
+ | ENFORCED
| ENUM_P
| ERROR_P
| ESCAPE
@@ -17803,6 +17982,7 @@ unreserved_keyword:
| NOWAIT
| NULLS_P
| OBJECT_P
+ | OBJECTS_P
| OF
| OFF
| OIDS
@@ -17825,6 +18005,7 @@ unreserved_keyword:
| PASSING
| PASSWORD
| PATH
+ | PERIOD
| PLAN
| PLANS
| POLICY
@@ -17844,7 +18025,6 @@ unreserved_keyword:
| RANGE
| READ
| REASSIGN
- | RECHECK
| RECURSIVE
| REF_P
| REFERENCING
@@ -17941,6 +18121,7 @@ unreserved_keyword:
| VERSION_P
| VIEW
| VIEWS
+ | VIRTUAL
| VOLATILE
| WHITESPACE_P
| WITHIN
@@ -18285,6 +18466,7 @@ bare_label_keyword:
| ENCODING
| ENCRYPTED
| END_P
+ | ENFORCED
| ENUM_P
| ERROR_P
| ESCAPE
@@ -18423,6 +18605,7 @@ bare_label_keyword:
| NULLS_P
| NUMERIC
| OBJECT_P
+ | OBJECTS_P
| OF
| OFF
| OIDS
@@ -18449,6 +18632,7 @@ bare_label_keyword:
| PASSING
| PASSWORD
| PATH
+ | PERIOD
| PLACING
| PLAN
| PLANS
@@ -18472,7 +18656,6 @@ bare_label_keyword:
| READ
| REAL
| REASSIGN
- | RECHECK
| RECURSIVE
| REF_P
| REFERENCES
@@ -18595,6 +18778,7 @@ bare_label_keyword:
| VERSION_P
| VIEW
| VIEWS
+ | VIRTUAL
| VOLATILE
| WHEN
| WHITESPACE_P
@@ -18666,10 +18850,10 @@ makeColumnRef(char *colname, List *indirection,
int location, core_yyscan_t yyscanner)
{
/*
- * Generate a ColumnRef node, with an A_Indirection node added if there
- * is any subscripting in the specified indirection list. However,
- * any field selection at the start of the indirection list must be
- * transposed into the "fields" part of the ColumnRef node.
+ * Generate a ColumnRef node, with an A_Indirection node added if there is
+ * any subscripting in the specified indirection list. However, any field
+ * selection at the start of the indirection list must be transposed into
+ * the "fields" part of the ColumnRef node.
*/
ColumnRef *c = makeNode(ColumnRef);
int nfields = 0;
@@ -18744,7 +18928,7 @@ makeIntConst(int val, int location)
n->val.ival.ival = val;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
#endif
@@ -18757,42 +18941,42 @@ makeFloatConst(char *str, int location)
n->val.fval.fval = str;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
makeBoolAConst(bool state, int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->val.boolval.type = T_Boolean;
n->val.boolval.boolval = state;
n->location = location;
- return (Node *) n;
+ return (Node *) n;
}
static Node *
makeBitStringConst(char *str, int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->val.bsval.type = T_BitString;
n->val.bsval.bsval = str;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
makeNullAConst(int location)
{
- A_Const *n = makeNode(A_Const);
+ A_Const *n = makeNode(A_Const);
n->isnull = true;
n->location = location;
- return (Node *)n;
+ return (Node *) n;
}
static Node *
@@ -18876,7 +19060,7 @@ check_func_name(List *names, core_yyscan_t yyscanner)
static List *
check_indirection(List *indirection, core_yyscan_t yyscanner)
{
- ListCell *l;
+ ListCell *l;
foreach(l, indirection)
{
@@ -18931,7 +19115,7 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
core_yyscan_t yyscanner)
{
FunctionParameter *lastd = (FunctionParameter *) llast(directargs);
- Integer *ndirectargs;
+ Integer *ndirectargs;
/* No restriction unless last direct arg is VARIADIC */
if (lastd->mode == FUNC_PARAM_VARIADIC)
@@ -18939,15 +19123,15 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
FunctionParameter *firsto = (FunctionParameter *) linitial(orderedargs);
/*
- * We ignore the names, though the aggr_arg production allows them;
- * it doesn't allow default values, so those need not be checked.
+ * We ignore the names, though the aggr_arg production allows them; it
+ * doesn't allow default values, so those need not be checked.
*/
if (list_length(orderedargs) != 1 ||
firsto->mode != FUNC_PARAM_VARIADIC)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("an ordered-set aggregate with a VARIADIC direct argument must have one VARIADIC aggregated argument of the same data type"),
- parser_errposition(exprLocation((Node *) firsto))));
+ parser_errposition(firsto->location)));
/* OK, drop the duplicate VARIADIC argument from the internal form */
orderedargs = NIL;
@@ -18995,7 +19179,7 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple OFFSET clauses not allowed"),
- parser_errposition(exprLocation(limitClause->limitOffset))));
+ parser_errposition(limitClause->offsetLoc)));
stmt->limitOffset = limitClause->limitOffset;
}
if (limitClause && limitClause->limitCount)
@@ -19004,19 +19188,18 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple LIMIT clauses not allowed"),
- parser_errposition(exprLocation(limitClause->limitCount))));
+ parser_errposition(limitClause->countLoc)));
stmt->limitCount = limitClause->limitCount;
}
if (limitClause)
{
- if (stmt->limitOption)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("multiple limit options not allowed")));
+ /* If there was a conflict, we must have detected it above */
+ Assert(!stmt->limitOption);
if (!stmt->sortClause && limitClause->limitOption == LIMIT_OPTION_WITH_TIES)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("WITH TIES cannot be specified without ORDER BY clause")));
+ errmsg("WITH TIES cannot be specified without ORDER BY clause"),
+ parser_errposition(limitClause->optionLoc)));
if (limitClause->limitOption == LIMIT_OPTION_WITH_TIES && stmt->lockingClause)
{
ListCell *lc;
@@ -19029,7 +19212,8 @@ insertSelectOptions(SelectStmt *stmt,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("%s and %s options cannot be used together",
- "SKIP LOCKED", "WITH TIES")));
+ "SKIP LOCKED", "WITH TIES"),
+ parser_errposition(limitClause->optionLoc)));
}
}
stmt->limitOption = limitClause->limitOption;
@@ -19098,7 +19282,7 @@ doNegate(Node *n, int location)
{
if (IsA(n, A_Const))
{
- A_Const *con = (A_Const *) n;
+ A_Const *con = (A_Const *) n;
/* report the constant's location as that of the '-' sign */
con->location = location;
@@ -19126,7 +19310,7 @@ doNegateFloat(Float *v)
if (*oldval == '+')
oldval++;
if (*oldval == '-')
- v->fval = oldval+1; /* just strip the '-' */
+ v->fval = oldval + 1; /* just strip the '-' */
else
v->fval = psprintf("-%s", oldval);
}
@@ -19172,12 +19356,14 @@ makeNotExpr(Node *expr, int location)
}
static Node *
-makeAArrayExpr(List *elements, int location)
+makeAArrayExpr(List *elements, int location, int location_end)
{
A_ArrayExpr *n = makeNode(A_ArrayExpr);
n->elements = elements;
n->location = location;
+ n->list_start = location;
+ n->list_end = location_end;
return (Node *) n;
}
@@ -19197,10 +19383,11 @@ static Node *
makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
int location)
{
- XmlExpr *x = makeNode(XmlExpr);
+ XmlExpr *x = makeNode(XmlExpr);
x->op = op;
x->name = name;
+
/*
* named_args is a list of ResTarget; it'll be split apart into separate
* expression and name lists in transformXmlExpr().
@@ -19210,7 +19397,7 @@ makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
x->args = args;
/* xmloption, if relevant, must be filled in by caller */
/* type and typmod will be filled in during parse analysis */
- x->type = InvalidOid; /* marks the node as not analyzed */
+ x->type = InvalidOid; /* marks the node as not analyzed */
x->location = location;
return (Node *) x;
}
@@ -19219,7 +19406,7 @@ makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
* Merge the input and output parameters of a table function.
*/
static List *
-mergeTableFuncParameters(List *func_args, List *columns)
+mergeTableFuncParameters(List *func_args, List *columns, core_yyscan_t yyscanner)
{
ListCell *lc;
@@ -19233,7 +19420,8 @@ mergeTableFuncParameters(List *func_args, List *columns)
p->mode != FUNC_PARAM_VARIADIC)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("OUT and INOUT arguments aren't allowed in TABLE functions")));
+ errmsg("OUT and INOUT arguments aren't allowed in TABLE functions"),
+ parser_errposition(p->location)));
}
return list_concat(func_args, columns);
@@ -19334,7 +19522,7 @@ makeRangeVarFromQualifiedName(char *name, List *namelist, int location,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("improper qualified name (too many dotted names): %s",
NameListToString(lcons(makeString(name), namelist))),
- parser_errposition(location)));
+ parser_errposition(location)));
break;
}
@@ -19385,8 +19573,8 @@ SplitColQualList(List *qualList,
*/
static void
processCASbits(int cas_bits, int location, const char *constrType,
- bool *deferrable, bool *initdeferred, bool *not_valid,
- bool *no_inherit, core_yyscan_t yyscanner)
+ bool *deferrable, bool *initdeferred, bool *is_enforced,
+ bool *not_valid, bool *no_inherit, core_yyscan_t yyscanner)
{
/* defaults */
if (deferrable)
@@ -19395,6 +19583,8 @@ processCASbits(int cas_bits, int location, const char *constrType,
*initdeferred = false;
if (not_valid)
*not_valid = false;
+ if (is_enforced)
+ *is_enforced = true;
if (cas_bits & (CAS_DEFERRABLE | CAS_INITIALLY_DEFERRED))
{
@@ -19403,7 +19593,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked DEFERRABLE",
constrType),
parser_errposition(location)));
@@ -19416,7 +19606,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked DEFERRABLE",
constrType),
parser_errposition(location)));
@@ -19429,7 +19619,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked NOT VALID",
constrType),
parser_errposition(location)));
@@ -19442,11 +19632,46 @@ processCASbits(int cas_bits, int location, const char *constrType,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is CHECK, UNIQUE, or similar */
+ /* translator: %s is CHECK, UNIQUE, or similar */
errmsg("%s constraints cannot be marked NO INHERIT",
constrType),
parser_errposition(location)));
}
+
+ if (cas_bits & CAS_NOT_ENFORCED)
+ {
+ if (is_enforced)
+ *is_enforced = false;
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ /* translator: %s is CHECK, UNIQUE, or similar */
+ errmsg("%s constraints cannot be marked NOT ENFORCED",
+ constrType),
+ parser_errposition(location)));
+
+ /*
+ * NB: The validated status is irrelevant when the constraint is set to
+ * NOT ENFORCED, but for consistency, it should be set accordingly.
+ * This ensures that if the constraint is later changed to ENFORCED, it
+ * will automatically be in the correct NOT VALIDATED state.
+ */
+ if (not_valid)
+ *not_valid = true;
+ }
+
+ if (cas_bits & CAS_ENFORCED)
+ {
+ if (is_enforced)
+ *is_enforced = true;
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ /* translator: %s is CHECK, UNIQUE, or similar */
+ errmsg("%s constraints cannot be marked ENFORCED",
+ constrType),
+ parser_errposition(location)));
+ }
}
/*
@@ -19454,7 +19679,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
* PartitionStrategy representation, or die trying.
*/
static PartitionStrategy
-parsePartitionStrategy(char *strategy)
+parsePartitionStrategy(char *strategy, int location, core_yyscan_t yyscanner)
{
if (pg_strcasecmp(strategy, "list") == 0)
return PARTITION_STRATEGY_LIST;
@@ -19465,9 +19690,9 @@ parsePartitionStrategy(char *strategy)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized partitioning strategy \"%s\"",
- strategy)));
- return PARTITION_STRATEGY_LIST; /* keep compiler quiet */
+ errmsg("unrecognized partitioning strategy \"%s\"", strategy),
+ parser_errposition(location)));
+ return PARTITION_STRATEGY_LIST; /* keep compiler quiet */
}
@@ -19538,8 +19763,8 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
parser_errposition(pubobj->location)));
/*
- * We can distinguish between the different type of schema
- * objects based on whether name and pubtable is set.
+ * We can distinguish between the different type of schema objects
+ * based on whether name and pubtable is set.
*/
if (pubobj->name)
pubobj->pubobjtype = PUBLICATIONOBJ_TABLES_IN_SCHEMA;
@@ -19594,11 +19819,13 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
w->ctes = list_make1(cte);
w->location = -1;
- /* create target list for the new SELECT from the alias list of the
- * recursive view specification */
- foreach (lc, aliases)
+ /*
+ * create target list for the new SELECT from the alias list of the
+ * recursive view specification
+ */
+ foreach(lc, aliases)
{
- ResTarget *rt = makeNode(ResTarget);
+ ResTarget *rt = makeNode(ResTarget);
rt->name = NULL;
rt->indirection = NIL;
@@ -19608,8 +19835,10 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
tl = lappend(tl, rt);
}
- /* create new SELECT combining WITH clause, target list, and fake FROM
- * clause */
+ /*
+ * create new SELECT combining WITH clause, target list, and fake FROM
+ * clause
+ */
s->withClause = w;
s->targetList = tl;
s->fromClause = list_make1(makeRangeVar(NULL, relname, -1));
diff --git a/src/parser/keywords.c b/src/parser/keywords.c
index 83feb9f47..835ddfeb5 100644
--- a/src/parser/keywords.c
+++ b/src/parser/keywords.c
@@ -4,8 +4,8 @@
* PostgreSQL's list of SQL keywords
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
diff --git a/src/parser/kwlookup.c b/src/parser/kwlookup.c
index d4364dc27..ff2498cf8 100644
--- a/src/parser/kwlookup.c
+++ b/src/parser/kwlookup.c
@@ -4,8 +4,8 @@
* Key word lookup for PostgreSQL
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
diff --git a/src/parser/list.c b/src/parser/list.c
index 909517632..17f394fb0 100644
--- a/src/parser/list.c
+++ b/src/parser/list.c
@@ -5,8 +5,8 @@
*
* See comments in pg_list.h
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
diff --git a/src/parser/makefuncs.c b/src/parser/makefuncs.c
index 3777c66af..be807d982 100644
--- a/src/parser/makefuncs.c
+++ b/src/parser/makefuncs.c
@@ -4,8 +4,8 @@
* creator functions for various nodes. The functions here are for the
* most frequently created nodes.
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -54,7 +54,7 @@ makeSimpleA_Expr(A_Expr_Kind kind, char *name,
A_Expr *a = makeNode(A_Expr);
a->kind = kind;
- a->name = list_make1(makeString((char *) name));
+ a->name = list_make1(makeString(name));
a->lexpr = lexpr;
a->rexpr = rexpr;
a->location = location;
@@ -83,12 +83,14 @@ makeVar(int varno,
var->varlevelsup = varlevelsup;
/*
- * Only a few callers need to make Var nodes with non-null varnullingrels,
- * or with varnosyn/varattnosyn different from varno/varattno. We don't
- * provide separate arguments for them, but just initialize them to NULL
- * and the given varno/varattno. This reduces code clutter and chance of
- * error for most callers.
+ * Only a few callers need to make Var nodes with varreturningtype
+ * different from VAR_RETURNING_DEFAULT, non-null varnullingrels, or with
+ * varnosyn/varattnosyn different from varno/varattno. We don't provide
+ * separate arguments for them, but just initialize them to sensible
+ * default values. This reduces code clutter and chance of error for most
+ * callers.
*/
+ var->varreturningtype = VAR_RETURNING_DEFAULT;
var->varnullingrels = NULL;
var->varnosyn = (Index) varno;
var->varattnosyn = varattno;
@@ -163,6 +165,53 @@ makeWholeRowVar(RangeTblEntry *rte,
varlevelsup);
break;
+ case RTE_SUBQUERY:
+
+ /*
+ * For a standard subquery, the Var should be of RECORD type.
+ * However, if we're looking at a subquery that was expanded from
+ * a view or SRF (only possible during planning), we must use the
+ * appropriate rowtype, so that the resulting Var has the same
+ * type that we would have produced from the original RTE.
+ */
+ if (OidIsValid(rte->relid))
+ {
+ /* Subquery was expanded from a view */
+ toid = get_rel_type_id(rte->relid);
+ if (!OidIsValid(toid))
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("relation \"%s\" does not have a composite type",
+ get_rel_name(rte->relid))));
+ }
+ else if (rte->functions)
+ {
+ /*
+ * Subquery was expanded from a set-returning function. That
+ * would not have happened if there's more than one function
+ * or ordinality was requested. We also needn't worry about
+ * the allowScalar case, since the planner doesn't use that.
+ * Otherwise this must match the RTE_FUNCTION code below.
+ */
+ Assert(!allowScalar);
+ fexpr = ((RangeTblFunction *) linitial(rte->functions))->funcexpr;
+ toid = exprType(fexpr);
+ if (!type_is_rowtype(toid))
+ toid = RECORDOID;
+ }
+ else
+ {
+ /* Normal subquery-in-FROM */
+ toid = RECORDOID;
+ }
+ result = makeVar(varno,
+ InvalidAttrNumber,
+ toid,
+ -1,
+ InvalidOid,
+ varlevelsup);
+ break;
+
case RTE_FUNCTION:
/*
@@ -219,8 +268,8 @@ makeWholeRowVar(RangeTblEntry *rte,
default:
/*
- * RTE is a join, subselect, tablefunc, or VALUES. We represent
- * this as a whole-row Var of RECORD type. (Note that in most
+ * RTE is a join, tablefunc, VALUES, CTE, etc. We represent these
+ * cases as a whole-row Var of RECORD type. (Note that in most
* cases the Var will be expanded to a RowExpr during planning,
* but that is not our concern here.)
*/
@@ -437,6 +486,30 @@ makeRangeVar(char *schemaname, char *relname, int location)
return r;
}
+/*
+ * makeNotNullConstraint -
+ * creates a Constraint node for NOT NULL constraints
+ */
+Constraint *
+makeNotNullConstraint(String *colname)
+{
+ Constraint *notnull;
+
+ notnull = makeNode(Constraint);
+ notnull->contype = CONSTR_NOTNULL;
+ notnull->conname = NULL;
+ notnull->is_no_inherit = false;
+ notnull->deferrable = false;
+ notnull->initdeferred = false;
+ notnull->location = -1;
+ notnull->keys = list_make1(colname);
+ notnull->is_enforced = true;
+ notnull->skip_validation = false;
+ notnull->initially_valid = true;
+
+ return notnull;
+}
+
/*
* makeTypeName -
* build a TypeName node for an unqualified name.
diff --git a/src/parser/outfuncs.c b/src/parser/outfuncs.c
index f98af2b6e..99a02ce38 100644
--- a/src/parser/outfuncs.c
+++ b/src/parser/outfuncs.c
@@ -3,8 +3,8 @@
* outfuncs.c
* Output functions for Postgres tree nodes.
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -72,6 +72,7 @@ static void _outCoerceToDomainValue(StringInfo str, CoerceToDomainValue *node);
static void _outSetToDefault(StringInfo str, SetToDefault *node);
static void _outCurrentOfExpr(StringInfo str, CurrentOfExpr *node);
static void _outInferenceElem(StringInfo str, InferenceElem *node);
+static void _outReturningExpr(StringInfo str, ReturningExpr *node);
static void _outTargetEntry(StringInfo str, TargetEntry *node);
static void _outRangeTblRef(StringInfo str, RangeTblRef *node);
static void _outJoinExpr(StringInfo str, JoinExpr *node);
@@ -100,6 +101,8 @@ static void _outCTECycleClause(StringInfo str, CTECycleClause *node);
static void _outCommonTableExpr(StringInfo str, CommonTableExpr *node);
static void _outMergeWhenClauses(StringInfo str, List *node);
static void _outMergeAction(StringInfo str, MergeAction *node);
+static void _outReturningOption(StringInfo str, List *node);
+static void _outReturningClause(StringInfo str, ReturningClause *node);
static void _outSetOperationStmt(StringInfo str, SetOperationStmt *node);
static void _outTableSampleClause(StringInfo str, TableSampleClause *node);
static void _outA_Expr(StringInfo str, A_Expr *node);
@@ -185,6 +188,7 @@ static void _outFuncName(StringInfo str, List *func_name);
static void _outSetRest(StringInfo str, VariableSetStmt *node);
static void _outSetTransactionModeList(StringInfo str, List *list);
static void _outAlterTableCmd(StringInfo str, AlterTableCmd *node);
+static void _outATAlterConstraint(StringInfo str, ATAlterConstraint *node);
static void _outOptSeqList(StringInfo str, List *options);
static void _outObjectWithArgs(StringInfo str, ObjectWithArgs *node);
static void _outFunctionParameter(StringInfo str, FunctionParameter *node);
@@ -810,6 +814,12 @@ _outInferenceElem(StringInfo str, InferenceElem *node)
}
+static void
+_outReturningExpr(StringInfo str, ReturningExpr *node)
+{
+
+}
+
static void
_outTargetEntry(StringInfo str, TargetEntry *node)
{
@@ -924,9 +934,17 @@ static void
_outCreateStmt(StringInfo str, CreateStmt *node)
{
appendStringInfoString(str, "CREATE ");
+
if (node->relation->relpersistence == RELPERSISTENCE_TEMP)
appendStringInfoString(str, "TEMP ");
+ else if (node->relation->relpersistence == RELPERSISTENCE_UNLOGGED)
+ appendStringInfoString(str, "UNLOGGED ");
+
appendStringInfoString(str, "TABLE ");
+
+ if (node->if_not_exists)
+ appendStringInfoString(str, "IF NOT EXISTS ");
+
_outNode(str, node->relation);
appendStringInfoString(str, " (");
_outNode(str, node->tableElts);
@@ -939,6 +957,12 @@ _outCreateStmt(StringInfo str, CreateStmt *node)
appendStringInfoString(str, ")");
}
+ if (node->accessMethod)
+ {
+ appendStringInfoString(str, " USING ");
+ appendStringInfoString(str, node->accessMethod);
+ }
+
if (node->options)
_outWithDefinition(str, node->options);
@@ -972,9 +996,17 @@ static void
_outCreateTableAsStmt(StringInfo str, CreateTableAsStmt *node)
{
appendStringInfoString(str, "CREATE ");
+
if (node->into->rel->relpersistence == RELPERSISTENCE_TEMP)
appendStringInfoString(str, "TEMP ");
+ else if (node->into->rel->relpersistence == RELPERSISTENCE_UNLOGGED)
+ appendStringInfoString(str, "UNLOGGED ");
+
appendStringInfoString(str, "TABLE ");
+
+ if (node->if_not_exists)
+ appendStringInfoString(str, "IF NOT EXISTS ");
+
_outNode(str, node->into->rel);
if (node->into->colNames)
@@ -984,6 +1016,12 @@ _outCreateTableAsStmt(StringInfo str, CreateTableAsStmt *node)
appendStringInfoString(str, ") ");
}
+ if (node->into->accessMethod)
+ {
+ appendStringInfoString(str, " USING ");
+ appendStringInfoString(str, node->into->accessMethod);
+ }
+
if (node->into->options)
_outWithDefinition(str, node->into->options);
@@ -1017,6 +1055,14 @@ _outCreateTableAsStmt(StringInfo str, CreateTableAsStmt *node)
appendStringInfoString(str, " AS");
_outSelectStmt(str, (SelectStmt *) node->query);
}
+
+ if (node->into->skipData)
+ {
+ if (node->into->skipData == TRUE)
+ appendStringInfoString(str, " WITH NO DATA");
+ else
+ appendStringInfoString(str, " WITH DATA");
+ }
}
static void
@@ -1180,6 +1226,8 @@ _outSelectStmt(StringInfo str, SelectStmt *node)
appendStringInfoString(str, "CREATE ");
if (rel->relpersistence == RELPERSISTENCE_TEMP)
appendStringInfoString(str, "TEMP ");
+ else if (rel->relpersistence == RELPERSISTENCE_UNLOGGED)
+ appendStringInfoString(str, "UNLOGGED ");
appendStringInfoString(str, "TABLE ");
_outNode(str, into->rel);
@@ -1834,6 +1882,48 @@ _outMergeAction(StringInfo str, MergeAction *node)
{
}
+static void
+_outReturningOption(StringInfo str, List *node)
+{
+ ListCell *lc;
+ char comma = 0;
+
+ appendStringInfoString(str, "WITH (");
+
+ foreach(lc, node)
+ {
+ ReturningOption *r = (ReturningOption *) lfirst(lc);
+
+ if (comma == 0)
+ comma = 1;
+ else
+ appendStringInfoString(str, ", ");
+
+ if (r->option == RETURNING_OPTION_OLD)
+ appendStringInfoString(str, "OLD ");
+ else if (r->option == RETURNING_OPTION_NEW)
+ appendStringInfoString(str, "NEW ");
+
+ appendStringInfoString(str, "AS ");
+ appendStringInfoString(str, "\"");
+ appendStringInfoString(str, r->value);
+ appendStringInfoString(str, "\"");
+ }
+
+ appendStringInfoString(str, ") ");
+}
+
+static void
+_outReturningClause(StringInfo str, ReturningClause *node)
+{
+
+ if (node->options)
+ _outReturningOption(str, node->options);
+
+ if (node->exprs)
+ _outList(str, node->exprs);
+}
+
static void
_outSetOperationStmt(StringInfo str, SetOperationStmt *node)
{
@@ -2604,10 +2694,10 @@ _outInsertStmt(StringInfo str, InsertStmt *node)
_outOnConflictClause(str, node->onConflictClause);
}
- if (node->returningList)
+ if (node->returningClause)
{
appendStringInfoString(str, " RETURNING ");
- _outNode(str, node->returningList);
+ _outNode(str, node->returningClause);
}
}
@@ -2719,10 +2809,10 @@ _outUpdateStmt(StringInfo str, UpdateStmt *node)
_outNode(str, node->whereClause);
}
- if (node->returningList)
+ if (node->returningClause)
{
appendStringInfoString(str, " RETURNING ");
- _outNode(str, node->returningList);
+ _outNode(str, node->returningClause);
}
}
@@ -2748,10 +2838,10 @@ _outDeleteStmt(StringInfo str, DeleteStmt *node)
_outNode(str, node->whereClause);
}
- if (node->returningList)
+ if (node->returningClause)
{
appendStringInfoString(str, " RETURNING ");
- _outNode(str, node->returningList);
+ _outNode(str, node->returningClause);
}
}
@@ -2778,10 +2868,10 @@ _outMergeStmt(StringInfo str, MergeStmt *node)
_outMergeWhenClauses(str, node->mergeWhenClauses);
}
- if (node->returningList)
+ if (node->returningClause)
{
appendStringInfoString(str, " RETURNING ");
- _outNode(str, node->returningList);
+ _outNode(str, node->returningClause);
}
}
@@ -3842,6 +3932,11 @@ _outAlterTableCmd(StringInfo str, AlterTableCmd *node)
}
}
+static void
+_outATAlterConstraint(StringInfo str, ATAlterConstraint *node)
+{
+}
+
static void
_outAlterTableStmt(StringInfo str, AlterTableStmt *node)
{
@@ -3912,9 +4007,17 @@ static void
_outCreateSeqStmt(StringInfo str, CreateSeqStmt *node)
{
appendStringInfoString(str, "CREATE ");
+
if (node->sequence->relpersistence == RELPERSISTENCE_TEMP)
appendStringInfoString(str, "TEMP ");
+ else if (node->sequence->relpersistence == RELPERSISTENCE_UNLOGGED)
+ appendStringInfoString(str, "UNLOGGED ");
+
appendStringInfoString(str, "SEQUENCE ");
+
+ if (node->if_not_exists)
+ appendStringInfoString(str, "IF NOT EXISTS ");
+
_outNode(str, node->sequence);
_outOptSeqList(str, node->options);
@@ -6076,11 +6179,6 @@ _outPartitionRangeDatum(StringInfo str, PartitionRangeDatum *node)
{
}
-static void
-_outSinglePartitionSpec(StringInfo str, const SinglePartitionSpec *node)
-{
-}
-
/*
* _outNode -
* converts a Node into ascii string and append it to 'str'
@@ -6297,6 +6395,9 @@ _outNode(StringInfo str, void *obj)
case T_InferenceElem:
_outInferenceElem(str, obj);
break;
+ case T_ReturningExpr:
+ _outReturningExpr(str, obj);
+ break;
case T_TargetEntry:
_outTargetEntry(str, obj);
break;
@@ -6398,6 +6499,12 @@ _outNode(StringInfo str, void *obj)
case T_MergeWhenClause:
_outMergeWhenClauses(str, obj);
break;
+ case T_ReturningOption:
+ _outReturningOption(str, obj);
+ break;
+ case T_ReturningClause:
+ _outReturningClause(str, obj);
+ break;
case T_SetOperationStmt:
_outSetOperationStmt(str, obj);
break;
@@ -6546,9 +6653,6 @@ _outNode(StringInfo str, void *obj)
case T_PartitionRangeDatum:
_outPartitionRangeDatum(str, obj);
break;
- case T_SinglePartitionSpec:
- _outSinglePartitionSpec(str, obj);
- break;
case T_InsertStmt:
_outInsertStmt(str, obj);
@@ -6662,6 +6766,10 @@ _outNode(StringInfo str, void *obj)
_outAlterTableCmd(str, obj);
break;
+ case T_ATAlterConstraint:
+ _outATAlterConstraint(str, obj);
+ break;
+
case T_CreateSeqStmt:
_outCreateSeqStmt(str, obj);
break;
diff --git a/src/parser/parser.c b/src/parser/parser.c
index 878220be9..997c175fb 100644
--- a/src/parser/parser.c
+++ b/src/parser/parser.c
@@ -10,8 +10,8 @@
* analyze.c and related files.
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
diff --git a/src/parser/scan.l b/src/parser/scan.l
index 03f86b5f1..011728cc8 100644
--- a/src/parser/scan.l
+++ b/src/parser/scan.l
@@ -22,8 +22,8 @@
* Postgres 9.2, this check is made automatically by the Makefile.)
*
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
@@ -42,10 +42,12 @@
#include "scansup.h"
#include "kwlookup.h"
#include "pg_wchar.h"
+#include "miscnodes.h"
#include "gram.h"
#include "utils/palloc.h"
#include "utils/elog.h"
+#include "utils/elog.h"
}
%{
@@ -95,12 +97,6 @@ const uint16 ScanKeywordTokens[] = {
*/
#define YYSTYPE core_YYSTYPE
-/*
- * Set the type of yyextra. All state variables used by the scanner should
- * be in yyextra, *not* statically allocated.
- */
-#define YY_EXTRA_TYPE core_yy_extra_type *
-
/*
* Each call to yylex must set yylloc to the location of the found token
* (expressed as a byte offset from the start of the input text).
@@ -142,15 +138,6 @@ static void addunicode(pg_wchar c, yyscan_t yyscanner);
static void check_string_escape_warning(unsigned char ychar, core_yyscan_t yyscanner);
static void check_escape_warning(core_yyscan_t yyscanner);
-/*
- * Work around a bug in flex 2.5.35: it emits a couple of functions that
- * it forgets to emit declarations for. Since we use -Wmissing-prototypes,
- * this would cause warnings. Providing our own declarations should be
- * harmless even when the bug gets fixed.
- */
-extern int core_yyget_column(yyscan_t yyscanner);
-extern void core_yyset_column(int column_no, yyscan_t yyscanner);
-
%}
%option reentrant
@@ -167,6 +154,7 @@ extern void core_yyset_column(int column_no, yyscan_t yyscanner);
%option noyyfree
%option warn
%option prefix="core_yy"
+%option extra-type="core_yy_extra_type *"
/*
* OK, here is a short description of lex/flex rules behavior.
@@ -418,16 +406,30 @@ numericfail {decinteger}\.\.
real ({decinteger}|{numeric})[Ee][-+]?{decinteger}
realfail ({decinteger}|{numeric})[Ee][-+]
-decinteger_junk {decinteger}{ident_start}
-hexinteger_junk {hexinteger}{ident_start}
-octinteger_junk {octinteger}{ident_start}
-bininteger_junk {bininteger}{ident_start}
-numeric_junk {numeric}{ident_start}
-real_junk {real}{ident_start}
-
/* Positional parameters don't accept underscores. */
param \${decdigit}+
-param_junk \${decdigit}+{ident_start}
+
+/*
+ * An identifier immediately following an integer literal is disallowed because
+ * in some cases it's ambiguous what is meant: for example, 0x1234 could be
+ * either a hexinteger or a decinteger "0" and an identifier "x1234". We can
+ * detect such problems by seeing if integer_junk matches a longer substring
+ * than any of the XXXinteger patterns (decinteger, hexinteger, octinteger,
+ * bininteger). One "junk" pattern is sufficient because
+ * {decinteger}{identifier} will match all the same strings we'd match with
+ * {hexinteger}{identifier} etc.
+ *
+ * Note that the rule for integer_junk must appear after the ones for
+ * XXXinteger to make this work correctly: 0x1234 will match both hexinteger
+ * and integer_junk, and we need hexinteger to be chosen in that case.
+ *
+ * Also disallow strings matched by numeric_junk, real_junk and param_junk
+ * for consistency.
+ */
+integer_junk {decinteger}{identifier}
+numeric_junk {numeric}{identifier}
+real_junk {real}{identifier}
+param_junk \${decdigit}+{identifier}
other .
@@ -1057,19 +1059,7 @@ other .
SET_YYLLOC();
yyerror("trailing junk after numeric literal");
}
-{decinteger_junk} {
- SET_YYLLOC();
- yyerror("trailing junk after numeric literal");
- }
-{hexinteger_junk} {
- SET_YYLLOC();
- yyerror("trailing junk after numeric literal");
- }
-{octinteger_junk} {
- SET_YYLLOC();
- yyerror("trailing junk after numeric literal");
- }
-{bininteger_junk} {
+{integer_junk} {
SET_YYLLOC();
yyerror("trailing junk after numeric literal");
}
@@ -1210,7 +1200,7 @@ setup_scanner_errposition_callback(ScannerCallbackState *scbstate,
scbstate->yyscanner = yyscanner;
scbstate->location = location;
scbstate->errcallback.callback = scb_error_callback;
- scbstate->errcallback.arg = (void *) scbstate;
+ scbstate->errcallback.arg = scbstate;
scbstate->errcallback.previous = error_context_stack;
error_context_stack = &scbstate->errcallback;
}
@@ -1490,10 +1480,10 @@ check_escape_warning(core_yyscan_t yyscanner)
ereport(WARNING,
(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
errmsg("nonstandard use of escape in a string literal"),
- errhint("Use the escape string syntax for escapes, e.g., E'\\r\\n'."),
+ errhint("Use the escape string syntax for escapes, e.g., E'\\r\\n'."),
lexer_errposition()));
#endif
- yyextra->warn_on_first_escape = false; /* warn only once per string */
+ yyextra->warn_on_first_escape = false; /* warn only once per string */
}
/*
diff --git a/src/parser/scansup.c b/src/parser/scansup.c
index 27df0468a..943fb358b 100644
--- a/src/parser/scansup.c
+++ b/src/parser/scansup.c
@@ -3,8 +3,8 @@
* scansup.c
* scanner support routines used by the core lexer
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
diff --git a/src/parser/snprintf.c b/src/parser/snprintf.c
index ec0355205..e82832f24 100644
--- a/src/parser/snprintf.c
+++ b/src/parser/snprintf.c
@@ -3,7 +3,7 @@
* Copyright (c) 1983, 1995, 1996 Eric P. Allman
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -394,13 +394,22 @@ static void leading_pad(int zpad, int signvalue, int *padlen,
static void trailing_pad(int padlen, PrintfTarget * target);
/*
- * If strchrnul exists (it's a glibc-ism), it's a good bit faster than the
- * equivalent manual loop. If it doesn't exist, provide a replacement.
+ * If strchrnul exists (it's a glibc-ism, but since adopted by some other
+ * platforms), it's a good bit faster than the equivalent manual loop.
+ * Use it if possible, and if it doesn't exist, use this replacement.
*
* Note: glibc declares this as returning "char *", but that would require
* casting away const internally, so we don't follow that detail.
+ *
+ * Note: macOS has this too as of Sequoia 15.4, but it's hidden behind
+ * a deployment-target check that causes compile errors if the deployment
+ * target isn't high enough. So !HAVE_DECL_STRCHRNUL may mean "yes it's
+ * declared, but it doesn't compile". To avoid failing in that scenario,
+ * use a macro to avoid matching <string.h>'s name.
*/
-#ifndef HAVE_STRCHRNUL
+#if !HAVE_DECL_STRCHRNUL
+
+#define strchrnul pg_strchrnul
static inline const char *
strchrnul(const char *s, int c)
@@ -410,19 +419,7 @@ strchrnul(const char *s, int c)
return s;
}
-#else
-
-/*
- * glibc's <string.h> declares strchrnul only if _GNU_SOURCE is defined.
- * While we typically use that on glibc platforms, configure will set
- * HAVE_STRCHRNUL whether it's used or not. Fill in the missing declaration
- * so that this file will compile cleanly with or without _GNU_SOURCE.
- */
-#ifndef _GNU_SOURCE
-extern char *strchrnul(const char *s, int c);
-#endif
-
-#endif /* HAVE_STRCHRNUL */
+#endif /* !HAVE_DECL_STRCHRNUL */
/*
@@ -616,6 +613,28 @@ nextch2:
fmtpos = accum;
accum = 0;
goto nextch2;
+#ifdef WIN32
+ case 'I':
+ /* Windows PRI*{32,64,PTR} size */
+ if (format[0] == '3' && format[1] == '2')
+ format += 2;
+ else if (format[0] == '6' && format[1] == '4')
+ {
+ format += 2;
+ longlongflag = 1;
+ }
+ else
+ {
+#if SIZEOF_VOID_P == SIZEOF_LONG
+ longflag = 1;
+#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG
+ longlongflag = 1;
+#else
+#error "cannot find integer type of the same size as intptr_t"
+#endif
+ }
+ goto nextch2;
+#endif
case 'l':
if (longflag)
longlongflag = 1;
@@ -623,16 +642,12 @@ nextch2:
longflag = 1;
goto nextch2;
case 'z':
-#if SIZEOF_SIZE_T == 8
-#ifdef HAVE_LONG_INT_64
+#if SIZEOF_SIZE_T == SIZEOF_LONG
longflag = 1;
-#elif defined(HAVE_LONG_LONG_INT_64)
+#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
longlongflag = 1;
#else
-#error "Don't know how to print 64bit integers"
-#endif
-#else
- /* assume size_t is same size as int */
+#error "cannot find integer type of the same size as size_t"
#endif
goto nextch2;
case 'h':
@@ -883,6 +898,28 @@ nextch1:
fmtpos = accum;
accum = 0;
goto nextch1;
+#ifdef WIN32
+ case 'I':
+ /* Windows PRI*{32,64,PTR} size */
+ if (format[0] == '3' && format[1] == '2')
+ format += 2;
+ else if (format[0] == '6' && format[1] == '4')
+ {
+ format += 2;
+ longlongflag = 1;
+ }
+ else
+ {
+#if SIZEOF_VOID_P == SIZEOF_LONG
+ longflag = 1;
+#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG
+ longlongflag = 1;
+#else
+#error "cannot find integer type of the same size as intptr_t"
+#endif
+ }
+ goto nextch1;
+#endif
case 'l':
if (longflag)
longlongflag = 1;
@@ -890,16 +927,12 @@ nextch1:
longflag = 1;
goto nextch1;
case 'z':
-#if SIZEOF_SIZE_T == 8
-#ifdef HAVE_LONG_INT_64
+#if SIZEOF_SIZE_T == SIZEOF_LONG
longflag = 1;
-#elif defined(HAVE_LONG_LONG_INT_64)
+#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
longlongflag = 1;
#else
-#error "Don't know how to print 64bit integers"
-#endif
-#else
- /* assume size_t is same size as int */
+#error "cannot find integer type of the same size as size_t"
#endif
goto nextch1;
case 'h':
diff --git a/src/parser/stringinfo.c b/src/parser/stringinfo.c
index c35e5bacf..3eda7732b 100644
--- a/src/parser/stringinfo.c
+++ b/src/parser/stringinfo.c
@@ -6,11 +6,11 @@
* It can be used to buffer either ordinary C strings (null-terminated text)
* or arbitrary binary data. All storage is allocated with palloc().
*
- * Portions Copyright (c) 2003-2024, PgPool Global Development Group
- * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003-2025, PgPool Global Development Group
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * src/backend/lib/stringinfo.c
+ * src/common/stringinfo.c
*
*-------------------------------------------------------------------------
*/
@@ -21,6 +21,40 @@
#include "stringinfo.h"
#include "utils/palloc.h"
+/*
+ * initStringInfoInternal
+ *
+ * Initialize a StringInfoData struct (with previously undefined contents)
+ * to describe an empty string.
+ * The initial memory allocation size is specified by 'initsize'.
+ * The valid range for 'initsize' is 1 to MaxAllocSize.
+ */
+static inline void
+initStringInfoInternal(StringInfo str, int initsize)
+{
+ Assert(initsize >= 1 && initsize <= MaxAllocSize);
+
+ str->data = (char *) palloc(initsize);
+ str->maxlen = initsize;
+ resetStringInfo(str);
+}
+
+/*
+ * makeStringInfoInternal(int initsize)
+ *
+ * Create an empty 'StringInfoData' & return a pointer to it.
+ * The initial memory allocation size is specified by 'initsize'.
+ * The valid range for 'initsize' is 1 to MaxAllocSize.
+ */
+static inline StringInfo
+makeStringInfoInternal(int initsize)
+{
+ StringInfo res = (StringInfo) palloc(sizeof(StringInfoData));
+
+ initStringInfoInternal(res, initsize);
+ return res;
+}
+
/*
* makeStringInfo
*
@@ -29,13 +63,20 @@
StringInfo
makeStringInfo(void)
{
- StringInfo res;
-
- res = (StringInfo) palloc(sizeof(StringInfoData));
-
- initStringInfo(res);
+ return makeStringInfoInternal(STRINGINFO_DEFAULT_SIZE);
+}
- return res;
+/*
+ * makeStringInfoExt(int initsize)
+ *
+ * Create an empty 'StringInfoData' & return a pointer to it.
+ * The initial memory allocation size is specified by 'initsize'.
+ * The valid range for 'initsize' is 1 to MaxAllocSize.
+ */
+StringInfo
+makeStringInfoExt(int initsize)
+{
+ return makeStringInfoInternal(initsize);
}
/*
@@ -47,11 +88,21 @@ makeStringInfo(void)
void
initStringInfo(StringInfo str)
{
- int size = 1024; /* initial default buffer size */
+ initStringInfoInternal(str, STRINGINFO_DEFAULT_SIZE);
+}
- str->data = (char *) palloc(size);
- str->maxlen = size;
- resetStringInfo(str);
+/*
+ * initStringInfoExt
+ *
+ * Initialize a StringInfoData struct (with previously undefined contents)
+ * to describe an empty string.
+ * The initial memory allocation size is specified by 'initsize'.
+ * The valid range for 'initsize' is 1 to MaxAllocSize.
+ */
+void
+initStringInfoExt(StringInfo str, int initsize)
+{
+ initStringInfoInternal(str, initsize);
}
/*
@@ -292,7 +343,7 @@ enlargeStringInfo(StringInfo str, int needed)
if (((Size) needed) >= (MaxAllocSize - (Size) str->len))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("out of memory"),
+ errmsg("string buffer exceeds maximum allowed length (%zu bytes)", MaxAllocSize),
errdetail("Cannot enlarge string buffer containing %d bytes by %d more bytes.",
str->len, needed)));
#endif
diff --git a/src/parser/value.c b/src/parser/value.c
index 3b7ab09a8..f99883c5b 100644
--- a/src/parser/value.c
+++ b/src/parser/value.c
@@ -4,8 +4,8 @@
* implementation of value nodes
*
*
- * Copyright (c) 2003-2024, PgPool Global Development Group
- * Copyright (c) 2003-2024, PostgreSQL Global Development Group
+ * Copyright (c) 2003-2025, PgPool Global Development Group
+ * Copyright (c) 2003-2025, PostgreSQL Global Development Group
*
*
* IDENTIFICATION
diff --git a/src/parser/wchar.c b/src/parser/wchar.c
index 1e3a1b0ae..27c972fc0 100644
--- a/src/parser/wchar.c
+++ b/src/parser/wchar.c
@@ -9,6 +9,7 @@
#include "utils/elog.h"
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include "pg_wchar.h"
#ifndef WIN32
@@ -115,6 +116,24 @@ const char *pg_enc2gettext_tbl[] =
[PG_SHIFT_JIS_2004] = "SHIFT_JISX0213",
};
+/*
+ * In today's multibyte encodings other than UTF8, this two-byte sequence
+ * ensures pg_encoding_mblen() == 2 && pg_encoding_verifymbstr() == 0.
+ *
+ * For historical reasons, several verifychar implementations opt to reject
+ * this pair specifically. Byte pair range constraints, in encoding
+ * originator documentation, always excluded this pair. No core conversion
+ * could translate it. However, longstanding verifychar implementations
+ * accepted any non-NUL byte. big5_to_euc_tw and big5_to_mic even translate
+ * pairs not valid per encoding originator documentation. To avoid tightening
+ * core or non-core conversions in a security patch, we sought this one pair.
+ *
+ * PQescapeString() historically used spaces for BYTE1; many other values
+ * could suffice for BYTE1.
+ */
+#define NONUTF8_INVALID_BYTE0 (0x8d)
+#define NONUTF8_INVALID_BYTE1 (' ')
+
/*
* Operations on multi-byte encodings are driven by a table of helper
@@ -706,454 +725,8 @@ mbbisearch(pg_wchar ucs, const struct mbinterval *table, int max)
static int
ucs_wcwidth(pg_wchar ucs)
{
- /* sorted list of non-overlapping intervals of non-spacing characters */
- static const struct mbinterval nonspacing[] = {
- {0x00AD, 0x00AD},
- {0x0300, 0x036F},
- {0x0483, 0x0489},
- {0x0591, 0x05BD},
- {0x05BF, 0x05BF},
- {0x05C1, 0x05C2},
- {0x05C4, 0x05C5},
- {0x05C7, 0x05C7},
- {0x0600, 0x0605},
- {0x0610, 0x061A},
- {0x061C, 0x061C},
- {0x064B, 0x065F},
- {0x0670, 0x0670},
- {0x06D6, 0x06DD},
- {0x06DF, 0x06E4},
- {0x06E7, 0x06E8},
- {0x06EA, 0x06ED},
- {0x070F, 0x070F},
- {0x0711, 0x0711},
- {0x0730, 0x074A},
- {0x07A6, 0x07B0},
- {0x07EB, 0x07F3},
- {0x07FD, 0x07FD},
- {0x0816, 0x0819},
- {0x081B, 0x0823},
- {0x0825, 0x0827},
- {0x0829, 0x082D},
- {0x0859, 0x085B},
- {0x0890, 0x089F},
- {0x08CA, 0x0902},
- {0x093A, 0x093A},
- {0x093C, 0x093C},
- {0x0941, 0x0948},
- {0x094D, 0x094D},
- {0x0951, 0x0957},
- {0x0962, 0x0963},
- {0x0981, 0x0981},
- {0x09BC, 0x09BC},
- {0x09C1, 0x09C4},
- {0x09CD, 0x09CD},
- {0x09E2, 0x09E3},
- {0x09FE, 0x0A02},
- {0x0A3C, 0x0A3C},
- {0x0A41, 0x0A51},
- {0x0A70, 0x0A71},
- {0x0A75, 0x0A75},
- {0x0A81, 0x0A82},
- {0x0ABC, 0x0ABC},
- {0x0AC1, 0x0AC8},
- {0x0ACD, 0x0ACD},
- {0x0AE2, 0x0AE3},
- {0x0AFA, 0x0B01},
- {0x0B3C, 0x0B3C},
- {0x0B3F, 0x0B3F},
- {0x0B41, 0x0B44},
- {0x0B4D, 0x0B56},
- {0x0B62, 0x0B63},
- {0x0B82, 0x0B82},
- {0x0BC0, 0x0BC0},
- {0x0BCD, 0x0BCD},
- {0x0C00, 0x0C00},
- {0x0C04, 0x0C04},
- {0x0C3C, 0x0C3C},
- {0x0C3E, 0x0C40},
- {0x0C46, 0x0C56},
- {0x0C62, 0x0C63},
- {0x0C81, 0x0C81},
- {0x0CBC, 0x0CBC},
- {0x0CBF, 0x0CBF},
- {0x0CC6, 0x0CC6},
- {0x0CCC, 0x0CCD},
- {0x0CE2, 0x0CE3},
- {0x0D00, 0x0D01},
- {0x0D3B, 0x0D3C},
- {0x0D41, 0x0D44},
- {0x0D4D, 0x0D4D},
- {0x0D62, 0x0D63},
- {0x0D81, 0x0D81},
- {0x0DCA, 0x0DCA},
- {0x0DD2, 0x0DD6},
- {0x0E31, 0x0E31},
- {0x0E34, 0x0E3A},
- {0x0E47, 0x0E4E},
- {0x0EB1, 0x0EB1},
- {0x0EB4, 0x0EBC},
- {0x0EC8, 0x0ECE},
- {0x0F18, 0x0F19},
- {0x0F35, 0x0F35},
- {0x0F37, 0x0F37},
- {0x0F39, 0x0F39},
- {0x0F71, 0x0F7E},
- {0x0F80, 0x0F84},
- {0x0F86, 0x0F87},
- {0x0F8D, 0x0FBC},
- {0x0FC6, 0x0FC6},
- {0x102D, 0x1030},
- {0x1032, 0x1037},
- {0x1039, 0x103A},
- {0x103D, 0x103E},
- {0x1058, 0x1059},
- {0x105E, 0x1060},
- {0x1071, 0x1074},
- {0x1082, 0x1082},
- {0x1085, 0x1086},
- {0x108D, 0x108D},
- {0x109D, 0x109D},
- {0x135D, 0x135F},
- {0x1712, 0x1714},
- {0x1732, 0x1733},
- {0x1752, 0x1753},
- {0x1772, 0x1773},
- {0x17B4, 0x17B5},
- {0x17B7, 0x17BD},
- {0x17C6, 0x17C6},
- {0x17C9, 0x17D3},
- {0x17DD, 0x17DD},
- {0x180B, 0x180F},
- {0x1885, 0x1886},
- {0x18A9, 0x18A9},
- {0x1920, 0x1922},
- {0x1927, 0x1928},
- {0x1932, 0x1932},
- {0x1939, 0x193B},
- {0x1A17, 0x1A18},
- {0x1A1B, 0x1A1B},
- {0x1A56, 0x1A56},
- {0x1A58, 0x1A60},
- {0x1A62, 0x1A62},
- {0x1A65, 0x1A6C},
- {0x1A73, 0x1A7F},
- {0x1AB0, 0x1B03},
- {0x1B34, 0x1B34},
- {0x1B36, 0x1B3A},
- {0x1B3C, 0x1B3C},
- {0x1B42, 0x1B42},
- {0x1B6B, 0x1B73},
- {0x1B80, 0x1B81},
- {0x1BA2, 0x1BA5},
- {0x1BA8, 0x1BA9},
- {0x1BAB, 0x1BAD},
- {0x1BE6, 0x1BE6},
- {0x1BE8, 0x1BE9},
- {0x1BED, 0x1BED},
- {0x1BEF, 0x1BF1},
- {0x1C2C, 0x1C33},
- {0x1C36, 0x1C37},
- {0x1CD0, 0x1CD2},
- {0x1CD4, 0x1CE0},
- {0x1CE2, 0x1CE8},
- {0x1CED, 0x1CED},
- {0x1CF4, 0x1CF4},
- {0x1CF8, 0x1CF9},
- {0x1DC0, 0x1DFF},
- {0x200B, 0x200F},
- {0x202A, 0x202E},
- {0x2060, 0x206F},
- {0x20D0, 0x20F0},
- {0x2CEF, 0x2CF1},
- {0x2D7F, 0x2D7F},
- {0x2DE0, 0x2DFF},
- {0x302A, 0x302D},
- {0x3099, 0x309A},
- {0xA66F, 0xA672},
- {0xA674, 0xA67D},
- {0xA69E, 0xA69F},
- {0xA6F0, 0xA6F1},
- {0xA802, 0xA802},
- {0xA806, 0xA806},
- {0xA80B, 0xA80B},
- {0xA825, 0xA826},
- {0xA82C, 0xA82C},
- {0xA8C4, 0xA8C5},
- {0xA8E0, 0xA8F1},
- {0xA8FF, 0xA8FF},
- {0xA926, 0xA92D},
- {0xA947, 0xA951},
- {0xA980, 0xA982},
- {0xA9B3, 0xA9B3},
- {0xA9B6, 0xA9B9},
- {0xA9BC, 0xA9BD},
- {0xA9E5, 0xA9E5},
- {0xAA29, 0xAA2E},
- {0xAA31, 0xAA32},
- {0xAA35, 0xAA36},
- {0xAA43, 0xAA43},
- {0xAA4C, 0xAA4C},
- {0xAA7C, 0xAA7C},
- {0xAAB0, 0xAAB0},
- {0xAAB2, 0xAAB4},
- {0xAAB7, 0xAAB8},
- {0xAABE, 0xAABF},
- {0xAAC1, 0xAAC1},
- {0xAAEC, 0xAAED},
- {0xAAF6, 0xAAF6},
- {0xABE5, 0xABE5},
- {0xABE8, 0xABE8},
- {0xABED, 0xABED},
- {0xFB1E, 0xFB1E},
- {0xFE00, 0xFE0F},
- {0xFE20, 0xFE2F},
- {0xFEFF, 0xFEFF},
- {0xFFF9, 0xFFFB},
- {0x101FD, 0x101FD},
- {0x102E0, 0x102E0},
- {0x10376, 0x1037A},
- {0x10A01, 0x10A0F},
- {0x10A38, 0x10A3F},
- {0x10AE5, 0x10AE6},
- {0x10D24, 0x10D27},
- {0x10EAB, 0x10EAC},
- {0x10EFD, 0x10EFF},
- {0x10F46, 0x10F50},
- {0x10F82, 0x10F85},
- {0x11001, 0x11001},
- {0x11038, 0x11046},
- {0x11070, 0x11070},
- {0x11073, 0x11074},
- {0x1107F, 0x11081},
- {0x110B3, 0x110B6},
- {0x110B9, 0x110BA},
- {0x110BD, 0x110BD},
- {0x110C2, 0x110CD},
- {0x11100, 0x11102},
- {0x11127, 0x1112B},
- {0x1112D, 0x11134},
- {0x11173, 0x11173},
- {0x11180, 0x11181},
- {0x111B6, 0x111BE},
- {0x111C9, 0x111CC},
- {0x111CF, 0x111CF},
- {0x1122F, 0x11231},
- {0x11234, 0x11234},
- {0x11236, 0x11237},
- {0x1123E, 0x1123E},
- {0x11241, 0x11241},
- {0x112DF, 0x112DF},
- {0x112E3, 0x112EA},
- {0x11300, 0x11301},
- {0x1133B, 0x1133C},
- {0x11340, 0x11340},
- {0x11366, 0x11374},
- {0x11438, 0x1143F},
- {0x11442, 0x11444},
- {0x11446, 0x11446},
- {0x1145E, 0x1145E},
- {0x114B3, 0x114B8},
- {0x114BA, 0x114BA},
- {0x114BF, 0x114C0},
- {0x114C2, 0x114C3},
- {0x115B2, 0x115B5},
- {0x115BC, 0x115BD},
- {0x115BF, 0x115C0},
- {0x115DC, 0x115DD},
- {0x11633, 0x1163A},
- {0x1163D, 0x1163D},
- {0x1163F, 0x11640},
- {0x116AB, 0x116AB},
- {0x116AD, 0x116AD},
- {0x116B0, 0x116B5},
- {0x116B7, 0x116B7},
- {0x1171D, 0x1171F},
- {0x11722, 0x11725},
- {0x11727, 0x1172B},
- {0x1182F, 0x11837},
- {0x11839, 0x1183A},
- {0x1193B, 0x1193C},
- {0x1193E, 0x1193E},
- {0x11943, 0x11943},
- {0x119D4, 0x119DB},
- {0x119E0, 0x119E0},
- {0x11A01, 0x11A0A},
- {0x11A33, 0x11A38},
- {0x11A3B, 0x11A3E},
- {0x11A47, 0x11A47},
- {0x11A51, 0x11A56},
- {0x11A59, 0x11A5B},
- {0x11A8A, 0x11A96},
- {0x11A98, 0x11A99},
- {0x11C30, 0x11C3D},
- {0x11C3F, 0x11C3F},
- {0x11C92, 0x11CA7},
- {0x11CAA, 0x11CB0},
- {0x11CB2, 0x11CB3},
- {0x11CB5, 0x11CB6},
- {0x11D31, 0x11D45},
- {0x11D47, 0x11D47},
- {0x11D90, 0x11D91},
- {0x11D95, 0x11D95},
- {0x11D97, 0x11D97},
- {0x11EF3, 0x11EF4},
- {0x11F00, 0x11F01},
- {0x11F36, 0x11F3A},
- {0x11F40, 0x11F40},
- {0x11F42, 0x11F42},
- {0x13430, 0x13440},
- {0x13447, 0x13455},
- {0x16AF0, 0x16AF4},
- {0x16B30, 0x16B36},
- {0x16F4F, 0x16F4F},
- {0x16F8F, 0x16F92},
- {0x16FE4, 0x16FE4},
- {0x1BC9D, 0x1BC9E},
- {0x1BCA0, 0x1CF46},
- {0x1D167, 0x1D169},
- {0x1D173, 0x1D182},
- {0x1D185, 0x1D18B},
- {0x1D1AA, 0x1D1AD},
- {0x1D242, 0x1D244},
- {0x1DA00, 0x1DA36},
- {0x1DA3B, 0x1DA6C},
- {0x1DA75, 0x1DA75},
- {0x1DA84, 0x1DA84},
- {0x1DA9B, 0x1DAAF},
- {0x1E000, 0x1E02A},
- {0x1E08F, 0x1E08F},
- {0x1E130, 0x1E136},
- {0x1E2AE, 0x1E2AE},
- {0x1E2EC, 0x1E2EF},
- {0x1E4EC, 0x1E4EF},
- {0x1E8D0, 0x1E8D6},
- {0x1E944, 0x1E94A},
- {0xE0001, 0xE01EF},
- };
-
- static const struct mbinterval east_asian_fw[] = {
- {0x1100, 0x115F},
- {0x231A, 0x231B},
- {0x2329, 0x232A},
- {0x23E9, 0x23EC},
- {0x23F0, 0x23F0},
- {0x23F3, 0x23F3},
- {0x25FD, 0x25FE},
- {0x2614, 0x2615},
- {0x2648, 0x2653},
- {0x267F, 0x267F},
- {0x2693, 0x2693},
- {0x26A1, 0x26A1},
- {0x26AA, 0x26AB},
- {0x26BD, 0x26BE},
- {0x26C4, 0x26C5},
- {0x26CE, 0x26CE},
- {0x26D4, 0x26D4},
- {0x26EA, 0x26EA},
- {0x26F2, 0x26F3},
- {0x26F5, 0x26F5},
- {0x26FA, 0x26FA},
- {0x26FD, 0x26FD},
- {0x2705, 0x2705},
- {0x270A, 0x270B},
- {0x2728, 0x2728},
- {0x274C, 0x274C},
- {0x274E, 0x274E},
- {0x2753, 0x2755},
- {0x2757, 0x2757},
- {0x2795, 0x2797},
- {0x27B0, 0x27B0},
- {0x27BF, 0x27BF},
- {0x2B1B, 0x2B1C},
- {0x2B50, 0x2B50},
- {0x2B55, 0x2B55},
- {0x2E80, 0x2E99},
- {0x2E9B, 0x2EF3},
- {0x2F00, 0x2FD5},
- {0x2FF0, 0x303E},
- {0x3041, 0x3096},
- {0x3099, 0x30FF},
- {0x3105, 0x312F},
- {0x3131, 0x318E},
- {0x3190, 0x31E3},
- {0x31EF, 0x321E},
- {0x3220, 0x3247},
- {0x3250, 0x4DBF},
- {0x4E00, 0xA48C},
- {0xA490, 0xA4C6},
- {0xA960, 0xA97C},
- {0xAC00, 0xD7A3},
- {0xF900, 0xFAFF},
- {0xFE10, 0xFE19},
- {0xFE30, 0xFE52},
- {0xFE54, 0xFE66},
- {0xFE68, 0xFE6B},
- {0xFF01, 0xFF60},
- {0xFFE0, 0xFFE6},
- {0x16FE0, 0x16FE4},
- {0x16FF0, 0x16FF1},
- {0x17000, 0x187F7},
- {0x18800, 0x18CD5},
- {0x18D00, 0x18D08},
- {0x1AFF0, 0x1AFF3},
- {0x1AFF5, 0x1AFFB},
- {0x1AFFD, 0x1AFFE},
- {0x1B000, 0x1B122},
- {0x1B150, 0x1B152},
- {0x1B164, 0x1B167},
- {0x1B170, 0x1B2FB},
- {0x1F004, 0x1F004},
- {0x1F0CF, 0x1F0CF},
- {0x1F18E, 0x1F18E},
- {0x1F191, 0x1F19A},
- {0x1F200, 0x1F202},
- {0x1F210, 0x1F23B},
- {0x1F240, 0x1F248},
- {0x1F250, 0x1F251},
- {0x1F260, 0x1F265},
- {0x1F300, 0x1F320},
- {0x1F32D, 0x1F335},
- {0x1F337, 0x1F37C},
- {0x1F37E, 0x1F393},
- {0x1F3A0, 0x1F3CA},
- {0x1F3CF, 0x1F3D3},
- {0x1F3E0, 0x1F3F0},
- {0x1F3F4, 0x1F3F4},
- {0x1F3F8, 0x1F43E},
- {0x1F440, 0x1F440},
- {0x1F442, 0x1F4FC},
- {0x1F4FF, 0x1F53D},
- {0x1F54B, 0x1F54E},
- {0x1F550, 0x1F567},
- {0x1F57A, 0x1F57A},
- {0x1F595, 0x1F596},
- {0x1F5A4, 0x1F5A4},
- {0x1F5FB, 0x1F64F},
- {0x1F680, 0x1F6C5},
- {0x1F6CC, 0x1F6CC},
- {0x1F6D0, 0x1F6D2},
- {0x1F6D5, 0x1F6D7},
- {0x1F6DD, 0x1F6DF},
- {0x1F6EB, 0x1F6EC},
- {0x1F6F4, 0x1F6FC},
- {0x1F7E0, 0x1F7EB},
- {0x1F7F0, 0x1F7F0},
- {0x1F90C, 0x1F93A},
- {0x1F93C, 0x1F945},
- {0x1F947, 0x1F9FF},
- {0x1FA70, 0x1FA74},
- {0x1FA78, 0x1FA7C},
- {0x1FA80, 0x1FA86},
- {0x1FA90, 0x1FAAC},
- {0x1FAB0, 0x1FABA},
- {0x1FAC0, 0x1FAC5},
- {0x1FAD0, 0x1FAD9},
- {0x1FAE0, 0x1FAE7},
- {0x1FAF0, 0x1FAF6},
- {0x20000, 0x2FFFD},
- {0x30000, 0x3FFFD},
- };
+#include "unicode_nonspacing_table.h"
+#include "unicode_east_asian_fw_table.h"
/* test for 8-bit control characters */
if (ucs == 0)
@@ -2010,6 +1583,11 @@ pg_big5_verifychar(const unsigned char *s, int len)
if (len < l)
return -1;
+ if (l == 2 &&
+ s[0] == NONUTF8_INVALID_BYTE0 &&
+ s[1] == NONUTF8_INVALID_BYTE1)
+ return -1;
+
while (--l > 0)
{
if (*++s == '\0')
@@ -2059,6 +1637,11 @@ pg_gbk_verifychar(const unsigned char *s, int len)
if (len < l)
return -1;
+ if (l == 2 &&
+ s[0] == NONUTF8_INVALID_BYTE0 &&
+ s[1] == NONUTF8_INVALID_BYTE1)
+ return -1;
+
while (--l > 0)
{
if (*++s == '\0')
@@ -2108,6 +1691,11 @@ pg_uhc_verifychar(const unsigned char *s, int len)
if (len < l)
return -1;
+ if (l == 2 &&
+ s[0] == NONUTF8_INVALID_BYTE0 &&
+ s[1] == NONUTF8_INVALID_BYTE1)
+ return -1;
+
while (--l > 0)
{
if (*++s == '\0')
@@ -2630,6 +2218,19 @@ pg_eucjp_increment(unsigned char *charptr, int length)
#endif /* !FRONTEND */
+/*
+ * Fills the provided buffer with two bytes such that:
+ * pg_encoding_mblen(dst) == 2 && pg_encoding_verifymbstr(dst) == 0
+ */
+void
+pg_encoding_set_invalid(int encoding, char *dst)
+{
+ Assert(pg_encoding_max_length(encoding) > 1);
+
+ dst[0] = (encoding == PG_UTF8 ? 0xc0 : NONUTF8_INVALID_BYTE0);
+ dst[1] = NONUTF8_INVALID_BYTE1;
+}
+
/*
*-------------------------------------------------------------------
* encoding info table
@@ -2683,10 +2284,27 @@ const pg_wchar_tbl pg_wchar_table[] = {
/*
* Returns the byte length of a multibyte character.
*
- * Caution: when dealing with text that is not certainly valid in the
- * specified encoding, the result may exceed the actual remaining
- * string length. Callers that are not prepared to deal with that
- * should use pg_encoding_mblen_bounded() instead.
+ * Choose "mblen" functions based on the input string characteristics.
+ * pg_encoding_mblen() can be used when ANY of these conditions are met:
+ *
+ * - The input string is zero-terminated
+ *
+ * - The input string is known to be valid in the encoding (e.g., string
+ * converted from database encoding)
+ *
+ * - The encoding is not GB18030 (e.g., when only database encodings are
+ * passed to 'encoding' parameter)
+ *
+ * encoding==GB18030 requires examining up to two bytes to determine character
+ * length. Therefore, callers satisfying none of those conditions must use
+ * pg_encoding_mblen_or_incomplete() instead, as access to mbstr[1] cannot be
+ * guaranteed to be within allocation bounds.
+ *
+ * When dealing with text that is not certainly valid in the specified
+ * encoding, the result may exceed the actual remaining string length.
+ * Callers that are not prepared to deal with that should use Min(remaining,
+ * pg_encoding_mblen_or_incomplete()). For zero-terminated strings, that and
+ * pg_encoding_mblen_bounded() are interchangeable.
*/
int
pg_encoding_mblen(int encoding, const char *mbstr)
@@ -2697,8 +2315,28 @@ pg_encoding_mblen(int encoding, const char *mbstr)
}
/*
- * Returns the byte length of a multibyte character; but not more than
- * the distance to end of string.
+ * Returns the byte length of a multibyte character (possibly not
+ * zero-terminated), or INT_MAX if too few bytes remain to determine a length.
+ */
+int
+pg_encoding_mblen_or_incomplete(int encoding, const char *mbstr,
+ size_t remaining)
+{
+ /*
+ * Define zero remaining as too few, even for single-byte encodings.
+ * pg_gb18030_mblen() reads one or two bytes; single-byte encodings read
+ * zero; others read one.
+ */
+ if (remaining < 1 ||
+ (encoding == PG_GB18030 && IS_HIGHBIT_SET(*mbstr) && remaining < 2))
+ return INT_MAX;
+ return pg_encoding_mblen(encoding, mbstr);
+}
+
+/*
+ * Returns the byte length of a multibyte character; but not more than the
+ * distance to the terminating zero byte. For input that might lack a
+ * terminating zero, use Min(remaining, pg_encoding_mblen_or_incomplete()).
*/
int
pg_encoding_mblen_bounded(int encoding, const char *mbstr)
@@ -2751,7 +2389,13 @@ pg_encoding_max_length(int encoding)
{
Assert(PG_VALID_ENCODING(encoding));
- return pg_wchar_table[encoding].maxmblen;
+ /*
+ * Check for the encoding despite the assert, due to some mingw versions
+ * otherwise issuing bogus warnings.
+ */
+ return PG_VALID_ENCODING(encoding) ?
+ pg_wchar_table[encoding].maxmblen :
+ pg_wchar_table[PG_SQL_ASCII].maxmblen;
}
#ifndef FRONTEND
diff --git a/src/rewrite/pool_timestamp.c b/src/rewrite/pool_timestamp.c
index 44d9d90eb..32de3f309 100644
--- a/src/rewrite/pool_timestamp.c
+++ b/src/rewrite/pool_timestamp.c
@@ -523,7 +523,7 @@ rewrite_timestamp_insert(InsertStmt *i_stmt, TSRewriteContext *ctx)
rewrite_timestamp_walker, (void *) ctx);
raw_expression_tree_walker(
- (Node *) i_stmt->returningList,
+ (Node *) i_stmt->returningClause,
rewrite_timestamp_walker, (void *) ctx);
rewrite = ctx->rewrite;
@@ -743,7 +743,7 @@ rewrite_timestamp_update(UpdateStmt *u_stmt, TSRewriteContext *ctx)
rewrite_timestamp_walker, (void *) ctx);
raw_expression_tree_walker(
- (Node *) u_stmt->returningList,
+ (Node *) u_stmt->returningClause,
rewrite_timestamp_walker, (void *) ctx);
rewrite = ctx->rewrite;
@@ -881,7 +881,7 @@ rewrite_timestamp(POOL_CONNECTION_POOL *backend, Node *node,
rewrite_timestamp_walker, (void *) &ctx);
raw_expression_tree_walker(
- (Node *) d_stmt->returningList,
+ (Node *) d_stmt->returningClause,
rewrite_timestamp_walker, (void *) &ctx);
raw_expression_tree_walker(
@@ -1533,7 +1533,7 @@ raw_expression_tree_walker(Node *node,
return true;
if (WALK(stmt->onConflictClause, context))
return true;
- if (WALK(stmt->returningList, context))
+ if (WALK(stmt->returningClause, context))
return true;
if (WALK(stmt->withClause, context))
return true;
@@ -1549,7 +1549,7 @@ raw_expression_tree_walker(Node *node,
return true;
if (WALK(stmt->whereClause, context))
return true;
- if (WALK(stmt->returningList, context))
+ if (WALK(stmt->returningClause, context))
return true;
if (WALK(stmt->withClause, context))
return true;
@@ -1567,7 +1567,7 @@ raw_expression_tree_walker(Node *node,
return true;
if (WALK(stmt->fromClause, context))
return true;
- if (WALK(stmt->returningList, context))
+ if (WALK(stmt->returningClause, context))
return true;
if (WALK(stmt->withClause, context))
return true;
diff --git a/src/tools/pgindent/enums.list b/src/tools/pgindent/enums.list
index 5668af69f..5aa369e01 100644
--- a/src/tools/pgindent/enums.list
+++ b/src/tools/pgindent/enums.list
@@ -60,4 +60,4 @@ WDCommandStatus
fe_scram_state_enum
scram_state_enum
ExplainFormat
-RowCompareType
+CompareType
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index d7309565d..70efbdb60 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -453,7 +453,7 @@ RoleSpec
RoleSpecType
RoleStmtType
RowCompareExpr
-RowCompareType
+CompareType
RowDesc
RowExpr
RowMarkClause
[parent: 9e6408c58d50]