summaryrefslogtreecommitdiffstats
path: root/src/backend/catalog
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:18:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:18:03 +0000
commitb4b8efbd3826ac0af2d1c2e7c40fcf80a4bfba45 (patch)
treebec866278030c41c624a91037b1dd88f41c99d8e /src/backend/catalog
parentAdding upstream version 15.5. (diff)
downloadpostgresql-15-b4b8efbd3826ac0af2d1c2e7c40fcf80a4bfba45.tar.xz
postgresql-15-b4b8efbd3826ac0af2d1c2e7c40fcf80a4bfba45.zip
Adding upstream version 15.6.upstream/15.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/backend/catalog')
-rw-r--r--src/backend/catalog/aclchk.c4
-rw-r--r--src/backend/catalog/heap.c7
-rw-r--r--src/backend/catalog/index.c19
3 files changed, 25 insertions, 5 deletions
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 95d85a7..567807b 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -6135,9 +6135,9 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
ReleaseSysCache(tuple);
}
- /* pg_largeobject_metadata */
- else if (classoid == LargeObjectMetadataRelationId)
+ else if (classoid == LargeObjectRelationId)
{
+ /* For large objects, we must consult pg_largeobject_metadata */
Datum aclDatum;
bool isNull;
HeapTuple tuple;
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index a21de89..bd6b9c4 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -2328,7 +2328,8 @@ AddRelationNewConstraints(Relation rel,
continue;
/* If the DEFAULT is volatile we cannot use a missing value */
- if (colDef->missingMode && contain_volatile_functions((Node *) expr))
+ if (colDef->missingMode &&
+ contain_volatile_functions_after_planning((Expr *) expr))
colDef->missingMode = false;
defOid = StoreAttrDefault(rel, colDef->attnum, expr, is_internal,
@@ -2763,9 +2764,11 @@ cookDefault(ParseState *pstate,
if (attgenerated)
{
+ /* Disallow refs to other generated columns */
check_nested_generated(pstate, expr);
- if (contain_mutable_functions(expr))
+ /* Disallow mutable functions */
+ if (contain_mutable_functions_after_planning((Expr *) expr))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("generation expression is not immutable")));
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index db697a9..bab02e1 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -3621,7 +3621,24 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
* Open the target index relation and get an exclusive lock on it, to
* ensure that no one else is touching this particular index.
*/
- iRel = index_open(indexId, AccessExclusiveLock);
+ if ((params->options & REINDEXOPT_MISSING_OK) != 0)
+ iRel = try_index_open(indexId, AccessExclusiveLock);
+ else
+ iRel = index_open(indexId, AccessExclusiveLock);
+
+ /* if index relation is gone, leave */
+ if (!iRel)
+ {
+ /* Roll back any GUC changes */
+ AtEOXact_GUC(false, save_nestlevel);
+
+ /* Restore userid and security context */
+ SetUserIdAndSecContext(save_userid, save_sec_context);
+
+ /* Close parent heap relation, but keep locks */
+ table_close(heapRelation, NoLock);
+ return;
+ }
if (progress)
pgstat_progress_update_param(PROGRESS_CREATEIDX_ACCESS_METHOD_OID,