Re: add constraints to views - Mailing list pgsql-general

From Tom Lane
Subject Re: add constraints to views
Date
Msg-id 25410.1064078047@sss.pgh.pa.us
Whole thread Raw
In response to Re: add constraints to views  (Andreas Fromm <Andreas.Fromm@physik.uni-erlangen.de>)
List pgsql-general
Andreas Fromm <Andreas.Fromm@physik.uni-erlangen.de> writes:
> No, I mean that the view behaves like a table with the same columns as
> table, but that restricts to records on wich tag is set. To insert a
> record to this "special"  table it requires to have field1 set. In other
> words: A record of table is a record of view if tag is set. If tag is
> set, then field1 has also have to have a value. If tag is not set, it
> may have a value for field1, but will not show up in the view. Of course
> I could achive this be triggers, but I thought it could be possible to
> do via constraints on the view.

Constraints on a view are meaningless --- it has no real rows to
constrain.  Put the constraints on the underlying table.

            regards, tom lane

pgsql-general by date:

Previous
From: Christopher Browne
Date:
Subject: Re: need for in-place upgrades
Next
From: Tom Lane
Date:
Subject: Re: State of Beta 2