summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane2002-08-31 22:10:48 +0000
committerTom Lane2002-08-31 22:10:48 +0000
commit845a6c3acccea0ec34e70808787aa7d431b0d96d (patch)
treec6e162146378dc6cdb62793d3b30674b6d64d465 /src/test
parent1440acd703e04f39340f7fb3a432b028a791e038 (diff)
Code review for domain-constraints patch. Use a new ConstraintTest node
type for runtime constraint checks, instead of misusing the parse-time Constraint node for the purpose. Fix some damage introduced into type coercion logic; in particular ensure that a coerced expression tree will read out the correct result type when inspected (patch had broken some RelabelType cases). Enforce domain NOT NULL constraints against columns that are omitted from an INSERT.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/domain.out7
-rw-r--r--src/test/regress/sql/domain.sql3
2 files changed, 4 insertions, 6 deletions
diff --git a/src/test/regress/expected/domain.out b/src/test/regress/expected/domain.out
index a67559129c..522c28121f 100644
--- a/src/test/regress/expected/domain.out
+++ b/src/test/regress/expected/domain.out
@@ -41,8 +41,7 @@ select * from basictest;
(2 rows)
-- check that domains inherit operations from base types
--- XXX shouldn't have to quote the constant here
-select testtext || testvarchar as concat, testnumeric + '42' as sum
+select testtext || testvarchar as concat, testnumeric + 42 as sum
from basictest;
concat | sum
-----------+--------
@@ -99,7 +98,7 @@ create table nulltest
, col4 dnull
);
INSERT INTO nulltest DEFAULT VALUES;
-ERROR: ExecInsert: Fail to add null value in not null attribute col3
+ERROR: Domain dnotnull does not allow NULL values
INSERT INTO nulltest values ('a', 'b', 'c', 'd'); -- Good
INSERT INTO nulltest values (NULL, 'b', 'c', 'd');
ERROR: Domain dnotnull does not allow NULL values
@@ -147,7 +146,7 @@ create table defaulttest
, col5 ddef1 NOT NULL DEFAULT NULL
, col6 ddef2 DEFAULT '88'
, col7 ddef4 DEFAULT 8000
- , col8 ddef5
+ , col8 ddef5
);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'defaulttest_pkey' for table 'defaulttest'
insert into defaulttest default values;
diff --git a/src/test/regress/sql/domain.sql b/src/test/regress/sql/domain.sql
index 4c2e7e31ac..9627870934 100644
--- a/src/test/regress/sql/domain.sql
+++ b/src/test/regress/sql/domain.sql
@@ -38,8 +38,7 @@ INSERT INTO basictest values ('88', 'haha', 'short', '123.1212'); -- Truncate
select * from basictest;
-- check that domains inherit operations from base types
--- XXX shouldn't have to quote the constant here
-select testtext || testvarchar as concat, testnumeric + '42' as sum
+select testtext || testvarchar as concat, testnumeric + 42 as sum
from basictest;
drop table basictest;