pg_query 6.1.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -1
- data/README.md +1 -1
- data/Rakefile +3 -2
- data/ext/pg_query/extconf.rb +2 -2
- data/ext/pg_query/include/pg_query.h +32 -2
- data/ext/pg_query/include/postgres/access/amapi.h +1 -1
- data/ext/pg_query/include/postgres/access/slru.h +1 -1
- data/ext/pg_query/include/postgres/access/tableam.h +11 -4
- data/ext/pg_query/include/postgres/access/xlog.h +1 -0
- data/ext/pg_query/include/postgres/access/xlogdefs.h +2 -1
- data/ext/pg_query/include/postgres/commands/defrem.h +1 -1
- data/ext/pg_query/include/postgres/commands/trigger.h +18 -0
- data/ext/pg_query/include/postgres/executor/executor.h +4 -0
- data/ext/pg_query/include/postgres/mb/pg_wchar.h +2 -0
- data/ext/pg_query/include/postgres/miscadmin.h +2 -1
- data/ext/pg_query/include/postgres/nodes/execnodes.h +6 -8
- data/ext/pg_query/include/postgres/nodes/pathnodes.h +1 -2
- data/ext/pg_query/include/postgres/pg_config.h +10 -9
- data/ext/pg_query/include/postgres/pg_config_manual.h +2 -0
- data/ext/pg_query/include/postgres/port/atomics/generic-gcc.h +10 -2
- data/ext/pg_query/include/postgres/port/pg_iovec.h +9 -3
- data/ext/pg_query/include/postgres/replication/reorderbuffer.h +29 -9
- data/ext/pg_query/include/postgres/replication/slot.h +2 -0
- data/ext/pg_query/include/postgres/utils/elog.h +1 -0
- data/ext/pg_query/include/postgres/utils/guc.h +1 -1
- data/ext/pg_query/include/postgres/utils/guc_hooks.h +0 -2
- data/ext/pg_query/include/postgres/utils/pg_locale.h +5 -0
- data/ext/pg_query/include/postgres_deparse.h +34 -0
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +673 -516
- data/ext/pg_query/pg_query.pb-c.c +488 -0
- data/ext/pg_query/pg_query_deparse.c +148 -15
- data/ext/pg_query/pg_query_internal.h +9 -8
- data/ext/pg_query/pg_query_is_utility_stmt.c +70 -0
- data/ext/pg_query/pg_query_normalize.c +3 -0
- data/ext/pg_query/pg_query_raw_tree_walker_supports.c +117 -0
- data/ext/pg_query/pg_query_ruby.c +150 -0
- data/ext/pg_query/pg_query_summary.c +941 -0
- data/ext/pg_query/pg_query_summary.h +109 -0
- data/ext/pg_query/pg_query_summary_statement_type.c +797 -0
- data/ext/pg_query/pg_query_summary_truncate.c +530 -0
- data/ext/pg_query/postgres_deparse.c +4481 -3870
- data/ext/pg_query/src_backend_catalog_namespace.c +29 -0
- data/ext/pg_query/src_backend_nodes_bitmapset.c +84 -1
- data/ext/pg_query/src_backend_nodes_list.c +60 -1
- data/ext/pg_query/src_backend_parser_gram.c +739 -732
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +2 -2
- data/ext/pg_query/src_backend_utils_error_elog.c +11 -0
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +43 -4
- data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +22 -7
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +3 -3
- data/ext/pg_query/src_backend_utils_mmgr_bump.c +1 -1
- data/ext/pg_query/src_common_stringinfo.c +20 -0
- data/ext/pg_query/src_common_wchar.c +46 -6
- data/lib/pg_query/deparse.rb +29 -8
- data/lib/pg_query/parse.rb +19 -0
- data/lib/pg_query/pg_query_pb.rb +7 -2
- data/lib/pg_query/split.rb +20 -0
- data/lib/pg_query/treewalker.rb +9 -7
- data/lib/pg_query/version.rb +1 -1
- data/lib/pg_query.rb +1 -0
- metadata +10 -3
- data/ext/pg_query/postgres_deparse.h +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6368eb8723a3304d1a1d3c60cd51e91903b6d755cd6b7a6a74a1c7b0ddee0d1f
|
|
4
|
+
data.tar.gz: a5bc85ef1993dc502d600043c91901767facfafcaa0c0d811f4df6f401fac9d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5a7a69cd2224bed11134276a5f76d4e5cd2d3876e8b1613493e4e1ee67f9ec6409d5f2962f354a25352b678beaf98332b594067e8c80eeb16fb8fad25cf907a
|
|
7
|
+
data.tar.gz: 9db3709022d52488e135f4092dbf3c35c33ec88f01573780eb407587749369fb201e25f55e6a9ac9c236a2c2cde0c8af57f30824eaf5a93cdcc784c4c874f646
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,43 @@
|
|
|
4
4
|
|
|
5
5
|
* ...
|
|
6
6
|
|
|
7
|
+
## 6.2.1 2026-01-20
|
|
8
|
+
|
|
9
|
+
* Upgrade to libpg_query 17-6.2.1
|
|
10
|
+
- Add pg_query_is_utility_stmt function to determine if query text contains utility statements [#313](https://github.com/pganalyze/libpg_query/pull/313)
|
|
11
|
+
- This is a fast check for callers that don't actually need the parse tree itself
|
|
12
|
+
- Add fast summary information function (pg_query_summary)
|
|
13
|
+
- This allows gathering certain information, for example which tables are referenced in a
|
|
14
|
+
statement, without requiring a Protobuf serialization step in a higher level library
|
|
15
|
+
- Additionally this can also be used to perform "smart truncation" of a query by
|
|
16
|
+
omitting deeply nested information (e.g. a CTE definition, or a target list) whilst
|
|
17
|
+
preserving more essential parts like the FROM clause
|
|
18
|
+
- Deparser:
|
|
19
|
+
- Introduce pretty printing / formatting
|
|
20
|
+
- Introduces a new optional pretty print mode that emits a human readable
|
|
21
|
+
output. A detailed explanation of the mechanism can be found at the start
|
|
22
|
+
of the deparser file.
|
|
23
|
+
- Rework handling of expressions inside typecasts
|
|
24
|
+
- Prefer (..)::type syntax, unless we are already in a function call.
|
|
25
|
+
- Use lowercase keywords in xmlroot functions
|
|
26
|
+
- This matches other XML functions as well as the Postgres documentation,
|
|
27
|
+
since these are closer to function argument names than regular keywords.
|
|
28
|
+
- Fix deparse of ALTER TABLE a ALTER b SET STATISTICS DEFAULT
|
|
29
|
+
- Fix the null pointer dereference when handling identity columns
|
|
30
|
+
- Allow alternate definitions of NAMEDATALEN identifier limit
|
|
31
|
+
- This allows building libpg_query with an override of the built-time limit of
|
|
32
|
+
Postgres identifiers (typically 63 characters)
|
|
33
|
+
- Normalization: Add support for CALL statements
|
|
34
|
+
- Bump Postgres to 17.7 and switch back to release tarballs
|
|
35
|
+
* Deparser: Support pretty-printing and other deparser options
|
|
36
|
+
- `PgQuery::ParserResult#deparse` now takes options like `pretty_print`
|
|
37
|
+
* Add `PgQuery.split_with_parser` method to allow splitting statements
|
|
38
|
+
* Support Ruby 4.0+ development versions for extension building
|
|
39
|
+
* Fix ABI version error with TruffleRuby on Mac
|
|
40
|
+
* Support finding functions invoked with CALL
|
|
41
|
+
* Support null_test and boolean_test node type with parsing
|
|
42
|
+
* Expose `PgQuery::ParserResult#find_tree_location` method
|
|
43
|
+
|
|
7
44
|
## 6.1.0 2025-04-02
|
|
8
45
|
|
|
9
46
|
* Upgrade to libpg_query 17-6.1.0
|
|
@@ -174,7 +211,7 @@
|
|
|
174
211
|
|
|
175
212
|
* Update to libpg_query 13-2.0.6
|
|
176
213
|
- Update to Postgres 13.3 patch release
|
|
177
|
-
- Normalize: Don't touch "GROUP BY 1" and "ORDER BY 1" expressions, keep original text
|
|
214
|
+
- Normalize: Don't touch "GROUP BY 1" and "ORDER BY 1" expressions, keep original text
|
|
178
215
|
- Fingerprint: Cache list item hashes to fingerprint complex queries faster
|
|
179
216
|
- Deparser: Emit the RangeVar catalogname if present
|
|
180
217
|
- Fix crash in pg_scan function when encountering backslash escapes
|
data/README.md
CHANGED
|
@@ -178,11 +178,11 @@ not correctly handle all CTEs, or rewrite columns with explicit table names.
|
|
|
178
178
|
|
|
179
179
|
Currently tested and officially supported Ruby versions:
|
|
180
180
|
|
|
181
|
-
* CRuby 2.7
|
|
182
181
|
* CRuby 3.0
|
|
183
182
|
* CRuby 3.1
|
|
184
183
|
* CRuby 3.2
|
|
185
184
|
* CRuby 3.3
|
|
185
|
+
* CRuby 3.4
|
|
186
186
|
|
|
187
187
|
Not supported:
|
|
188
188
|
|
data/Rakefile
CHANGED
|
@@ -5,8 +5,8 @@ require 'rspec/core/rake_task'
|
|
|
5
5
|
require 'rubocop/rake_task'
|
|
6
6
|
require 'open-uri'
|
|
7
7
|
|
|
8
|
-
LIB_PG_QUERY_TAG = '17-6.1
|
|
9
|
-
LIB_PG_QUERY_SHA256SUM = '
|
|
8
|
+
LIB_PG_QUERY_TAG = '17-6.2.1'.freeze
|
|
9
|
+
LIB_PG_QUERY_SHA256SUM = '678434d59511c8892c37ba5b9816ab641bd007cef2eda215b2297c39b79c861d'.freeze
|
|
10
10
|
|
|
11
11
|
Rake::ExtensionTask.new 'pg_query' do |ext|
|
|
12
12
|
ext.lib_dir = 'lib/pg_query'
|
|
@@ -66,6 +66,7 @@ task :update_source do
|
|
|
66
66
|
system("mv #{extdir}/postgres/* #{extdir}/")
|
|
67
67
|
system("rmdir #{extdir}/postgres")
|
|
68
68
|
system("cp -a #{libdir}/pg_query.h #{extdir}/include")
|
|
69
|
+
system("cp -a #{libdir}/postgres_deparse.h #{extdir}/include")
|
|
69
70
|
# Protobuf definitions
|
|
70
71
|
system("protoc --proto_path=#{libdir}/protobuf --ruby_out=#{File.join(__dir__, 'lib/pg_query')} #{libdir}/protobuf/pg_query.proto")
|
|
71
72
|
system("mkdir -p #{extdir}/include/protobuf")
|
data/ext/pg_query/extconf.rb
CHANGED
|
@@ -29,7 +29,7 @@ def export_ruby_abi_version
|
|
|
29
29
|
return false if m.nil?
|
|
30
30
|
major = m[1].to_i
|
|
31
31
|
minor = m[2].to_i
|
|
32
|
-
major >= 3 && minor >= 2
|
|
32
|
+
((major >= 3 && minor >= 2) || major >= 4)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def ext_symbols_filename
|
|
@@ -43,7 +43,7 @@ end
|
|
|
43
43
|
SYMFILE = File.join(__dir__, ext_symbols_filename)
|
|
44
44
|
|
|
45
45
|
if RUBY_PLATFORM =~ /darwin/
|
|
46
|
-
$DLDFLAGS << " -Wl,-exported_symbols_list #{SYMFILE}" unless
|
|
46
|
+
$DLDFLAGS << " -Wl,-exported_symbols_list #{SYMFILE}" unless %w(rbx truffleruby).include?(RUBY_ENGINE)
|
|
47
47
|
elsif RUBY_PLATFORM !~ /cygwin|mswin|mingw|bccwin|wince|emx/
|
|
48
48
|
$DLDFLAGS << " -Wl,--retain-symbols-file=#{SYMFILE}"
|
|
49
49
|
end
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#ifndef PG_QUERY_H
|
|
2
2
|
#define PG_QUERY_H
|
|
3
3
|
|
|
4
|
+
#include <stdbool.h>
|
|
4
5
|
#include <stdint.h>
|
|
5
6
|
#include <sys/types.h>
|
|
6
7
|
|
|
8
|
+
#include "postgres_deparse.h"
|
|
9
|
+
|
|
7
10
|
typedef struct {
|
|
8
11
|
char* message; // exception message
|
|
9
12
|
char* funcname; // source function of exception (e.g. SearchSysCache)
|
|
@@ -13,6 +16,12 @@ typedef struct {
|
|
|
13
16
|
char* context; // additional context (optional, can be NULL)
|
|
14
17
|
} PgQueryError;
|
|
15
18
|
|
|
19
|
+
typedef struct {
|
|
20
|
+
int length;
|
|
21
|
+
bool *items;
|
|
22
|
+
PgQueryError* error;
|
|
23
|
+
} PgQueryIsUtilityResult;
|
|
24
|
+
|
|
16
25
|
typedef struct {
|
|
17
26
|
size_t len;
|
|
18
27
|
char* data;
|
|
@@ -53,6 +62,12 @@ typedef struct {
|
|
|
53
62
|
PgQueryError* error;
|
|
54
63
|
} PgQueryDeparseResult;
|
|
55
64
|
|
|
65
|
+
typedef struct {
|
|
66
|
+
PostgresDeparseComment **comments;
|
|
67
|
+
size_t comment_count;
|
|
68
|
+
PgQueryError* error;
|
|
69
|
+
} PgQueryDeparseCommentsResult;
|
|
70
|
+
|
|
56
71
|
typedef struct {
|
|
57
72
|
char* plpgsql_funcs;
|
|
58
73
|
PgQueryError* error;
|
|
@@ -70,6 +85,12 @@ typedef struct {
|
|
|
70
85
|
PgQueryError* error;
|
|
71
86
|
} PgQueryNormalizeResult;
|
|
72
87
|
|
|
88
|
+
typedef struct {
|
|
89
|
+
PgQueryProtobuf summary;
|
|
90
|
+
char* stderr_buffer;
|
|
91
|
+
PgQueryError* error;
|
|
92
|
+
} PgQuerySummaryParseResult;
|
|
93
|
+
|
|
73
94
|
// Postgres parser options (parse mode and GUCs that affect parsing)
|
|
74
95
|
|
|
75
96
|
typedef enum
|
|
@@ -118,23 +139,32 @@ PgQuerySplitResult pg_query_split_with_scanner(const char *input);
|
|
|
118
139
|
PgQuerySplitResult pg_query_split_with_parser(const char *input);
|
|
119
140
|
|
|
120
141
|
PgQueryDeparseResult pg_query_deparse_protobuf(PgQueryProtobuf parse_tree);
|
|
142
|
+
PgQueryDeparseResult pg_query_deparse_protobuf_opts(PgQueryProtobuf parse_tree, struct PostgresDeparseOpts opts);
|
|
143
|
+
PgQueryDeparseCommentsResult pg_query_deparse_comments_for_query(const char *query);
|
|
144
|
+
|
|
145
|
+
PgQueryIsUtilityResult pg_query_is_utility_stmt(const char *query);
|
|
146
|
+
|
|
147
|
+
PgQuerySummaryParseResult pg_query_summary(const char* input, int parser_options, int truncate_limit);
|
|
121
148
|
|
|
122
149
|
void pg_query_free_normalize_result(PgQueryNormalizeResult result);
|
|
123
150
|
void pg_query_free_scan_result(PgQueryScanResult result);
|
|
124
151
|
void pg_query_free_parse_result(PgQueryParseResult result);
|
|
125
152
|
void pg_query_free_split_result(PgQuerySplitResult result);
|
|
126
153
|
void pg_query_free_deparse_result(PgQueryDeparseResult result);
|
|
154
|
+
void pg_query_free_deparse_comments_result(PgQueryDeparseCommentsResult result);
|
|
127
155
|
void pg_query_free_protobuf_parse_result(PgQueryProtobufParseResult result);
|
|
128
156
|
void pg_query_free_plpgsql_parse_result(PgQueryPlpgsqlParseResult result);
|
|
129
157
|
void pg_query_free_fingerprint_result(PgQueryFingerprintResult result);
|
|
158
|
+
void pg_query_free_is_utility_result(PgQueryIsUtilityResult result);
|
|
159
|
+
void pg_query_free_summary_parse_result(PgQuerySummaryParseResult result);
|
|
130
160
|
|
|
131
161
|
// Optional, cleans up the top-level memory context (automatically done for threads that exit)
|
|
132
162
|
void pg_query_exit(void);
|
|
133
163
|
|
|
134
164
|
// Postgres version information
|
|
135
165
|
#define PG_MAJORVERSION "17"
|
|
136
|
-
#define PG_VERSION "17.
|
|
137
|
-
#define PG_VERSION_NUM
|
|
166
|
+
#define PG_VERSION "17.7"
|
|
167
|
+
#define PG_VERSION_NUM 170007
|
|
138
168
|
|
|
139
169
|
// Deprecated APIs below
|
|
140
170
|
|
|
@@ -271,7 +271,7 @@ typedef struct IndexAmRoutine
|
|
|
271
271
|
ambuild_function ambuild;
|
|
272
272
|
ambuildempty_function ambuildempty;
|
|
273
273
|
aminsert_function aminsert;
|
|
274
|
-
aminsertcleanup_function aminsertcleanup;
|
|
274
|
+
aminsertcleanup_function aminsertcleanup; /* can be NULL */
|
|
275
275
|
ambulkdelete_function ambulkdelete;
|
|
276
276
|
amvacuumcleanup_function amvacuumcleanup;
|
|
277
277
|
amcanreturn_function amcanreturn; /* can be NULL */
|
|
@@ -55,7 +55,7 @@ typedef enum
|
|
|
55
55
|
/*
|
|
56
56
|
* Shared-memory state
|
|
57
57
|
*
|
|
58
|
-
*
|
|
58
|
+
* SLRU bank locks are used to protect access to the other fields, except
|
|
59
59
|
* latest_page_number, which uses atomics; see comment in slru.c.
|
|
60
60
|
*/
|
|
61
61
|
typedef struct SlruSharedData
|
|
@@ -129,7 +129,9 @@ typedef enum TU_UpdateIndexes
|
|
|
129
129
|
/*
|
|
130
130
|
* When table_tuple_update, table_tuple_delete, or table_tuple_lock fail
|
|
131
131
|
* because the target tuple is already outdated, they fill in this struct to
|
|
132
|
-
* provide information to the caller about what happened.
|
|
132
|
+
* provide information to the caller about what happened. When those functions
|
|
133
|
+
* succeed, the contents of this struct should not be relied upon, except for
|
|
134
|
+
* `traversed`, which may be set in both success and failure cases.
|
|
133
135
|
*
|
|
134
136
|
* ctid is the target's ctid link: it is the same as the target's TID if the
|
|
135
137
|
* target was deleted, or the location of the replacement tuple if the target
|
|
@@ -145,6 +147,9 @@ typedef enum TU_UpdateIndexes
|
|
|
145
147
|
* tuple); otherwise cmax is zero. (We make this restriction because
|
|
146
148
|
* HeapTupleHeaderGetCmax doesn't work for tuples outdated in other
|
|
147
149
|
* transactions.)
|
|
150
|
+
*
|
|
151
|
+
* traversed indicates if an update chain was followed in order to try to lock
|
|
152
|
+
* the target tuple. (This may be set in both success and failure cases.)
|
|
148
153
|
*/
|
|
149
154
|
typedef struct TM_FailureData
|
|
150
155
|
{
|
|
@@ -1549,7 +1554,7 @@ table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot,
|
|
|
1549
1554
|
*
|
|
1550
1555
|
* Input parameters:
|
|
1551
1556
|
* relation: relation containing tuple (caller must hold suitable lock)
|
|
1552
|
-
* tid: TID of tuple to lock
|
|
1557
|
+
* tid: TID of tuple to lock (updated if an update chain was followed)
|
|
1553
1558
|
* snapshot: snapshot to use for visibility determinations
|
|
1554
1559
|
* cid: current command ID (used for visibility test, and stored into
|
|
1555
1560
|
* tuple's cmax if lock is successful)
|
|
@@ -1574,8 +1579,10 @@ table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot,
|
|
|
1574
1579
|
* TM_WouldBlock: lock couldn't be acquired and wait_policy is skip
|
|
1575
1580
|
*
|
|
1576
1581
|
* In the failure cases other than TM_Invisible and TM_Deleted, the routine
|
|
1577
|
-
* fills *tmfd with the tuple's t_ctid, t_xmax, and, if possible, t_cmax.
|
|
1578
|
-
*
|
|
1582
|
+
* fills *tmfd with the tuple's t_ctid, t_xmax, and, if possible, t_cmax.
|
|
1583
|
+
* Additionally, in both success and failure cases, tmfd->traversed is set if
|
|
1584
|
+
* an update chain was followed. See comments for struct TM_FailureData for
|
|
1585
|
+
* additional info.
|
|
1579
1586
|
*/
|
|
1580
1587
|
static inline TM_Result
|
|
1581
1588
|
table_tuple_lock(Relation rel, ItemPointer tid, Snapshot snapshot,
|
|
@@ -265,6 +265,7 @@ extern void SwitchIntoArchiveRecovery(XLogRecPtr EndRecPtr, TimeLineID replayTLI
|
|
|
265
265
|
extern void ReachedEndOfBackup(XLogRecPtr EndRecPtr, TimeLineID tli);
|
|
266
266
|
extern void SetInstallXLogFileSegmentActive(void);
|
|
267
267
|
extern bool IsInstallXLogFileSegmentActive(void);
|
|
268
|
+
extern void ResetInstallXLogFileSegmentActive(void);
|
|
268
269
|
extern void XLogShutdownWalRcv(void);
|
|
269
270
|
|
|
270
271
|
/*
|
|
@@ -25,7 +25,8 @@ typedef uint64 XLogRecPtr;
|
|
|
25
25
|
* WAL segment, initializing the first WAL page at WAL segment size, so no XLOG
|
|
26
26
|
* record can begin at zero.
|
|
27
27
|
*/
|
|
28
|
-
#define InvalidXLogRecPtr
|
|
28
|
+
#define InvalidXLogRecPtr 0
|
|
29
|
+
#define XLogRecPtrIsValid(r) ((r) != InvalidXLogRecPtr)
|
|
29
30
|
#define XLogRecPtrIsInvalid(r) ((r) == InvalidXLogRecPtr)
|
|
30
31
|
|
|
31
32
|
/*
|
|
@@ -81,7 +81,7 @@ extern void RemoveOperatorById(Oid operOid);
|
|
|
81
81
|
extern ObjectAddress AlterOperator(AlterOperatorStmt *stmt);
|
|
82
82
|
|
|
83
83
|
/* commands/statscmds.c */
|
|
84
|
-
extern ObjectAddress CreateStatistics(CreateStatsStmt *stmt);
|
|
84
|
+
extern ObjectAddress CreateStatistics(CreateStatsStmt *stmt, bool check_rights);
|
|
85
85
|
extern ObjectAddress AlterStatistics(AlterStatsStmt *stmt);
|
|
86
86
|
extern void RemoveStatisticsById(Oid statsOid);
|
|
87
87
|
extern void RemoveStatisticsDataById(Oid statsOid, bool inh);
|
|
@@ -206,6 +206,15 @@ extern void ExecBSDeleteTriggers(EState *estate,
|
|
|
206
206
|
extern void ExecASDeleteTriggers(EState *estate,
|
|
207
207
|
ResultRelInfo *relinfo,
|
|
208
208
|
TransitionCaptureState *transition_capture);
|
|
209
|
+
extern bool ExecBRDeleteTriggersNew(EState *estate,
|
|
210
|
+
EPQState *epqstate,
|
|
211
|
+
ResultRelInfo *relinfo,
|
|
212
|
+
ItemPointer tupleid,
|
|
213
|
+
HeapTuple fdw_trigtuple,
|
|
214
|
+
TupleTableSlot **epqslot,
|
|
215
|
+
TM_Result *tmresult,
|
|
216
|
+
TM_FailureData *tmfd,
|
|
217
|
+
bool is_merge_delete);
|
|
209
218
|
extern bool ExecBRDeleteTriggers(EState *estate,
|
|
210
219
|
EPQState *epqstate,
|
|
211
220
|
ResultRelInfo *relinfo,
|
|
@@ -228,6 +237,15 @@ extern void ExecBSUpdateTriggers(EState *estate,
|
|
|
228
237
|
extern void ExecASUpdateTriggers(EState *estate,
|
|
229
238
|
ResultRelInfo *relinfo,
|
|
230
239
|
TransitionCaptureState *transition_capture);
|
|
240
|
+
extern bool ExecBRUpdateTriggersNew(EState *estate,
|
|
241
|
+
EPQState *epqstate,
|
|
242
|
+
ResultRelInfo *relinfo,
|
|
243
|
+
ItemPointer tupleid,
|
|
244
|
+
HeapTuple fdw_trigtuple,
|
|
245
|
+
TupleTableSlot *newslot,
|
|
246
|
+
TM_Result *tmresult,
|
|
247
|
+
TM_FailureData *tmfd,
|
|
248
|
+
bool is_merge_update);
|
|
231
249
|
extern bool ExecBRUpdateTriggers(EState *estate,
|
|
232
250
|
EPQState *epqstate,
|
|
233
251
|
ResultRelInfo *relinfo,
|
|
@@ -210,6 +210,10 @@ extern void standard_ExecutorEnd(QueryDesc *queryDesc);
|
|
|
210
210
|
extern void ExecutorRewind(QueryDesc *queryDesc);
|
|
211
211
|
extern bool ExecCheckPermissions(List *rangeTable,
|
|
212
212
|
List *rteperminfos, bool ereport_on_violation);
|
|
213
|
+
extern bool ExecCheckOneRelPerms(RTEPermissionInfo *perminfo);
|
|
214
|
+
extern void CheckValidResultRelNew(ResultRelInfo *resultRelInfo, CmdType operation,
|
|
215
|
+
OnConflictAction onConflictAction,
|
|
216
|
+
List *mergeActions);
|
|
213
217
|
extern void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation,
|
|
214
218
|
List *mergeActions);
|
|
215
219
|
extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
|
|
@@ -664,6 +664,8 @@ extern int pg_valid_server_encoding_id(int encoding);
|
|
|
664
664
|
*/
|
|
665
665
|
extern void pg_encoding_set_invalid(int encoding, char *dst);
|
|
666
666
|
extern int pg_encoding_mblen(int encoding, const char *mbstr);
|
|
667
|
+
extern int pg_encoding_mblen_or_incomplete(int encoding, const char *mbstr,
|
|
668
|
+
size_t remaining);
|
|
667
669
|
extern int pg_encoding_mblen_bounded(int encoding, const char *mbstr);
|
|
668
670
|
extern int pg_encoding_dsplen(int encoding, const char *mbstr);
|
|
669
671
|
extern int pg_encoding_verifymbchar(int encoding, const char *mbstr, int len);
|
|
@@ -114,7 +114,8 @@ extern void ProcessInterrupts(void);
|
|
|
114
114
|
(unlikely(InterruptPending))
|
|
115
115
|
#else
|
|
116
116
|
#define INTERRUPTS_PENDING_CONDITION() \
|
|
117
|
-
(unlikely(UNBLOCKED_SIGNAL_QUEUE()) ?
|
|
117
|
+
(unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? \
|
|
118
|
+
pgwin32_dispatch_queued_signals() : (void) 0, \
|
|
118
119
|
unlikely(InterruptPending))
|
|
119
120
|
#endif
|
|
120
121
|
|
|
@@ -164,7 +164,7 @@ typedef struct ExprState
|
|
|
164
164
|
* UniqueProcs
|
|
165
165
|
* UniqueStrats
|
|
166
166
|
* Unique is it a unique index?
|
|
167
|
-
*
|
|
167
|
+
* NullsNotDistinct is NULLS NOT DISTINCT?
|
|
168
168
|
* ReadyForInserts is it valid for inserts?
|
|
169
169
|
* CheckedUnchanged IndexUnchanged status determined yet?
|
|
170
170
|
* IndexUnchanged aminsert hint, cached for retail inserts
|
|
@@ -574,15 +574,13 @@ typedef struct ResultRelInfo
|
|
|
574
574
|
bool ri_RootToChildMapValid;
|
|
575
575
|
|
|
576
576
|
/*
|
|
577
|
-
*
|
|
577
|
+
* Other information needed by child result relations
|
|
578
578
|
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
* mentioned in the query is an inherited table, nor when tuple routing is
|
|
582
|
-
* not needed.
|
|
579
|
+
* ri_RootResultRelInfo gives the target relation mentioned in the query.
|
|
580
|
+
* Used as the root for tuple routing and/or transition capture.
|
|
583
581
|
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
582
|
+
* ri_PartitionTupleSlot is non-NULL if the relation is a partition to
|
|
583
|
+
* route tuples into and ri_RootToChildMap conversion is needed.
|
|
586
584
|
*/
|
|
587
585
|
struct ResultRelInfo *ri_RootResultRelInfo;
|
|
588
586
|
TupleTableSlot *ri_PartitionTupleSlot;
|
|
@@ -1101,8 +1101,7 @@ typedef struct IndexOptInfo IndexOptInfo;
|
|
|
1101
1101
|
#define HAVE_INDEXOPTINFO_TYPEDEF 1
|
|
1102
1102
|
#endif
|
|
1103
1103
|
|
|
1104
|
-
struct IndexPath; /*
|
|
1105
|
-
struct PlannerInfo; /* avoid including pathnodes.h here */
|
|
1104
|
+
struct IndexPath; /* forward declaration */
|
|
1106
1105
|
|
|
1107
1106
|
struct IndexOptInfo
|
|
1108
1107
|
{
|
|
@@ -104,6 +104,10 @@
|
|
|
104
104
|
`LLVMCreatePerfJITEventListener', and to 0 if you don't. */
|
|
105
105
|
/* #undef HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER */
|
|
106
106
|
|
|
107
|
+
/* Define to 1 if you have the declaration of `memset_s', and to 0 if you
|
|
108
|
+
don't. */
|
|
109
|
+
#define HAVE_DECL_MEMSET_S 1
|
|
110
|
+
|
|
107
111
|
/* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you
|
|
108
112
|
don't. */
|
|
109
113
|
#define HAVE_DECL_POSIX_FADVISE 0
|
|
@@ -302,9 +306,6 @@
|
|
|
302
306
|
/* Define to 1 if you have the <memory.h> header file. */
|
|
303
307
|
#define HAVE_MEMORY_H 1
|
|
304
308
|
|
|
305
|
-
/* Define to 1 if you have the `memset_s' function. */
|
|
306
|
-
#define HAVE_MEMSET_S 1
|
|
307
|
-
|
|
308
309
|
/* Define to 1 if you have the `mkdtemp' function. */
|
|
309
310
|
#define HAVE_MKDTEMP 1
|
|
310
311
|
|
|
@@ -592,7 +593,7 @@
|
|
|
592
593
|
#define PACKAGE_NAME "PostgreSQL"
|
|
593
594
|
|
|
594
595
|
/* Define to the full name and version of this package. */
|
|
595
|
-
#define PACKAGE_STRING "PostgreSQL 17.
|
|
596
|
+
#define PACKAGE_STRING "PostgreSQL 17.7"
|
|
596
597
|
|
|
597
598
|
/* Define to the one symbol short name of this package. */
|
|
598
599
|
#define PACKAGE_TARNAME "postgresql"
|
|
@@ -601,7 +602,7 @@
|
|
|
601
602
|
#define PACKAGE_URL "https://www.postgresql.org/"
|
|
602
603
|
|
|
603
604
|
/* Define to the version of this package. */
|
|
604
|
-
#define PACKAGE_VERSION "17.
|
|
605
|
+
#define PACKAGE_VERSION "17.7"
|
|
605
606
|
|
|
606
607
|
/* Define to the name of a signed 128-bit integer type. */
|
|
607
608
|
#define PG_INT128_TYPE __int128
|
|
@@ -620,7 +621,7 @@
|
|
|
620
621
|
#define PG_MAJORVERSION_NUM 17
|
|
621
622
|
|
|
622
623
|
/* PostgreSQL minor version number */
|
|
623
|
-
#define PG_MINORVERSION_NUM
|
|
624
|
+
#define PG_MINORVERSION_NUM 7
|
|
624
625
|
|
|
625
626
|
/* Define to best printf format archetype, usually gnu_printf if available. */
|
|
626
627
|
#define PG_PRINTF_ATTRIBUTE printf
|
|
@@ -629,13 +630,13 @@
|
|
|
629
630
|
#define PG_USE_STDBOOL 1
|
|
630
631
|
|
|
631
632
|
/* PostgreSQL version as a string */
|
|
632
|
-
#define PG_VERSION "17.
|
|
633
|
+
#define PG_VERSION "17.7"
|
|
633
634
|
|
|
634
635
|
/* PostgreSQL version as a number */
|
|
635
|
-
#define PG_VERSION_NUM
|
|
636
|
+
#define PG_VERSION_NUM 170007
|
|
636
637
|
|
|
637
638
|
/* A string containing the version number, platform, and C compiler */
|
|
638
|
-
#define PG_VERSION_STR "PostgreSQL 17.
|
|
639
|
+
#define PG_VERSION_STR "PostgreSQL 17.7 (libpg_query)"
|
|
639
640
|
|
|
640
641
|
/* Define to 1 to allow profiling output to be saved separately for each
|
|
641
642
|
process. */
|
|
@@ -44,12 +44,20 @@
|
|
|
44
44
|
|
|
45
45
|
#if !defined(pg_read_barrier_impl) && defined(HAVE_GCC__ATOMIC_INT32_CAS)
|
|
46
46
|
/* acquire semantics include read barrier semantics */
|
|
47
|
-
# define pg_read_barrier_impl()
|
|
47
|
+
# define pg_read_barrier_impl() do \
|
|
48
|
+
{ \
|
|
49
|
+
pg_compiler_barrier_impl(); \
|
|
50
|
+
__atomic_thread_fence(__ATOMIC_ACQUIRE); \
|
|
51
|
+
} while (0)
|
|
48
52
|
#endif
|
|
49
53
|
|
|
50
54
|
#if !defined(pg_write_barrier_impl) && defined(HAVE_GCC__ATOMIC_INT32_CAS)
|
|
51
55
|
/* release semantics include write barrier semantics */
|
|
52
|
-
# define pg_write_barrier_impl()
|
|
56
|
+
# define pg_write_barrier_impl() do \
|
|
57
|
+
{ \
|
|
58
|
+
pg_compiler_barrier_impl(); \
|
|
59
|
+
__atomic_thread_fence(__ATOMIC_RELEASE); \
|
|
60
|
+
} while (0)
|
|
53
61
|
#endif
|
|
54
62
|
|
|
55
63
|
|
|
@@ -21,9 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
#else
|
|
23
23
|
|
|
24
|
-
/* POSIX requires at least 16 as a maximum iovcnt. */
|
|
25
|
-
#define IOV_MAX 16
|
|
26
|
-
|
|
27
24
|
/* Define our own POSIX-compatible iovec struct. */
|
|
28
25
|
struct iovec
|
|
29
26
|
{
|
|
@@ -33,6 +30,15 @@ struct iovec
|
|
|
33
30
|
|
|
34
31
|
#endif
|
|
35
32
|
|
|
33
|
+
/*
|
|
34
|
+
* If <limits.h> didn't define IOV_MAX, define our own. X/Open requires at
|
|
35
|
+
* least 16. (GNU Hurd apparently feel that they're not bound by X/Open,
|
|
36
|
+
* because they don't define this symbol at all.)
|
|
37
|
+
*/
|
|
38
|
+
#ifndef IOV_MAX
|
|
39
|
+
#define IOV_MAX 16
|
|
40
|
+
#endif
|
|
41
|
+
|
|
36
42
|
/* Define a reasonable maximum that is safe to use on the stack. */
|
|
37
43
|
#define PG_IOV_MAX Min(IOV_MAX, 32)
|
|
38
44
|
|
|
@@ -159,15 +159,16 @@ typedef struct ReorderBufferChange
|
|
|
159
159
|
} ReorderBufferChange;
|
|
160
160
|
|
|
161
161
|
/* ReorderBufferTXN txn_flags */
|
|
162
|
-
#define RBTXN_HAS_CATALOG_CHANGES
|
|
163
|
-
#define RBTXN_IS_SUBXACT
|
|
164
|
-
#define RBTXN_IS_SERIALIZED
|
|
165
|
-
#define RBTXN_IS_SERIALIZED_CLEAR
|
|
166
|
-
#define RBTXN_IS_STREAMED
|
|
167
|
-
#define RBTXN_HAS_PARTIAL_CHANGE
|
|
168
|
-
#define RBTXN_PREPARE
|
|
169
|
-
#define RBTXN_SKIPPED_PREPARE
|
|
170
|
-
#define RBTXN_HAS_STREAMABLE_CHANGE
|
|
162
|
+
#define RBTXN_HAS_CATALOG_CHANGES 0x0001
|
|
163
|
+
#define RBTXN_IS_SUBXACT 0x0002
|
|
164
|
+
#define RBTXN_IS_SERIALIZED 0x0004
|
|
165
|
+
#define RBTXN_IS_SERIALIZED_CLEAR 0x0008
|
|
166
|
+
#define RBTXN_IS_STREAMED 0x0010
|
|
167
|
+
#define RBTXN_HAS_PARTIAL_CHANGE 0x0020
|
|
168
|
+
#define RBTXN_PREPARE 0x0040
|
|
169
|
+
#define RBTXN_SKIPPED_PREPARE 0x0080
|
|
170
|
+
#define RBTXN_HAS_STREAMABLE_CHANGE 0x0100
|
|
171
|
+
#define RBTXN_DISTR_INVAL_OVERFLOWED 0x0200
|
|
171
172
|
|
|
172
173
|
/* Does the transaction have catalog changes? */
|
|
173
174
|
#define rbtxn_has_catalog_changes(txn) \
|
|
@@ -231,6 +232,12 @@ typedef struct ReorderBufferChange
|
|
|
231
232
|
((txn)->txn_flags & RBTXN_SKIPPED_PREPARE) != 0 \
|
|
232
233
|
)
|
|
233
234
|
|
|
235
|
+
/* Is the array of distributed inval messages overflowed? */
|
|
236
|
+
#define rbtxn_distr_inval_overflowed(txn) \
|
|
237
|
+
( \
|
|
238
|
+
((txn)->txn_flags & RBTXN_DISTR_INVAL_OVERFLOWED) != 0 \
|
|
239
|
+
)
|
|
240
|
+
|
|
234
241
|
/* Is this a top-level transaction? */
|
|
235
242
|
#define rbtxn_is_toptxn(txn) \
|
|
236
243
|
( \
|
|
@@ -422,6 +429,12 @@ typedef struct ReorderBufferTXN
|
|
|
422
429
|
* Private data pointer of the output plugin.
|
|
423
430
|
*/
|
|
424
431
|
void *output_plugin_private;
|
|
432
|
+
|
|
433
|
+
/*
|
|
434
|
+
* Stores cache invalidation messages distributed by other transactions.
|
|
435
|
+
*/
|
|
436
|
+
uint32 ninvalidations_distributed;
|
|
437
|
+
SharedInvalidationMessage *invalidations_distributed;
|
|
425
438
|
} ReorderBufferTXN;
|
|
426
439
|
|
|
427
440
|
/* so we can define the callbacks used inside struct ReorderBuffer itself */
|
|
@@ -709,6 +722,9 @@ extern void ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid,
|
|
|
709
722
|
CommandId cmin, CommandId cmax, CommandId combocid);
|
|
710
723
|
extern void ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn,
|
|
711
724
|
Size nmsgs, SharedInvalidationMessage *msgs);
|
|
725
|
+
extern void ReorderBufferAddDistributedInvalidations(ReorderBuffer *rb, TransactionId xid,
|
|
726
|
+
XLogRecPtr lsn, Size nmsgs,
|
|
727
|
+
SharedInvalidationMessage *msgs);
|
|
712
728
|
extern void ReorderBufferImmediateInvalidation(ReorderBuffer *rb, uint32 ninvalidations,
|
|
713
729
|
SharedInvalidationMessage *invalidations);
|
|
714
730
|
extern void ReorderBufferProcessXid(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn);
|
|
@@ -729,6 +745,10 @@ extern TransactionId *ReorderBufferGetCatalogChangesXacts(ReorderBuffer *rb);
|
|
|
729
745
|
|
|
730
746
|
extern void ReorderBufferSetRestartPoint(ReorderBuffer *rb, XLogRecPtr ptr);
|
|
731
747
|
|
|
748
|
+
extern uint32 ReorderBufferGetInvalidations(ReorderBuffer *rb,
|
|
749
|
+
TransactionId xid,
|
|
750
|
+
SharedInvalidationMessage **msgs);
|
|
751
|
+
|
|
732
752
|
extern void StartupReorderBuffer(void);
|
|
733
753
|
|
|
734
754
|
#endif
|
|
@@ -258,6 +258,8 @@ extern void ReplicationSlotMarkDirty(void);
|
|
|
258
258
|
/* misc stuff */
|
|
259
259
|
extern void ReplicationSlotInitialize(void);
|
|
260
260
|
extern bool ReplicationSlotValidateName(const char *name, int elevel);
|
|
261
|
+
extern bool ReplicationSlotValidateNameInternal(const char *name,
|
|
262
|
+
int *err_code, char **err_msg, char **err_hint);
|
|
261
263
|
extern void ReplicationSlotReserveWal(void);
|
|
262
264
|
extern void ReplicationSlotsComputeRequiredXmin(bool already_locked);
|
|
263
265
|
extern void ReplicationSlotsComputeRequiredLSN(void);
|
|
@@ -536,5 +536,6 @@ extern void write_jsonlog(ErrorData *edata);
|
|
|
536
536
|
* safely (memory context, GUC load etc)
|
|
537
537
|
*/
|
|
538
538
|
extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2);
|
|
539
|
+
extern void vwrite_stderr(const char *fmt, va_list ap) pg_attribute_printf(1, 0);
|
|
539
540
|
|
|
540
541
|
#endif /* ELOG_H */
|
|
@@ -102,7 +102,7 @@ typedef enum
|
|
|
102
102
|
* will show as "default" in pg_settings. If there is a specific reason not
|
|
103
103
|
* to want that, use source == PGC_S_OVERRIDE.
|
|
104
104
|
*
|
|
105
|
-
* NB: see GucSource_Names in
|
|
105
|
+
* NB: see GucSource_Names in guc_tables.c if you change this.
|
|
106
106
|
*/
|
|
107
107
|
typedef enum
|
|
108
108
|
{
|
|
@@ -86,8 +86,6 @@ extern bool check_maintenance_io_concurrency(int *newval, void **extra,
|
|
|
86
86
|
extern void assign_maintenance_io_concurrency(int newval, void *extra);
|
|
87
87
|
extern bool check_max_connections(int *newval, void **extra, GucSource source);
|
|
88
88
|
extern bool check_max_wal_senders(int *newval, void **extra, GucSource source);
|
|
89
|
-
extern bool check_max_slot_wal_keep_size(int *newval, void **extra,
|
|
90
|
-
GucSource source);
|
|
91
89
|
extern void assign_max_wal_size(int newval, void *extra);
|
|
92
90
|
extern bool check_max_worker_processes(int *newval, void **extra,
|
|
93
91
|
GucSource source);
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
#include <xlocale.h>
|
|
17
17
|
#endif
|
|
18
18
|
#ifdef USE_ICU
|
|
19
|
+
/* only include the C APIs, to avoid errors in cpluspluscheck */
|
|
20
|
+
#undef U_SHOW_CPLUSPLUS_API
|
|
21
|
+
#define U_SHOW_CPLUSPLUS_API 0
|
|
22
|
+
#undef U_SHOW_CPLUSPLUS_HEADER_API
|
|
23
|
+
#define U_SHOW_CPLUSPLUS_HEADER_API 0
|
|
19
24
|
#include <unicode/ucol.h>
|
|
20
25
|
#endif
|
|
21
26
|
|