On Tue, 25 Nov 2014 21:41:12 +0100 Alban Hertroys <haramrae@xxxxxxxxx> 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general