4 -- bad in postquel, but ok in PostgreSQL
18 -- this used to be a syntax error, but now we allow an empty target list
24 select * from nonesuch;
25 ERROR: relation "nonesuch" does not exist
26 LINE 1: select * from nonesuch;
28 -- bad name in target list
29 select nonesuch from pg_database;
30 ERROR: column "nonesuch" does not exist
31 LINE 1: select nonesuch from pg_database;
33 -- empty distinct list isn't OK
34 select distinct from pg_database;
35 ERROR: syntax error at or near "from"
36 LINE 1: select distinct from pg_database;
38 -- bad attribute name on lhs of operator
39 select * from pg_database where nonesuch = pg_database.datname;
40 ERROR: column "nonesuch" does not exist
41 LINE 1: select * from pg_database where nonesuch = pg_database.datna...
43 -- bad attribute name on rhs of operator
44 select * from pg_database where pg_database.datname = nonesuch;
45 ERROR: column "nonesuch" does not exist
46 LINE 1: ...ect * from pg_database where pg_database.datname = nonesuch;
48 -- bad attribute name in select distinct on
49 select distinct on (foobar) * from pg_database;
50 ERROR: column "foobar" does not exist
51 LINE 1: select distinct on (foobar) * from pg_database;
53 -- grouping with FOR UPDATE
54 select null from pg_database group by datname for update;
55 ERROR: FOR UPDATE is not allowed with GROUP BY clause
56 select null from pg_database group by grouping sets (()) for update;
57 ERROR: FOR UPDATE is not allowed with GROUP BY clause
60 -- missing relation name (this had better not wildcard!)
62 ERROR: syntax error at or near ";"
67 ERROR: relation "nonesuch" does not exist
68 LINE 1: delete from nonesuch;
72 -- missing relation name (this had better not wildcard!)
74 ERROR: syntax error at or near ";"
79 ERROR: table "nonesuch" does not exist
83 -- missing relation name
85 ERROR: syntax error at or near ";"
86 LINE 1: alter table rename;
89 alter table nonesuch rename to newnonesuch;
90 ERROR: relation "nonesuch" does not exist
92 alter table nonesuch rename to stud_emp;
93 ERROR: relation "nonesuch" does not exist
95 alter table stud_emp rename to student;
96 ERROR: relation "student" already exists
98 alter table stud_emp rename to stud_emp;
99 ERROR: relation "stud_emp" already exists
100 -- attribute renaming
102 alter table nonesuchrel rename column nonesuchatt to newnonesuchatt;
103 ERROR: relation "nonesuchrel" does not exist
105 alter table emp rename column nonesuchatt to newnonesuchatt;
106 ERROR: column "nonesuchatt" does not exist
108 alter table emp rename column salary to manager;
109 ERROR: column "manager" of relation "stud_emp" already exists
111 alter table emp rename column salary to ctid;
112 ERROR: column name "ctid" conflicts with a system column name
117 WARNING: there is no transaction in progress
120 WARNING: there is no transaction in progress
123 -- sfunc/finalfunc type disagreement
124 create aggregate newavg2 (sfunc = int4pl,
129 ERROR: function int2um(integer) does not exist
131 create aggregate newcnt1 (sfunc = int4inc,
134 ERROR: aggregate input type must be specified
137 -- missing index name
139 ERROR: syntax error at or near ";"
144 ERROR: syntax error at or near "314159"
145 LINE 1: drop index 314159;
149 ERROR: index "nonesuch" does not exist
152 -- missing aggregate name
154 ERROR: syntax error at or near ";"
155 LINE 1: drop aggregate;
157 -- missing aggregate type
158 drop aggregate newcnt1;
159 ERROR: syntax error at or near ";"
160 LINE 1: drop aggregate newcnt1;
162 -- bad aggregate name
163 drop aggregate 314159 (int);
164 ERROR: syntax error at or near "314159"
165 LINE 1: drop aggregate 314159 (int);
167 -- bad aggregate type
168 drop aggregate newcnt (nonesuch);
169 ERROR: type "nonesuch" does not exist
171 drop aggregate nonesuch (int4);
172 ERROR: aggregate nonesuch(integer) does not exist
173 -- no such aggregate for type
174 drop aggregate newcnt (float4);
175 ERROR: aggregate newcnt(real) does not exist
178 -- missing function name
180 ERROR: syntax error at or near "("
181 LINE 1: drop function ();
184 drop function 314159();
185 ERROR: syntax error at or near "314159"
186 LINE 1: drop function 314159();
189 drop function nonesuch();
190 ERROR: function nonesuch() does not exist
195 ERROR: syntax error at or near ";"
200 ERROR: syntax error at or near "314159"
201 LINE 1: drop type 314159;
205 ERROR: type "nonesuch" does not exist
208 -- missing everything
210 ERROR: syntax error at or near ";"
211 LINE 1: drop operator;
214 drop operator equals;
215 ERROR: syntax error at or near ";"
216 LINE 1: drop operator equals;
220 ERROR: syntax error at or near ";"
221 LINE 1: drop operator ===;
223 -- missing parentheses
224 drop operator int4, int4;
225 ERROR: syntax error at or near ","
226 LINE 1: drop operator int4, int4;
228 -- missing operator name
229 drop operator (int4, int4);
230 ERROR: syntax error at or near "("
231 LINE 1: drop operator (int4, int4);
233 -- missing type list contents
234 drop operator === ();
235 ERROR: syntax error at or near ")"
236 LINE 1: drop operator === ();
239 drop operator === (int4);
240 ERROR: missing argument
241 LINE 1: drop operator === (int4);
243 HINT: Use NONE to denote the missing argument of a unary operator.
244 -- no such operator by that name
245 drop operator === (int4, int4);
246 ERROR: operator does not exist: integer === integer
248 drop operator = (nonesuch);
249 ERROR: missing argument
250 LINE 1: drop operator = (nonesuch);
252 HINT: Use NONE to denote the missing argument of a unary operator.
254 drop operator = ( , int4);
255 ERROR: syntax error at or near ","
256 LINE 1: drop operator = ( , int4);
259 drop operator = (nonesuch, int4);
260 ERROR: type "nonesuch" does not exist
262 drop operator = (int4, nonesuch);
263 ERROR: type "nonesuch" does not exist
265 drop operator = (int4, );
266 ERROR: syntax error at or near ")"
267 LINE 1: drop operator = (int4, );
273 ERROR: syntax error at or near ";"
278 ERROR: syntax error at or near "314159"
279 LINE 1: drop rule 314159;
282 drop rule nonesuch on noplace;
283 ERROR: relation "noplace" does not exist
284 -- these postquel variants are no longer supported
285 drop tuple rule nonesuch;
286 ERROR: syntax error at or near "tuple"
287 LINE 1: drop tuple rule nonesuch;
289 drop instance rule nonesuch on noplace;
290 ERROR: syntax error at or near "instance"
291 LINE 1: drop instance rule nonesuch on noplace;
293 drop rewrite rule nonesuch;
294 ERROR: syntax error at or near "rewrite"
295 LINE 1: drop rewrite rule nonesuch;
298 -- Check that division-by-zero is properly caught.
301 ERROR: division by zero
303 ERROR: division by zero
305 ERROR: division by zero
307 ERROR: division by zero
309 ERROR: division by zero
311 ERROR: division by zero
313 ERROR: division by zero
315 ERROR: division by zero
317 ERROR: division by zero
319 ERROR: division by zero
321 ERROR: division by zero
323 -- Test psql's reporting of syntax error location
326 ERROR: syntax error at or near "xxx"
330 ERROR: syntax error at or near "foo"
334 ERROR: syntax error at or near ";"
335 LINE 1: CREATE TABLE ;
339 ERROR: syntax error at end of input
342 INSERT INTO foo VALUES(123) foo;
343 ERROR: syntax error at or near "foo"
344 LINE 1: INSERT INTO foo VALUES(123) foo;
348 ERROR: syntax error at or near "123"
349 LINE 1: INSERT INTO 123
354 ERROR: syntax error at or near "123"
355 LINE 2: VALUES(123) 123
359 (id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY,
361 id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL);
362 ERROR: syntax error at or near "NUL"
363 LINE 3: id3 INTEGER NOT NUL,
365 -- long line to be truncated on the left
366 CREATE TABLE foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL,
367 id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL);
368 ERROR: syntax error at or near "NUL"
369 LINE 1: ...OT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL,
371 -- long line to be truncated on the right
373 id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY);
374 ERROR: syntax error at or near "NUL"
375 LINE 2: id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQ...
377 -- long line to be truncated both ways
378 CREATE TABLE foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL);
379 ERROR: syntax error at or near "NUL"
380 LINE 1: ...L, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 I...
382 -- long line to be truncated on the left, many lines
386 foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL,
396 ERROR: syntax error at or near "NUL"
397 LINE 4: ...OT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL,
399 -- long line to be truncated on the right, many lines
404 id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY)
406 ERROR: syntax error at or near "NUL"
407 LINE 5: id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQ...
409 -- long line to be truncated both ways, many lines
416 UNIQUE NOT NULL, idx INT4 UNIQUE NOT NULL, idy INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL,
417 idz INT4 UNIQUE NOT NULL,
418 idv INT4 UNIQUE NOT NULL);
419 ERROR: syntax error at or near "NUL"
420 LINE 7: ...L, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 I...
422 -- more than 10 lines...
438 idx INT4 UNIQUE NOT NULL, idy INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL,
439 idz INT4 UNIQUE NOT NULL,
445 ERROR: syntax error at or near "NUL"
446 LINE 16: ...L, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 I...