4 CREATE TABLE VARCHAR_TBL(f1 varchar(1));
5 INSERT INTO VARCHAR_TBL (f1) VALUES ('a');
6 INSERT INTO VARCHAR_TBL (f1) VALUES ('A');
7 -- any of the following three input formats are acceptable
8 INSERT INTO VARCHAR_TBL (f1) VALUES ('1');
9 INSERT INTO VARCHAR_TBL (f1) VALUES (2);
10 INSERT INTO VARCHAR_TBL (f1) VALUES ('3');
12 INSERT INTO VARCHAR_TBL (f1) VALUES ('');
13 -- try varchar's of greater than 1 length
14 INSERT INTO VARCHAR_TBL (f1) VALUES ('cd');
15 ERROR: value too long for type character varying(1)
16 INSERT INTO VARCHAR_TBL (f1) VALUES ('c ');
17 SELECT * FROM VARCHAR_TBL;
92 DROP TABLE VARCHAR_TBL;
94 -- Now test longer arrays of char
96 CREATE TABLE VARCHAR_TBL(f1 varchar(4));
97 INSERT INTO VARCHAR_TBL (f1) VALUES ('a');
98 INSERT INTO VARCHAR_TBL (f1) VALUES ('ab');
99 INSERT INTO VARCHAR_TBL (f1) VALUES ('abcd');
100 INSERT INTO VARCHAR_TBL (f1) VALUES ('abcde');
101 ERROR: value too long for type character varying(4)
102 INSERT INTO VARCHAR_TBL (f1) VALUES ('abcd ');
103 SELECT * FROM VARCHAR_TBL;