summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane2002-03-20 19:45:13 +0000
committerTom Lane2002-03-20 19:45:13 +0000
commit337b22cb473f1c5cca011a511c488d20e153eec4 (patch)
treebfec217a7ac7672d796217bfd9dce348a255e1b0 /src/test
parent251282d4b7bf7593cece7c4ce5669beb778604e3 (diff)
Code review for DOMAIN patch.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/domain.out36
-rw-r--r--src/test/regress/sql/domain.sql11
2 files changed, 42 insertions, 5 deletions
diff --git a/src/test/regress/expected/domain.out b/src/test/regress/expected/domain.out
index 4d8d13ec2d7..7127215869a 100644
--- a/src/test/regress/expected/domain.out
+++ b/src/test/regress/expected/domain.out
@@ -3,9 +3,9 @@ create domain domaindroptest int4;
comment on domain domaindroptest is 'About to drop this..';
create domain basetypetest domaindroptest;
ERROR: DefineDomain: domaindroptest is not a basetype
+drop domain domaindroptest cascade;
+ERROR: DROP DOMAIN does not support the CASCADE keyword
drop domain domaindroptest;
-ERROR: parser: parse error at or near ";"
-drop domain domaindroptest restrict;
-- TEST Domains.
create domain domainvarchar varchar(5);
create domain domainnumeric numeric(8,2);
@@ -29,11 +29,21 @@ select * from basictest;
88 | haha | short | 123.12
(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
+from basictest;
+ concat | sum
+-----------+--------
+ hahashort | 165.12
+ hahashort | 165.12
+(2 rows)
+
drop table basictest;
drop domain domainvarchar restrict;
drop domain domainnumeric restrict;
drop domain domainint4 restrict;
-drop domain domaintext restrict;
+drop domain domaintext;
-- Array Test
create domain domainint4arr int4[1];
create domain domaintextarr text[2][3];
@@ -46,6 +56,26 @@ INSERT INTO domarrtest values ('{{2,2}{2,2}}', '{{"a","b"}}');
INSERT INTO domarrtest values ('{2,2}', '{{"a","b"}{"c","d"}{"e"}}');
INSERT INTO domarrtest values ('{2,2}', '{{"a"}{"c"}}');
INSERT INTO domarrtest values (NULL, '{{"a","b"}{"c","d","e"}}');
+select * from domarrtest;
+ testint4arr | testtextarr
+---------------+---------------------
+ {2,2} | {{a,c},{"",d}}
+ {{2,2},{0,2}} | {{a,b}}
+ {2,2} | {{a},{c},{e}}
+ {2,2} | {{c},{""}}
+ | {{a,c,""},{"",d,e}}
+(5 rows)
+
+select testint4arr[1], testtextarr[2:2] from domarrtest;
+ testint4arr | testtextarr
+-------------+-------------
+ 2 | {{"",d}}
+ |
+ 2 | {{c}}
+ 2 | {{""}}
+ | {{"",d,e}}
+(5 rows)
+
drop table domarrtest;
drop domain domainint4arr restrict;
drop domain domaintextarr restrict;
diff --git a/src/test/regress/sql/domain.sql b/src/test/regress/sql/domain.sql
index 1417fe31896..cecb876c386 100644
--- a/src/test/regress/sql/domain.sql
+++ b/src/test/regress/sql/domain.sql
@@ -6,8 +6,8 @@ comment on domain domaindroptest is 'About to drop this..';
create domain basetypetest domaindroptest;
+drop domain domaindroptest cascade;
drop domain domaindroptest;
-drop domain domaindroptest restrict;
-- TEST Domains.
@@ -31,11 +31,16 @@ INSERT INTO basictest values ('88', 'haha', 'short text', '123.12'); -- Bad varc
INSERT INTO basictest values ('88', 'haha', 'short', '123.1212'); -- Truncate numeric
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
+from basictest;
+
drop table basictest;
drop domain domainvarchar restrict;
drop domain domainnumeric restrict;
drop domain domainint4 restrict;
-drop domain domaintext restrict;
+drop domain domaintext;
-- Array Test
@@ -51,6 +56,8 @@ INSERT INTO domarrtest values ('{{2,2}{2,2}}', '{{"a","b"}}');
INSERT INTO domarrtest values ('{2,2}', '{{"a","b"}{"c","d"}{"e"}}');
INSERT INTO domarrtest values ('{2,2}', '{{"a"}{"c"}}');
INSERT INTO domarrtest values (NULL, '{{"a","b"}{"c","d","e"}}');
+select * from domarrtest;
+select testint4arr[1], testtextarr[2:2] from domarrtest;
drop table domarrtest;
drop domain domainint4arr restrict;