Re: Emulating trigger BEFORE SELECT behavior - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Emulating trigger BEFORE SELECT behavior
Date
Msg-id 5170037B.4020008@gmail.com
Whole thread Raw
In response to Re: Emulating trigger BEFORE SELECT behavior  (Atri Sharma <atri.jiit@gmail.com>)
List pgsql-general
On 04/18/2013 07:19 AM, Atri Sharma wrote:
>>
>> So what would you run the SELECT against, another view or table?
>
> No, what I meant was:
>
> SELECT on main table: fires a rule which updates a view V1
>
> Now, essentially, view V1 has the data I was trying to acquire
> originally through BEFORE INSERT trigger.
>
> When I need the data, I can query view V1.

Fair warning, it is morning here, the body is up, the brain cells are
lagging behind:) So here it goes, from the docs:

"Presently, ON SELECT rules must be unconditional INSTEAD rules and must
have actions that consist of a single SELECT command"

So if you want to do an UPDATE I'm guessing you will need to create a
function for the SELECT. Basically Alfonso's previous suggestion. This
is where things can start getting tricky.

This is where I grab a pencil and start laying out ideas on paper. Right
now I cannot offer anything more than that.

>
> Atri
>
>
> --
> Regards,
>
> Atri
> l'apprenant
>
>


--
Adrian Klaver
adrian.klaver@gmail.com


pgsql-general by date:

Previous
From: Atri Sharma
Date:
Subject: Re: Emulating trigger BEFORE SELECT behavior
Next
From: Fabrízio de Royes Mello
Date:
Subject: Re: Emulating trigger BEFORE SELECT behavior