1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +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:
Simon Riggs
2015-04-05 11:37:08 -04:00
parent ca6805338f
commit 0ef0396ae1
7 changed files with 1560 additions and 813 deletions

View File

@ -165,9 +165,9 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
referenced;
if (OidIsValid(relOid))
rel = heap_open(relOid, AccessExclusiveLock);
rel = heap_open(relOid, ShareRowExclusiveLock);
else
rel = heap_openrv(stmt->relation, AccessExclusiveLock);
rel = heap_openrv(stmt->relation, ShareRowExclusiveLock);
/*
* Triggers must be on tables or views, and there are additional