Add support for AT LOCAL
[pgsql.git] / src / test / regress / expected / name.out
blobd58df2ba4157ebf235c4defdb901320a862902a5
1 --
2 -- NAME
3 -- all inputs are silently truncated at NAMEDATALEN-1 (63) characters
4 --
5 -- fixed-length by reference
6 SELECT name 'name string' = name 'name string' AS "True";
7  True 
8 ------
9  t
10 (1 row)
12 SELECT name 'name string' = name 'name string ' AS "False";
13  False 
14 -------
15  f
16 (1 row)
21 CREATE TABLE NAME_TBL(f1 name);
22 INSERT INTO NAME_TBL(f1) VALUES ('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR');
23 INSERT INTO NAME_TBL(f1) VALUES ('1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr');
24 INSERT INTO NAME_TBL(f1) VALUES ('asdfghjkl;');
25 INSERT INTO NAME_TBL(f1) VALUES ('343f%2a');
26 INSERT INTO NAME_TBL(f1) VALUES ('d34aaasdf');
27 INSERT INTO NAME_TBL(f1) VALUES ('');
28 INSERT INTO NAME_TBL(f1) VALUES ('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ');
29 SELECT * FROM NAME_TBL;
30                                f1                                
31 -----------------------------------------------------------------
32  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
33  1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq
34  asdfghjkl;
35  343f%2a
36  d34aaasdf
38  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
39 (7 rows)
41 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 <> '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR';
42                                f1                                
43 -----------------------------------------------------------------
44  1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq
45  asdfghjkl;
46  343f%2a
47  d34aaasdf
49 (5 rows)
51 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR';
52                                f1                                
53 -----------------------------------------------------------------
54  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
55  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
56 (2 rows)
58 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 < '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR';
59  f1 
60 ----
62 (1 row)
64 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 <= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR';
65                                f1                                
66 -----------------------------------------------------------------
67  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
69  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
70 (3 rows)
72 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 > '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR';
73                                f1                                
74 -----------------------------------------------------------------
75  1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq
76  asdfghjkl;
77  343f%2a
78  d34aaasdf
79 (4 rows)
81 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 >= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR';
82                                f1                                
83 -----------------------------------------------------------------
84  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
85  1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq
86  asdfghjkl;
87  343f%2a
88  d34aaasdf
89  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
90 (6 rows)
92 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*';
93                                f1                                
94 -----------------------------------------------------------------
95  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
96  1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq
97  asdfghjkl;
98  343f%2a
99  d34aaasdf
101  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
102 (7 rows)
104 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 !~ '.*';
105  f1 
106 ----
107 (0 rows)
109 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 ~ '[0-9]';
110                                f1                                
111 -----------------------------------------------------------------
112  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
113  1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq
114  343f%2a
115  d34aaasdf
116  1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ
117 (5 rows)
119 SELECT c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*asdf.*';
120      f1     
121 ------------
122  asdfghjkl;
123  d34aaasdf
124 (2 rows)
126 DROP TABLE NAME_TBL;
127 DO $$
128 DECLARE r text[];
129 BEGIN
130   r := parse_ident('Schemax.Tabley');
131   RAISE NOTICE '%', format('%I.%I', r[1], r[2]);
132   r := parse_ident('"SchemaX"."TableY"');
133   RAISE NOTICE '%', format('%I.%I', r[1], r[2]);
134 END;
136 NOTICE:  schemax.tabley
137 NOTICE:  "SchemaX"."TableY"
138 SELECT parse_ident('foo.boo');
139  parse_ident 
140 -------------
141  {foo,boo}
142 (1 row)
144 SELECT parse_ident('foo.boo[]'); -- should fail
145 ERROR:  string is not a valid identifier: "foo.boo[]"
146 SELECT parse_ident('foo.boo[]', strict => false); -- ok
147  parse_ident 
148 -------------
149  {foo,boo}
150 (1 row)
152 -- should fail
153 SELECT parse_ident(' ');
154 ERROR:  string is not a valid identifier: " "
155 SELECT parse_ident(' .aaa');
156 ERROR:  string is not a valid identifier: " .aaa"
157 DETAIL:  No valid identifier before ".".
158 SELECT parse_ident(' aaa . ');
159 ERROR:  string is not a valid identifier: " aaa . "
160 DETAIL:  No valid identifier after ".".
161 SELECT parse_ident('aaa.a%b');
162 ERROR:  string is not a valid identifier: "aaa.a%b"
163 SELECT parse_ident(E'X\rXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
164 ERROR:  string is not a valid identifier: "X\rXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
165 SELECT length(a[1]), length(a[2]) from parse_ident('"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy') as a ;
166  length | length 
167 --------+--------
168     414 |    289
169 (1 row)
171 SELECT parse_ident(' first . "  second  " ."   third   ". "  ' || repeat('x',66) || '"');
172                                                 parse_ident                                                
173 -----------------------------------------------------------------------------------------------------------
174  {first,"  second  ","   third   ","  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
175 (1 row)
177 SELECT parse_ident(' first . "  second  " ."   third   ". "  ' || repeat('x',66) || '"')::name[];
178                                              parse_ident                                              
179 ------------------------------------------------------------------------------------------------------
180  {first,"  second  ","   third   ","  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
181 (1 row)
183 SELECT parse_ident(E'"c".X XXXX\002XXXXXX');
184 ERROR:  string is not a valid identifier: ""c".X XXXX\x02XXXXXX"
185 SELECT parse_ident('1020');
186 ERROR:  string is not a valid identifier: "1020"
187 SELECT parse_ident('10.20');
188 ERROR:  string is not a valid identifier: "10.20"
189 SELECT parse_ident('.');
190 ERROR:  string is not a valid identifier: "."
191 DETAIL:  No valid identifier before ".".
192 SELECT parse_ident('.1020');
193 ERROR:  string is not a valid identifier: ".1020"
194 DETAIL:  No valid identifier before ".".
195 SELECT parse_ident('xxx.1020');
196 ERROR:  string is not a valid identifier: "xxx.1020"
197 DETAIL:  No valid identifier after ".".