From 43c2e97ed45d665b1a8ef0fa3d20e7c5492f5f2b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 6 Nov 2020 16:17:57 -0500 Subject: 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 --- src/backend/commands/lockcmds.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/backend/commands/lockcmds.c') diff --git a/src/backend/commands/lockcmds.c b/src/backend/commands/lockcmds.c index 15b4c2f90ad..a1670821aa4 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) -- cgit v1.2.3