Re: SQL functions and triggers? - Mailing list pgsql-general

From Bill Moran
Subject Re: SQL functions and triggers?
Date
Msg-id 20141125160105.0c56e2605910d3b211038aac@potentialtech.com
Whole thread Raw
In response to SQL functions and triggers?  (Alban Hertroys <haramrae@gmail.com>)
List pgsql-general
On Tue, 25 Nov 2014 21:41:12 +0100
Alban Hertroys <haramrae@gmail.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
wasmodifying a database creation script that was originally intended for Firebird to work with Postgres and the example
triggerprocedures 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
isusually ?returns trigger?, which I don?t know how to translate to SQL. Next to that, what should the SQL statement
insidethe 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


pgsql-general by date:

Previous
From: Dev Kumkar
Date:
Subject: Re: Transactions to create pg_multixact members and offsets
Next
From: Dev Kumkar
Date:
Subject: Lock Management: Waiting on locks