Re: A VIEW mimicing a TABLE

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: A VIEW mimicing a TABLE
Date: 2006-12-14 09:05:52
Message-ID: 458113F0.8040307@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com> 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
> underlying table's default, or different if you want.
>
> ALTER TABLE view ALTER COLUMN col SET DEFAULT expr

After blinking my eyes a few times, I tested this and indeed: You can
use ALTER TABLE on a view. Amazing...

/me makes a note to check the archives why there is no ALTER VIEW command.

--
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2006-12-14 09:16:01 Re: dynamic plpgsql question
Previous Message Vanyel 2006-12-14 08:16:01 How to check constraints before call of simple_heap_insert()?