From: | Bill Moran <wmoran(at)potentialtech(dot)com> |
---|---|
To: | Alban Hertroys <haramrae(at)gmail(dot)com> |
Cc: | pgsql-general General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: SQL functions and triggers? |
Date: | 2014-11-25 21:01:05 |
Message-ID: | 20141125160105.0c56e2605910d3b211038aac@potentialtech.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 25 Nov 2014 21:41:12 +0100
Alban Hertroys <haramrae(at)gmail(dot)com> wrote:
> Hi all,
>
> In the past, when writing trigger functions, I?ve always used pl/pgsql without giving it a second thought. Today I was modifying a database creation script that was originally intended for Firebird to work with Postgres and the example trigger procedures in there were very close to pure SQL.
>
> Hence, I started rewriting them as SQL functions, but is that really possible? The return-type for trigger functions is usually ?returns trigger?, which I don?t know how to translate to SQL. Next to that, what should the SQL statement inside the function be returning?
Last I checked, triggers had to be written in a language that could "return
trigger". A look at the 9.4 documentation seems to suggest that this is
still a requirement, although I didn't find a definitive statement to that
effect.
Since stored procedures written in SQL are unable to return the trigger type,
it's not currently possible to write triggers in SQL.
--
Bill Moran
I need your help to succeed:
http://gamesbybill.com
From | Date | Subject | |
---|---|---|---|
Next Message | Dev Kumkar | 2014-11-25 21:02:09 | Re: Transactions to create pg_multixact members and offsets |
Previous Message | Alban Hertroys | 2014-11-25 20:41:12 | SQL functions and triggers? |