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