Skip to content

Commit 370a27c

Browse files
committed
Update to libpg_query 17-6.1.0
This fixes strchrnul compatibility on macOS 15.4+
1 parent 00b50ee commit 370a27c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+521
-335
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ benchmark:
1616

1717
# --- Below only needed for releasing new versions
1818

19-
LIB_PG_QUERY_TAG = 17-6.0.0
19+
LIB_PG_QUERY_TAG = 17-6.1.0
2020

2121
root_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
2222
LIB_TMPDIR = $(root_dir)/tmp

parse_test.go

Lines changed: 18 additions & 18 deletions
Large diffs are not rendered by default.

parser/include/pg_query.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ void pg_query_exit(void);
133133

134134
// Postgres version information
135135
#define PG_MAJORVERSION "17"
136-
#define PG_VERSION "17.0"
137-
#define PG_VERSION_NUM 170000
136+
#define PG_VERSION "17.4"
137+
#define PG_VERSION_NUM 170004
138138

139139
// Deprecated APIs below
140140

parser/include/postgres/access/amapi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ typedef enum IndexAMProperty
7676
* opfamily. This allows ALTER OPERATOR FAMILY DROP, and causes that to
7777
* happen automatically if the operator or support func is dropped. This
7878
* is the right behavior for inessential ("loose") objects.
79+
*
80+
* We also make dependencies on lefttype/righttype, of the same strength as
81+
* the dependency on the operator or support func, unless these dependencies
82+
* are redundant with the dependency on the operator or support func.
7983
*/
8084
typedef struct OpFamilyMember
8185
{

parser/include/postgres/access/genam.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,14 @@ extern SysScanDesc systable_beginscan_ordered(Relation heapRelation,
233233
extern HeapTuple systable_getnext_ordered(SysScanDesc sysscan,
234234
ScanDirection direction);
235235
extern void systable_endscan_ordered(SysScanDesc sysscan);
236+
extern void systable_inplace_update_begin(Relation relation,
237+
Oid indexId,
238+
bool indexOK,
239+
Snapshot snapshot,
240+
int nkeys, const ScanKeyData *key,
241+
HeapTuple *oldtupcopy,
242+
void **state);
243+
extern void systable_inplace_update_finish(void *state, HeapTuple tuple);
244+
extern void systable_inplace_update_cancel(void *state);
236245

237246
#endif /* GENAM_H */

parser/include/postgres/access/slru.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ typedef struct SlruCtlData
128128
{
129129
SlruShared shared;
130130

131-
/*
132-
* Bitmask to determine bank number from page number.
133-
*/
134-
bits16 bank_mask;
131+
/* Number of banks in this SLRU. */
132+
uint16 nbanks;
135133

136134
/*
137135
* If true, use long segment file names. Otherwise, use short file names.
@@ -163,7 +161,6 @@ typedef struct SlruCtlData
163161
* it's always the same, it doesn't need to be in shared memory.
164162
*/
165163
char Dir[64];
166-
167164
} SlruCtlData;
168165

169166
typedef SlruCtlData *SlruCtl;
@@ -179,7 +176,7 @@ SimpleLruGetBankLock(SlruCtl ctl, int64 pageno)
179176
{
180177
int bankno;
181178

182-
bankno = pageno & ctl->bank_mask;
179+
bankno = pageno % ctl->nbanks;
183180
return &(ctl->shared->bank_locks[bankno].lock);
184181
}
185182

parser/include/postgres/access/tableam.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ typedef enum TU_UpdateIndexes
137137
*
138138
* xmax is the outdating transaction's XID. If the caller wants to visit the
139139
* replacement tuple, it must check that this matches before believing the
140-
* replacement is really a match.
140+
* replacement is really a match. This is InvalidTransactionId if the target
141+
* was !LP_NORMAL (expected only for a TID retrieved from syscache).
141142
*
142143
* cmax is the outdating command's CID, but only when the failure code is
143144
* TM_SelfModified (i.e., something in the current transaction outdated the

parser/include/postgres/access/transam.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,49 @@ FullTransactionIdNewer(FullTransactionId a, FullTransactionId b)
370370
return b;
371371
}
372372

373+
/*
374+
* Compute FullTransactionId for the given TransactionId, assuming xid was
375+
* between [oldestXid, nextXid] at the time when TransamVariables->nextXid was
376+
* nextFullXid. When adding calls, evaluate what prevents xid from preceding
377+
* oldestXid if SetTransactionIdLimit() runs between the collection of xid and
378+
* the collection of nextFullXid.
379+
*/
380+
static inline FullTransactionId
381+
FullTransactionIdFromAllowableAt(FullTransactionId nextFullXid,
382+
TransactionId xid)
383+
{
384+
uint32 epoch;
385+
386+
/* Special transaction ID. */
387+
if (!TransactionIdIsNormal(xid))
388+
return FullTransactionIdFromEpochAndXid(0, xid);
389+
390+
Assert(TransactionIdPrecedesOrEquals(xid,
391+
XidFromFullTransactionId(nextFullXid)));
392+
393+
/*
394+
* The 64 bit result must be <= nextFullXid, since nextFullXid hadn't been
395+
* issued yet when xid was in the past. The xid must therefore be from
396+
* the epoch of nextFullXid or the epoch before. We know this because we
397+
* must remove (by freezing) an XID before assigning the XID half an epoch
398+
* ahead of it.
399+
*
400+
* The unlikely() branch hint is dubious. It's perfect for the first 2^32
401+
* XIDs of a cluster's life. Right at 2^32 XIDs, misprediction shoots to
402+
* 100%, then improves until perfection returns 2^31 XIDs later. Since
403+
* current callers pass relatively-recent XIDs, expect >90% prediction
404+
* accuracy overall. This favors average latency over tail latency.
405+
*/
406+
epoch = EpochFromFullTransactionId(nextFullXid);
407+
if (unlikely(xid > XidFromFullTransactionId(nextFullXid)))
408+
{
409+
Assert(epoch != 0);
410+
epoch--;
411+
}
412+
413+
return FullTransactionIdFromEpochAndXid(epoch, xid);
414+
}
415+
373416
#endif /* FRONTEND */
374417

375418
#endif /* TRANSAM_H */

parser/include/postgres/c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ typedef void (*pg_funcptr_t) (void);
435435
* bool
436436
* Boolean value, either true or false.
437437
*
438-
* We use stdbool.h if available and its bool has size 1. That's useful for
438+
* We use stdbool.h if bool has size 1 after including it. That's useful for
439439
* better compiler and debugger output and for compatibility with third-party
440440
* libraries. But PostgreSQL currently cannot deal with bool of other sizes;
441441
* there are static assertions around the code to prevent that.

parser/include/postgres/catalog/objectaddress.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ extern bool get_object_namensp_unique(Oid class_id);
6969

7070
extern HeapTuple get_catalog_object_by_oid(Relation catalog,
7171
AttrNumber oidcol, Oid objectId);
72+
extern HeapTuple get_catalog_object_by_oid_extended(Relation catalog,
73+
AttrNumber oidcol,
74+
Oid objectId,
75+
bool locktup);
7276

7377
extern char *getObjectDescription(const ObjectAddress *object,
7478
bool missing_ok);

0 commit comments

Comments
 (0)