diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-11-05 11:44:32 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-11-05 11:44:32 -0500 |
| commit | 5b7bfc39726ff9f6c52dd73e337c34e74e0d1f39 (patch) | |
| tree | 26bacc8d4af4da76765675e0e1a74ba238235a26 /src/test | |
| parent | 48e1291342dd7771cf8c67aa1d7ec1f394b95dd8 (diff) | |
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
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/lock.out | 4 | ||||
| -rw-r--r-- | src/test/regress/sql/lock.sql | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/test/regress/expected/lock.out b/src/test/regress/expected/lock.out index 1d6a4e9f1e0..f39280a4fa6 100644 --- a/src/test/regress/expected/lock.out +++ b/src/test/regress/expected/lock.out @@ -124,16 +124,14 @@ select relname from pg_locks l, pg_class c (2 rows) ROLLBACK; --- detecting infinite recursions in view definitions +-- Verify that we cope with infinite recursion in view definitions. CREATE OR REPLACE VIEW lock_view2 AS SELECT * from lock_view3; BEGIN TRANSACTION; LOCK TABLE lock_view2 IN EXCLUSIVE MODE; -ERROR: infinite recursion detected in rules for relation "lock_view2" ROLLBACK; CREATE VIEW lock_view7 AS SELECT * from lock_view2; BEGIN TRANSACTION; LOCK TABLE lock_view7 IN EXCLUSIVE MODE; -ERROR: infinite recursion detected in rules for relation "lock_view2" ROLLBACK; -- Verify that we can lock a table with inheritance children. CREATE TABLE lock_tbl2 (b BIGINT) INHERITS (lock_tbl1); diff --git a/src/test/regress/sql/lock.sql b/src/test/regress/sql/lock.sql index 98d13fc8e1e..4f032f1c2e4 100644 --- a/src/test/regress/sql/lock.sql +++ b/src/test/regress/sql/lock.sql @@ -87,7 +87,7 @@ select relname from pg_locks l, pg_class c where l.relation = c.oid and relname like '%lock_%' and mode = 'ExclusiveLock' order by relname; ROLLBACK; --- detecting infinite recursions in view definitions +-- Verify that we cope with infinite recursion in view definitions. CREATE OR REPLACE VIEW lock_view2 AS SELECT * from lock_view3; BEGIN TRANSACTION; LOCK TABLE lock_view2 IN EXCLUSIVE MODE; |
