Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-14 Thread William Leite Araújo
14 Dec 2006 02:45:12 -0800, SunWuKung <[EMAIL PROTECTED]>: > 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? A constant, a

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-14 Thread Rafal Pietrak
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 v

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-14 Thread SunWuKung
> 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? B. -

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-14 Thread Rafal Pietrak
On Thu, 2006-12-14 at 08:01 -0200, William Leite Araújo wrote: > > On 12/13/06, Rafal Pietrak <[EMAIL PROTECTED]> wrote: > CREATE RULE new_entry_notm AS ON INSERT to logview WHERE > new.tm IS NULL > DO INSTEAD INSERT (id,info) VALUES (new.id,new.info); > CREATE RULE

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-14 Thread William Leite Araújo
On 12/13/06, Rafal Pietrak <[EMAIL PROTECTED]> wrote: Hi, May be someone could help me with this: For some time now, I exercise the use of VIEWs to expose just the features of TABLES a particular user is supposed to see/have. I can see that with a VIEW, I can do prity mutch everything I can d

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-14 Thread Alban Hertroys
Tom Lane wrote: > Rafal Pietrak <[EMAIL PROTECTED]> writes: >> I can see that with a VIEW, I can do prity mutch everything I can do >> with a TABLE, so a VIEW mimics a TABLE quite well but one feature: a >> default value for a row on INSERT. > > You can add a default to a view's column, either

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-13 Thread Rafal Pietrak
On Wed, 2006-12-13 at 11:08 -0500, Tom Lane wrote: > > You can add a default to a view's column, either the same as the > underlying table's default, or different if you want. > > ALTER TABLE view ALTER COLUMN col SET DEFAULT expr G! The obvious solutions are most difficult to spot. Thenx! --

Re: [GENERAL] A VIEW mimicing a TABLE

2006-12-13 Thread Tom Lane
Rafal Pietrak <[EMAIL PROTECTED]> writes: > I can see that with a VIEW, I can do prity mutch everything I can do > with a TABLE, so a VIEW mimics a TABLE quite well but one feature: a > default value for a row on INSERT. You can add a default to a view's column, either the same as the underlyi

[GENERAL] A VIEW mimicing a TABLE

2006-12-13 Thread Rafal Pietrak
Hi, May be someone could help me with this: For some time now, I exercise the use of VIEWs to expose just the features of TABLES a particular user is supposed to see/have. I can see that with a VIEW, I can do prity mutch everything I can do with a TABLE, so a VIEW mimics a TABLE quite well b