add constraints to views

From: Andreas Fromm <Andreas(dot)Fromm(at)physik(dot)uni-erlangen(dot)de>
To: List pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: add constraints to views
Date: 2003-09-20 10:19:53
Message-ID: 3F6C29C9.5040607@physik.uni-erlangen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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-----

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gaetano Mendola 2003-09-20 11:32:26 Re: add constraints to views
Previous Message Mike Mascari 2003-09-20 05:20:42 Re: OT: HEADS-UP: viral storm out there