summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index f6c9cf3b0ec..8e4743d1101 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8606,7 +8606,7 @@ CloneFkReferencing(List **wqueue, Relation parentRel, Relation partRel)
ListCell *cell;
tuple = SearchSysCache1(CONSTROID, parentConstrOid);
- if (!tuple)
+ if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u",
parentConstrOid);
constrForm = (Form_pg_constraint) GETSTRUCT(tuple);
@@ -8785,7 +8785,7 @@ tryAttachPartitionForeignKey(ForeignKeyCacheInfo *fk,
parentConstrTup = SearchSysCache1(CONSTROID,
ObjectIdGetDatum(parentConstrOid));
- if (!parentConstrTup)
+ if (!HeapTupleIsValid(parentConstrTup))
elog(ERROR, "cache lookup failed for constraint %u", parentConstrOid);
parentConstr = (Form_pg_constraint) GETSTRUCT(parentConstrTup);
@@ -8816,9 +8816,8 @@ tryAttachPartitionForeignKey(ForeignKeyCacheInfo *fk,
*/
partcontup = SearchSysCache1(CONSTROID,
ObjectIdGetDatum(fk->conoid));
- if (!partcontup)
- elog(ERROR, "cache lookup failed for constraint %u",
- fk->conoid);
+ if (!HeapTupleIsValid(partcontup))
+ elog(ERROR, "cache lookup failed for constraint %u", fk->conoid);
partConstr = (Form_pg_constraint) GETSTRUCT(partcontup);
if (OidIsValid(partConstr->conparentid) ||
!partConstr->convalidated ||
@@ -16001,7 +16000,7 @@ ATExecDetachPartition(Relation rel, RangeVar *name)
Constraint *fkconstraint;
contup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(fk->conoid));
- if (!contup)
+ if (!HeapTupleIsValid(contup))
elog(ERROR, "cache lookup failed for constraint %u", fk->conoid);
conform = (Form_pg_constraint) GETSTRUCT(contup);
@@ -16346,9 +16345,8 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
indTup = SearchSysCache1(INDEXRELID,
ObjectIdGetDatum(inhForm->inhrelid));
- if (!indTup)
- elog(ERROR, "cache lookup failed for index %u",
- inhForm->inhrelid);
+ if (!HeapTupleIsValid(indTup))
+ elog(ERROR, "cache lookup failed for index %u", inhForm->inhrelid);
indexForm = (Form_pg_index) GETSTRUCT(indTup);
if (indexForm->indisvalid)
tuples += 1;