Re: OLD pseudo relation for INSERT in rules and triggers

From: Rafał Pietrak <rafal(at)zorro(dot)isa-geek(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: OLD pseudo relation for INSERT in rules and triggers
Date: 2013-01-01 21:16:49
Message-ID: 50E35241.9090506@zorro.isa-geek.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

W dniu 01/01/2013 07:24 PM, Adrian Klaver pisze:
> On 01/01/2013 10:17 AM, Rafał Pietrak wrote:
>
[---------------]
>> If not, I think having OLD.* in INSERT rules/triggers is worth
>> pondering.
>>
>> The thing is, that it would be a valuable tool to mimic table-propper
>> functionality by a view. The OLD.* preudorelation on INSERT could
>> provide column defaults from the underlaying table definition.
[----------------]
>
> http://www.postgresql.org/docs/9.2/interactive/sql-alterview.html
>
> "SET/DROP DEFAULT
> These forms set or remove the default value for a column. A default
> value associated with a view column is inserted into INSERT statements
> on the view before the view's ON INSERT rule is applied, if the INSERT
> does not specify a value for the column."

Aha. I felt, I was missing something.

> It is not quite the same, but close.
>
It's not the same, as one has to keep track of the default value for one
thing in two places; but it's surely better then nothing (as I thought,
was the case).

thenx again,

-R

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marko Tiikkaja 2013-01-02 00:16:11 Re: Recovering from an exception
Previous Message Adrian Klaver 2013-01-01 18:24:54 Re: OLD pseudo relation for INSERT in rules and triggers