Re: A VIEW mimicing a TABLE - Mailing list pgsql-general

From Rafal Pietrak
Subject Re: A VIEW mimicing a TABLE
Date
Msg-id 1166097143.27564.114.camel@zorro.isa-geek.com
Whole thread Raw
In response to Re: A VIEW mimicing a TABLE  ("SunWuKung" <Balazs.Klein@t-online.hu>)
List pgsql-general
On Thu, 2006-12-14 at 02:45 -0800, SunWuKung wrote:
> > CREATE RULE new_entry AS ON INSERT to logview DO INSTEAD INSERT
> >    (id,tm,info) VALUES (COALESCE(new.id,[default]),COALESCE(new.tm
> > ,[default]),COALESCE(new.info,[default]));
>
> what would [default] insert here?
> the default of the view or the default of the underlying table?

I admit, I haven't tested that myself yet.

But as I understand 'the theory', it would be the default of a VIEW.

This is because we don't have any means to access the [default] of an
underlaying table (nothing like 'foreign-default-reference' :), so we
define a [default] for a VIEW as an entirely separate entity.

This might be a problem for sequences, but in that case, we may put
*the*same* sequence for a VIEW [default] and for an underalaying TABLE
[default], so we don't actually need 'foreign-default-reference'
'construct' here. Other requirements for 'common [default]' might prove
more difficult to implement, but for me this is quite sufficient.

--
-R

pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: about the RULE system
Next
From: Marc Evans
Date:
Subject: 8.2 server core dump