summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-11-06 16:17:57 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-11-06 16:17:57 -0500
commit9e555180f23dd4d1a85a8b2b93350358322a540a (patch)
tree321f3aaa9d304ef506eeebd07d4a14b934c037be /src/backend
parent768ab4d676aa84cfcb8f59e843e4e97559b6cc5e (diff)
Revert "Accept relations of any kind in LOCK TABLE".
Revert 59ab4ac32, as well as the followup fix 33862cb9c, in all branches. We need to think a bit harder about what the behavior of LOCK TABLE on views should be, and there's no time for that before next week's releases. We'll take another crack at this later. Discussion: https://postgr.es/m/16703-e348f58aab3cf6cc@postgresql.org
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/commands/lockcmds.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/commands/lockcmds.c b/src/backend/commands/lockcmds.c
index be3bdcf859a..175d1f3f2e6 100644
--- a/src/backend/commands/lockcmds.c
+++ b/src/backend/commands/lockcmds.c
@@ -87,6 +87,13 @@ RangeVarCallbackForLockTable(const RangeVar *rv, Oid relid, Oid oldrelid,
return; /* woops, concurrently dropped; no permissions
* check */
+ /* Currently, we only allow plain tables to be locked */
+ if (relkind != RELKIND_RELATION)
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("\"%s\" is not a table",
+ rv->relname)));
+
/* Check permissions. */
aclresult = LockTableAclCheck(relid, lockmode);
if (aclresult != ACLCHECK_OK)