diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-16 19:57:48 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-16 19:57:48 +0000 |
| commit | a4e1304ed1700c9831fdacc908fa0461ef0f5151 (patch) | |
| tree | 23b359a93d2342d2eb0a71892c13fe82bf575821 /src/test/regress/input | |
| parent | 47a895fe725e1b993a1e127aa534ebdc82982ff0 (diff) | |
| download | postgresql-a4e1304ed1700c9831fdacc908fa0461ef0f5151.tar.gz | |
Add check that inherited constraints and defaults work.
Diffstat (limited to 'src/test/regress/input')
| -rw-r--r-- | src/test/regress/input/constraints.source | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/test/regress/input/constraints.source b/src/test/regress/input/constraints.source index f30a2dd0ae..5c39c825c1 100644 --- a/src/test/regress/input/constraints.source +++ b/src/test/regress/input/constraints.source @@ -84,9 +84,10 @@ SELECT '' AS two, * from CHECK2_TBL; CREATE SEQUENCE INSERT_SEQ; CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'), - y TEXT DEFAULT '-NULL-', z INT DEFAULT -1 * currval('insert_seq'), - CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8), - CHECK (x + z = 0)); + y TEXT DEFAULT '-NULL-', + z INT DEFAULT -1 * currval('insert_seq'), + CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8), + CHECK (x + z = 0)); INSERT INTO INSERT_TBL VALUES (null, null, null); INSERT INTO INSERT_TBL(x,z) VALUES (2, -2); @@ -119,6 +120,23 @@ INSERT INTO INSERT_TBL(y) VALUES ('Y'); SELECT 'eight' AS one, currval('insert_seq'); -- +-- Check inheritance of defaults and constraints +-- + +CREATE TABLE INSERT_CHILD (cx INT default 42, + cy INT CHECK (cy > x)) + INHERITS (INSERT_TBL); + +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11); +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6); +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7); +INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7); + +SELECT * FROM INSERT_CHILD; + +DROP TABLE INSERT_CHILD; + +-- -- Check constraints on INSERT INTO -- |
