Re: Triggers with DO functionality - Mailing list pgsql-hackers

From Thom Brown
Subject Re: Triggers with DO functionality
Date
Msg-id CAA-aLv4efPdk-oaztf++Q34BiQtT6zQHk+9ft1HFVvknsaheOA@mail.gmail.com
Whole thread Raw
In response to Re: Triggers with DO functionality  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Triggers with DO functionality  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
List pgsql-hackers
On 17 February 2012 17:26, Peter Eisentraut <peter_e@gmx.net> wrote:
> On fre, 2012-02-17 at 13:22 +0000, Thom Brown wrote:
>> So instead of
>>
>> CREATE TRIGGER...
>> EXECUTE PROCEDURE functioname();
>>
>> you'd have:
>>
>> CREATE TRIGGER...
>> DO $$
>> ...
>> $$;
>
> I had wished for this many times and was about to propose something
> similar.
>
> We might wish to review the SQL standard and other implementations to
> make porting triggers a bit easier too.

I had looked at how a couple other RDBMS's do it, and there are:

CREATE TRIGGER...
BEGIN
END;

and

CREATE TRIGGER...
AS
BEGIN
END;

And thinking about it, DO is a bit nonsense here, so maybe we'd just
have something like:

CREATE TRIGGER...
AS $$
BEGIN
END;
$$;

i.e. the same as a function.

-- 
Thom


pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Command Triggers
Next
From: Robert Haas
Date:
Subject: Re: MySQL search query is not executing in Postgres DB