Michael Paquier, per Coverity.
classRel = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(rel)));
+ if (!HeapTupleIsValid(tuple))
+ elog(ERROR, "cache lookup failed for relation %u",
+ RelationGetRelid(rel));
+
#ifdef USE_ASSERT_CHECKING
{
Form_pg_class classForm;
Node *boundspec;
tuple = SearchSysCache1(RELOID, inhrelid);
+ if (!HeapTupleIsValid(tuple))
+ elog(ERROR, "cache lookup failed for relation %u", inhrelid);
/*
* It is possible that the pg_class tuple of a partition has not been
elog(ERROR, "relation \"%s\" has relispartition = false",
RelationGetRelationName(rel));
tuple = SearchSysCache1(RELOID, RelationGetRelid(rel));
+ if (!HeapTupleIsValid(tuple))
+ elog(ERROR, "cache lookup failed for relation %u",
+ RelationGetRelid(rel));
+
boundDatum = SysCacheGetAttr(RELOID, tuple,
Anum_pg_class_relpartbound,
&isnull);
PGresult *res;
int ntups;
int i;
- PQExpBuffer query = createPQExpBuffer();
+ PQExpBuffer query;
PartInfo *partinfo;
int i_partrelid;
return NULL;
}
+ query = createPQExpBuffer();
+
/* Make sure we are in proper schema */
selectSourceSchema(fout, "pg_catalog");
void
getTablePartitionKeyInfo(Archive *fout, TableInfo *tblinfo, int numTables)
{
- PQExpBuffer q = createPQExpBuffer();
+ PQExpBuffer q;
int i;
PGresult *res;
if (fout->remoteVersion < 100000)
return;
+ q = createPQExpBuffer();
+
for (i = 0; i < numTables; i++)
{
TableInfo *tbinfo = &(tblinfo[i]);
Assert(PQntuples(res) == 1);
tbinfo->partkeydef = pg_strdup(PQgetvalue(res, 0, 0));
}
+
+ destroyPQExpBuffer(q);
}
/*