Re: Emulating trigger BEFORE SELECT behavior

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
Cc: Alfonso Afonso <aafonsoc(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Emulating trigger BEFORE SELECT behavior
Date: 2013-04-18 14:30:19
Message-ID: 5170037B.4020008@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2013-04-18 14:31:38 Re: Emulating trigger BEFORE SELECT behavior
Previous Message Atri Sharma 2013-04-18 14:19:09 Re: Emulating trigger BEFORE SELECT behavior