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

From Gaetano Mendola
Subject Re: add constraints to views
Date
Msg-id 3F6C3ACA.3020409@bigfoot.com
Whole thread Raw
In response to add constraints to views  (Andreas Fromm <Andreas.Fromm@physik.uni-erlangen.de>)
Responses Re: add constraints to views
List pgsql-general
Andreas Fromm wrote:

> CREATE VIEW test_view (
> ~    SELECT * FROM test_table WHERE tag
> );
>
> Now I want ad a NOT NULL constraint to the view on field1. I tryed the
> following, but neither works.

what does mean add a null constrain to a view ?  Do you mean
filter out the records with the field1 null ?

CREATE OR REPLACE test_view AS
     SELECT *
     FROM test_table
     WHERE field1 IS NOT NULL AND
           tag;


Regards
Gaetano Mendola


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: 'order by' does "wrong" with unicode-chars (german umlauts)
Next
From: Gaetano Mendola
Date:
Subject: Re: This mail list and its policies