-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b34bee
commit eafdeee
Showing
4 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
create domain domainvarchar varchar(5); | ||
create domain domainint4 int4; | ||
create domain domaintext text; | ||
create table basictest | ||
( testint4 domainint4 | ||
, testtext domaintext | ||
, testvarchar domainvarchar | ||
); | ||
INSERT INTO basictest values ('88', 'haha', 'short'); -- Good | ||
INSERT INTO basictest values ('88', 'haha', 'short text'); -- Bad varchar | ||
ERROR: value too long for type character varying(5) | ||
INSERT INTO basictest values ('888', 'haha', 'short'); | ||
select * from basictest; | ||
testint4 | testtext | testvarchar | ||
----------+----------+------------- | ||
88 | haha | short | ||
888 | haha | short | ||
(2 rows) | ||
|
||
select testtext || testvarchar as concat, testint4 + 12 as sum | ||
from basictest; | ||
concat | sum | ||
-----------+----- | ||
hahashort | 100 | ||
hahashort | 900 | ||
(2 rows) | ||
|
||
drop table basictest; | ||
drop domain domainvarchar restrict; | ||
drop domain domainint4 restrict; | ||
drop domain domaintext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ test: transaction_errors | |
test: secrets | ||
test: prepare | ||
test: function | ||
test: domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
create domain domainvarchar varchar(5); | ||
create domain domainint4 int4; | ||
create domain domaintext text; | ||
|
||
create table basictest | ||
( testint4 domainint4 | ||
, testtext domaintext | ||
, testvarchar domainvarchar | ||
); | ||
|
||
INSERT INTO basictest values ('88', 'haha', 'short'); -- Good | ||
INSERT INTO basictest values ('88', 'haha', 'short text'); -- Bad varchar | ||
INSERT INTO basictest values ('888', 'haha', 'short'); | ||
|
||
select * from basictest; | ||
|
||
select testtext || testvarchar as concat, testint4 + 12 as sum | ||
from basictest; | ||
|
||
drop table basictest; | ||
drop domain domainvarchar restrict; | ||
drop domain domainint4 restrict; | ||
drop domain domaintext; |