summaryrefslogtreecommitdiff
path: root/src/test/regress/expected
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2006-06-27 03:43:20 +0000
committerBruce Momjian <bruce@momjian.us>2006-06-27 03:43:20 +0000
commitdc2c25fc6246866ce809a8b6bf1d2a2856334b54 (patch)
tree4674e3a5b63f72f1bc0805c05d14b908b0dd589c /src/test/regress/expected
parent62f2693688205bdfc5d61b905b70f3aad8234c5c (diff)
downloadpostgresql-dc2c25fc6246866ce809a8b6bf1d2a2856334b54.tar.gz
Add INCLUDING CONSTRAINTS to CREATE TABLE LIKE.
Greg Stark
Diffstat (limited to 'src/test/regress/expected')
-rw-r--r--src/test/regress/expected/inherit.out21
-rw-r--r--src/test/regress/expected/sanity_check.out3
2 files changed, 22 insertions, 2 deletions
diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out
index 9517c36baa..f4bdb8d825 100644
--- a/src/test/regress/expected/inherit.out
+++ b/src/test/regress/expected/inherit.out
@@ -606,7 +606,7 @@ SELECT * FROM a; /* Has ee entry */
CREATE TABLE inhf (LIKE inhx, LIKE inhx); /* Throw error */
ERROR: column "xx" duplicated
-CREATE TABLE inhf (LIKE inhx INCLUDING DEFAULTS);
+CREATE TABLE inhf (LIKE inhx INCLUDING DEFAULTS INCLUDING CONSTRAINTS);
INSERT INTO inhf DEFAULT VALUES;
SELECT * FROM inhf; /* Single entry with value 'text' */
xx
@@ -614,6 +614,25 @@ SELECT * FROM inhf; /* Single entry with value 'text' */
text
(1 row)
+ALTER TABLE inhx add constraint foo CHECK (xx = 'text');
+ALTER TABLE inhx ADD PRIMARY KEY (xx);
+NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "inhx_pkey" for table "inhx"
+CREATE TABLE inhg (LIKE inhx); /* Doesn't copy constraint */
+INSERT INTO inhg VALUES ('foo');
+DROP TABLE inhg;
+CREATE TABLE inhg (x text, LIKE inhx INCLUDING CONSTRAINTS, y text); /* Copies constraints */
+INSERT INTO inhg VALUES ('x', 'text', 'y'); /* Succeeds */
+INSERT INTO inhg VALUES ('x', 'text', 'y'); /* Succeeds -- Unique constraints not copied */
+INSERT INTO inhg VALUES ('x', 'foo', 'y'); /* fails due to constraint */
+ERROR: new row for relation "inhg" violates check constraint "foo"
+SELECT * FROM inhg; /* Two records with three columns in order x=x, xx=text, y=y */
+ x | xx | y
+---+------+---
+ x | text | y
+ x | text | y
+(2 rows)
+
+DROP TABLE inhg;
-- Test changing the type of inherited columns
insert into d values('test','one','two','three');
alter table a alter column aa type integer using bit_length(aa);
diff --git a/src/test/regress/expected/sanity_check.out b/src/test/regress/expected/sanity_check.out
index d1b9e21530..35c44d7a46 100644
--- a/src/test/regress/expected/sanity_check.out
+++ b/src/test/regress/expected/sanity_check.out
@@ -23,6 +23,7 @@ SELECT relname, relhasindex
hash_name_heap | t
hash_txt_heap | t
ihighway | t
+ inhx | t
num_exp_add | t
num_exp_div | t
num_exp_ln | t
@@ -70,7 +71,7 @@ SELECT relname, relhasindex
shighway | t
tenk1 | t
tenk2 | t
-(60 rows)
+(61 rows)
--
-- another sanity check: every system catalog that has OIDs should have