aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-07-20 15:18:25 +0900
committerMichael Paquier <michael@paquier.xyz>2023-07-20 15:18:25 +0900
commit2a990abd79acea4717cc8f982a28f35b6b347ddb (patch)
tree2a5b181b6d75fe5cd20367a327cd80f7e0cca868 /src/backend/commands/tablecmds.c
parent47556a0013fa64d44add2760577d49cf2eca4cd0 (diff)
downloadpostgresql-2a990abd79acea4717cc8f982a28f35b6b347ddb.tar.gz
postgresql-2a990abd79acea4717cc8f982a28f35b6b347ddb.zip
Add missing ObjectIdGetDatum() in syscache lookup calls for Oids
Based on how postgres.h foes the Oid <-> Datum conversion, there is no existing bugs but let's be consistent. 17 spots have been noticed as incorrectly passing down Oids rather than Datums. Aleksander got one, Zhang two and I the rest. Author: Michael Paquier, Aleksander Alekseev, Zhang Mingli Discussion: https://postgr.es/m/ZLUhqsqQN1MOaxdw@paquier.xyz
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 4dc029f91f1..727f1517507 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -10147,7 +10147,7 @@ CloneFkReferenced(Relation parentRel, Relation partitionRel)
Oid deleteTriggerOid,
updateTriggerOid;
- tuple = SearchSysCache1(CONSTROID, constrOid);
+ tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constrOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", constrOid);
constrForm = (Form_pg_constraint) GETSTRUCT(tuple);
@@ -10353,7 +10353,7 @@ CloneFkReferencing(List **wqueue, Relation parentRel, Relation partRel)
Oid insertTriggerOid,
updateTriggerOid;
- tuple = SearchSysCache1(CONSTROID, parentConstrOid);
+ tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(parentConstrOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u",
parentConstrOid);
@@ -13723,7 +13723,7 @@ ATExecAlterColumnGenericOptions(Relation rel,
/* First, determine FDW validator associated to the foreign table. */
ftrel = table_open(ForeignTableRelationId, AccessShareLock);
- tuple = SearchSysCache1(FOREIGNTABLEREL, rel->rd_id);
+ tuple = SearchSysCache1(FOREIGNTABLEREL, ObjectIdGetDatum(rel->rd_id));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -16186,7 +16186,8 @@ ATExecGenericOptions(Relation rel, List *options)
ftrel = table_open(ForeignTableRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(FOREIGNTABLEREL, rel->rd_id);
+ tuple = SearchSysCacheCopy1(FOREIGNTABLEREL,
+ ObjectIdGetDatum(rel->rd_id));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),