mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
Add more infinite recursion detection while locking a view.
Also add regression test cases for detecting infinite recursion in locking view tests. Some document enhancements. Patch by Yugo Nagata.
This commit is contained in:
@ -120,6 +120,17 @@ select relname from pg_locks l, pg_class c
|
||||
lock_view6
|
||||
(2 rows)
|
||||
|
||||
ROLLBACK;
|
||||
-- detecting infinite recursions 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);
|
||||
@ -142,11 +153,12 @@ RESET ROLE;
|
||||
--
|
||||
-- Clean up
|
||||
--
|
||||
DROP VIEW lock_view7;
|
||||
DROP VIEW lock_view6;
|
||||
DROP VIEW lock_view5;
|
||||
DROP VIEW lock_view4;
|
||||
DROP VIEW lock_view3;
|
||||
DROP VIEW lock_view2;
|
||||
DROP VIEW lock_view3 CASCADE;
|
||||
NOTICE: drop cascades to view lock_view2
|
||||
DROP VIEW lock_view1;
|
||||
DROP TABLE lock_tbl3;
|
||||
DROP TABLE lock_tbl2;
|
||||
|
@ -84,6 +84,15 @@ 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
|
||||
CREATE OR REPLACE VIEW lock_view2 AS SELECT * from lock_view3;
|
||||
BEGIN TRANSACTION;
|
||||
LOCK TABLE lock_view2 IN EXCLUSIVE MODE;
|
||||
ROLLBACK;
|
||||
CREATE VIEW lock_view7 AS SELECT * from lock_view2;
|
||||
BEGIN TRANSACTION;
|
||||
LOCK TABLE lock_view7 IN EXCLUSIVE MODE;
|
||||
ROLLBACK;
|
||||
|
||||
-- Verify that we can lock a table with inheritance children.
|
||||
CREATE TABLE lock_tbl2 (b BIGINT) INHERITS (lock_tbl1);
|
||||
@ -107,11 +116,11 @@ RESET ROLE;
|
||||
--
|
||||
-- Clean up
|
||||
--
|
||||
DROP VIEW lock_view7;
|
||||
DROP VIEW lock_view6;
|
||||
DROP VIEW lock_view5;
|
||||
DROP VIEW lock_view4;
|
||||
DROP VIEW lock_view3;
|
||||
DROP VIEW lock_view2;
|
||||
DROP VIEW lock_view3 CASCADE;
|
||||
DROP VIEW lock_view1;
|
||||
DROP TABLE lock_tbl3;
|
||||
DROP TABLE lock_tbl2;
|
||||
|
Reference in New Issue
Block a user