mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Reduce lock levels of some trigger DDL and add FKs
Reduce lock levels to ShareRowExclusive for the following SQL CREATE TRIGGER (but not DROP or ALTER) ALTER TABLE ENABLE TRIGGER ALTER TABLE DISABLE TRIGGER ALTER TABLE … ADD CONSTRAINT FOREIGN KEY Original work by Simon Riggs, extracted and refreshed by Andreas Karlsson New test cases added by Andreas Karlsson Reviewed by Noah Misch, Andres Freund, Michael Paquier and Simon Riggs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -34,4 +34,7 @@ test: skip-locked-3
|
||||
test: skip-locked-4
|
||||
test: drop-index-concurrently-1
|
||||
test: alter-table-1
|
||||
test: alter-table-2
|
||||
test: alter-table-3
|
||||
test: create-trigger
|
||||
test: timeouts
|
||||
|
@ -1957,9 +1957,9 @@ create trigger ttdummy
|
||||
execute procedure
|
||||
ttdummy (1, 1);
|
||||
select * from my_locks order by 1;
|
||||
relname | max_lockmode
|
||||
-----------+---------------------
|
||||
alterlock | AccessExclusiveLock
|
||||
relname | max_lockmode
|
||||
-----------+-----------------------
|
||||
alterlock | ShareRowExclusiveLock
|
||||
(1 row)
|
||||
|
||||
rollback;
|
||||
@ -1971,10 +1971,10 @@ select * from my_locks order by 1;
|
||||
|
||||
alter table alterlock2 add foreign key (f1) references alterlock (f1);
|
||||
select * from my_locks order by 1;
|
||||
relname | max_lockmode
|
||||
-----------------+---------------------
|
||||
alterlock | AccessExclusiveLock
|
||||
alterlock2 | AccessExclusiveLock
|
||||
relname | max_lockmode
|
||||
-----------------+-----------------------
|
||||
alterlock | ShareRowExclusiveLock
|
||||
alterlock2 | ShareRowExclusiveLock
|
||||
alterlock2_pkey | AccessShareLock
|
||||
alterlock_pkey | AccessShareLock
|
||||
(4 rows)
|
||||
@ -1984,10 +1984,10 @@ begin;
|
||||
alter table alterlock2
|
||||
add constraint alterlock2nv foreign key (f1) references alterlock (f1) NOT VALID;
|
||||
select * from my_locks order by 1;
|
||||
relname | max_lockmode
|
||||
------------+---------------------
|
||||
alterlock | AccessExclusiveLock
|
||||
alterlock2 | AccessExclusiveLock
|
||||
relname | max_lockmode
|
||||
------------+-----------------------
|
||||
alterlock | ShareRowExclusiveLock
|
||||
alterlock2 | ShareRowExclusiveLock
|
||||
(2 rows)
|
||||
|
||||
commit;
|
||||
|
Reference in New Issue
Block a user