add constraints to views - Mailing list pgsql-general

From Andreas Fromm
Subject add constraints to views
Date
Msg-id 3F6C29C9.5040607@physik.uni-erlangen.de
Whole thread Raw
Responses Re: add constraints to views
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Please consider the following situation.

CREATE TABLE test_table (
~    id SERIAL PRIMARY_KEY,
~    tag BOOLEAN,
~    field1 INTEGER
);

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.

ALTER TABLE test_view ADD CONSTRAINT isit CHECK ( field1 IS NOT NULL);
ALTER TABLE test_view ALTER field1 SET NOT NULL;

How can I do this?

Regards

Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org

iD8DBQE/bCnEPkvkZVZzNY0RAgiBAKChAPbr+RV1bTYX5+2vnCg/KU6k5ACfeGmd
/tbh47tLhPee5mAkFLzODZU=
=LDWj
-----END PGP SIGNATURE-----



pgsql-general by date:

Previous
From: Mike Mascari
Date:
Subject: Re: OT: HEADS-UP: viral storm out there
Next
From: Richard Huxton
Date:
Subject: PG + PHP, was Re: Zend survey result about dbms...