From ec516818a81aa43c56eb433e9c47304c19f4ac1b 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 d48a15984f3..bb7d9e8239e 100644 --- a/src/backend/commands/lockcmds.c +++ b/src/backend/commands/lockcmds.c @@ -88,6 +88,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 && relkind != RELKIND_PARTITIONED_TABLE) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("\"%s\" is not a table", + rv->relname))); + /* * Make note if a temporary relation has been accessed in this * transaction. -- cgit v1.2.3