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

From Tom Lane
Subject Re: A VIEW mimicing a TABLE
Date
Msg-id 6913.1166026097@sss.pgh.pa.us
Whole thread Raw
In response to A VIEW mimicing a TABLE  (Rafal Pietrak <rafal@zorro.isa-geek.com>)
Responses Re: A VIEW mimicing a TABLE  (Rafal Pietrak <rafal@zorro.isa-geek.com>)
Re: A VIEW mimicing a TABLE  (Alban Hertroys <alban@magproductions.nl>)
List pgsql-general
Rafal Pietrak <rafal@zorro.isa-geek.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

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [girgen@FreeBSD.org: Re: port fault on pg_ctl's place]
Next
From: Erik Jones
Date:
Subject: Re: dynamic plpgsql question