aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorStephen Frost <sfrost@snowman.net>2016-04-15 21:57:15 -0400
committerStephen Frost <sfrost@snowman.net>2016-04-15 21:57:15 -0400
commit99f2f3c19ae7d6aa2950a9bdb549217c5a60d941 (patch)
tree703eb73dea293b1cc79888cb9ebabafaaee9b17d /src/backend
parentd2de44c2ce5c697a2de8089fb377816b2387107a (diff)
downloadpostgresql-99f2f3c19ae7d6aa2950a9bdb549217c5a60d941.tar.gz
postgresql-99f2f3c19ae7d6aa2950a9bdb549217c5a60d941.zip
In recordExtensionInitPriv(), keep the scan til we're done with it
For reasons of sheer brain fade, we (I) was calling systable_endscan() immediately after systable_getnext() and expecting the tuple returned by systable_getnext() to still be valid. That's clearly wrong. Move the systable_endscan() down below the tuple usage. Discovered initially by Pavel Stehule and then also by Alvaro. Add a regression test based on Alvaro's testing.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/catalog/aclchk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 4b49bb67ba0..7d656d5c6de 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -5283,8 +5283,6 @@ recordExtensionInitPriv(Oid objoid, Oid classoid, int objsubid, Acl *new_acl)
/* There should exist only one entry or none. */
oldtuple = systable_getnext(scan);
- systable_endscan(scan);
-
/* If we find an entry, update it with the latest ACL. */
if (HeapTupleIsValid(oldtuple))
{
@@ -5340,6 +5338,8 @@ recordExtensionInitPriv(Oid objoid, Oid classoid, int objsubid, Acl *new_acl)
CatalogUpdateIndexes(relation, tuple);
}
+ systable_endscan(scan);
+
/* prevent error when processing objects multiple times */
CommandCounterIncrement();