From e75d99818dd3940be997520e64db8c9e3b207e39 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 21 May 2024 07:05:26 +0200 Subject: Merging upstream version 15.7. Signed-off-by: Daniel Baumann --- src/include/access/tableam.h | 4 ++-- src/include/catalog/pg_opclass.dat | 7 +++++-- src/include/executor/functions.h | 6 ++++++ src/include/lib/simplehash.h | 3 +++ src/include/nodes/execnodes.h | 4 ++++ src/include/storage/lmgr.h | 2 ++ 6 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src/include') diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h index 5d0431a..6a7b4a5 100644 --- a/src/include/access/tableam.h +++ b/src/include/access/tableam.h @@ -601,8 +601,8 @@ typedef struct TableAmRoutine const RelFileNode *newrnode); /* See table_relation_copy_for_cluster() */ - void (*relation_copy_for_cluster) (Relation NewTable, - Relation OldTable, + void (*relation_copy_for_cluster) (Relation OldTable, + Relation NewTable, Relation OldIndex, bool use_sort, TransactionId OldestXmin, diff --git a/src/include/catalog/pg_opclass.dat b/src/include/catalog/pg_opclass.dat index dbcae7f..7a939d9 100644 --- a/src/include/catalog/pg_opclass.dat +++ b/src/include/catalog/pg_opclass.dat @@ -91,8 +91,11 @@ # Here's an ugly little hack to save space in the system catalog indexes. # btree doesn't ordinarily allow a storage type different from input type; # but cstring and name are the same thing except for trailing padding, -# and we can safely omit that within an index entry. So we declare the -# btree opclass for name as using cstring storage type. +# so we choose to omit that within an index entry. Here we declare the +# btree opclass for name as using cstring storage type. This does require +# that we pad the cstring out with the full NAMEDATALEN bytes when performing +# index-only scans. See corresponding hacks in ExecInitIndexOnlyScan() and +# StoreIndexTuple(). { opcmethod => 'btree', opcname => 'name_ops', opcfamily => 'btree/text_ops', opcintype => 'name', opckeytype => 'cstring' }, diff --git a/src/include/executor/functions.h b/src/include/executor/functions.h index 4c20cf4..fda7424 100644 --- a/src/include/executor/functions.h +++ b/src/include/executor/functions.h @@ -50,6 +50,12 @@ extern bool check_sql_fn_retval(List *queryTreeLists, bool insertDroppedCols, List **resultTargetList); +extern bool check_sql_fn_retval_ext(List *queryTreeLists, + Oid rettype, TupleDesc rettupdesc, + char prokind, + bool insertDroppedCols, + List **resultTargetList); + extern DestReceiver *CreateSQLFunctionDestReceiver(void); #endif /* FUNCTIONS_H */ diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index d95388d..5d5fa78 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -1101,6 +1101,9 @@ SH_STAT(SH_TYPE * tb) max_collisions = curcoll; } + /* large enough to be worth freeing, even if just used for debugging */ + pfree(collisions); + if (tb->members > 0) { fillfactor = tb->members / ((double) tb->size); diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 9f176b0..8b4d382 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1592,6 +1592,8 @@ typedef struct IndexScanState * TableSlot slot for holding tuples fetched from the table * VMBuffer buffer in use for visibility map testing, if any * PscanLen size of parallel index-only scan descriptor + * NameCStringAttNums attnums of name typed columns to pad to NAMEDATALEN + * NameCStringCount number of elements in the NameCStringAttNums array * ---------------- */ typedef struct IndexOnlyScanState @@ -1611,6 +1613,8 @@ typedef struct IndexOnlyScanState TupleTableSlot *ioss_TableSlot; Buffer ioss_VMBuffer; Size ioss_PscanLen; + AttrNumber *ioss_NameCStringAttNums; + int ioss_NameCStringCount; } IndexOnlyScanState; /* ---------------- diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index be1d2c9..2c0c1f3 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -93,6 +93,8 @@ extern void SpeculativeInsertionWait(TransactionId xid, uint32 token); /* Lock a general object (other than a relation) of the current database */ extern void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); +extern bool ConditionalLockDatabaseObject(Oid classid, Oid objid, + uint16 objsubid, LOCKMODE lockmode); extern void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); -- cgit v1.2.3