Commit 6cffe54a authored by Peter Eisentraut's avatar Peter Eisentraut

Fix pointer confusion

get_object_address_publication_rel() needed to check *relation, not
relation.  Rename the variables to match style used nearby to avoid the
confusion.
parent 16a61884
...@@ -729,7 +729,7 @@ static ObjectAddress get_object_address_opf_member(ObjectType objtype, ...@@ -729,7 +729,7 @@ static ObjectAddress get_object_address_opf_member(ObjectType objtype,
static ObjectAddress get_object_address_usermapping(List *objname, static ObjectAddress get_object_address_usermapping(List *objname,
List *objargs, bool missing_ok); List *objargs, bool missing_ok);
static ObjectAddress get_object_address_publication_rel(List *objname, static ObjectAddress get_object_address_publication_rel(List *objname,
List *objargs, Relation *relation, List *objargs, Relation *relp,
bool missing_ok); bool missing_ok);
static ObjectAddress get_object_address_defacl(List *objname, List *objargs, static ObjectAddress get_object_address_defacl(List *objname, List *objargs,
bool missing_ok); bool missing_ok);
...@@ -1815,15 +1815,16 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok) ...@@ -1815,15 +1815,16 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok)
*/ */
static ObjectAddress static ObjectAddress
get_object_address_publication_rel(List *objname, List *objargs, get_object_address_publication_rel(List *objname, List *objargs,
Relation *relation, bool missing_ok) Relation *relp, bool missing_ok)
{ {
ObjectAddress address; ObjectAddress address;
Relation relation;
char *pubname; char *pubname;
Publication *pub; Publication *pub;
ObjectAddressSet(address, PublicationRelRelationId, InvalidOid); ObjectAddressSet(address, PublicationRelRelationId, InvalidOid);
*relation = relation_openrv_extended(makeRangeVarFromNameList(objname), relation = relation_openrv_extended(makeRangeVarFromNameList(objname),
AccessShareLock, missing_ok); AccessShareLock, missing_ok);
if (!relation) if (!relation)
return address; return address;
...@@ -1839,7 +1840,7 @@ get_object_address_publication_rel(List *objname, List *objargs, ...@@ -1839,7 +1840,7 @@ get_object_address_publication_rel(List *objname, List *objargs,
/* Find the publication relation mapping in syscache. */ /* Find the publication relation mapping in syscache. */
address.objectId = address.objectId =
GetSysCacheOid2(PUBLICATIONRELMAP, GetSysCacheOid2(PUBLICATIONRELMAP,
ObjectIdGetDatum(RelationGetRelid(*relation)), ObjectIdGetDatum(RelationGetRelid(relation)),
ObjectIdGetDatum(pub->oid)); ObjectIdGetDatum(pub->oid));
if (!OidIsValid(address.objectId)) if (!OidIsValid(address.objectId))
{ {
...@@ -1847,10 +1848,11 @@ get_object_address_publication_rel(List *objname, List *objargs, ...@@ -1847,10 +1848,11 @@ get_object_address_publication_rel(List *objname, List *objargs,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("publication relation \"%s\" in publication \"%s\" does not exist", errmsg("publication relation \"%s\" in publication \"%s\" does not exist",
RelationGetRelationName(*relation), pubname))); RelationGetRelationName(relation), pubname)));
return address; return address;
} }
*relp = relation;
return address; return address;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment