diff options
| author | Bruce Momjian <bruce@momjian.us> | 2000-08-29 04:20:47 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2000-08-29 04:20:47 +0000 |
| commit | d4f626507ca56bf3e1a8adeea7f158535ddb0220 (patch) | |
| tree | 86f7e998ee995a2393c4e2b74f6573a57abf47c0 /src/test/regress/sql/alter_table.sql | |
| parent | c51041f4ba52d722c336a1ac28ebe6be61df88bc (diff) | |
| download | postgresql-d4f626507ca56bf3e1a8adeea7f158535ddb0220.tar.gz | |
This is mostly the same as an earlier patch I
didn't hear anything about, but which would
have broken with the function manager changes
anyway.
Well, this patch checks that a unique constraint
of some form (unique or pk) is on the referenced
columns of an FK constraint and that the columns
in the referencing table exist at creation time.
The former is to move closer to SQL compatibility
and the latter is in answer to a bug report.
I also added a basic check of this functionality
to the alter table and foreign key regression
tests.
Stephan Szabo
sszabo@bigpanda.com
Diffstat (limited to 'src/test/regress/sql/alter_table.sql')
| -rw-r--r-- | src/test/regress/sql/alter_table.sql | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index 0642e96ba1..cb7b9a2a46 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -180,6 +180,12 @@ INSERT INTO tmp3 values (1,10); INSERT INTO tmp3 values (1,20); INSERT INTO tmp3 values (5,50); +-- Try (and fail) to add constraint due to invalid source columns +ALTER TABLE tmp3 add constraint tmpconstr foreign key(c) references tmp2 match full; + +-- Try (and fail) to add constraint due to invalide destination columns explicitly given +ALTER TABLE tmp3 add constraint tmpconstr foreign key(a) references tmp2(b) match full; + -- Try (and fail) to add constraint due to invalid data ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 match full; |
