Re: Can column name aliases be supported?

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can column name aliases be supported?
Date: 2012-08-24 02:12:20
Message-ID: 5036E304.6090309@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/23/2012 10:19 PM, Gauthier, Dave wrote:
> Updateable views. This is great. I didn't know about these. Absolutely delicious !
> I found a great example here... http://vibhorkumar.wordpress.com/2011/10/28/instead-of-trigger/
>
> The problem of user updating >1 alias remains, but I have no problem bouncing them if they attempt that. Maybe return a "-E- You cannot update multiple aliases of the same base value" (something like that). I'd just have to detect this circumstance, raise the message and bounce (return OLD).
>
> Does this sound doable?

With a RULE, probably not.

With a `DO INSTEAD` view trigger - available in Pg 9.1 and above - yes.
I'd recommend using a view trigger instead of a rule if at all possible.
Rules are tricksy things and sooner or later they'll bite you.

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ondrej Ivanič 2012-08-24 02:17:43 Re: Some thoughts on table inheritance (which is uniquely awesome on PostgreSQL)
Previous Message Chris Travers 2012-08-24 02:04:01 Re: Some thoughts on table inheritance (which is uniquely awesome on PostgreSQL)