aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/lockcmds.c
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
commit43c2e97ed45d665b1a8ef0fa3d20e7c5492f5f2b (patch)
tree0ae2c2c77f3d7aab8782170130eaa6c15828ec60 /src/backend/commands/lockcmds.c
parent9e98ddd16e0623fe3f993fdd6dd032af5be7da6c (diff)
downloadpostgresql-43c2e97ed45d665b1a8ef0fa3d20e7c5492f5f2b.tar.gz
postgresql-43c2e97ed45d665b1a8ef0fa3d20e7c5492f5f2b.zip
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/commands/lockcmds.c')
-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 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)