Re: How to make the row changes inside trigger function visible to the top level sql statement?

From: Sergey Konoplev <sergey(dot)konoplev(at)postgresql-consulting(dot)com>
To: haifeng liu <haifeng(dot)813(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: How to make the row changes inside trigger function visible to the top level sql statement?
Date: 2012-08-09 11:11:45
Message-ID: CAL_0b1tSaJ0cp+oHsEnCP7qDemcHuNM-hUXpaBzrrrs5XTHyRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Aug 9, 2012 at 2:53 PM, Sergey Konoplev
<sergey(dot)konoplev(at)postgresql-consulting(dot)com> wrote:
>> How can I make the row changes inside the trigger function visible to the top level statement?
>
> your redirecting function is okay. However the only way to get the
> inserted row back is to do it from a subsequent statement in the
> partitioning case.

BTW I am not completely correct here. There is a solution but it is a
tricky one https://gist.github.com/59067. I am not sure if it is a
good performing one but it will work.

> In your application you can use LISTEN/NOTIFY if you need to get some
> specific information from trigger BTW. May be it will help somehow.
>
> --
> Sergey Konoplev
>
> a database architect, software developer at PostgreSQL-Consulting.com
> http://www.postgresql-consulting.com
>
> Jabber: gray(dot)ru(at)gmail(dot)com Skype: gray-hemp Phone: +79160686204

--
Sergey Konoplev

a database architect, software developer at PostgreSQL-Consulting.com
http://www.postgresql-consulting.com

Jabber: gray(dot)ru(at)gmail(dot)com Skype: gray-hemp Phone: +79160686204

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Haifeng Liu 2012-08-09 12:32:03 Re: How to make the row changes inside trigger function visible to the top level sql statement?
Previous Message Sergey Konoplev 2012-08-09 10:53:54 Re: How to make the row changes inside trigger function visible to the top level sql statement?