extension patch of CREATE OR REPLACE TRIGGER - Mailing list pgsql-hackers

From Osumi, Takamichi
Subject extension patch of CREATE OR REPLACE TRIGGER
Date
Msg-id 0DDF369B45A1B44B8A687ED43F06557C010BC362@G01JPEXMBYT03
Whole thread Raw
Responses Re: extension patch of CREATE OR REPLACE TRIGGER
Re: extension patch of CREATE OR REPLACE TRIGGER
List pgsql-hackers

Dear hackers

 

Hi there !

One past thread about introducing CREATE OR REPLACE TRIGGER into the syntax

had stopped without complete discussion in terms of LOCK level.

 

The past thread is this. I'd like to inherit this one.

https://www.postgresql.org/message-id/flat/0B4917A40C80E34BBEC4BE1A7A9AB7E276F5D9%40g01jpexmbkw05#39f3c956d549c134474724d2b775399c

Mr. Tom Lane mentioned that this change requires really careful study in this thread.

 

First of all, please don't forget I don't talk about DO CLAUSE in this thread.

Secondly, Mr. Surafel Temesgen pointed out a bug but it doesn't appear.

 

Anyway, let's go back to the main topic.

From my perspective, how CREATE OR REPLACE TRIGGER works is,

when there is no counterpart replaced by a new trigger,

CREATE TRIGGER is processed with SHARE ROW EXCLUSIVE LOCK as usual.

 

On the other hand, when there's,

REPLACE TRIGGER procedure is executed with ACCESS EXCLUSIVE LOCK.

 

This feeling comes from my idea

that acquiring ACCESS EXCLUSIVE LOCK when replacing trigger occurs

provides data consistency between transactions and protects concurrent pg_dump.

 

In order to make this come true, as the first step,

I've made a patch to add CREATE OR REPLACE TRIGGER with some basic tests in triggers.sql.

 

Yet, I'm still wondering which part of LOCK level in this patch should be raised to ACCESS EXCLUSIVE LOCK.

Could anyone give me an advise about

how to protect the process of trigger replacement in the way I suggested above ?

 

--------------------

Takamichi Osumi

Attachment

pgsql-hackers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: reloption to prevent VACUUM from truncating empty pages at theend of relation
Next
From: "Ideriha, Takeshi"
Date:
Subject: RE: Protect syscache from bloating with negative cache entries