Trigger function interface

Started by Tatsuo Ishiiover 10 years ago4 messagesgeneral
Jump to latest
#1Tatsuo Ishii
t-ishii@sra.co.jp

Is it possible to get the parse tree in a C trigger function which is
invoked when DML (INSERT/UPDATE/DELETE against a view) is executed?

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Tatsuo Ishii (#1)
Re: Trigger function interface

On 1/6/16 7:03 PM, Tatsuo Ishii wrote:

Is it possible to get the parse tree in a C trigger function which is
invoked when DML (INSERT/UPDATE/DELETE against a view) is executed?

Yes, it's in fcinfo->flinfo->fn_expr.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Jim Nasby (#2)
Re: Trigger function interface

On 1/6/16 7:03 PM, Tatsuo Ishii wrote:

Is it possible to get the parse tree in a C trigger function which is
invoked when DML (INSERT/UPDATE/DELETE against a view) is executed?

Yes, it's in fcinfo->flinfo->fn_expr.

Thanks for the info. But is this the parse tree for the top level
query which involves the trigger?

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Tatsuo Ishii (#3)
Re: Trigger function interface

On 1/7/16 6:15 PM, Tatsuo Ishii wrote:

On 1/6/16 7:03 PM, Tatsuo Ishii wrote:

Is it possible to get the parse tree in a C trigger function which is
invoked when DML (INSERT/UPDATE/DELETE against a view) is executed?

Yes, it's in fcinfo->flinfo->fn_expr.

Thanks for the info. But is this the parse tree for the top level
query which involves the trigger?

Hrm, apparently not. fcinfo->context would maybe be helpful, but I'm not
sure.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general