Re: Can column name aliases be supported? - Mailing list pgsql-general

From Craig Ringer
Subject Re: Can column name aliases be supported?
Date
Msg-id 5036E304.6090309@ringerc.id.au
Whole thread Raw
In response to Re: Can column name aliases be supported?  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List 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
returna "-E- You cannot update multiple aliases of the same base value" (something like that).  I'd just have to detect
thiscircumstance, 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



pgsql-general by date:

Previous
From: Chris Travers
Date:
Subject: Re: Some thoughts on table inheritance (which is uniquely awesome on PostgreSQL)
Next
From: Ondrej Ivanič
Date:
Subject: Re: Some thoughts on table inheritance (which is uniquely awesome on PostgreSQL)