Don't throw an error for LOCK TABLE on a self-referential view.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 5 Nov 2020 16:44:32 +0000 (11:44 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 5 Nov 2020 16:44:32 +0000 (11:44 -0500)
commit7dc18c619dac7ddf8af62b4d33e4bd33c7bfb067
tree1989151dba91a1f3dc9c78a805bd26a986af1f4a
parent205f958406cc85f8f73e151906ecd281ff05d80a
Don't throw an error for LOCK TABLE on a self-referential view.

LOCK TABLE has complained about "infinite recursion" when applied
to a self-referential view, ever since we made it recurse into views
in v11.  However, that breaks pg_dump's new assumption that it's
okay to lock every relation.  There doesn't seem to be any good
reason to throw an error: if we just abandon the recursion, we've
still satisfied the requirement of locking every referenced relation.

Per bug #16703 from Andrew Bille (via Alexander Lakhin).

Discussion: https://postgr.es/m/16703-e348f58aab3cf6cc@postgresql.org
src/backend/commands/lockcmds.c
src/test/regress/expected/lock.out
src/test/regress/sql/lock.sql