Skip site navigation (1) Skip section navigation (2)

Re: Triggers with DO functionality

From: Thom Brown <thom(at)linux(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Triggers with DO functionality
Date: 2012-02-17 17:49:30
Message-ID: CAA-aLv4efPdk-oaztf++Q34BiQtT6zQHk+9ft1HFVvknsaheOA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 17 February 2012 17:26, Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2012-02-17 17:59:40
Subject: Re: MySQL search query is not executing in Postgres DB
Previous:From: Dimitri FontaineDate: 2012-02-17 17:45:29
Subject: Re: Command Triggers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group