summaryrefslogtreecommitdiff
path: root/contrib/sepgsql/proc.c
diff options
context:
space:
mode:
authorTom Lane2017-06-04 20:20:03 +0000
committerTom Lane2017-06-04 20:20:03 +0000
commite7941a976688f0f5d13a5227ed4f3efe0718db9d (patch)
tree70ed212430cbfe514222fb70d8b8115fd695b316 /contrib/sepgsql/proc.c
parent9db7d47f909482ac2b76c28f5e9a2ef48fb19b9d (diff)
Replace over-optimistic Assert in partitioning code with a runtime test.
get_partition_parent felt that it could simply Assert that systable_getnext found a tuple. This is unlike any other caller of that function, and it's unsafe IMO --- in fact, the reason I noticed it was that the Assert failed. (OK, I was working with known-inconsistent catalog contents, but I wasn't expecting the DB to fall over quite that violently. The behavior in a non-assert-enabled build wouldn't be very nice, either.) Fix it to do what other callers do, namely an actual runtime-test-and-elog. Also, standardize the wording of elog messages that are complaining about unexpected failure of systable_getnext. 90% of them say "could not find tuple for <object>", so make the remainder do likewise. Many of the holdouts were using the phrasing "cache lookup failed", which is outright misleading since no catcache search is involved.
Diffstat (limited to 'contrib/sepgsql/proc.c')
-rw-r--r--contrib/sepgsql/proc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/sepgsql/proc.c b/contrib/sepgsql/proc.c
index 4ccf4a5e60d..73564edaa79 100644
--- a/contrib/sepgsql/proc.c
+++ b/contrib/sepgsql/proc.c
@@ -68,7 +68,7 @@ sepgsql_proc_post_create(Oid functionId)
tuple = systable_getnext(sscan);
if (!HeapTupleIsValid(tuple))
- elog(ERROR, "catalog lookup failed for proc %u", functionId);
+ elog(ERROR, "could not find tuple for function %u", functionId);
proForm = (Form_pg_proc) GETSTRUCT(tuple);
@@ -261,7 +261,7 @@ sepgsql_proc_setattr(Oid functionId)
SnapshotSelf, 1, &skey);
newtup = systable_getnext(sscan);
if (!HeapTupleIsValid(newtup))
- elog(ERROR, "catalog lookup failed for function %u", functionId);
+ elog(ERROR, "could not find tuple for function %u", functionId);
newform = (Form_pg_proc) GETSTRUCT(newtup);
/*