aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2018-01-10 09:22:07 -0500
committerPeter Eisentraut <peter_e@gmx.net>2018-01-10 09:22:07 -0500
commitacc67ffd0a8c728b928958e75b76ee544b64c2d8 (patch)
treed5554ae7c2242d144ea780cc4f55dd500e857809 /src/backend/utils
parentd16c2de6244f3b71c0c77a3d63905227fdc78428 (diff)
downloadpostgresql-acc67ffd0a8c728b928958e75b76ee544b64c2d8.tar.gz
postgresql-acc67ffd0a8c728b928958e75b76ee544b64c2d8.zip
Give more accurate error message for dropping pinned portal
The previous code gave the same error message for attempting to drop pinned and active portals, but those are separate states, so give separate error messages.
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/mmgr/portalmem.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index 9edc1ccc832..84c68ac1895 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -464,11 +464,17 @@ PortalDrop(Portal portal, bool isTopCommit)
/*
* Don't allow dropping a pinned portal, it's still needed by whoever
- * pinned it. Not sure if the PORTAL_ACTIVE case can validly happen or
- * not...
+ * pinned it.
*/
- if (portal->portalPinned ||
- portal->status == PORTAL_ACTIVE)
+ if (portal->portalPinned)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_CURSOR_STATE),
+ errmsg("cannot drop pinned portal \"%s\"", portal->name)));
+
+ /*
+ * Not sure if the PORTAL_ACTIVE case can validly happen or not...
+ */
+ if (portal->status == PORTAL_ACTIVE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_CURSOR_STATE),
errmsg("cannot drop active portal \"%s\"", portal->name)));