Commit b153c092 authored by Tom Lane's avatar Tom Lane

Add a bunch of new error location reports to parse-analysis error messages.

There are still some weak spots around JOIN USING and relation alias lists,
but most errors reported within backend/parser/ now have locations.
parent 9ac42991
...@@ -257,88 +257,144 @@ SELECT '[(0,0,0,0),(1,0,0,0)]'::cube AS cube; ...@@ -257,88 +257,144 @@ SELECT '[(0,0,0,0),(1,0,0,0)]'::cube AS cube;
-- invalid input: parse errors -- invalid input: parse errors
SELECT ''::cube AS cube; SELECT ''::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT ''::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT 'ABC'::cube AS cube; SELECT 'ABC'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT 'ABC'::cube AS cube;
^
DETAIL: syntax error at or near "A" DETAIL: syntax error at or near "A"
SELECT '()'::cube AS cube; SELECT '()'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '()'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '[]'::cube AS cube; SELECT '[]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[()]'::cube AS cube; SELECT '[()]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[()]'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '[(1)]'::cube AS cube; SELECT '[(1)]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1)]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[(1),]'::cube AS cube; SELECT '[(1),]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[(1),2]'::cube AS cube; SELECT '[(1),2]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),2]'::cube AS cube;
^
DETAIL: syntax error at or near "2" DETAIL: syntax error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube; SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),(2),(3)]'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '1,'::cube AS cube; SELECT '1,'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,'::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT '1,2,'::cube AS cube; SELECT '1,2,'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2,'::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT '1,,2'::cube AS cube; SELECT '1,,2'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,,2'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '(1,)'::cube AS cube; SELECT '(1,)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,)'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '(1,2,)'::cube AS cube; SELECT '(1,2,)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,)'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '(1,,2)'::cube AS cube; SELECT '(1,,2)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,,2)'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
-- invalid input: semantic errors and trailing garbage -- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0 SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),(2)],'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1 SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1,2,3),(2,3)]'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2,3) and (2,3). DETAIL: Different point dimensions in (1,2,3) and (2,3).
SELECT '[(1,2),(1,2,3)]'::cube AS cube; -- 1 SELECT '[(1,2),(1,2,3)]'::cube AS cube; -- 1
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1,2),(1,2,3)]'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2) and (1,2,3). DETAIL: Different point dimensions in (1,2) and (1,2,3).
SELECT '(1),(2),'::cube AS cube; -- 2 SELECT '(1),(2),'::cube AS cube; -- 2
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1),(2),'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3 SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3),(2,3)'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2,3) and (2,3). DETAIL: Different point dimensions in (1,2,3) and (2,3).
SELECT '(1,2),(1,2,3)'::cube AS cube; -- 3 SELECT '(1,2),(1,2,3)'::cube AS cube; -- 3
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2),(1,2,3)'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2) and (1,2,3). DETAIL: Different point dimensions in (1,2) and (1,2,3).
SELECT '(1,2,3)ab'::cube AS cube; -- 4 SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3)ab'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5 SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3)a'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5 SELECT '(1,2)('::cube AS cube; -- 5
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2)('::cube AS cube;
^
DETAIL: syntax error at or near "(" DETAIL: syntax error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6 SELECT '1,2ab'::cube AS cube; -- 6
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2ab'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6 SELECT '1 e7'::cube AS cube; -- 6
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1 e7'::cube AS cube;
^
DETAIL: syntax error at or near "e" DETAIL: syntax error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7 SELECT '1,2a'::cube AS cube; -- 7
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2a'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '1..2'::cube AS cube; -- 7 SELECT '1..2'::cube AS cube; -- 7
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1..2'::cube AS cube;
^
DETAIL: syntax error at or near ".2" DETAIL: syntax error at or near ".2"
-- --
-- Testing building cubes from float8 values -- Testing building cubes from float8 values
...@@ -430,9 +486,13 @@ ERROR: Index out of bounds ...@@ -430,9 +486,13 @@ ERROR: Index out of bounds
-- --
select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube; select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...
^
DETAIL: A cube cannot have more than 100 dimensions. DETAIL: A cube cannot have more than 100 dimensions.
select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube; select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...
^
DETAIL: A cube cannot have more than 100 dimensions. DETAIL: A cube cannot have more than 100 dimensions.
-- --
-- testing the operators -- testing the operators
......
...@@ -257,88 +257,144 @@ SELECT '[(0,0,0,0),(1,0,0,0)]'::cube AS cube; ...@@ -257,88 +257,144 @@ SELECT '[(0,0,0,0),(1,0,0,0)]'::cube AS cube;
-- invalid input: parse errors -- invalid input: parse errors
SELECT ''::cube AS cube; SELECT ''::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT ''::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT 'ABC'::cube AS cube; SELECT 'ABC'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT 'ABC'::cube AS cube;
^
DETAIL: syntax error at or near "A" DETAIL: syntax error at or near "A"
SELECT '()'::cube AS cube; SELECT '()'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '()'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '[]'::cube AS cube; SELECT '[]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[()]'::cube AS cube; SELECT '[()]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[()]'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '[(1)]'::cube AS cube; SELECT '[(1)]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1)]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[(1),]'::cube AS cube; SELECT '[(1),]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[(1),2]'::cube AS cube; SELECT '[(1),2]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),2]'::cube AS cube;
^
DETAIL: syntax error at or near "2" DETAIL: syntax error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube; SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),(2),(3)]'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '1,'::cube AS cube; SELECT '1,'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,'::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT '1,2,'::cube AS cube; SELECT '1,2,'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2,'::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT '1,,2'::cube AS cube; SELECT '1,,2'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,,2'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '(1,)'::cube AS cube; SELECT '(1,)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,)'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '(1,2,)'::cube AS cube; SELECT '(1,2,)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,)'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '(1,,2)'::cube AS cube; SELECT '(1,,2)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,,2)'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
-- invalid input: semantic errors and trailing garbage -- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0 SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),(2)],'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1 SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1,2,3),(2,3)]'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2,3) and (2,3). DETAIL: Different point dimensions in (1,2,3) and (2,3).
SELECT '[(1,2),(1,2,3)]'::cube AS cube; -- 1 SELECT '[(1,2),(1,2,3)]'::cube AS cube; -- 1
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1,2),(1,2,3)]'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2) and (1,2,3). DETAIL: Different point dimensions in (1,2) and (1,2,3).
SELECT '(1),(2),'::cube AS cube; -- 2 SELECT '(1),(2),'::cube AS cube; -- 2
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1),(2),'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3 SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3),(2,3)'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2,3) and (2,3). DETAIL: Different point dimensions in (1,2,3) and (2,3).
SELECT '(1,2),(1,2,3)'::cube AS cube; -- 3 SELECT '(1,2),(1,2,3)'::cube AS cube; -- 3
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2),(1,2,3)'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2) and (1,2,3). DETAIL: Different point dimensions in (1,2) and (1,2,3).
SELECT '(1,2,3)ab'::cube AS cube; -- 4 SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3)ab'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5 SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3)a'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5 SELECT '(1,2)('::cube AS cube; -- 5
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2)('::cube AS cube;
^
DETAIL: syntax error at or near "(" DETAIL: syntax error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6 SELECT '1,2ab'::cube AS cube; -- 6
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2ab'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6 SELECT '1 e7'::cube AS cube; -- 6
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1 e7'::cube AS cube;
^
DETAIL: syntax error at or near "e" DETAIL: syntax error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7 SELECT '1,2a'::cube AS cube; -- 7
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2a'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '1..2'::cube AS cube; -- 7 SELECT '1..2'::cube AS cube; -- 7
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1..2'::cube AS cube;
^
DETAIL: syntax error at or near ".2" DETAIL: syntax error at or near ".2"
-- --
-- Testing building cubes from float8 values -- Testing building cubes from float8 values
...@@ -430,9 +486,13 @@ ERROR: Index out of bounds ...@@ -430,9 +486,13 @@ ERROR: Index out of bounds
-- --
select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube; select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...
^
DETAIL: A cube cannot have more than 100 dimensions. DETAIL: A cube cannot have more than 100 dimensions.
select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube; select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...
^
DETAIL: A cube cannot have more than 100 dimensions. DETAIL: A cube cannot have more than 100 dimensions.
-- --
-- testing the operators -- testing the operators
......
...@@ -257,88 +257,144 @@ SELECT '[(0,0,0,0),(1,0,0,0)]'::cube AS cube; ...@@ -257,88 +257,144 @@ SELECT '[(0,0,0,0),(1,0,0,0)]'::cube AS cube;
-- invalid input: parse errors -- invalid input: parse errors
SELECT ''::cube AS cube; SELECT ''::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT ''::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT 'ABC'::cube AS cube; SELECT 'ABC'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT 'ABC'::cube AS cube;
^
DETAIL: syntax error at or near "A" DETAIL: syntax error at or near "A"
SELECT '()'::cube AS cube; SELECT '()'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '()'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '[]'::cube AS cube; SELECT '[]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[()]'::cube AS cube; SELECT '[()]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[()]'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '[(1)]'::cube AS cube; SELECT '[(1)]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1)]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[(1),]'::cube AS cube; SELECT '[(1),]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),]'::cube AS cube;
^
DETAIL: syntax error at or near "]" DETAIL: syntax error at or near "]"
SELECT '[(1),2]'::cube AS cube; SELECT '[(1),2]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),2]'::cube AS cube;
^
DETAIL: syntax error at or near "2" DETAIL: syntax error at or near "2"
SELECT '[(1),(2),(3)]'::cube AS cube; SELECT '[(1),(2),(3)]'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),(2),(3)]'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '1,'::cube AS cube; SELECT '1,'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,'::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT '1,2,'::cube AS cube; SELECT '1,2,'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2,'::cube AS cube;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT '1,,2'::cube AS cube; SELECT '1,,2'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,,2'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '(1,)'::cube AS cube; SELECT '(1,)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,)'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '(1,2,)'::cube AS cube; SELECT '(1,2,)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,)'::cube AS cube;
^
DETAIL: syntax error at or near ")" DETAIL: syntax error at or near ")"
SELECT '(1,,2)'::cube AS cube; SELECT '(1,,2)'::cube AS cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,,2)'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
-- invalid input: semantic errors and trailing garbage -- invalid input: semantic errors and trailing garbage
SELECT '[(1),(2)],'::cube AS cube; -- 0 SELECT '[(1),(2)],'::cube AS cube; -- 0
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1),(2)],'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1 SELECT '[(1,2,3),(2,3)]'::cube AS cube; -- 1
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1,2,3),(2,3)]'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2,3) and (2,3). DETAIL: Different point dimensions in (1,2,3) and (2,3).
SELECT '[(1,2),(1,2,3)]'::cube AS cube; -- 1 SELECT '[(1,2),(1,2,3)]'::cube AS cube; -- 1
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '[(1,2),(1,2,3)]'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2) and (1,2,3). DETAIL: Different point dimensions in (1,2) and (1,2,3).
SELECT '(1),(2),'::cube AS cube; -- 2 SELECT '(1),(2),'::cube AS cube; -- 2
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1),(2),'::cube AS cube;
^
DETAIL: syntax error at or near "," DETAIL: syntax error at or near ","
SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3 SELECT '(1,2,3),(2,3)'::cube AS cube; -- 3
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3),(2,3)'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2,3) and (2,3). DETAIL: Different point dimensions in (1,2,3) and (2,3).
SELECT '(1,2),(1,2,3)'::cube AS cube; -- 3 SELECT '(1,2),(1,2,3)'::cube AS cube; -- 3
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2),(1,2,3)'::cube AS cube;
^
DETAIL: Different point dimensions in (1,2) and (1,2,3). DETAIL: Different point dimensions in (1,2) and (1,2,3).
SELECT '(1,2,3)ab'::cube AS cube; -- 4 SELECT '(1,2,3)ab'::cube AS cube; -- 4
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3)ab'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '(1,2,3)a'::cube AS cube; -- 5 SELECT '(1,2,3)a'::cube AS cube; -- 5
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2,3)a'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '(1,2)('::cube AS cube; -- 5 SELECT '(1,2)('::cube AS cube; -- 5
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '(1,2)('::cube AS cube;
^
DETAIL: syntax error at or near "(" DETAIL: syntax error at or near "("
SELECT '1,2ab'::cube AS cube; -- 6 SELECT '1,2ab'::cube AS cube; -- 6
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2ab'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '1 e7'::cube AS cube; -- 6 SELECT '1 e7'::cube AS cube; -- 6
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1 e7'::cube AS cube;
^
DETAIL: syntax error at or near "e" DETAIL: syntax error at or near "e"
SELECT '1,2a'::cube AS cube; -- 7 SELECT '1,2a'::cube AS cube; -- 7
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1,2a'::cube AS cube;
^
DETAIL: syntax error at or near "a" DETAIL: syntax error at or near "a"
SELECT '1..2'::cube AS cube; -- 7 SELECT '1..2'::cube AS cube; -- 7
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: SELECT '1..2'::cube AS cube;
^
DETAIL: syntax error at or near ".2" DETAIL: syntax error at or near ".2"
-- --
-- Testing building cubes from float8 values -- Testing building cubes from float8 values
...@@ -430,9 +486,13 @@ ERROR: Index out of bounds ...@@ -430,9 +486,13 @@ ERROR: Index out of bounds
-- --
select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube; select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...
^
DETAIL: A cube cannot have more than 100 dimensions. DETAIL: A cube cannot have more than 100 dimensions.
select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube; select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube;
ERROR: bad cube representation ERROR: bad cube representation
LINE 1: select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...
^
DETAIL: A cube cannot have more than 100 dimensions. DETAIL: A cube cannot have more than 100 dimensions.
-- --
-- testing the operators -- testing the operators
......
...@@ -394,30 +394,48 @@ SELECT '100(+-)1'::seg AS seg; ...@@ -394,30 +394,48 @@ SELECT '100(+-)1'::seg AS seg;
-- invalid input -- invalid input
SELECT ''::seg AS seg; SELECT ''::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT ''::seg AS seg;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT 'ABC'::seg AS seg; SELECT 'ABC'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT 'ABC'::seg AS seg;
^
DETAIL: syntax error at or near "A" DETAIL: syntax error at or near "A"
SELECT '1ABC'::seg AS seg; SELECT '1ABC'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1ABC'::seg AS seg;
^
DETAIL: syntax error at or near "A" DETAIL: syntax error at or near "A"
SELECT '1.'::seg AS seg; SELECT '1.'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1.'::seg AS seg;
^
DETAIL: syntax error at or near "." DETAIL: syntax error at or near "."
SELECT '1.....'::seg AS seg; SELECT '1.....'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1.....'::seg AS seg;
^
DETAIL: syntax error at or near ".." DETAIL: syntax error at or near ".."
SELECT '.1'::seg AS seg; SELECT '.1'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '.1'::seg AS seg;
^
DETAIL: syntax error at or near "." DETAIL: syntax error at or near "."
SELECT '1..2.'::seg AS seg; SELECT '1..2.'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1..2.'::seg AS seg;
^
DETAIL: syntax error at or near "." DETAIL: syntax error at or near "."
SELECT '1 e7'::seg AS seg; SELECT '1 e7'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1 e7'::seg AS seg;
^
DETAIL: syntax error at or near "e" DETAIL: syntax error at or near "e"
SELECT '1e700'::seg AS seg; SELECT '1e700'::seg AS seg;
ERROR: "1e700" is out of range for type real ERROR: "1e700" is out of range for type real
LINE 1: SELECT '1e700'::seg AS seg;
^
-- --
-- testing the operators -- testing the operators
-- --
......
...@@ -394,30 +394,48 @@ SELECT '100(+-)1'::seg AS seg; ...@@ -394,30 +394,48 @@ SELECT '100(+-)1'::seg AS seg;
-- invalid input -- invalid input
SELECT ''::seg AS seg; SELECT ''::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT ''::seg AS seg;
^
DETAIL: syntax error at end of input DETAIL: syntax error at end of input
SELECT 'ABC'::seg AS seg; SELECT 'ABC'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT 'ABC'::seg AS seg;
^
DETAIL: syntax error at or near "A" DETAIL: syntax error at or near "A"
SELECT '1ABC'::seg AS seg; SELECT '1ABC'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1ABC'::seg AS seg;
^
DETAIL: syntax error at or near "A" DETAIL: syntax error at or near "A"
SELECT '1.'::seg AS seg; SELECT '1.'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1.'::seg AS seg;
^
DETAIL: syntax error at or near "." DETAIL: syntax error at or near "."
SELECT '1.....'::seg AS seg; SELECT '1.....'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1.....'::seg AS seg;
^
DETAIL: syntax error at or near ".." DETAIL: syntax error at or near ".."
SELECT '.1'::seg AS seg; SELECT '.1'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '.1'::seg AS seg;
^
DETAIL: syntax error at or near "." DETAIL: syntax error at or near "."
SELECT '1..2.'::seg AS seg; SELECT '1..2.'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1..2.'::seg AS seg;
^
DETAIL: syntax error at or near "." DETAIL: syntax error at or near "."
SELECT '1 e7'::seg AS seg; SELECT '1 e7'::seg AS seg;
ERROR: bad seg representation ERROR: bad seg representation
LINE 1: SELECT '1 e7'::seg AS seg;
^
DETAIL: syntax error at or near "e" DETAIL: syntax error at or near "e"
SELECT '1e700'::seg AS seg; SELECT '1e700'::seg AS seg;
ERROR: "1e700" is out of range for type real ERROR: "1e700" is out of range for type real
LINE 1: SELECT '1e700'::seg AS seg;
^
-- --
-- testing the operators -- testing the operators
-- --
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.92 2008/05/09 23:32:04 tgl Exp $ * $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.93 2008/09/01 20:42:43 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -247,7 +247,7 @@ Boot_DeclareIndexStmt: ...@@ -247,7 +247,7 @@ Boot_DeclareIndexStmt:
{ {
do_start(); do_start();
DefineIndex(makeRangeVar(NULL, LexIDStr($6)), DefineIndex(makeRangeVar(NULL, LexIDStr($6), -1),
LexIDStr($3), LexIDStr($3),
$4, $4,
LexIDStr($8), LexIDStr($8),
...@@ -265,7 +265,7 @@ Boot_DeclareUniqueIndexStmt: ...@@ -265,7 +265,7 @@ Boot_DeclareUniqueIndexStmt:
{ {
do_start(); do_start();
DefineIndex(makeRangeVar(NULL, LexIDStr($7)), DefineIndex(makeRangeVar(NULL, LexIDStr($7), -1),
LexIDStr($4), LexIDStr($4),
$5, $5,
LexIDStr($9), LexIDStr($9),
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.244 2008/06/24 17:58:27 tgl Exp $ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.245 2008/09/01 20:42:43 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -637,7 +637,7 @@ boot_openrel(char *relname) ...@@ -637,7 +637,7 @@ boot_openrel(char *relname)
elog(DEBUG4, "open relation %s, attrsize %d", elog(DEBUG4, "open relation %s, attrsize %d",
relname, (int) ATTRIBUTE_TUPLE_SIZE); relname, (int) ATTRIBUTE_TUPLE_SIZE);
boot_reldesc = heap_openrv(makeRangeVar(NULL, relname), NoLock); boot_reldesc = heap_openrv(makeRangeVar(NULL, relname, -1), NoLock);
numattr = boot_reldesc->rd_rel->relnatts; numattr = boot_reldesc->rd_rel->relnatts;
for (i = 0; i < numattr; i++) for (i = 0; i < numattr; i++)
{ {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.110 2008/08/30 01:39:13 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.111 2008/09/01 20:42:43 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2156,7 +2156,7 @@ QualifiedNameGetCreationNamespace(List *names, char **objname_p) ...@@ -2156,7 +2156,7 @@ QualifiedNameGetCreationNamespace(List *names, char **objname_p)
RangeVar * RangeVar *
makeRangeVarFromNameList(List *names) makeRangeVarFromNameList(List *names)
{ {
RangeVar *rel = makeRangeVar(NULL, NULL); RangeVar *rel = makeRangeVar(NULL, NULL, -1);
switch (list_length(names)) switch (list_length(names))
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.10 2008/05/09 23:32:04 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.11 2008/09/01 20:42:43 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -73,7 +73,7 @@ BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid) ...@@ -73,7 +73,7 @@ BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid)
{ {
Relation rel; Relation rel;
rel = heap_openrv(makeRangeVar(NULL, relName), AccessExclusiveLock); rel = heap_openrv(makeRangeVar(NULL, relName, -1), AccessExclusiveLock);
/* Note: during bootstrap may see uncataloged relation */ /* Note: during bootstrap may see uncataloged relation */
if (rel->rd_rel->relkind != RELKIND_RELATION && if (rel->rd_rel->relkind != RELKIND_RELATION &&
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.264 2008/08/28 23:09:45 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.265 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -5112,7 +5112,8 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint, ...@@ -5112,7 +5112,8 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
* Reconstruct a RangeVar for my relation (not passed in, unfortunately). * Reconstruct a RangeVar for my relation (not passed in, unfortunately).
*/ */
myRel = makeRangeVar(get_namespace_name(RelationGetNamespace(rel)), myRel = makeRangeVar(get_namespace_name(RelationGetNamespace(rel)),
pstrdup(RelationGetRelationName(rel))); pstrdup(RelationGetRelationName(rel)),
-1);
/* Make changes-so-far visible */ /* Make changes-so-far visible */
CommandCounterIncrement(); CommandCounterIncrement();
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.236 2008/07/18 20:26:06 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.237 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -655,7 +655,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid) ...@@ -655,7 +655,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
else else
{ {
/* Work around ancient pg_dump bug that omitted constrrel */ /* Work around ancient pg_dump bug that omitted constrrel */
fkcon->pktable = makeRangeVar(NULL, pk_table_name); fkcon->pktable = makeRangeVar(NULL, pk_table_name, -1);
} }
} }
else else
...@@ -667,7 +667,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid) ...@@ -667,7 +667,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
else else
{ {
/* Work around ancient pg_dump bug that omitted constrrel */ /* Work around ancient pg_dump bug that omitted constrrel */
atstmt->relation = makeRangeVar(NULL, fk_table_name); atstmt->relation = makeRangeVar(NULL, fk_table_name, -1);
} }
} }
atstmt->cmds = list_make1(atcmd); atstmt->cmds = list_make1(atcmd);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.403 2008/08/30 01:39:13 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.404 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -722,6 +722,7 @@ _copyRangeVar(RangeVar *from) ...@@ -722,6 +722,7 @@ _copyRangeVar(RangeVar *from)
COPY_SCALAR_FIELD(inhOpt); COPY_SCALAR_FIELD(inhOpt);
COPY_SCALAR_FIELD(istemp); COPY_SCALAR_FIELD(istemp);
COPY_NODE_FIELD(alias); COPY_NODE_FIELD(alias);
COPY_LOCATION_FIELD(location);
return newnode; return newnode;
} }
...@@ -1773,10 +1774,11 @@ _copySortBy(SortBy *from) ...@@ -1773,10 +1774,11 @@ _copySortBy(SortBy *from)
{ {
SortBy *newnode = makeNode(SortBy); SortBy *newnode = makeNode(SortBy);
COPY_NODE_FIELD(node);
COPY_SCALAR_FIELD(sortby_dir); COPY_SCALAR_FIELD(sortby_dir);
COPY_SCALAR_FIELD(sortby_nulls); COPY_SCALAR_FIELD(sortby_nulls);
COPY_NODE_FIELD(useOp); COPY_NODE_FIELD(useOp);
COPY_NODE_FIELD(node); COPY_LOCATION_FIELD(location);
return newnode; return newnode;
} }
...@@ -2406,7 +2408,7 @@ _copyNotifyStmt(NotifyStmt *from) ...@@ -2406,7 +2408,7 @@ _copyNotifyStmt(NotifyStmt *from)
{ {
NotifyStmt *newnode = makeNode(NotifyStmt); NotifyStmt *newnode = makeNode(NotifyStmt);
COPY_NODE_FIELD(relation); COPY_STRING_FIELD(conditionname);
return newnode; return newnode;
} }
...@@ -2416,7 +2418,7 @@ _copyListenStmt(ListenStmt *from) ...@@ -2416,7 +2418,7 @@ _copyListenStmt(ListenStmt *from)
{ {
ListenStmt *newnode = makeNode(ListenStmt); ListenStmt *newnode = makeNode(ListenStmt);
COPY_NODE_FIELD(relation); COPY_STRING_FIELD(conditionname);
return newnode; return newnode;
} }
...@@ -2426,7 +2428,7 @@ _copyUnlistenStmt(UnlistenStmt *from) ...@@ -2426,7 +2428,7 @@ _copyUnlistenStmt(UnlistenStmt *from)
{ {
UnlistenStmt *newnode = makeNode(UnlistenStmt); UnlistenStmt *newnode = makeNode(UnlistenStmt);
COPY_NODE_FIELD(relation); COPY_STRING_FIELD(conditionname);
return newnode; return newnode;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.330 2008/08/30 01:39:13 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.331 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -106,6 +106,7 @@ _equalRangeVar(RangeVar *a, RangeVar *b) ...@@ -106,6 +106,7 @@ _equalRangeVar(RangeVar *a, RangeVar *b)
COMPARE_SCALAR_FIELD(inhOpt); COMPARE_SCALAR_FIELD(inhOpt);
COMPARE_SCALAR_FIELD(istemp); COMPARE_SCALAR_FIELD(istemp);
COMPARE_NODE_FIELD(alias); COMPARE_NODE_FIELD(alias);
COMPARE_LOCATION_FIELD(location);
return true; return true;
} }
...@@ -1230,7 +1231,7 @@ _equalRuleStmt(RuleStmt *a, RuleStmt *b) ...@@ -1230,7 +1231,7 @@ _equalRuleStmt(RuleStmt *a, RuleStmt *b)
static bool static bool
_equalNotifyStmt(NotifyStmt *a, NotifyStmt *b) _equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
{ {
COMPARE_NODE_FIELD(relation); COMPARE_STRING_FIELD(conditionname);
return true; return true;
} }
...@@ -1238,7 +1239,7 @@ _equalNotifyStmt(NotifyStmt *a, NotifyStmt *b) ...@@ -1238,7 +1239,7 @@ _equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
static bool static bool
_equalListenStmt(ListenStmt *a, ListenStmt *b) _equalListenStmt(ListenStmt *a, ListenStmt *b)
{ {
COMPARE_NODE_FIELD(relation); COMPARE_STRING_FIELD(conditionname);
return true; return true;
} }
...@@ -1246,7 +1247,7 @@ _equalListenStmt(ListenStmt *a, ListenStmt *b) ...@@ -1246,7 +1247,7 @@ _equalListenStmt(ListenStmt *a, ListenStmt *b)
static bool static bool
_equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b) _equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
{ {
COMPARE_NODE_FIELD(relation); COMPARE_STRING_FIELD(conditionname);
return true; return true;
} }
...@@ -1837,10 +1838,11 @@ _equalTypeCast(TypeCast *a, TypeCast *b) ...@@ -1837,10 +1838,11 @@ _equalTypeCast(TypeCast *a, TypeCast *b)
static bool static bool
_equalSortBy(SortBy *a, SortBy *b) _equalSortBy(SortBy *a, SortBy *b)
{ {
COMPARE_NODE_FIELD(node);
COMPARE_SCALAR_FIELD(sortby_dir); COMPARE_SCALAR_FIELD(sortby_dir);
COMPARE_SCALAR_FIELD(sortby_nulls); COMPARE_SCALAR_FIELD(sortby_nulls);
COMPARE_NODE_FIELD(useOp); COMPARE_NODE_FIELD(useOp);
COMPARE_NODE_FIELD(node); COMPARE_LOCATION_FIELD(location);
return true; return true;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.59 2008/08/28 23:09:46 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.60 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -266,7 +266,7 @@ makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, CoercionForm rformat) ...@@ -266,7 +266,7 @@ makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, CoercionForm rformat)
* creates a RangeVar node (rather oversimplified case) * creates a RangeVar node (rather oversimplified case)
*/ */
RangeVar * RangeVar *
makeRangeVar(char *schemaname, char *relname) makeRangeVar(char *schemaname, char *relname, int location)
{ {
RangeVar *r = makeNode(RangeVar); RangeVar *r = makeNode(RangeVar);
...@@ -276,6 +276,7 @@ makeRangeVar(char *schemaname, char *relname) ...@@ -276,6 +276,7 @@ makeRangeVar(char *schemaname, char *relname)
r->inhOpt = INH_DEFAULT; r->inhOpt = INH_DEFAULT;
r->istemp = false; r->istemp = false;
r->alias = NULL; r->alias = NULL;
r->location = location;
return r; return r;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.31 2008/08/28 23:09:46 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.32 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -613,6 +613,9 @@ exprLocation(Node *expr) ...@@ -613,6 +613,9 @@ exprLocation(Node *expr)
return -1; return -1;
switch (nodeTag(expr)) switch (nodeTag(expr))
{ {
case T_RangeVar:
loc = ((RangeVar *) expr)->location;
break;
case T_Var: case T_Var:
loc = ((Var *) expr)->location; loc = ((Var *) expr)->location;
break; break;
...@@ -789,6 +792,10 @@ exprLocation(Node *expr) ...@@ -789,6 +792,10 @@ exprLocation(Node *expr)
/* just use argument's location */ /* just use argument's location */
loc = exprLocation((Node *) ((TargetEntry *) expr)->expr); loc = exprLocation((Node *) ((TargetEntry *) expr)->expr);
break; break;
case T_IntoClause:
/* use the contained RangeVar's location --- close enough */
loc = exprLocation((Node *) ((IntoClause *) expr)->rel);
break;
case T_List: case T_List:
{ {
/* report location of first list member that has a location */ /* report location of first list member that has a location */
...@@ -852,6 +859,10 @@ exprLocation(Node *expr) ...@@ -852,6 +859,10 @@ exprLocation(Node *expr)
loc = leftmostLoc(loc, tc->location); loc = leftmostLoc(loc, tc->location);
} }
break; break;
case T_SortBy:
/* just use argument's location (ignore operator, if any) */
loc = exprLocation(((SortBy *) expr)->node);
break;
case T_TypeName: case T_TypeName:
loc = ((TypeName *) expr)->location; loc = ((TypeName *) expr)->location;
break; break;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.337 2008/08/30 01:39:14 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.338 2008/09/01 20:42:44 tgl Exp $
* *
* NOTES * NOTES
* Every node type that can appear in stored rules' parsetrees *must* * Every node type that can appear in stored rules' parsetrees *must*
...@@ -667,6 +667,7 @@ _outRangeVar(StringInfo str, RangeVar *node) ...@@ -667,6 +667,7 @@ _outRangeVar(StringInfo str, RangeVar *node)
WRITE_ENUM_FIELD(inhOpt, InhOption); WRITE_ENUM_FIELD(inhOpt, InhOption);
WRITE_BOOL_FIELD(istemp); WRITE_BOOL_FIELD(istemp);
WRITE_NODE_FIELD(alias); WRITE_NODE_FIELD(alias);
WRITE_LOCATION_FIELD(location);
} }
static void static void
...@@ -1609,7 +1610,7 @@ _outNotifyStmt(StringInfo str, NotifyStmt *node) ...@@ -1609,7 +1610,7 @@ _outNotifyStmt(StringInfo str, NotifyStmt *node)
{ {
WRITE_NODE_TYPE("NOTIFY"); WRITE_NODE_TYPE("NOTIFY");
WRITE_NODE_FIELD(relation); WRITE_STRING_FIELD(conditionname);
} }
static void static void
...@@ -2038,10 +2039,11 @@ _outSortBy(StringInfo str, SortBy *node) ...@@ -2038,10 +2039,11 @@ _outSortBy(StringInfo str, SortBy *node)
{ {
WRITE_NODE_TYPE("SORTBY"); WRITE_NODE_TYPE("SORTBY");
WRITE_NODE_FIELD(node);
WRITE_ENUM_FIELD(sortby_dir, SortByDir); WRITE_ENUM_FIELD(sortby_dir, SortByDir);
WRITE_ENUM_FIELD(sortby_nulls, SortByNulls); WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
WRITE_NODE_FIELD(useOp); WRITE_NODE_FIELD(useOp);
WRITE_NODE_FIELD(node); WRITE_LOCATION_FIELD(location);
} }
static void static void
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.213 2008/08/28 23:09:46 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.214 2008/09/01 20:42:44 tgl Exp $
* *
* NOTES * NOTES
* Path and Plan nodes do not have any readfuncs support, because we * Path and Plan nodes do not have any readfuncs support, because we
...@@ -179,7 +179,7 @@ _readNotifyStmt(void) ...@@ -179,7 +179,7 @@ _readNotifyStmt(void)
{ {
READ_LOCALS(NotifyStmt); READ_LOCALS(NotifyStmt);
READ_NODE_FIELD(relation); READ_STRING_FIELD(conditionname);
READ_DONE(); READ_DONE();
} }
...@@ -278,6 +278,7 @@ _readRangeVar(void) ...@@ -278,6 +278,7 @@ _readRangeVar(void)
READ_ENUM_FIELD(inhOpt, InhOption); READ_ENUM_FIELD(inhOpt, InhOption);
READ_BOOL_FIELD(istemp); READ_BOOL_FIELD(istemp);
READ_NODE_FIELD(alias); READ_NODE_FIELD(alias);
READ_LOCATION_FIELD(location);
READ_DONE(); READ_DONE();
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.150 2008/08/25 22:42:33 tgl Exp $ * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.151 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -733,7 +733,7 @@ build_physical_tlist(PlannerInfo *root, RelOptInfo *rel) ...@@ -733,7 +733,7 @@ build_physical_tlist(PlannerInfo *root, RelOptInfo *rel)
break; break;
case RTE_FUNCTION: case RTE_FUNCTION:
expandRTE(rte, varno, 0, true /* include dropped */ , expandRTE(rte, varno, 0, -1, true /* include dropped */ ,
NULL, &colvars); NULL, &colvars);
foreach(l, colvars) foreach(l, colvars)
{ {
...@@ -758,7 +758,7 @@ build_physical_tlist(PlannerInfo *root, RelOptInfo *rel) ...@@ -758,7 +758,7 @@ build_physical_tlist(PlannerInfo *root, RelOptInfo *rel)
break; break;
case RTE_VALUES: case RTE_VALUES:
expandRTE(rte, varno, 0, false /* dropped not applicable */ , expandRTE(rte, varno, 0, -1, false /* dropped not applicable */ ,
NULL, &colvars); NULL, &colvars);
foreach(l, colvars) foreach(l, colvars)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.78 2008/08/28 23:09:46 tgl Exp $ * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.79 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -30,10 +30,16 @@ typedef struct ...@@ -30,10 +30,16 @@ typedef struct
typedef struct typedef struct
{ {
int varno; int var_location;
int varattno;
int sublevels_up; int sublevels_up;
} contain_var_reference_context; } locate_var_of_level_context;
typedef struct
{
int var_location;
int relid;
int sublevels_up;
} locate_var_of_relation_context;
typedef struct typedef struct
{ {
...@@ -56,11 +62,12 @@ typedef struct ...@@ -56,11 +62,12 @@ typedef struct
static bool pull_varnos_walker(Node *node, static bool pull_varnos_walker(Node *node,
pull_varnos_context *context); pull_varnos_context *context);
static bool pull_varattnos_walker(Node *node, Bitmapset **varattnos); static bool pull_varattnos_walker(Node *node, Bitmapset **varattnos);
static bool contain_var_reference_walker(Node *node,
contain_var_reference_context *context);
static bool contain_var_clause_walker(Node *node, void *context); static bool contain_var_clause_walker(Node *node, void *context);
static bool contain_vars_of_level_walker(Node *node, int *sublevels_up); static bool contain_vars_of_level_walker(Node *node, int *sublevels_up);
static bool contain_vars_above_level_walker(Node *node, int *sublevels_up); static bool locate_var_of_level_walker(Node *node,
locate_var_of_level_context *context);
static bool locate_var_of_relation_walker(Node *node,
locate_var_of_relation_context *context);
static bool find_minimum_var_level_walker(Node *node, static bool find_minimum_var_level_walker(Node *node,
find_minimum_var_level_context *context); find_minimum_var_level_context *context);
static bool pull_var_clause_walker(Node *node, static bool pull_var_clause_walker(Node *node,
...@@ -136,6 +143,7 @@ pull_varnos_walker(Node *node, pull_varnos_context *context) ...@@ -136,6 +143,7 @@ pull_varnos_walker(Node *node, pull_varnos_context *context)
(void *) context); (void *) context);
} }
/* /*
* pull_varattnos * pull_varattnos
* Find all the distinct attribute numbers present in an expression tree, * Find all the distinct attribute numbers present in an expression tree,
...@@ -178,69 +186,6 @@ pull_varattnos_walker(Node *node, Bitmapset **varattnos) ...@@ -178,69 +186,6 @@ pull_varattnos_walker(Node *node, Bitmapset **varattnos)
} }
/*
* contain_var_reference
*
* Detect whether a parsetree contains any references to a specified
* attribute of a specified rtable entry.
*
* NOTE: this is used on not-yet-planned expressions. It may therefore find
* bare SubLinks, and if so it needs to recurse into them to look for uplevel
* references to the desired rtable entry! But when we find a completed
* SubPlan, we only need to look at the parameters passed to the subplan.
*/
bool
contain_var_reference(Node *node, int varno, int varattno, int levelsup)
{
contain_var_reference_context context;
context.varno = varno;
context.varattno = varattno;
context.sublevels_up = levelsup;
/*
* Must be prepared to start with a Query or a bare expression tree; if
* it's a Query, we don't want to increment sublevels_up.
*/
return query_or_expression_tree_walker(node,
contain_var_reference_walker,
(void *) &context,
0);
}
static bool
contain_var_reference_walker(Node *node,
contain_var_reference_context *context)
{
if (node == NULL)
return false;
if (IsA(node, Var))
{
Var *var = (Var *) node;
if (var->varno == context->varno &&
var->varattno == context->varattno &&
var->varlevelsup == context->sublevels_up)
return true;
return false;
}
if (IsA(node, Query))
{
/* Recurse into RTE subquery or not-yet-planned sublink subquery */
bool result;
context->sublevels_up++;
result = query_tree_walker((Query *) node,
contain_var_reference_walker,
(void *) context, 0);
context->sublevels_up--;
return result;
}
return expression_tree_walker(node, contain_var_reference_walker,
(void *) context);
}
/* /*
* contain_var_clause * contain_var_clause
* Recursively scan a clause to discover whether it contains any Var nodes * Recursively scan a clause to discover whether it contains any Var nodes
...@@ -273,6 +218,7 @@ contain_var_clause_walker(Node *node, void *context) ...@@ -273,6 +218,7 @@ contain_var_clause_walker(Node *node, void *context)
return expression_tree_walker(node, contain_var_clause_walker, context); return expression_tree_walker(node, contain_var_clause_walker, context);
} }
/* /*
* contain_vars_of_level * contain_vars_of_level
* Recursively scan a clause to discover whether it contains any Var nodes * Recursively scan a clause to discover whether it contains any Var nodes
...@@ -328,53 +274,146 @@ contain_vars_of_level_walker(Node *node, int *sublevels_up) ...@@ -328,53 +274,146 @@ contain_vars_of_level_walker(Node *node, int *sublevels_up)
(void *) sublevels_up); (void *) sublevels_up);
} }
/* /*
* contain_vars_above_level * locate_var_of_level
* Recursively scan a clause to discover whether it contains any Var nodes * Find the parse location of any Var of the specified query level.
* above the specified query level. (For example, pass zero to detect
* all nonlocal Vars.)
* *
* Returns true if any such Var found. * Returns -1 if no such Var is in the querytree, or if they all have
* unknown parse location. (The former case is probably caller error,
* but we don't bother to distinguish it from the latter case.)
* *
* Will recurse into sublinks. Also, may be invoked directly on a Query. * Will recurse into sublinks. Also, may be invoked directly on a Query.
*
* Note: it might seem appropriate to merge this functionality into
* contain_vars_of_level, but that would complicate that function's API.
* Currently, the only uses of this function are for error reporting,
* and so shaving cycles probably isn't very important.
*/ */
bool int
contain_vars_above_level(Node *node, int levelsup) locate_var_of_level(Node *node, int levelsup)
{ {
int sublevels_up = levelsup; locate_var_of_level_context context;
return query_or_expression_tree_walker(node, context.var_location = -1; /* in case we find nothing */
contain_vars_above_level_walker, context.sublevels_up = levelsup;
(void *) &sublevels_up,
(void) query_or_expression_tree_walker(node,
locate_var_of_level_walker,
(void *) &context,
0); 0);
return context.var_location;
} }
static bool static bool
contain_vars_above_level_walker(Node *node, int *sublevels_up) locate_var_of_level_walker(Node *node,
locate_var_of_level_context *context)
{ {
if (node == NULL) if (node == NULL)
return false; return false;
if (IsA(node, Var)) if (IsA(node, Var))
{ {
if (((Var *) node)->varlevelsup > *sublevels_up) Var *var = (Var *) node;
if (var->varlevelsup == context->sublevels_up &&
var->location >= 0)
{
context->var_location = var->location;
return true; /* abort tree traversal and return true */ return true; /* abort tree traversal and return true */
}
return false;
}
if (IsA(node, CurrentOfExpr))
{
/* since CurrentOfExpr doesn't carry location, nothing we can do */
return false;
} }
if (IsA(node, Query)) if (IsA(node, Query))
{ {
/* Recurse into subselects */ /* Recurse into subselects */
bool result; bool result;
(*sublevels_up)++; context->sublevels_up++;
result = query_tree_walker((Query *) node, result = query_tree_walker((Query *) node,
contain_vars_above_level_walker, locate_var_of_level_walker,
(void *) sublevels_up, (void *) context,
0); 0);
(*sublevels_up)--; context->sublevels_up--;
return result; return result;
} }
return expression_tree_walker(node, return expression_tree_walker(node,
contain_vars_above_level_walker, locate_var_of_level_walker,
(void *) sublevels_up); (void *) context);
}
/*
* locate_var_of_relation
* Find the parse location of any Var of the specified relation.
*
* Returns -1 if no such Var is in the querytree, or if they all have
* unknown parse location.
*
* Will recurse into sublinks. Also, may be invoked directly on a Query.
*/
int
locate_var_of_relation(Node *node, int relid, int levelsup)
{
locate_var_of_relation_context context;
context.var_location = -1; /* in case we find nothing */
context.relid = relid;
context.sublevels_up = levelsup;
(void) query_or_expression_tree_walker(node,
locate_var_of_relation_walker,
(void *) &context,
0);
return context.var_location;
}
static bool
locate_var_of_relation_walker(Node *node,
locate_var_of_relation_context *context)
{
if (node == NULL)
return false;
if (IsA(node, Var))
{
Var *var = (Var *) node;
if (var->varno == context->relid &&
var->varlevelsup == context->sublevels_up &&
var->location >= 0)
{
context->var_location = var->location;
return true; /* abort tree traversal and return true */
}
return false;
}
if (IsA(node, CurrentOfExpr))
{
/* since CurrentOfExpr doesn't carry location, nothing we can do */
return false;
}
if (IsA(node, Query))
{
/* Recurse into subselects */
bool result;
context->sublevels_up++;
result = query_tree_walker((Query *) node,
locate_var_of_relation_walker,
(void *) context,
0);
context->sublevels_up--;
return result;
}
return expression_tree_walker(node,
locate_var_of_relation_walker,
(void *) context);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.82 2008/08/28 23:09:47 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.83 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -70,7 +70,9 @@ transformAggregateCall(ParseState *pstate, Aggref *agg) ...@@ -70,7 +70,9 @@ transformAggregateCall(ParseState *pstate, Aggref *agg)
if (checkExprHasAggs((Node *) agg->args)) if (checkExprHasAggs((Node *) agg->args))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR), (errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregate function calls cannot be nested"))); errmsg("aggregate function calls cannot be nested"),
parser_errposition(pstate,
locate_agg_of_level((Node *) agg->args, 0))));
} }
if (min_varlevel < 0) if (min_varlevel < 0)
...@@ -117,11 +119,15 @@ parseCheckAggregates(ParseState *pstate, Query *qry) ...@@ -117,11 +119,15 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
if (checkExprHasAggs(qry->jointree->quals)) if (checkExprHasAggs(qry->jointree->quals))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR), (errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregates not allowed in WHERE clause"))); errmsg("aggregates not allowed in WHERE clause"),
parser_errposition(pstate,
locate_agg_of_level(qry->jointree->quals, 0))));
if (checkExprHasAggs((Node *) qry->jointree->fromlist)) if (checkExprHasAggs((Node *) qry->jointree->fromlist))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR), (errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregates not allowed in JOIN conditions"))); errmsg("aggregates not allowed in JOIN conditions"),
parser_errposition(pstate,
locate_agg_of_level((Node *) qry->jointree->fromlist, 0))));
/* /*
* No aggregates allowed in GROUP BY clauses, either. * No aggregates allowed in GROUP BY clauses, either.
...@@ -140,7 +146,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry) ...@@ -140,7 +146,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
if (checkExprHasAggs(expr)) if (checkExprHasAggs(expr))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR), (errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregates not allowed in GROUP BY clause"))); errmsg("aggregates not allowed in GROUP BY clause"),
parser_errposition(pstate,
locate_agg_of_level(expr, 0))));
groupClauses = lcons(expr, groupClauses); groupClauses = lcons(expr, groupClauses);
} }
...@@ -327,13 +335,14 @@ check_ungrouped_columns_walker(Node *node, ...@@ -327,13 +335,14 @@ check_ungrouped_columns_walker(Node *node,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR), (errcode(ERRCODE_GROUPING_ERROR),
errmsg("column \"%s.%s\" must appear in the GROUP BY clause or be used in an aggregate function", errmsg("column \"%s.%s\" must appear in the GROUP BY clause or be used in an aggregate function",
rte->eref->aliasname, attname))); rte->eref->aliasname, attname),
parser_errposition(context->pstate, var->location)));
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR), (errcode(ERRCODE_GROUPING_ERROR),
errmsg("subquery uses ungrouped column \"%s.%s\" from outer query", errmsg("subquery uses ungrouped column \"%s.%s\" from outer query",
rte->eref->aliasname, attname))); rte->eref->aliasname, attname),
parser_errposition(context->pstate, var->location)));
} }
if (IsA(node, Query)) if (IsA(node, Query))
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.165 2008/08/28 23:09:47 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.166 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -180,6 +180,7 @@ coerce_type(ParseState *pstate, Node *node, ...@@ -180,6 +180,7 @@ coerce_type(ParseState *pstate, Node *node,
Oid baseTypeId; Oid baseTypeId;
int32 baseTypeMod; int32 baseTypeMod;
Type targetType; Type targetType;
ParseCallbackState pcbstate;
/* /*
* If the target type is a domain, we want to call its base type's * If the target type is a domain, we want to call its base type's
...@@ -207,6 +208,12 @@ coerce_type(ParseState *pstate, Node *node, ...@@ -207,6 +208,12 @@ coerce_type(ParseState *pstate, Node *node,
else else
newcon->location = location; newcon->location = location;
/*
* Set up to point at the constant's text if the input routine
* throws an error.
*/
setup_parser_errposition_callback(&pcbstate, pstate, con->location);
/* /*
* We pass typmod -1 to the input routine, primarily because existing * We pass typmod -1 to the input routine, primarily because existing
* input routines follow implicit-coercion semantics for length * input routines follow implicit-coercion semantics for length
...@@ -223,6 +230,8 @@ coerce_type(ParseState *pstate, Node *node, ...@@ -223,6 +230,8 @@ coerce_type(ParseState *pstate, Node *node,
else else
newcon->constvalue = stringTypeDatum(targetType, NULL, -1); newcon->constvalue = stringTypeDatum(targetType, NULL, -1);
cancel_parser_errposition_callback(&pcbstate);
result = (Node *) newcon; result = (Node *) newcon;
/* If target is a domain, apply constraints. */ /* If target is a domain, apply constraints. */
...@@ -257,7 +266,8 @@ coerce_type(ParseState *pstate, Node *node, ...@@ -257,7 +266,8 @@ coerce_type(ParseState *pstate, Node *node,
paramno > toppstate->p_numparams) paramno > toppstate->p_numparams)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_PARAMETER), (errcode(ERRCODE_UNDEFINED_PARAMETER),
errmsg("there is no parameter $%d", paramno))); errmsg("there is no parameter $%d", paramno),
parser_errposition(pstate, param->location)));
if (toppstate->p_paramtypes[paramno - 1] == UNKNOWNOID) if (toppstate->p_paramtypes[paramno - 1] == UNKNOWNOID)
{ {
...@@ -277,7 +287,8 @@ coerce_type(ParseState *pstate, Node *node, ...@@ -277,7 +287,8 @@ coerce_type(ParseState *pstate, Node *node,
paramno), paramno),
errdetail("%s versus %s", errdetail("%s versus %s",
format_type_be(toppstate->p_paramtypes[paramno - 1]), format_type_be(toppstate->p_paramtypes[paramno - 1]),
format_type_be(targetTypeId)))); format_type_be(targetTypeId)),
parser_errposition(pstate, param->location)));
} }
param->paramtype = targetTypeId; param->paramtype = targetTypeId;
...@@ -819,10 +830,11 @@ coerce_record_to_complex(ParseState *pstate, Node *node, ...@@ -819,10 +830,11 @@ coerce_record_to_complex(ParseState *pstate, Node *node,
{ {
int rtindex = ((Var *) node)->varno; int rtindex = ((Var *) node)->varno;
int sublevels_up = ((Var *) node)->varlevelsup; int sublevels_up = ((Var *) node)->varlevelsup;
int vlocation = ((Var *) node)->location;
RangeTblEntry *rte; RangeTblEntry *rte;
rte = GetRTEByRangeTablePosn(pstate, rtindex, sublevels_up); rte = GetRTEByRangeTablePosn(pstate, rtindex, sublevels_up);
expandRTE(rte, rtindex, sublevels_up, false, expandRTE(rte, rtindex, sublevels_up, vlocation, false,
NULL, &args); NULL, &args);
} }
else else
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.233 2008/08/30 01:39:14 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.234 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -122,7 +122,7 @@ transformExpr(ParseState *pstate, Node *expr) ...@@ -122,7 +122,7 @@ transformExpr(ParseState *pstate, Node *expr)
A_Const *con = (A_Const *) expr; A_Const *con = (A_Const *) expr;
Value *val = &con->val; Value *val = &con->val;
result = (Node *) make_const(val, con->location); result = (Node *) make_const(pstate, val, con->location);
break; break;
} }
...@@ -454,6 +454,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) ...@@ -454,6 +454,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
* "rel.*". * "rel.*".
*/ */
if (refnameRangeTblEntry(pstate, NULL, name1, if (refnameRangeTblEntry(pstate, NULL, name1,
cref->location,
&levels_up) != NULL) &levels_up) != NULL)
node = transformWholeRowRef(pstate, NULL, name1, node = transformWholeRowRef(pstate, NULL, name1,
cref->location); cref->location);
...@@ -621,7 +622,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) ...@@ -621,7 +622,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
* return a pointer to it. * return a pointer to it.
*/ */
static Oid * static Oid *
find_param_type(ParseState *pstate, int paramno) find_param_type(ParseState *pstate, int paramno, int location)
{ {
Oid *result; Oid *result;
...@@ -635,14 +636,15 @@ find_param_type(ParseState *pstate, int paramno) ...@@ -635,14 +636,15 @@ find_param_type(ParseState *pstate, int paramno)
if (paramno <= 0) /* probably can't happen? */ if (paramno <= 0) /* probably can't happen? */
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_PARAMETER), (errcode(ERRCODE_UNDEFINED_PARAMETER),
errmsg("there is no parameter $%d", paramno))); errmsg("there is no parameter $%d", paramno),
parser_errposition(pstate, location)));
if (paramno > pstate->p_numparams) if (paramno > pstate->p_numparams)
{ {
if (!pstate->p_variableparams) if (!pstate->p_variableparams)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_PARAMETER), (errcode(ERRCODE_UNDEFINED_PARAMETER),
errmsg("there is no parameter $%d", errmsg("there is no parameter $%d", paramno),
paramno))); parser_errposition(pstate, location)));
/* Okay to enlarge param array */ /* Okay to enlarge param array */
if (pstate->p_paramtypes) if (pstate->p_paramtypes)
pstate->p_paramtypes = (Oid *) repalloc(pstate->p_paramtypes, pstate->p_paramtypes = (Oid *) repalloc(pstate->p_paramtypes,
...@@ -672,7 +674,7 @@ static Node * ...@@ -672,7 +674,7 @@ static Node *
transformParamRef(ParseState *pstate, ParamRef *pref) transformParamRef(ParseState *pstate, ParamRef *pref)
{ {
int paramno = pref->number; int paramno = pref->number;
Oid *pptype = find_param_type(pstate, paramno); Oid *pptype = find_param_type(pstate, paramno, pref->location);
Param *param; Param *param;
param = makeNode(Param); param = makeNode(Param);
...@@ -1235,10 +1237,22 @@ transformSubLink(ParseState *pstate, SubLink *sublink) ...@@ -1235,10 +1237,22 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
pstate->p_hasSubLinks = true; pstate->p_hasSubLinks = true;
qtree = parse_sub_analyze(sublink->subselect, pstate); qtree = parse_sub_analyze(sublink->subselect, pstate);
if (qtree->commandType != CMD_SELECT ||
qtree->utilityStmt != NULL || /*
qtree->intoClause != NULL) * Check that we got something reasonable. Many of these conditions are
elog(ERROR, "bad query in sub-select"); * impossible given restrictions of the grammar, but check 'em anyway.
*/
if (!IsA(qtree, Query) ||
qtree->commandType != CMD_SELECT ||
qtree->utilityStmt != NULL)
elog(ERROR, "unexpected non-SELECT command in SubLink");
if (qtree->intoClause)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("subquery cannot have SELECT INTO"),
parser_errposition(pstate,
exprLocation((Node *) qtree->intoClause))));
sublink->subselect = (Node *) qtree; sublink->subselect = (Node *) qtree;
if (sublink->subLinkType == EXISTS_SUBLINK) if (sublink->subLinkType == EXISTS_SUBLINK)
...@@ -1445,7 +1459,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, ...@@ -1445,7 +1459,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find element type for data type %s", errmsg("could not find element type for data type %s",
format_type_be(array_type)))); format_type_be(array_type)),
parser_errposition(pstate, a->location)));
} }
else else
{ {
...@@ -1455,7 +1470,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, ...@@ -1455,7 +1470,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find array type for data type %s", errmsg("could not find array type for data type %s",
format_type_be(element_type)))); format_type_be(element_type)),
parser_errposition(pstate, a->location)));
} }
coerce_hard = false; coerce_hard = false;
} }
...@@ -1823,7 +1839,7 @@ transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr) ...@@ -1823,7 +1839,7 @@ transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr)
/* If a parameter is used, it must be of type REFCURSOR */ /* If a parameter is used, it must be of type REFCURSOR */
if (cexpr->cursor_name == NULL) if (cexpr->cursor_name == NULL)
{ {
Oid *pptype = find_param_type(pstate, cexpr->cursor_param); Oid *pptype = find_param_type(pstate, cexpr->cursor_param, -1);
if (pstate->p_variableparams && *pptype == UNKNOWNOID) if (pstate->p_variableparams && *pptype == UNKNOWNOID)
{ {
...@@ -1866,12 +1882,12 @@ transformWholeRowRef(ParseState *pstate, char *schemaname, char *relname, ...@@ -1866,12 +1882,12 @@ transformWholeRowRef(ParseState *pstate, char *schemaname, char *relname,
/* Look up the referenced RTE, creating it if needed */ /* Look up the referenced RTE, creating it if needed */
rte = refnameRangeTblEntry(pstate, schemaname, relname, rte = refnameRangeTblEntry(pstate, schemaname, relname, location,
&sublevels_up); &sublevels_up);
if (rte == NULL) if (rte == NULL)
rte = addImplicitRTE(pstate, makeRangeVar(schemaname, relname), rte = addImplicitRTE(pstate,
location); makeRangeVar(schemaname, relname, location));
vnum = RTERangeTablePosn(pstate, rte, &sublevels_up); vnum = RTERangeTablePosn(pstate, rte, &sublevels_up);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.206 2008/08/28 23:09:47 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.207 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -270,7 +270,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, ...@@ -270,7 +270,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find array type for data type %s", errmsg("could not find array type for data type %s",
format_type_be(newa->element_typeid)))); format_type_be(newa->element_typeid)),
parser_errposition(pstate, exprLocation((Node *) vargs))));
newa->multidims = false; newa->multidims = false;
newa->location = exprLocation((Node *) vargs); newa->location = exprLocation((Node *) vargs);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.102 2008/08/28 23:09:47 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.103 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#include "utils/varbit.h" #include "utils/varbit.h"
static void pcb_error_callback(void *arg);
/* /*
* make_parsestate * make_parsestate
* Allocate and initialize a new ParseState. * Allocate and initialize a new ParseState.
...@@ -112,6 +115,62 @@ parser_errposition(ParseState *pstate, int location) ...@@ -112,6 +115,62 @@ parser_errposition(ParseState *pstate, int location)
} }
/*
* setup_parser_errposition_callback
* Arrange for non-parser errors to report an error position
*
* Sometimes the parser calls functions that aren't part of the parser
* subsystem and can't reasonably be passed a ParseState; yet we would
* like any errors thrown in those functions to be tagged with a parse
* error location. Use this function to set up an error context stack
* entry that will accomplish that. Usage pattern:
*
* declare a local variable "ParseCallbackState pcbstate"
* ...
* setup_parser_errposition_callback(&pcbstate, pstate, location);
* call function that might throw error;
* cancel_parser_errposition_callback(&pcbstate);
*/
void
setup_parser_errposition_callback(ParseCallbackState *pcbstate,
ParseState *pstate, int location)
{
/* Setup error traceback support for ereport() */
pcbstate->pstate = pstate;
pcbstate->location = location;
pcbstate->errcontext.callback = pcb_error_callback;
pcbstate->errcontext.arg = (void *) pcbstate;
pcbstate->errcontext.previous = error_context_stack;
error_context_stack = &pcbstate->errcontext;
}
/*
* Cancel a previously-set-up errposition callback.
*/
void
cancel_parser_errposition_callback(ParseCallbackState *pcbstate)
{
/* Pop the error context stack */
error_context_stack = pcbstate->errcontext.previous;
}
/*
* Error context callback for inserting parser error location.
*
* Note that this will be called for *any* error occurring while the
* callback is installed. We avoid inserting an irrelevant error location
* if the error is a query cancel --- are there any other important cases?
*/
static void
pcb_error_callback(void *arg)
{
ParseCallbackState *pcbstate = (ParseCallbackState *) arg;
if (geterrcode() != ERRCODE_QUERY_CANCELED)
(void) parser_errposition(pcbstate->pstate, pcbstate->location);
}
/* /*
* make_var * make_var
* Build a Var node for an attribute identified by RTE and attrno * Build a Var node for an attribute identified by RTE and attrno
...@@ -344,14 +403,15 @@ transformArraySubscripts(ParseState *pstate, ...@@ -344,14 +403,15 @@ transformArraySubscripts(ParseState *pstate,
* too many examples that fail if we try. * too many examples that fail if we try.
*/ */
Const * Const *
make_const(Value *value, int location) make_const(ParseState *pstate, Value *value, int location)
{ {
Const *con;
Datum val; Datum val;
int64 val64; int64 val64;
Oid typeid; Oid typeid;
int typelen; int typelen;
bool typebyval; bool typebyval;
Const *con; ParseCallbackState pcbstate;
switch (nodeTag(value)) switch (nodeTag(value))
{ {
...@@ -392,10 +452,13 @@ make_const(Value *value, int location) ...@@ -392,10 +452,13 @@ make_const(Value *value, int location)
} }
else else
{ {
/* arrange to report location if numeric_in() fails */
setup_parser_errposition_callback(&pcbstate, pstate, location);
val = DirectFunctionCall3(numeric_in, val = DirectFunctionCall3(numeric_in,
CStringGetDatum(strVal(value)), CStringGetDatum(strVal(value)),
ObjectIdGetDatum(InvalidOid), ObjectIdGetDatum(InvalidOid),
Int32GetDatum(-1)); Int32GetDatum(-1));
cancel_parser_errposition_callback(&pcbstate);
typeid = NUMERICOID; typeid = NUMERICOID;
typelen = -1; /* variable len */ typelen = -1; /* variable len */
...@@ -417,10 +480,13 @@ make_const(Value *value, int location) ...@@ -417,10 +480,13 @@ make_const(Value *value, int location)
break; break;
case T_BitString: case T_BitString:
/* arrange to report location if bit_in() fails */
setup_parser_errposition_callback(&pcbstate, pstate, location);
val = DirectFunctionCall3(bit_in, val = DirectFunctionCall3(bit_in,
CStringGetDatum(strVal(value)), CStringGetDatum(strVal(value)),
ObjectIdGetDatum(InvalidOid), ObjectIdGetDatum(InvalidOid),
Int32GetDatum(-1)); Int32GetDatum(-1));
cancel_parser_errposition_callback(&pcbstate);
typeid = BITOID; typeid = BITOID;
typelen = -1; typelen = -1;
typebyval = false; typebyval = false;
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.163 2008/08/30 01:39:14 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.164 2008/09/01 20:42:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -45,7 +45,7 @@ static Node *transformAssignmentIndirection(ParseState *pstate, ...@@ -45,7 +45,7 @@ static Node *transformAssignmentIndirection(ParseState *pstate,
int location); int location);
static List *ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, static List *ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
bool targetlist); bool targetlist);
static List *ExpandAllTables(ParseState *pstate); static List *ExpandAllTables(ParseState *pstate, int location);
static List *ExpandIndirectionStar(ParseState *pstate, A_Indirection *ind, static List *ExpandIndirectionStar(ParseState *pstate, A_Indirection *ind,
bool targetlist); bool targetlist);
static int FigureColnameInternal(Node *node, char **name); static int FigureColnameInternal(Node *node, char **name);
...@@ -836,7 +836,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, ...@@ -836,7 +836,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
* need not handle the targetlist==false case here. * need not handle the targetlist==false case here.
*/ */
Assert(targetlist); Assert(targetlist);
return ExpandAllTables(pstate); return ExpandAllTables(pstate, cref->location);
} }
else else
{ {
...@@ -889,11 +889,12 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, ...@@ -889,11 +889,12 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
break; break;
} }
rte = refnameRangeTblEntry(pstate, schemaname, relname, rte = refnameRangeTblEntry(pstate, schemaname, relname, cref->location,
&sublevels_up); &sublevels_up);
if (rte == NULL) if (rte == NULL)
rte = addImplicitRTE(pstate, makeRangeVar(schemaname, relname), rte = addImplicitRTE(pstate,
cref->location); makeRangeVar(schemaname, relname,
cref->location));
/* Require read access --- see comments in setTargetTable() */ /* Require read access --- see comments in setTargetTable() */
rte->requiredPerms |= ACL_SELECT; rte->requiredPerms |= ACL_SELECT;
...@@ -901,12 +902,13 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, ...@@ -901,12 +902,13 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
rtindex = RTERangeTablePosn(pstate, rte, &sublevels_up); rtindex = RTERangeTablePosn(pstate, rte, &sublevels_up);
if (targetlist) if (targetlist)
return expandRelAttrs(pstate, rte, rtindex, sublevels_up); return expandRelAttrs(pstate, rte, rtindex, sublevels_up,
cref->location);
else else
{ {
List *vars; List *vars;
expandRTE(rte, rtindex, sublevels_up, false, expandRTE(rte, rtindex, sublevels_up, cref->location, false,
NULL, &vars); NULL, &vars);
return vars; return vars;
} }
...@@ -923,7 +925,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, ...@@ -923,7 +925,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
* etc. * etc.
*/ */
static List * static List *
ExpandAllTables(ParseState *pstate) ExpandAllTables(ParseState *pstate, int location)
{ {
List *target = NIL; List *target = NIL;
ListCell *l; ListCell *l;
...@@ -932,7 +934,8 @@ ExpandAllTables(ParseState *pstate) ...@@ -932,7 +934,8 @@ ExpandAllTables(ParseState *pstate)
if (!pstate->p_varnamespace) if (!pstate->p_varnamespace)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("SELECT * with no tables specified is not valid"))); errmsg("SELECT * with no tables specified is not valid"),
parser_errposition(pstate, location)));
foreach(l, pstate->p_varnamespace) foreach(l, pstate->p_varnamespace)
{ {
...@@ -943,7 +946,8 @@ ExpandAllTables(ParseState *pstate) ...@@ -943,7 +946,8 @@ ExpandAllTables(ParseState *pstate)
rte->requiredPerms |= ACL_SELECT; rte->requiredPerms |= ACL_SELECT;
target = list_concat(target, target = list_concat(target,
expandRelAttrs(pstate, rte, rtindex, 0)); expandRelAttrs(pstate, rte, rtindex, 0,
location));
} }
return target; return target;
...@@ -1014,12 +1018,16 @@ ExpandIndirectionStar(ParseState *pstate, A_Indirection *ind, ...@@ -1014,12 +1018,16 @@ ExpandIndirectionStar(ParseState *pstate, A_Indirection *ind,
((Var *) expr)->varattno == InvalidAttrNumber) ((Var *) expr)->varattno == InvalidAttrNumber)
{ {
Var *var = (Var *) expr; Var *var = (Var *) expr;
Var *newvar;
newvar = makeVar(var->varno,
i + 1,
att->atttypid,
att->atttypmod,
var->varlevelsup);
newvar->location = var->location;
fieldnode = (Node *) makeVar(var->varno, fieldnode = (Node *) newvar;
i + 1,
att->atttypid,
att->atttypmod,
var->varlevelsup);
} }
else else
{ {
...@@ -1088,7 +1096,7 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup) ...@@ -1088,7 +1096,7 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup)
*lvar; *lvar;
int i; int i;
expandRTE(rte, var->varno, 0, false, expandRTE(rte, var->varno, 0, var->location, false,
&names, &vars); &names, &vars);
tupleDesc = CreateTemplateTupleDesc(list_length(vars), false); tupleDesc = CreateTemplateTupleDesc(list_length(vars), false);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.98 2008/08/30 01:39:14 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.99 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -69,7 +69,7 @@ LookupTypeName(ParseState *pstate, const TypeName *typename, ...@@ -69,7 +69,7 @@ LookupTypeName(ParseState *pstate, const TypeName *typename,
else if (typename->pct_type) else if (typename->pct_type)
{ {
/* Handle %TYPE reference to type of an existing field */ /* Handle %TYPE reference to type of an existing field */
RangeVar *rel = makeRangeVar(NULL, NULL); RangeVar *rel = makeRangeVar(NULL, NULL, typename->location);
char *field = NULL; char *field = NULL;
Oid relid; Oid relid;
AttrNumber attnum; AttrNumber attnum;
...@@ -122,7 +122,7 @@ LookupTypeName(ParseState *pstate, const TypeName *typename, ...@@ -122,7 +122,7 @@ LookupTypeName(ParseState *pstate, const TypeName *typename,
/* this construct should never have an array indicator */ /* this construct should never have an array indicator */
Assert(typename->arrayBounds == NIL); Assert(typename->arrayBounds == NIL);
/* emit nuisance notice */ /* emit nuisance notice (intentionally not errposition'd) */
ereport(NOTICE, ereport(NOTICE,
(errmsg("type reference %s converted to %s", (errmsg("type reference %s converted to %s",
TypeNameToString(typename), TypeNameToString(typename),
...@@ -247,6 +247,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ) ...@@ -247,6 +247,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
int n; int n;
ListCell *l; ListCell *l;
ArrayType *arrtypmod; ArrayType *arrtypmod;
ParseCallbackState pcbstate;
/* Return prespecified typmod if no typmod expressions */ /* Return prespecified typmod if no typmod expressions */
if (typename->typmods == NIL) if (typename->typmods == NIL)
...@@ -321,9 +322,14 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ) ...@@ -321,9 +322,14 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
arrtypmod = construct_array(datums, n, CSTRINGOID, arrtypmod = construct_array(datums, n, CSTRINGOID,
-2, false, 'c'); -2, false, 'c');
/* arrange to report location if type's typmodin function fails */
setup_parser_errposition_callback(&pcbstate, pstate, typename->location);
result = DatumGetInt32(OidFunctionCall1(typmodin, result = DatumGetInt32(OidFunctionCall1(typmodin,
PointerGetDatum(arrtypmod))); PointerGetDatum(arrtypmod)));
cancel_parser_errposition_callback(&pcbstate);
pfree(datums); pfree(datums);
pfree(arrtypmod); pfree(arrtypmod);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.16 2008/08/28 23:09:48 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.17 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -346,7 +346,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt, ...@@ -346,7 +346,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
* TABLE. * TABLE.
*/ */
seqstmt = makeNode(CreateSeqStmt); seqstmt = makeNode(CreateSeqStmt);
seqstmt->sequence = makeRangeVar(snamespace, sname); seqstmt->sequence = makeRangeVar(snamespace, sname, -1);
seqstmt->options = NIL; seqstmt->options = NIL;
cxt->blist = lappend(cxt->blist, seqstmt); cxt->blist = lappend(cxt->blist, seqstmt);
...@@ -357,7 +357,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt, ...@@ -357,7 +357,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
* done after this CREATE/ALTER TABLE. * done after this CREATE/ALTER TABLE.
*/ */
altseqstmt = makeNode(AlterSeqStmt); altseqstmt = makeNode(AlterSeqStmt);
altseqstmt->sequence = makeRangeVar(snamespace, sname); altseqstmt->sequence = makeRangeVar(snamespace, sname, -1);
attnamelist = list_make3(makeString(snamespace), attnamelist = list_make3(makeString(snamespace),
makeString(cxt->relation->relname), makeString(cxt->relation->relname),
makeString(column->colname)); makeString(column->colname));
...@@ -548,7 +548,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt, ...@@ -548,7 +548,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
bool including_indexes = false; bool including_indexes = false;
ListCell *elem; ListCell *elem;
relation = heap_openrv(inhRelation->relation, AccessShareLock); relation = parserOpenTable(pstate, inhRelation->relation, AccessShareLock);
if (relation->rd_rel->relkind != RELKIND_RELATION) if (relation->rd_rel->relkind != RELKIND_RELATION)
ereport(ERROR, ereport(ERROR,
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.145 2008/08/29 13:02:32 petere Exp $ * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.146 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -77,7 +77,8 @@ static void addlit(char *ytext, int yleng); ...@@ -77,7 +77,8 @@ static void addlit(char *ytext, int yleng);
static void addlitchar(unsigned char ychar); static void addlitchar(unsigned char ychar);
static char *litbufdup(void); static char *litbufdup(void);
static int lexer_errposition(void); #define lexer_errposition() scanner_errposition(yylloc)
static void check_escape_warning(void); static void check_escape_warning(void);
static void check_string_escape_warning(unsigned char ychar); static void check_string_escape_warning(unsigned char ychar);
...@@ -756,22 +757,27 @@ other . ...@@ -756,22 +757,27 @@ other .
%% %%
/* /*
* lexer_errposition * scanner_errposition
* Report a lexical-analysis-time cursor position, if possible. * Report a lexer or grammar error cursor position, if possible.
* *
* This is expected to be used within an ereport() call. The return value * This is expected to be used within an ereport() call. The return value
* is a dummy (always 0, in fact). * is a dummy (always 0, in fact).
* *
* Note that this can only be used for messages from the lexer itself, * Note that this can only be used for messages emitted during raw parsing
* since it depends on scanbuf to still be valid. * (essentially, scan.l and gram.y), since it requires scanbuf to still be
* valid.
*/ */
static int int
lexer_errposition(void) scanner_errposition(int location)
{ {
int pos; int pos;
Assert(scanbuf != NULL); /* else called from wrong place */
if (location < 0)
return 0; /* no-op if location is unknown */
/* Convert byte offset to character number */ /* Convert byte offset to character number */
pos = pg_mbstrlen_with_len(scanbuf, yylloc) + 1; pos = pg_mbstrlen_with_len(scanbuf, location) + 1;
/* And pass it to the ereport mechanism */ /* And pass it to the ereport mechanism */
return errposition(pos); return errposition(pos);
} }
...@@ -849,6 +855,7 @@ scanner_finish(void) ...@@ -849,6 +855,7 @@ scanner_finish(void)
{ {
yy_delete_buffer(scanbufhandle); yy_delete_buffer(scanbufhandle);
pfree(scanbuf); pfree(scanbuf);
scanbuf = NULL;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.112 2008/08/28 23:09:48 tgl Exp $ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.113 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -28,8 +28,16 @@ typedef struct ...@@ -28,8 +28,16 @@ typedef struct
int sublevels_up; int sublevels_up;
} contain_aggs_of_level_context; } contain_aggs_of_level_context;
typedef struct
{
int agg_location;
int sublevels_up;
} locate_agg_of_level_context;
static bool contain_aggs_of_level_walker(Node *node, static bool contain_aggs_of_level_walker(Node *node,
contain_aggs_of_level_context *context); contain_aggs_of_level_context *context);
static bool locate_agg_of_level_walker(Node *node,
locate_agg_of_level_context *context);
static bool checkExprHasSubLink_walker(Node *node, void *context); static bool checkExprHasSubLink_walker(Node *node, void *context);
static Relids offset_relid_set(Relids relids, int offset); static Relids offset_relid_set(Relids relids, int offset);
static Relids adjust_relid_set(Relids relids, int oldrelid, int newrelid); static Relids adjust_relid_set(Relids relids, int oldrelid, int newrelid);
...@@ -37,7 +45,8 @@ static Relids adjust_relid_set(Relids relids, int oldrelid, int newrelid); ...@@ -37,7 +45,8 @@ static Relids adjust_relid_set(Relids relids, int oldrelid, int newrelid);
/* /*
* checkExprHasAggs - * checkExprHasAggs -
* Check if an expression contains an aggregate function call. * Check if an expression contains an aggregate function call of the
* current query level.
*/ */
bool bool
checkExprHasAggs(Node *node) checkExprHasAggs(Node *node)
...@@ -101,6 +110,71 @@ contain_aggs_of_level_walker(Node *node, ...@@ -101,6 +110,71 @@ contain_aggs_of_level_walker(Node *node,
(void *) context); (void *) context);
} }
/*
* locate_agg_of_level -
* Find the parse location of any aggregate of the specified query level.
*
* Returns -1 if no such agg is in the querytree, or if they all have
* unknown parse location. (The former case is probably caller error,
* but we don't bother to distinguish it from the latter case.)
*
* Note: it might seem appropriate to merge this functionality into
* contain_aggs_of_level, but that would complicate that function's API.
* Currently, the only uses of this function are for error reporting,
* and so shaving cycles probably isn't very important.
*/
int
locate_agg_of_level(Node *node, int levelsup)
{
locate_agg_of_level_context context;
context.agg_location = -1; /* in case we find nothing */
context.sublevels_up = levelsup;
/*
* Must be prepared to start with a Query or a bare expression tree; if
* it's a Query, we don't want to increment sublevels_up.
*/
(void) query_or_expression_tree_walker(node,
locate_agg_of_level_walker,
(void *) &context,
0);
return context.agg_location;
}
static bool
locate_agg_of_level_walker(Node *node,
locate_agg_of_level_context *context)
{
if (node == NULL)
return false;
if (IsA(node, Aggref))
{
if (((Aggref *) node)->agglevelsup == context->sublevels_up &&
((Aggref *) node)->location >= 0)
{
context->agg_location = ((Aggref *) node)->location;
return true; /* abort the tree traversal and return true */
}
/* else fall through to examine argument */
}
if (IsA(node, Query))
{
/* Recurse into subselects */
bool result;
context->sublevels_up++;
result = query_tree_walker((Query *) node,
locate_agg_of_level_walker,
(void *) context, 0);
context->sublevels_up--;
return result;
}
return expression_tree_walker(node, locate_agg_of_level_walker,
(void *) context);
}
/* /*
* checkExprHasSubLink - * checkExprHasSubLink -
* Check if an expression contains a SubLink. * Check if an expression contains a SubLink.
...@@ -980,7 +1054,7 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context) ...@@ -980,7 +1054,7 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
* this is a JOIN), then omit dropped columns. * this is a JOIN), then omit dropped columns.
*/ */
expandRTE(context->target_rte, expandRTE(context->target_rte,
this_varno, this_varlevelsup, this_varno, this_varlevelsup, var->location,
(var->vartype != RECORDOID), (var->vartype != RECORDOID),
NULL, &fields); NULL, &fields);
/* Adjust the generated per-field Vars... */ /* Adjust the generated per-field Vars... */
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.297 2008/08/30 01:39:14 tgl Exp $ * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.298 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -801,7 +801,7 @@ ProcessUtility(Node *parsetree, ...@@ -801,7 +801,7 @@ ProcessUtility(Node *parsetree,
{ {
NotifyStmt *stmt = (NotifyStmt *) parsetree; NotifyStmt *stmt = (NotifyStmt *) parsetree;
Async_Notify(stmt->relation->relname); Async_Notify(stmt->conditionname);
} }
break; break;
...@@ -809,7 +809,7 @@ ProcessUtility(Node *parsetree, ...@@ -809,7 +809,7 @@ ProcessUtility(Node *parsetree,
{ {
ListenStmt *stmt = (ListenStmt *) parsetree; ListenStmt *stmt = (ListenStmt *) parsetree;
Async_Listen(stmt->relation->relname); Async_Listen(stmt->conditionname);
} }
break; break;
...@@ -817,8 +817,8 @@ ProcessUtility(Node *parsetree, ...@@ -817,8 +817,8 @@ ProcessUtility(Node *parsetree,
{ {
UnlistenStmt *stmt = (UnlistenStmt *) parsetree; UnlistenStmt *stmt = (UnlistenStmt *) parsetree;
if (stmt->relation) if (stmt->conditionname)
Async_Unlisten(stmt->relation->relname); Async_Unlisten(stmt->conditionname);
else else
Async_UnlistenAll(); Async_UnlistenAll();
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.281 2008/08/25 22:42:34 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.282 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2713,8 +2713,7 @@ get_utility_query_def(Query *query, deparse_context *context) ...@@ -2713,8 +2713,7 @@ get_utility_query_def(Query *query, deparse_context *context)
appendContextKeyword(context, "", appendContextKeyword(context, "",
0, PRETTYINDENT_STD, 1); 0, PRETTYINDENT_STD, 1);
appendStringInfo(buf, "NOTIFY %s", appendStringInfo(buf, "NOTIFY %s",
quote_qualified_identifier(stmt->relation->schemaname, quote_identifier(stmt->conditionname));
stmt->relation->relname));
} }
else else
{ {
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.205 2008/07/09 15:56:49 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.206 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -879,6 +879,23 @@ internalerrquery(const char *query) ...@@ -879,6 +879,23 @@ internalerrquery(const char *query)
return 0; /* return value does not matter */ return 0; /* return value does not matter */
} }
/*
* geterrcode --- return the currently set SQLSTATE error code
*
* This is only intended for use in error callback subroutines, since there
* is no other place outside elog.c where the concept is meaningful.
*/
int
geterrcode(void)
{
ErrorData *edata = &errordata[errordata_stack_depth];
/* we don't bother incrementing recursion_depth */
CHECK_STACK_DEPTH();
return edata->sqlerrcode;
}
/* /*
* geterrposition --- return the currently set error position (0 if none) * geterrposition --- return the currently set error position (0 if none)
* *
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.481 2008/08/28 23:09:48 tgl Exp $ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.482 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 200808281 #define CATALOG_VERSION_NO 200808311
#endif #endif
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.62 2008/08/28 23:09:48 tgl Exp $ * $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.63 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -56,7 +56,7 @@ extern Alias *makeAlias(const char *aliasname, List *colnames); ...@@ -56,7 +56,7 @@ extern Alias *makeAlias(const char *aliasname, List *colnames);
extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod,
CoercionForm rformat); CoercionForm rformat);
extern RangeVar *makeRangeVar(char *schemaname, char *relname); extern RangeVar *makeRangeVar(char *schemaname, char *relname, int location);
extern TypeName *makeTypeName(char *typnam); extern TypeName *makeTypeName(char *typnam);
extern TypeName *makeTypeNameFromNameList(List *names); extern TypeName *makeTypeNameFromNameList(List *names);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.373 2008/08/30 01:39:14 tgl Exp $ * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.374 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -358,10 +358,11 @@ typedef struct ResTarget ...@@ -358,10 +358,11 @@ typedef struct ResTarget
typedef struct SortBy typedef struct SortBy
{ {
NodeTag type; NodeTag type;
SortByDir sortby_dir; /* ASC/DESC/USING */ Node *node; /* expression to sort on */
SortByDir sortby_dir; /* ASC/DESC/USING/default */
SortByNulls sortby_nulls; /* NULLS FIRST/LAST */ SortByNulls sortby_nulls; /* NULLS FIRST/LAST */
List *useOp; /* name of op to use, if SORTBY_USING */ List *useOp; /* name of op to use, if SORTBY_USING */
Node *node; /* expression to sort on */ int location; /* operator location, or -1 if none/unknown */
} SortBy; } SortBy;
/* /*
...@@ -466,7 +467,9 @@ typedef struct DefElem ...@@ -466,7 +467,9 @@ typedef struct DefElem
* LockingClause - raw representation of FOR UPDATE/SHARE options * LockingClause - raw representation of FOR UPDATE/SHARE options
* *
* Note: lockedRels == NIL means "all relations in query". Otherwise it * Note: lockedRels == NIL means "all relations in query". Otherwise it
* is a list of String nodes giving relation eref names. * is a list of RangeVar nodes. (We use RangeVar mainly because it carries
* a location field --- currently, parse analysis insists on unqualified
* names in LockingClause.)
*/ */
typedef struct LockingClause typedef struct LockingClause
{ {
...@@ -1742,7 +1745,7 @@ typedef struct RuleStmt ...@@ -1742,7 +1745,7 @@ typedef struct RuleStmt
typedef struct NotifyStmt typedef struct NotifyStmt
{ {
NodeTag type; NodeTag type;
RangeVar *relation; /* qualified name to notify */ char *conditionname; /* condition name to notify */
} NotifyStmt; } NotifyStmt;
/* ---------------------- /* ----------------------
...@@ -1752,7 +1755,7 @@ typedef struct NotifyStmt ...@@ -1752,7 +1755,7 @@ typedef struct NotifyStmt
typedef struct ListenStmt typedef struct ListenStmt
{ {
NodeTag type; NodeTag type;
RangeVar *relation; /* name to listen on */ char *conditionname; /* condition name to listen on */
} ListenStmt; } ListenStmt;
/* ---------------------- /* ----------------------
...@@ -1762,7 +1765,7 @@ typedef struct ListenStmt ...@@ -1762,7 +1765,7 @@ typedef struct ListenStmt
typedef struct UnlistenStmt typedef struct UnlistenStmt
{ {
NodeTag type; NodeTag type;
RangeVar *relation; /* name to unlisten on, or NULL for all */ char *conditionname; /* name to unlisten on, or NULL for all */
} UnlistenStmt; } UnlistenStmt;
/* ---------------------- /* ----------------------
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.140 2008/08/28 23:09:48 tgl Exp $ * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.141 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -76,6 +76,7 @@ typedef struct RangeVar ...@@ -76,6 +76,7 @@ typedef struct RangeVar
* on children? */ * on children? */
bool istemp; /* is this a temp relation/sequence? */ bool istemp; /* is this a temp relation/sequence? */
Alias *alias; /* table alias & optional column aliases */ Alias *alias; /* table alias & optional column aliases */
int location; /* token location, or -1 if unknown */
} RangeVar; } RangeVar;
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/optimizer/var.h,v 1.37 2008/01/01 19:45:58 momjian Exp $ * $PostgreSQL: pgsql/src/include/optimizer/var.h,v 1.38 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -19,11 +19,10 @@ ...@@ -19,11 +19,10 @@
extern Relids pull_varnos(Node *node); extern Relids pull_varnos(Node *node);
extern void pull_varattnos(Node *node, Bitmapset **varattnos); extern void pull_varattnos(Node *node, Bitmapset **varattnos);
extern bool contain_var_reference(Node *node, int varno, int varattno,
int levelsup);
extern bool contain_var_clause(Node *node); extern bool contain_var_clause(Node *node);
extern bool contain_vars_of_level(Node *node, int levelsup); extern bool contain_vars_of_level(Node *node, int levelsup);
extern bool contain_vars_above_level(Node *node, int levelsup); extern int locate_var_of_level(Node *node, int levelsup);
extern int locate_var_of_relation(Node *node, int relid, int levelsup);
extern int find_minimum_var_level(Node *node); extern int find_minimum_var_level(Node *node);
extern List *pull_var_clause(Node *node, bool includeUpperVars); extern List *pull_var_clause(Node *node, bool includeUpperVars);
extern Node *flatten_join_alias_vars(PlannerInfo *root, Node *node); extern Node *flatten_join_alias_vars(PlannerInfo *root, Node *node);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.41 2008/04/04 11:47:19 mha Exp $ * $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.42 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -47,6 +47,7 @@ extern int filtered_base_yylex(void); ...@@ -47,6 +47,7 @@ extern int filtered_base_yylex(void);
extern void scanner_init(const char *str); extern void scanner_init(const char *str);
extern void scanner_finish(void); extern void scanner_finish(void);
extern int base_yylex(void); extern int base_yylex(void);
extern int scanner_errposition(int location);
extern void base_yyerror(const char *message); extern void base_yyerror(const char *message);
/* from gram.y */ /* from gram.y */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/parser/parse_node.h,v 1.55 2008/08/28 23:09:48 tgl Exp $ * $PostgreSQL: pgsql/src/include/parser/parse_node.h,v 1.56 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -82,10 +82,23 @@ typedef struct ParseState ...@@ -82,10 +82,23 @@ typedef struct ParseState
RangeTblEntry *p_target_rangetblentry; RangeTblEntry *p_target_rangetblentry;
} ParseState; } ParseState;
/* Support for parser_errposition_callback function */
typedef struct ParseCallbackState
{
ParseState *pstate;
int location;
ErrorContextCallback errcontext;
} ParseCallbackState;
extern ParseState *make_parsestate(ParseState *parentParseState); extern ParseState *make_parsestate(ParseState *parentParseState);
extern void free_parsestate(ParseState *pstate); extern void free_parsestate(ParseState *pstate);
extern int parser_errposition(ParseState *pstate, int location); extern int parser_errposition(ParseState *pstate, int location);
extern void setup_parser_errposition_callback(ParseCallbackState *pcbstate,
ParseState *pstate, int location);
extern void cancel_parser_errposition_callback(ParseCallbackState *pcbstate);
extern Var *make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, extern Var *make_var(ParseState *pstate, RangeTblEntry *rte, int attrno,
int location); int location);
extern Oid transformArrayType(Oid arrayType); extern Oid transformArrayType(Oid arrayType);
...@@ -96,6 +109,6 @@ extern ArrayRef *transformArraySubscripts(ParseState *pstate, ...@@ -96,6 +109,6 @@ extern ArrayRef *transformArraySubscripts(ParseState *pstate,
int32 elementTypMod, int32 elementTypMod,
List *indirection, List *indirection,
Node *assignFrom); Node *assignFrom);
extern Const *make_const(Value *value, int location); extern Const *make_const(ParseState *pstate, Value *value, int location);
#endif /* PARSE_NODE_H */ #endif /* PARSE_NODE_H */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/parser/parse_relation.h,v 1.57 2008/01/01 19:45:58 momjian Exp $ * $PostgreSQL: pgsql/src/include/parser/parse_relation.h,v 1.58 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -21,6 +21,7 @@ extern bool add_missing_from; ...@@ -21,6 +21,7 @@ extern bool add_missing_from;
extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate, extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate,
const char *schemaname, const char *schemaname,
const char *refname, const char *refname,
int location,
int *sublevels_up); int *sublevels_up);
extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1,
List *namespace2); List *namespace2);
...@@ -40,6 +41,8 @@ extern Node *qualifiedNameToVar(ParseState *pstate, ...@@ -40,6 +41,8 @@ extern Node *qualifiedNameToVar(ParseState *pstate,
char *colname, char *colname,
bool implicitRTEOK, bool implicitRTEOK,
int location); int location);
extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation,
int lockmode);
extern RangeTblEntry *addRangeTableEntry(ParseState *pstate, extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
RangeVar *relation, RangeVar *relation,
Alias *alias, Alias *alias,
...@@ -72,13 +75,12 @@ extern RangeTblEntry *addRangeTableEntryForJoin(ParseState *pstate, ...@@ -72,13 +75,12 @@ extern RangeTblEntry *addRangeTableEntryForJoin(ParseState *pstate,
extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte, extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte,
bool addToJoinList, bool addToJoinList,
bool addToRelNameSpace, bool addToVarNameSpace); bool addToRelNameSpace, bool addToVarNameSpace);
extern RangeTblEntry *addImplicitRTE(ParseState *pstate, RangeVar *relation, extern RangeTblEntry *addImplicitRTE(ParseState *pstate, RangeVar *relation);
int location);
extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
bool include_dropped, int location, bool include_dropped,
List **colnames, List **colvars); List **colnames, List **colvars);
extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte, extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte,
int rtindex, int sublevels_up); int rtindex, int sublevels_up, int location);
extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK); extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK);
extern Name attnumAttName(Relation rd, int attid); extern Name attnumAttName(Relation rd, int attid);
extern Oid attnumTypeId(Relation rd, int attid); extern Oid attnumTypeId(Relation rd, int attid);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/rewrite/rewriteManip.h,v 1.46 2008/08/22 00:16:04 tgl Exp $ * $PostgreSQL: pgsql/src/include/rewrite/rewriteManip.h,v 1.47 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -36,6 +36,7 @@ extern void AddQual(Query *parsetree, Node *qual); ...@@ -36,6 +36,7 @@ extern void AddQual(Query *parsetree, Node *qual);
extern void AddInvertedQual(Query *parsetree, Node *qual); extern void AddInvertedQual(Query *parsetree, Node *qual);
extern bool contain_aggs_of_level(Node *node, int levelsup); extern bool contain_aggs_of_level(Node *node, int levelsup);
extern int locate_agg_of_level(Node *node, int levelsup);
extern bool checkExprHasAggs(Node *node); extern bool checkExprHasAggs(Node *node);
extern bool checkExprHasSubLink(Node *node); extern bool checkExprHasSubLink(Node *node);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.93 2008/04/16 23:59:40 tgl Exp $ * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.94 2008/09/01 20:42:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -151,6 +151,7 @@ extern int errposition(int cursorpos); ...@@ -151,6 +151,7 @@ extern int errposition(int cursorpos);
extern int internalerrposition(int cursorpos); extern int internalerrposition(int cursorpos);
extern int internalerrquery(const char *query); extern int internalerrquery(const char *query);
extern int geterrcode(void);
extern int geterrposition(void); extern int geterrposition(void);
extern int getinternalerrposition(void); extern int getinternalerrposition(void);
......
...@@ -137,6 +137,8 @@ SELECT perl_record(); ...@@ -137,6 +137,8 @@ SELECT perl_record();
SELECT * FROM perl_record(); SELECT * FROM perl_record();
ERROR: a column definition list is required for functions returning "record" ERROR: a column definition list is required for functions returning "record"
LINE 1: SELECT * FROM perl_record();
^
SELECT * FROM perl_record() AS (f1 integer, f2 text, f3 text); SELECT * FROM perl_record() AS (f1 integer, f2 text, f3 text);
f1 | f2 | f3 f1 | f2 | f3
----+----+---- ----+----+----
...@@ -150,6 +152,8 @@ SELECT perl_record(); ...@@ -150,6 +152,8 @@ SELECT perl_record();
ERROR: function returning record called in context that cannot accept type record ERROR: function returning record called in context that cannot accept type record
SELECT * FROM perl_record(); SELECT * FROM perl_record();
ERROR: a column definition list is required for functions returning "record" ERROR: a column definition list is required for functions returning "record"
LINE 1: SELECT * FROM perl_record();
^
SELECT * FROM perl_record() AS (f1 integer, f2 text, f3 text); SELECT * FROM perl_record() AS (f1 integer, f2 text, f3 text);
f1 | f2 | f3 f1 | f2 | f3
----+-------+------- ----+-------+-------
...@@ -163,6 +167,8 @@ SELECT perl_record_set(); ...@@ -163,6 +167,8 @@ SELECT perl_record_set();
ERROR: set-valued function called in context that cannot accept a set ERROR: set-valued function called in context that cannot accept a set
SELECT * FROM perl_record_set(); SELECT * FROM perl_record_set();
ERROR: a column definition list is required for functions returning "record" ERROR: a column definition list is required for functions returning "record"
LINE 1: SELECT * FROM perl_record_set();
^
SELECT * FROM perl_record_set() AS (f1 integer, f2 text, f3 text); SELECT * FROM perl_record_set() AS (f1 integer, f2 text, f3 text);
f1 | f2 | f3 f1 | f2 | f3
----+----+---- ----+----+----
...@@ -179,6 +185,8 @@ SELECT perl_record_set(); ...@@ -179,6 +185,8 @@ SELECT perl_record_set();
ERROR: set-valued function called in context that cannot accept a set ERROR: set-valued function called in context that cannot accept a set
SELECT * FROM perl_record_set(); SELECT * FROM perl_record_set();
ERROR: a column definition list is required for functions returning "record" ERROR: a column definition list is required for functions returning "record"
LINE 1: SELECT * FROM perl_record_set();
^
SELECT * FROM perl_record_set() AS (f1 integer, f2 text, f3 text); SELECT * FROM perl_record_set() AS (f1 integer, f2 text, f3 text);
ERROR: setof-composite-returning Perl function must call return_next with reference to hash ERROR: setof-composite-returning Perl function must call return_next with reference to hash
CREATE OR REPLACE FUNCTION perl_record_set() RETURNS SETOF record AS $$ CREATE OR REPLACE FUNCTION perl_record_set() RETURNS SETOF record AS $$
...@@ -192,6 +200,8 @@ SELECT perl_record_set(); ...@@ -192,6 +200,8 @@ SELECT perl_record_set();
ERROR: set-valued function called in context that cannot accept a set ERROR: set-valued function called in context that cannot accept a set
SELECT * FROM perl_record_set(); SELECT * FROM perl_record_set();
ERROR: a column definition list is required for functions returning "record" ERROR: a column definition list is required for functions returning "record"
LINE 1: SELECT * FROM perl_record_set();
^
SELECT * FROM perl_record_set() AS (f1 integer, f2 text, f3 text); SELECT * FROM perl_record_set() AS (f1 integer, f2 text, f3 text);
f1 | f2 | f3 f1 | f2 | f3
----+-------+------------ ----+-------+------------
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.129 2008/08/29 13:02:33 petere Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.130 2008/09/01 20:42:46 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1272,7 +1272,7 @@ plpgsql_parse_tripwordtype(char *word) ...@@ -1272,7 +1272,7 @@ plpgsql_parse_tripwordtype(char *word)
word[i] = '%'; word[i] = '%';
pfree(cp[3]); pfree(cp[3]);
relvar = makeRangeVar(cp[0], cp[1]); relvar = makeRangeVar(cp[0], cp[1], -1);
classOid = RangeVarGetRelid(relvar, true); classOid = RangeVarGetRelid(relvar, true);
if (!OidIsValid(classOid)) if (!OidIsValid(classOid))
goto done; goto done;
...@@ -1393,7 +1393,7 @@ plpgsql_parse_dblwordrowtype(char *word) ...@@ -1393,7 +1393,7 @@ plpgsql_parse_dblwordrowtype(char *word)
word[i] = '%'; word[i] = '%';
/* Lookup the relation */ /* Lookup the relation */
relvar = makeRangeVar(cp[0], cp[1]); relvar = makeRangeVar(cp[0], cp[1], -1);
classOid = RangeVarGetRelid(relvar, true); classOid = RangeVarGetRelid(relvar, true);
if (!OidIsValid(classOid)) if (!OidIsValid(classOid))
ereport(ERROR, ereport(ERROR,
......
...@@ -29,12 +29,18 @@ INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12'); ...@@ -29,12 +29,18 @@ INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12');
-- what happens if we specify slightly misformatted abstime? -- what happens if we specify slightly misformatted abstime?
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00'); INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00');
ERROR: date/time field value out of range: "Feb 35, 1946 10:00:00" ERROR: date/time field value out of range: "Feb 35, 1946 10:00:00"
LINE 1: INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00'...
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10'); INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10');
ERROR: date/time field value out of range: "Feb 28, 1984 25:08:10" ERROR: date/time field value out of range: "Feb 28, 1984 25:08:10"
LINE 1: INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10'...
^
-- badly formatted abstimes: these should result in invalid abstimes -- badly formatted abstimes: these should result in invalid abstimes
INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format'); INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format');
ERROR: invalid input syntax for type abstime: "bad date format" ERROR: invalid input syntax for type abstime: "bad date format"
LINE 1: INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format');
^
INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843'); INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843');
-- test abstime operators -- test abstime operators
SELECT '' AS eight, * FROM ABSTIME_TBL; SELECT '' AS eight, * FROM ABSTIME_TBL;
......
...@@ -293,6 +293,8 @@ group by ten ...@@ -293,6 +293,8 @@ group by ten
having exists (select 1 from onek b having exists (select 1 from onek b
where sum(distinct a.four + b.four) = b.four); where sum(distinct a.four + b.four) = b.four);
ERROR: aggregates not allowed in WHERE clause ERROR: aggregates not allowed in WHERE clause
LINE 4: where sum(distinct a.four + b.four) = b.four)...
^
-- --
-- test for bitwise integer aggregates -- test for bitwise integer aggregates
-- --
......
...@@ -112,6 +112,8 @@ SELECT * FROM tmp_new; ...@@ -112,6 +112,8 @@ SELECT * FROM tmp_new;
ALTER TABLE tmp RENAME TO tmp_new2; ALTER TABLE tmp RENAME TO tmp_new2;
SELECT * FROM tmp; -- should fail SELECT * FROM tmp; -- should fail
ERROR: relation "tmp" does not exist ERROR: relation "tmp" does not exist
LINE 1: SELECT * FROM tmp;
^
SELECT * FROM tmp_new; SELECT * FROM tmp_new;
tmptable tmptable
---------- ----------
...@@ -780,8 +782,12 @@ LINE 1: update atacc1 set b = 2 where "........pg.dropped.1........"... ...@@ -780,8 +782,12 @@ LINE 1: update atacc1 set b = 2 where "........pg.dropped.1........"...
-- INSERTs -- INSERTs
insert into atacc1 values (10, 11, 12, 13); insert into atacc1 values (10, 11, 12, 13);
ERROR: INSERT has more expressions than target columns ERROR: INSERT has more expressions than target columns
LINE 1: insert into atacc1 values (10, 11, 12, 13);
^
insert into atacc1 values (default, 11, 12, 13); insert into atacc1 values (default, 11, 12, 13);
ERROR: INSERT has more expressions than target columns ERROR: INSERT has more expressions than target columns
LINE 1: insert into atacc1 values (default, 11, 12, 13);
^
insert into atacc1 values (11, 12, 13); insert into atacc1 values (11, 12, 13);
insert into atacc1 (a) values (10); insert into atacc1 (a) values (10);
ERROR: column "a" of relation "atacc1" does not exist ERROR: column "a" of relation "atacc1" does not exist
......
...@@ -775,16 +775,28 @@ select 'foo' ilike all (array['F%', '%O']); -- t ...@@ -775,16 +775,28 @@ select 'foo' ilike all (array['F%', '%O']); -- t
-- none of the following should be accepted -- none of the following should be accepted
select '{{1,{2}},{2,3}}'::text[]; select '{{1,{2}},{2,3}}'::text[];
ERROR: malformed array literal: "{{1,{2}},{2,3}}" ERROR: malformed array literal: "{{1,{2}},{2,3}}"
LINE 1: select '{{1,{2}},{2,3}}'::text[];
^
select '{{},{}}'::text[]; select '{{},{}}'::text[];
ERROR: malformed array literal: "{{},{}}" ERROR: malformed array literal: "{{},{}}"
LINE 1: select '{{},{}}'::text[];
^
select E'{{1,2},\\{2,3}}'::text[]; select E'{{1,2},\\{2,3}}'::text[];
ERROR: malformed array literal: "{{1,2},\{2,3}}" ERROR: malformed array literal: "{{1,2},\{2,3}}"
LINE 1: select E'{{1,2},\\{2,3}}'::text[];
^
select '{{"1 2" x},{3}}'::text[]; select '{{"1 2" x},{3}}'::text[];
ERROR: malformed array literal: "{{"1 2" x},{3}}" ERROR: malformed array literal: "{{"1 2" x},{3}}"
LINE 1: select '{{"1 2" x},{3}}'::text[];
^
select '{}}'::text[]; select '{}}'::text[];
ERROR: malformed array literal: "{}}" ERROR: malformed array literal: "{}}"
LINE 1: select '{}}'::text[];
^
select '{ }}'::text[]; select '{ }}'::text[];
ERROR: malformed array literal: "{ }}" ERROR: malformed array literal: "{ }}"
LINE 1: select '{ }}'::text[];
^
select array[]; select array[];
ERROR: cannot determine type of empty array ERROR: cannot determine type of empty array
LINE 1: select array[]; LINE 1: select array[];
......
...@@ -137,6 +137,8 @@ INSERT INTO BOOLTBL2 (f1) VALUES (bool 'FALSE'); ...@@ -137,6 +137,8 @@ INSERT INTO BOOLTBL2 (f1) VALUES (bool 'FALSE');
INSERT INTO BOOLTBL2 (f1) INSERT INTO BOOLTBL2 (f1)
VALUES (bool 'XXX'); VALUES (bool 'XXX');
ERROR: invalid input syntax for type boolean: "XXX" ERROR: invalid input syntax for type boolean: "XXX"
LINE 2: VALUES (bool 'XXX');
^
-- BOOLTBL2 should be full of false's at this point -- BOOLTBL2 should be full of false's at this point
SELECT '' AS f_4, BOOLTBL2.* FROM BOOLTBL2; SELECT '' AS f_4, BOOLTBL2.* FROM BOOLTBL2;
f_4 | f1 f_4 | f1
......
...@@ -25,8 +25,12 @@ INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)'); ...@@ -25,8 +25,12 @@ INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)');
-- badly formatted box inputs -- badly formatted box inputs
INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)'); INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)');
ERROR: invalid input syntax for type box: "(2.3, 4.5)" ERROR: invalid input syntax for type box: "(2.3, 4.5)"
LINE 1: INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)');
^
INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad'); INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
ERROR: invalid input syntax for type box: "asdfasdf(ad" ERROR: invalid input syntax for type box: "asdfasdf(ad"
LINE 1: INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
^
SELECT '' AS four, * FROM BOX_TBL; SELECT '' AS four, * FROM BOX_TBL;
four | f1 four | f1
------+--------------------- ------+---------------------
......
...@@ -11,10 +11,16 @@ INSERT INTO CIRCLE_TBL VALUES ('<(100,1),115>'); ...@@ -11,10 +11,16 @@ INSERT INTO CIRCLE_TBL VALUES ('<(100,1),115>');
-- bad values -- bad values
INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>'); INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
ERROR: invalid input syntax for type circle: "<(-100,0),-100>" ERROR: invalid input syntax for type circle: "<(-100,0),-100>"
LINE 1: INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
^
INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5'); INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
ERROR: invalid input syntax for type circle: "1abc,3,5" ERROR: invalid input syntax for type circle: "1abc,3,5"
LINE 1: INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
^
INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)'); INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
ERROR: invalid input syntax for type circle: "(3,(1,2),3)" ERROR: invalid input syntax for type circle: "(3,(1,2),3)"
LINE 1: INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
^
SELECT * FROM CIRCLE_TBL; SELECT * FROM CIRCLE_TBL;
f1 f1
---------------- ----------------
......
...@@ -107,6 +107,8 @@ DROP TABLE default_test; ...@@ -107,6 +107,8 @@ DROP TABLE default_test;
-- (we have borrowed numeric's typmod functions) -- (we have borrowed numeric's typmod functions)
CREATE TEMP TABLE mytab (foo widget(42,13,7)); -- should fail CREATE TEMP TABLE mytab (foo widget(42,13,7)); -- should fail
ERROR: invalid NUMERIC type modifier ERROR: invalid NUMERIC type modifier
LINE 1: CREATE TEMP TABLE mytab (foo widget(42,13,7));
^
CREATE TEMP TABLE mytab (foo widget(42,13)); CREATE TEMP TABLE mytab (foo widget(42,13));
SELECT format_type(atttypid,atttypmod) FROM pg_attribute SELECT format_type(atttypid,atttypmod) FROM pg_attribute
WHERE attrelid = 'mytab'::regclass AND attnum > 0; WHERE attrelid = 'mytab'::regclass AND attnum > 0;
......
...@@ -11,6 +11,8 @@ INSERT INTO DATE_TBL VALUES ('1996-03-02'); ...@@ -11,6 +11,8 @@ INSERT INTO DATE_TBL VALUES ('1996-03-02');
INSERT INTO DATE_TBL VALUES ('1997-02-28'); INSERT INTO DATE_TBL VALUES ('1997-02-28');
INSERT INTO DATE_TBL VALUES ('1997-02-29'); INSERT INTO DATE_TBL VALUES ('1997-02-29');
ERROR: date/time field value out of range: "1997-02-29" ERROR: date/time field value out of range: "1997-02-29"
LINE 1: INSERT INTO DATE_TBL VALUES ('1997-02-29');
^
INSERT INTO DATE_TBL VALUES ('1997-03-01'); INSERT INTO DATE_TBL VALUES ('1997-03-01');
INSERT INTO DATE_TBL VALUES ('1997-03-02'); INSERT INTO DATE_TBL VALUES ('1997-03-02');
INSERT INTO DATE_TBL VALUES ('2000-04-01'); INSERT INTO DATE_TBL VALUES ('2000-04-01');
...@@ -87,12 +89,18 @@ SELECT date '1999-01-18'; ...@@ -87,12 +89,18 @@ SELECT date '1999-01-18';
SELECT date '1/8/1999'; SELECT date '1/8/1999';
ERROR: date/time field value out of range: "1/8/1999" ERROR: date/time field value out of range: "1/8/1999"
LINE 1: SELECT date '1/8/1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1/18/1999'; SELECT date '1/18/1999';
ERROR: date/time field value out of range: "1/18/1999" ERROR: date/time field value out of range: "1/18/1999"
LINE 1: SELECT date '1/18/1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '18/1/1999'; SELECT date '18/1/1999';
ERROR: date/time field value out of range: "18/1/1999" ERROR: date/time field value out of range: "18/1/1999"
LINE 1: SELECT date '18/1/1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '01/02/03'; SELECT date '01/02/03';
date date
...@@ -126,6 +134,8 @@ SELECT date 'J2451187'; ...@@ -126,6 +134,8 @@ SELECT date 'J2451187';
SELECT date 'January 8, 99 BC'; SELECT date 'January 8, 99 BC';
ERROR: date/time field value out of range: "January 8, 99 BC" ERROR: date/time field value out of range: "January 8, 99 BC"
LINE 1: SELECT date 'January 8, 99 BC';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '99-Jan-08'; SELECT date '99-Jan-08';
date date
...@@ -141,6 +151,8 @@ SELECT date '1999-Jan-08'; ...@@ -141,6 +151,8 @@ SELECT date '1999-Jan-08';
SELECT date '08-Jan-99'; SELECT date '08-Jan-99';
ERROR: date/time field value out of range: "08-Jan-99" ERROR: date/time field value out of range: "08-Jan-99"
LINE 1: SELECT date '08-Jan-99';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '08-Jan-1999'; SELECT date '08-Jan-1999';
date date
...@@ -150,6 +162,8 @@ SELECT date '08-Jan-1999'; ...@@ -150,6 +162,8 @@ SELECT date '08-Jan-1999';
SELECT date 'Jan-08-99'; SELECT date 'Jan-08-99';
ERROR: date/time field value out of range: "Jan-08-99" ERROR: date/time field value out of range: "Jan-08-99"
LINE 1: SELECT date 'Jan-08-99';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date 'Jan-08-1999'; SELECT date 'Jan-08-1999';
date date
...@@ -159,8 +173,12 @@ SELECT date 'Jan-08-1999'; ...@@ -159,8 +173,12 @@ SELECT date 'Jan-08-1999';
SELECT date '99-08-Jan'; SELECT date '99-08-Jan';
ERROR: invalid input syntax for type date: "99-08-Jan" ERROR: invalid input syntax for type date: "99-08-Jan"
LINE 1: SELECT date '99-08-Jan';
^
SELECT date '1999-08-Jan'; SELECT date '1999-08-Jan';
ERROR: invalid input syntax for type date: "1999-08-Jan" ERROR: invalid input syntax for type date: "1999-08-Jan"
LINE 1: SELECT date '1999-08-Jan';
^
SELECT date '99 Jan 08'; SELECT date '99 Jan 08';
date date
------------ ------------
...@@ -175,6 +193,8 @@ SELECT date '1999 Jan 08'; ...@@ -175,6 +193,8 @@ SELECT date '1999 Jan 08';
SELECT date '08 Jan 99'; SELECT date '08 Jan 99';
ERROR: date/time field value out of range: "08 Jan 99" ERROR: date/time field value out of range: "08 Jan 99"
LINE 1: SELECT date '08 Jan 99';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '08 Jan 1999'; SELECT date '08 Jan 1999';
date date
...@@ -184,6 +204,8 @@ SELECT date '08 Jan 1999'; ...@@ -184,6 +204,8 @@ SELECT date '08 Jan 1999';
SELECT date 'Jan 08 99'; SELECT date 'Jan 08 99';
ERROR: date/time field value out of range: "Jan 08 99" ERROR: date/time field value out of range: "Jan 08 99"
LINE 1: SELECT date 'Jan 08 99';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date 'Jan 08 1999'; SELECT date 'Jan 08 1999';
date date
...@@ -217,15 +239,23 @@ SELECT date '1999-01-08'; ...@@ -217,15 +239,23 @@ SELECT date '1999-01-08';
SELECT date '08-01-99'; SELECT date '08-01-99';
ERROR: date/time field value out of range: "08-01-99" ERROR: date/time field value out of range: "08-01-99"
LINE 1: SELECT date '08-01-99';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '08-01-1999'; SELECT date '08-01-1999';
ERROR: date/time field value out of range: "08-01-1999" ERROR: date/time field value out of range: "08-01-1999"
LINE 1: SELECT date '08-01-1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '01-08-99'; SELECT date '01-08-99';
ERROR: date/time field value out of range: "01-08-99" ERROR: date/time field value out of range: "01-08-99"
LINE 1: SELECT date '01-08-99';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '01-08-1999'; SELECT date '01-08-1999';
ERROR: date/time field value out of range: "01-08-1999" ERROR: date/time field value out of range: "01-08-1999"
LINE 1: SELECT date '01-08-1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '99-08-01'; SELECT date '99-08-01';
date date
...@@ -253,15 +283,23 @@ SELECT date '1999 01 08'; ...@@ -253,15 +283,23 @@ SELECT date '1999 01 08';
SELECT date '08 01 99'; SELECT date '08 01 99';
ERROR: date/time field value out of range: "08 01 99" ERROR: date/time field value out of range: "08 01 99"
LINE 1: SELECT date '08 01 99';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '08 01 1999'; SELECT date '08 01 1999';
ERROR: date/time field value out of range: "08 01 1999" ERROR: date/time field value out of range: "08 01 1999"
LINE 1: SELECT date '08 01 1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '01 08 99'; SELECT date '01 08 99';
ERROR: date/time field value out of range: "01 08 99" ERROR: date/time field value out of range: "01 08 99"
LINE 1: SELECT date '01 08 99';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '01 08 1999'; SELECT date '01 08 1999';
ERROR: date/time field value out of range: "01 08 1999" ERROR: date/time field value out of range: "01 08 1999"
LINE 1: SELECT date '01 08 1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '99 08 01'; SELECT date '99 08 01';
date date
...@@ -302,6 +340,8 @@ SELECT date '1/8/1999'; ...@@ -302,6 +340,8 @@ SELECT date '1/8/1999';
SELECT date '1/18/1999'; SELECT date '1/18/1999';
ERROR: date/time field value out of range: "1/18/1999" ERROR: date/time field value out of range: "1/18/1999"
LINE 1: SELECT date '1/18/1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '18/1/1999'; SELECT date '18/1/1999';
date date
...@@ -347,6 +387,8 @@ SELECT date 'January 8, 99 BC'; ...@@ -347,6 +387,8 @@ SELECT date 'January 8, 99 BC';
SELECT date '99-Jan-08'; SELECT date '99-Jan-08';
ERROR: date/time field value out of range: "99-Jan-08" ERROR: date/time field value out of range: "99-Jan-08"
LINE 1: SELECT date '99-Jan-08';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999-Jan-08'; SELECT date '1999-Jan-08';
date date
...@@ -380,10 +422,16 @@ SELECT date 'Jan-08-1999'; ...@@ -380,10 +422,16 @@ SELECT date 'Jan-08-1999';
SELECT date '99-08-Jan'; SELECT date '99-08-Jan';
ERROR: invalid input syntax for type date: "99-08-Jan" ERROR: invalid input syntax for type date: "99-08-Jan"
LINE 1: SELECT date '99-08-Jan';
^
SELECT date '1999-08-Jan'; SELECT date '1999-08-Jan';
ERROR: invalid input syntax for type date: "1999-08-Jan" ERROR: invalid input syntax for type date: "1999-08-Jan"
LINE 1: SELECT date '1999-08-Jan';
^
SELECT date '99 Jan 08'; SELECT date '99 Jan 08';
ERROR: date/time field value out of range: "99 Jan 08" ERROR: date/time field value out of range: "99 Jan 08"
LINE 1: SELECT date '99 Jan 08';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999 Jan 08'; SELECT date '1999 Jan 08';
date date
...@@ -417,6 +465,8 @@ SELECT date 'Jan 08 1999'; ...@@ -417,6 +465,8 @@ SELECT date 'Jan 08 1999';
SELECT date '99 08 Jan'; SELECT date '99 08 Jan';
ERROR: invalid input syntax for type date: "99 08 Jan" ERROR: invalid input syntax for type date: "99 08 Jan"
LINE 1: SELECT date '99 08 Jan';
^
SELECT date '1999 08 Jan'; SELECT date '1999 08 Jan';
date date
------------ ------------
...@@ -425,6 +475,8 @@ SELECT date '1999 08 Jan'; ...@@ -425,6 +475,8 @@ SELECT date '1999 08 Jan';
SELECT date '99-01-08'; SELECT date '99-01-08';
ERROR: date/time field value out of range: "99-01-08" ERROR: date/time field value out of range: "99-01-08"
LINE 1: SELECT date '99-01-08';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999-01-08'; SELECT date '1999-01-08';
date date
...@@ -458,6 +510,8 @@ SELECT date '01-08-1999'; ...@@ -458,6 +510,8 @@ SELECT date '01-08-1999';
SELECT date '99-08-01'; SELECT date '99-08-01';
ERROR: date/time field value out of range: "99-08-01" ERROR: date/time field value out of range: "99-08-01"
LINE 1: SELECT date '99-08-01';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999-08-01'; SELECT date '1999-08-01';
date date
...@@ -467,6 +521,8 @@ SELECT date '1999-08-01'; ...@@ -467,6 +521,8 @@ SELECT date '1999-08-01';
SELECT date '99 01 08'; SELECT date '99 01 08';
ERROR: date/time field value out of range: "99 01 08" ERROR: date/time field value out of range: "99 01 08"
LINE 1: SELECT date '99 01 08';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999 01 08'; SELECT date '1999 01 08';
date date
...@@ -500,6 +556,8 @@ SELECT date '01 08 1999'; ...@@ -500,6 +556,8 @@ SELECT date '01 08 1999';
SELECT date '99 08 01'; SELECT date '99 08 01';
ERROR: date/time field value out of range: "99 08 01" ERROR: date/time field value out of range: "99 08 01"
LINE 1: SELECT date '99 08 01';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999 08 01'; SELECT date '1999 08 01';
date date
...@@ -540,6 +598,8 @@ SELECT date '1/18/1999'; ...@@ -540,6 +598,8 @@ SELECT date '1/18/1999';
SELECT date '18/1/1999'; SELECT date '18/1/1999';
ERROR: date/time field value out of range: "18/1/1999" ERROR: date/time field value out of range: "18/1/1999"
LINE 1: SELECT date '18/1/1999';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '01/02/03'; SELECT date '01/02/03';
date date
...@@ -579,6 +639,8 @@ SELECT date 'January 8, 99 BC'; ...@@ -579,6 +639,8 @@ SELECT date 'January 8, 99 BC';
SELECT date '99-Jan-08'; SELECT date '99-Jan-08';
ERROR: date/time field value out of range: "99-Jan-08" ERROR: date/time field value out of range: "99-Jan-08"
LINE 1: SELECT date '99-Jan-08';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999-Jan-08'; SELECT date '1999-Jan-08';
date date
...@@ -612,10 +674,16 @@ SELECT date 'Jan-08-1999'; ...@@ -612,10 +674,16 @@ SELECT date 'Jan-08-1999';
SELECT date '99-08-Jan'; SELECT date '99-08-Jan';
ERROR: invalid input syntax for type date: "99-08-Jan" ERROR: invalid input syntax for type date: "99-08-Jan"
LINE 1: SELECT date '99-08-Jan';
^
SELECT date '1999-08-Jan'; SELECT date '1999-08-Jan';
ERROR: invalid input syntax for type date: "1999-08-Jan" ERROR: invalid input syntax for type date: "1999-08-Jan"
LINE 1: SELECT date '1999-08-Jan';
^
SELECT date '99 Jan 08'; SELECT date '99 Jan 08';
ERROR: invalid input syntax for type date: "99 Jan 08" ERROR: invalid input syntax for type date: "99 Jan 08"
LINE 1: SELECT date '99 Jan 08';
^
SELECT date '1999 Jan 08'; SELECT date '1999 Jan 08';
date date
------------ ------------
...@@ -648,6 +716,8 @@ SELECT date 'Jan 08 1999'; ...@@ -648,6 +716,8 @@ SELECT date 'Jan 08 1999';
SELECT date '99 08 Jan'; SELECT date '99 08 Jan';
ERROR: invalid input syntax for type date: "99 08 Jan" ERROR: invalid input syntax for type date: "99 08 Jan"
LINE 1: SELECT date '99 08 Jan';
^
SELECT date '1999 08 Jan'; SELECT date '1999 08 Jan';
date date
------------ ------------
...@@ -656,6 +726,8 @@ SELECT date '1999 08 Jan'; ...@@ -656,6 +726,8 @@ SELECT date '1999 08 Jan';
SELECT date '99-01-08'; SELECT date '99-01-08';
ERROR: date/time field value out of range: "99-01-08" ERROR: date/time field value out of range: "99-01-08"
LINE 1: SELECT date '99-01-08';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999-01-08'; SELECT date '1999-01-08';
date date
...@@ -689,6 +761,8 @@ SELECT date '01-08-1999'; ...@@ -689,6 +761,8 @@ SELECT date '01-08-1999';
SELECT date '99-08-01'; SELECT date '99-08-01';
ERROR: date/time field value out of range: "99-08-01" ERROR: date/time field value out of range: "99-08-01"
LINE 1: SELECT date '99-08-01';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999-08-01'; SELECT date '1999-08-01';
date date
...@@ -698,6 +772,8 @@ SELECT date '1999-08-01'; ...@@ -698,6 +772,8 @@ SELECT date '1999-08-01';
SELECT date '99 01 08'; SELECT date '99 01 08';
ERROR: date/time field value out of range: "99 01 08" ERROR: date/time field value out of range: "99 01 08"
LINE 1: SELECT date '99 01 08';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999 01 08'; SELECT date '1999 01 08';
date date
...@@ -731,6 +807,8 @@ SELECT date '01 08 1999'; ...@@ -731,6 +807,8 @@ SELECT date '01 08 1999';
SELECT date '99 08 01'; SELECT date '99 08 01';
ERROR: date/time field value out of range: "99 08 01" ERROR: date/time field value out of range: "99 08 01"
LINE 1: SELECT date '99 08 01';
^
HINT: Perhaps you need a different "datestyle" setting. HINT: Perhaps you need a different "datestyle" setting.
SELECT date '1999 08 01'; SELECT date '1999 08 01';
date date
......
...@@ -22,6 +22,8 @@ SELECT 'red'::rainbow; ...@@ -22,6 +22,8 @@ SELECT 'red'::rainbow;
SELECT 'mauve'::rainbow; SELECT 'mauve'::rainbow;
ERROR: invalid input value for enum rainbow: "mauve" ERROR: invalid input value for enum rainbow: "mauve"
LINE 1: SELECT 'mauve'::rainbow;
^
-- --
-- Basic table creation, row selection -- Basic table creation, row selection
-- --
......
...@@ -25,6 +25,8 @@ LINE 1: select; ...@@ -25,6 +25,8 @@ LINE 1: select;
-- no such relation -- no such relation
select * from nonesuch; select * from nonesuch;
ERROR: relation "nonesuch" does not exist ERROR: relation "nonesuch" does not exist
LINE 1: select * from nonesuch;
^
-- missing target list -- missing target list
select from pg_database; select from pg_database;
ERROR: syntax error at or near "from" ERROR: syntax error at or near "from"
...@@ -66,6 +68,8 @@ LINE 1: delete from; ...@@ -66,6 +68,8 @@ LINE 1: delete from;
-- no such relation -- no such relation
delete from nonesuch; delete from nonesuch;
ERROR: relation "nonesuch" does not exist ERROR: relation "nonesuch" does not exist
LINE 1: delete from nonesuch;
^
-- --
-- DROP -- DROP
...@@ -245,6 +249,8 @@ LINE 1: drop operator === (); ...@@ -245,6 +249,8 @@ LINE 1: drop operator === ();
-- no such operator -- no such operator
drop operator === (int4); drop operator === (int4);
ERROR: missing argument ERROR: missing argument
LINE 1: drop operator === (int4);
^
HINT: Use NONE to denote the missing argument of a unary operator. HINT: Use NONE to denote the missing argument of a unary operator.
-- no such operator by that name -- no such operator by that name
drop operator === (int4, int4); drop operator === (int4, int4);
...@@ -252,6 +258,8 @@ ERROR: operator does not exist: integer === integer ...@@ -252,6 +258,8 @@ ERROR: operator does not exist: integer === integer
-- no such type1 -- no such type1
drop operator = (nonesuch); drop operator = (nonesuch);
ERROR: missing argument ERROR: missing argument
LINE 1: drop operator = (nonesuch);
^
HINT: Use NONE to denote the missing argument of a unary operator. HINT: Use NONE to denote the missing argument of a unary operator.
-- no such type1 -- no such type1
drop operator = ( , int4); drop operator = ( , int4);
......
...@@ -10,29 +10,53 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e-20'); ...@@ -10,29 +10,53 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e-20');
-- test for over and under flow -- test for over and under flow
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70');
ERROR: value out of range: overflow ERROR: value out of range: overflow
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70');
ERROR: value out of range: overflow ERROR: value out of range: overflow
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70');
ERROR: value out of range: underflow ERROR: value out of range: underflow
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
ERROR: value out of range: underflow ERROR: value out of range: underflow
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
^
-- bad input -- bad input
INSERT INTO FLOAT4_TBL(f1) VALUES (''); INSERT INTO FLOAT4_TBL(f1) VALUES ('');
ERROR: invalid input syntax for type real: "" ERROR: invalid input syntax for type real: ""
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('');
^
INSERT INTO FLOAT4_TBL(f1) VALUES (' '); INSERT INTO FLOAT4_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type real: " " ERROR: invalid input syntax for type real: " "
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES (' ');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz'); INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz');
ERROR: invalid input syntax for type real: "xyz" ERROR: invalid input syntax for type real: "xyz"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0'); INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0');
ERROR: invalid input syntax for type real: "5.0.0" ERROR: invalid input syntax for type real: "5.0.0"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('5 . 0'); INSERT INTO FLOAT4_TBL(f1) VALUES ('5 . 0');
ERROR: invalid input syntax for type real: "5 . 0" ERROR: invalid input syntax for type real: "5 . 0"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('5 . 0');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0'); INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0');
ERROR: invalid input syntax for type real: "5. 0" ERROR: invalid input syntax for type real: "5. 0"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0');
^
INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0'); INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0');
ERROR: invalid input syntax for type real: " - 3.0" ERROR: invalid input syntax for type real: " - 3.0"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5'); INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5');
ERROR: invalid input syntax for type real: "123 5" ERROR: invalid input syntax for type real: "123 5"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5');
^
-- special inputs -- special inputs
SELECT 'NaN'::float4; SELECT 'NaN'::float4;
float4 float4
...@@ -67,10 +91,16 @@ SELECT ' -INFINiTY '::float4; ...@@ -67,10 +91,16 @@ SELECT ' -INFINiTY '::float4;
-- bad special inputs -- bad special inputs
SELECT 'N A N'::float4; SELECT 'N A N'::float4;
ERROR: invalid input syntax for type real: "N A N" ERROR: invalid input syntax for type real: "N A N"
LINE 1: SELECT 'N A N'::float4;
^
SELECT 'NaN x'::float4; SELECT 'NaN x'::float4;
ERROR: invalid input syntax for type real: "NaN x" ERROR: invalid input syntax for type real: "NaN x"
LINE 1: SELECT 'NaN x'::float4;
^
SELECT ' INFINITY x'::float4; SELECT ' INFINITY x'::float4;
ERROR: invalid input syntax for type real: " INFINITY x" ERROR: invalid input syntax for type real: " INFINITY x"
LINE 1: SELECT ' INFINITY x'::float4;
^
SELECT 'Infinity'::float4 + 100.0; SELECT 'Infinity'::float4 + 100.0;
?column? ?column?
---------- ----------
......
...@@ -10,29 +10,53 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e-20'); ...@@ -10,29 +10,53 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e-20');
-- test for over and under flow -- test for over and under flow
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70');
ERROR: value out of range: overflow ERROR: value out of range: overflow
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70');
ERROR: value out of range: overflow ERROR: value out of range: overflow
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70');
ERROR: value out of range: underflow ERROR: value out of range: underflow
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
ERROR: value out of range: underflow ERROR: value out of range: underflow
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
^
-- bad input -- bad input
INSERT INTO FLOAT4_TBL(f1) VALUES (''); INSERT INTO FLOAT4_TBL(f1) VALUES ('');
ERROR: invalid input syntax for type real: "" ERROR: invalid input syntax for type real: ""
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('');
^
INSERT INTO FLOAT4_TBL(f1) VALUES (' '); INSERT INTO FLOAT4_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type real: " " ERROR: invalid input syntax for type real: " "
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES (' ');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz'); INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz');
ERROR: invalid input syntax for type real: "xyz" ERROR: invalid input syntax for type real: "xyz"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0'); INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0');
ERROR: invalid input syntax for type real: "5.0.0" ERROR: invalid input syntax for type real: "5.0.0"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('5 . 0'); INSERT INTO FLOAT4_TBL(f1) VALUES ('5 . 0');
ERROR: invalid input syntax for type real: "5 . 0" ERROR: invalid input syntax for type real: "5 . 0"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('5 . 0');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0'); INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0');
ERROR: invalid input syntax for type real: "5. 0" ERROR: invalid input syntax for type real: "5. 0"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0');
^
INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0'); INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0');
ERROR: invalid input syntax for type real: " - 3.0" ERROR: invalid input syntax for type real: " - 3.0"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5'); INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5');
ERROR: invalid input syntax for type real: "123 5" ERROR: invalid input syntax for type real: "123 5"
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5');
^
-- special inputs -- special inputs
SELECT 'NaN'::float4; SELECT 'NaN'::float4;
float4 float4
...@@ -67,10 +91,16 @@ SELECT ' -INFINiTY '::float4; ...@@ -67,10 +91,16 @@ SELECT ' -INFINiTY '::float4;
-- bad special inputs -- bad special inputs
SELECT 'N A N'::float4; SELECT 'N A N'::float4;
ERROR: invalid input syntax for type real: "N A N" ERROR: invalid input syntax for type real: "N A N"
LINE 1: SELECT 'N A N'::float4;
^
SELECT 'NaN x'::float4; SELECT 'NaN x'::float4;
ERROR: invalid input syntax for type real: "NaN x" ERROR: invalid input syntax for type real: "NaN x"
LINE 1: SELECT 'NaN x'::float4;
^
SELECT ' INFINITY x'::float4; SELECT ' INFINITY x'::float4;
ERROR: invalid input syntax for type real: " INFINITY x" ERROR: invalid input syntax for type real: " INFINITY x"
LINE 1: SELECT ' INFINITY x'::float4;
^
SELECT 'Infinity'::float4 + 100.0; SELECT 'Infinity'::float4 + 100.0;
?column? ?column?
---------- ----------
......
...@@ -10,29 +10,53 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200'); ...@@ -10,29 +10,53 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
-- test for underflow and overflow handling -- test for underflow and overflow handling
SELECT '10e400'::float8; SELECT '10e400'::float8;
ERROR: "10e400" is out of range for type double precision ERROR: "10e400" is out of range for type double precision
LINE 1: SELECT '10e400'::float8;
^
SELECT '-10e400'::float8; SELECT '-10e400'::float8;
ERROR: "-10e400" is out of range for type double precision ERROR: "-10e400" is out of range for type double precision
LINE 1: SELECT '-10e400'::float8;
^
SELECT '10e-400'::float8; SELECT '10e-400'::float8;
ERROR: "10e-400" is out of range for type double precision ERROR: "10e-400" is out of range for type double precision
LINE 1: SELECT '10e-400'::float8;
^
SELECT '-10e-400'::float8; SELECT '-10e-400'::float8;
ERROR: "-10e-400" is out of range for type double precision ERROR: "-10e-400" is out of range for type double precision
LINE 1: SELECT '-10e-400'::float8;
^
-- bad input -- bad input
INSERT INTO FLOAT8_TBL(f1) VALUES (''); INSERT INTO FLOAT8_TBL(f1) VALUES ('');
ERROR: invalid input syntax for type double precision: "" ERROR: invalid input syntax for type double precision: ""
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('');
^
INSERT INTO FLOAT8_TBL(f1) VALUES (' '); INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " " ERROR: invalid input syntax for type double precision: " "
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz'); INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
ERROR: invalid input syntax for type double precision: "xyz" ERROR: invalid input syntax for type double precision: "xyz"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
ERROR: invalid input syntax for type double precision: "5.0.0" ERROR: invalid input syntax for type double precision: "5.0.0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
ERROR: invalid input syntax for type double precision: "5 . 0" ERROR: invalid input syntax for type double precision: "5 . 0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
ERROR: invalid input syntax for type double precision: "5. 0" ERROR: invalid input syntax for type double precision: "5. 0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3'); INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
ERROR: invalid input syntax for type double precision: " - 3" ERROR: invalid input syntax for type double precision: " - 3"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5'); INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
ERROR: invalid input syntax for type double precision: "123 5" ERROR: invalid input syntax for type double precision: "123 5"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
^
-- special inputs -- special inputs
SELECT 'NaN'::float8; SELECT 'NaN'::float8;
float8 float8
...@@ -67,10 +91,16 @@ SELECT ' -INFINiTY '::float8; ...@@ -67,10 +91,16 @@ SELECT ' -INFINiTY '::float8;
-- bad special inputs -- bad special inputs
SELECT 'N A N'::float8; SELECT 'N A N'::float8;
ERROR: invalid input syntax for type double precision: "N A N" ERROR: invalid input syntax for type double precision: "N A N"
LINE 1: SELECT 'N A N'::float8;
^
SELECT 'NaN x'::float8; SELECT 'NaN x'::float8;
ERROR: invalid input syntax for type double precision: "NaN x" ERROR: invalid input syntax for type double precision: "NaN x"
LINE 1: SELECT 'NaN x'::float8;
^
SELECT ' INFINITY x'::float8; SELECT ' INFINITY x'::float8;
ERROR: invalid input syntax for type double precision: " INFINITY x" ERROR: invalid input syntax for type double precision: " INFINITY x"
LINE 1: SELECT ' INFINITY x'::float8;
^
SELECT 'Infinity'::float8 + 100.0; SELECT 'Infinity'::float8 + 100.0;
?column? ?column?
---------- ----------
...@@ -376,12 +406,20 @@ SELECT '' AS five, * FROM FLOAT8_TBL; ...@@ -376,12 +406,20 @@ SELECT '' AS five, * FROM FLOAT8_TBL;
-- test for over- and underflow -- test for over- and underflow
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
ERROR: "10e400" is out of range for type double precision ERROR: "10e400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
ERROR: "-10e400" is out of range for type double precision ERROR: "-10e400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
ERROR: "10e-400" is out of range for type double precision ERROR: "10e-400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
ERROR: "-10e-400" is out of range for type double precision ERROR: "-10e-400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
^
-- maintain external table consistency across platforms -- maintain external table consistency across platforms
-- delete all values and reinsert well-behaved ones -- delete all values and reinsert well-behaved ones
DELETE FROM FLOAT8_TBL; DELETE FROM FLOAT8_TBL;
......
...@@ -10,8 +10,12 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200'); ...@@ -10,8 +10,12 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
-- test for underflow and overflow handling -- test for underflow and overflow handling
SELECT '10e400'::float8; SELECT '10e400'::float8;
ERROR: "10e400" is out of range for type double precision ERROR: "10e400" is out of range for type double precision
LINE 1: SELECT '10e400'::float8;
^
SELECT '-10e400'::float8; SELECT '-10e400'::float8;
ERROR: "-10e400" is out of range for type double precision ERROR: "-10e400" is out of range for type double precision
LINE 1: SELECT '-10e400'::float8;
^
SELECT '10e-400'::float8; SELECT '10e-400'::float8;
float8 float8
-------- --------
...@@ -27,20 +31,36 @@ SELECT '-10e-400'::float8; ...@@ -27,20 +31,36 @@ SELECT '-10e-400'::float8;
-- bad input -- bad input
INSERT INTO FLOAT8_TBL(f1) VALUES (''); INSERT INTO FLOAT8_TBL(f1) VALUES ('');
ERROR: invalid input syntax for type double precision: "" ERROR: invalid input syntax for type double precision: ""
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('');
^
INSERT INTO FLOAT8_TBL(f1) VALUES (' '); INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " " ERROR: invalid input syntax for type double precision: " "
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz'); INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
ERROR: invalid input syntax for type double precision: "xyz" ERROR: invalid input syntax for type double precision: "xyz"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
ERROR: invalid input syntax for type double precision: "5.0.0" ERROR: invalid input syntax for type double precision: "5.0.0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
ERROR: invalid input syntax for type double precision: "5 . 0" ERROR: invalid input syntax for type double precision: "5 . 0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
ERROR: invalid input syntax for type double precision: "5. 0" ERROR: invalid input syntax for type double precision: "5. 0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3'); INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
ERROR: invalid input syntax for type double precision: " - 3" ERROR: invalid input syntax for type double precision: " - 3"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5'); INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
ERROR: invalid input syntax for type double precision: "123 5" ERROR: invalid input syntax for type double precision: "123 5"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
^
-- special inputs -- special inputs
SELECT 'NaN'::float8; SELECT 'NaN'::float8;
float8 float8
...@@ -75,10 +95,16 @@ SELECT ' -INFINiTY '::float8; ...@@ -75,10 +95,16 @@ SELECT ' -INFINiTY '::float8;
-- bad special inputs -- bad special inputs
SELECT 'N A N'::float8; SELECT 'N A N'::float8;
ERROR: invalid input syntax for type double precision: "N A N" ERROR: invalid input syntax for type double precision: "N A N"
LINE 1: SELECT 'N A N'::float8;
^
SELECT 'NaN x'::float8; SELECT 'NaN x'::float8;
ERROR: invalid input syntax for type double precision: "NaN x" ERROR: invalid input syntax for type double precision: "NaN x"
LINE 1: SELECT 'NaN x'::float8;
^
SELECT ' INFINITY x'::float8; SELECT ' INFINITY x'::float8;
ERROR: invalid input syntax for type double precision: " INFINITY x" ERROR: invalid input syntax for type double precision: " INFINITY x"
LINE 1: SELECT ' INFINITY x'::float8;
^
SELECT 'Infinity'::float8 + 100.0; SELECT 'Infinity'::float8 + 100.0;
?column? ?column?
---------- ----------
...@@ -384,8 +410,12 @@ SELECT '' AS five, * FROM FLOAT8_TBL; ...@@ -384,8 +410,12 @@ SELECT '' AS five, * FROM FLOAT8_TBL;
-- test for over- and underflow -- test for over- and underflow
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
ERROR: "10e400" is out of range for type double precision ERROR: "10e400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
ERROR: "-10e400" is out of range for type double precision ERROR: "-10e400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
-- maintain external table consistency across platforms -- maintain external table consistency across platforms
......
...@@ -10,8 +10,12 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200'); ...@@ -10,8 +10,12 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
-- test for underflow and overflow handling -- test for underflow and overflow handling
SELECT '10e400'::float8; SELECT '10e400'::float8;
ERROR: "10e400" is out of range for type double precision ERROR: "10e400" is out of range for type double precision
LINE 1: SELECT '10e400'::float8;
^
SELECT '-10e400'::float8; SELECT '-10e400'::float8;
ERROR: "-10e400" is out of range for type double precision ERROR: "-10e400" is out of range for type double precision
LINE 1: SELECT '-10e400'::float8;
^
SELECT '10e-400'::float8; SELECT '10e-400'::float8;
float8 float8
-------- --------
...@@ -27,20 +31,36 @@ SELECT '-10e-400'::float8; ...@@ -27,20 +31,36 @@ SELECT '-10e-400'::float8;
-- bad input -- bad input
INSERT INTO FLOAT8_TBL(f1) VALUES (''); INSERT INTO FLOAT8_TBL(f1) VALUES ('');
ERROR: invalid input syntax for type double precision: "" ERROR: invalid input syntax for type double precision: ""
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('');
^
INSERT INTO FLOAT8_TBL(f1) VALUES (' '); INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " " ERROR: invalid input syntax for type double precision: " "
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz'); INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
ERROR: invalid input syntax for type double precision: "xyz" ERROR: invalid input syntax for type double precision: "xyz"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
ERROR: invalid input syntax for type double precision: "5.0.0" ERROR: invalid input syntax for type double precision: "5.0.0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
ERROR: invalid input syntax for type double precision: "5 . 0" ERROR: invalid input syntax for type double precision: "5 . 0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
ERROR: invalid input syntax for type double precision: "5. 0" ERROR: invalid input syntax for type double precision: "5. 0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3'); INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
ERROR: invalid input syntax for type double precision: " - 3" ERROR: invalid input syntax for type double precision: " - 3"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5'); INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
ERROR: invalid input syntax for type double precision: "123 5" ERROR: invalid input syntax for type double precision: "123 5"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
^
-- special inputs -- special inputs
SELECT 'NaN'::float8; SELECT 'NaN'::float8;
float8 float8
...@@ -75,10 +95,16 @@ SELECT ' -INFINiTY '::float8; ...@@ -75,10 +95,16 @@ SELECT ' -INFINiTY '::float8;
-- bad special inputs -- bad special inputs
SELECT 'N A N'::float8; SELECT 'N A N'::float8;
ERROR: invalid input syntax for type double precision: "N A N" ERROR: invalid input syntax for type double precision: "N A N"
LINE 1: SELECT 'N A N'::float8;
^
SELECT 'NaN x'::float8; SELECT 'NaN x'::float8;
ERROR: invalid input syntax for type double precision: "NaN x" ERROR: invalid input syntax for type double precision: "NaN x"
LINE 1: SELECT 'NaN x'::float8;
^
SELECT ' INFINITY x'::float8; SELECT ' INFINITY x'::float8;
ERROR: invalid input syntax for type double precision: " INFINITY x" ERROR: invalid input syntax for type double precision: " INFINITY x"
LINE 1: SELECT ' INFINITY x'::float8;
^
SELECT 'Infinity'::float8 + 100.0; SELECT 'Infinity'::float8 + 100.0;
?column? ?column?
---------- ----------
...@@ -384,8 +410,12 @@ SELECT '' AS five, * FROM FLOAT8_TBL; ...@@ -384,8 +410,12 @@ SELECT '' AS five, * FROM FLOAT8_TBL;
-- test for over- and underflow -- test for over- and underflow
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
ERROR: "10e400" is out of range for type double precision ERROR: "10e400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
ERROR: "-10e400" is out of range for type double precision ERROR: "-10e400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
-- maintain external table consistency across platforms -- maintain external table consistency across platforms
......
...@@ -10,29 +10,53 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200'); ...@@ -10,29 +10,53 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
-- test for underflow and overflow handling -- test for underflow and overflow handling
SELECT '10e400'::float8; SELECT '10e400'::float8;
ERROR: "10e400" is out of range for type double precision ERROR: "10e400" is out of range for type double precision
LINE 1: SELECT '10e400'::float8;
^
SELECT '-10e400'::float8; SELECT '-10e400'::float8;
ERROR: "-10e400" is out of range for type double precision ERROR: "-10e400" is out of range for type double precision
LINE 1: SELECT '-10e400'::float8;
^
SELECT '10e-400'::float8; SELECT '10e-400'::float8;
ERROR: "10e-400" is out of range for type double precision ERROR: "10e-400" is out of range for type double precision
LINE 1: SELECT '10e-400'::float8;
^
SELECT '-10e-400'::float8; SELECT '-10e-400'::float8;
ERROR: "-10e-400" is out of range for type double precision ERROR: "-10e-400" is out of range for type double precision
LINE 1: SELECT '-10e-400'::float8;
^
-- bad input -- bad input
INSERT INTO FLOAT8_TBL(f1) VALUES (''); INSERT INTO FLOAT8_TBL(f1) VALUES ('');
ERROR: invalid input syntax for type double precision: "" ERROR: invalid input syntax for type double precision: ""
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('');
^
INSERT INTO FLOAT8_TBL(f1) VALUES (' '); INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " " ERROR: invalid input syntax for type double precision: " "
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz'); INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
ERROR: invalid input syntax for type double precision: "xyz" ERROR: invalid input syntax for type double precision: "xyz"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
ERROR: invalid input syntax for type double precision: "5.0.0" ERROR: invalid input syntax for type double precision: "5.0.0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
ERROR: invalid input syntax for type double precision: "5 . 0" ERROR: invalid input syntax for type double precision: "5 . 0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0'); INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
ERROR: invalid input syntax for type double precision: "5. 0" ERROR: invalid input syntax for type double precision: "5. 0"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
^
INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3'); INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
ERROR: invalid input syntax for type double precision: " - 3" ERROR: invalid input syntax for type double precision: " - 3"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5'); INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
ERROR: invalid input syntax for type double precision: "123 5" ERROR: invalid input syntax for type double precision: "123 5"
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
^
-- special inputs -- special inputs
SELECT 'NaN'::float8; SELECT 'NaN'::float8;
float8 float8
...@@ -67,10 +91,16 @@ SELECT ' -INFINiTY '::float8; ...@@ -67,10 +91,16 @@ SELECT ' -INFINiTY '::float8;
-- bad special inputs -- bad special inputs
SELECT 'N A N'::float8; SELECT 'N A N'::float8;
ERROR: invalid input syntax for type double precision: "N A N" ERROR: invalid input syntax for type double precision: "N A N"
LINE 1: SELECT 'N A N'::float8;
^
SELECT 'NaN x'::float8; SELECT 'NaN x'::float8;
ERROR: invalid input syntax for type double precision: "NaN x" ERROR: invalid input syntax for type double precision: "NaN x"
LINE 1: SELECT 'NaN x'::float8;
^
SELECT ' INFINITY x'::float8; SELECT ' INFINITY x'::float8;
ERROR: invalid input syntax for type double precision: " INFINITY x" ERROR: invalid input syntax for type double precision: " INFINITY x"
LINE 1: SELECT ' INFINITY x'::float8;
^
SELECT 'Infinity'::float8 + 100.0; SELECT 'Infinity'::float8 + 100.0;
?column? ?column?
---------- ----------
...@@ -376,12 +406,20 @@ SELECT '' AS five, * FROM FLOAT8_TBL; ...@@ -376,12 +406,20 @@ SELECT '' AS five, * FROM FLOAT8_TBL;
-- test for over- and underflow -- test for over- and underflow
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
ERROR: "10e400" is out of range for type double precision ERROR: "10e400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
ERROR: "-10e400" is out of range for type double precision ERROR: "-10e400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
ERROR: "10e-400" is out of range for type double precision ERROR: "10e-400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
^
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
ERROR: "-10e-400" is out of range for type double precision ERROR: "-10e-400" is out of range for type double precision
LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
^
-- maintain external table consistency across platforms -- maintain external table consistency across platforms
-- delete all values and reinsert well-behaved ones -- delete all values and reinsert well-behaved ones
DELETE FROM FLOAT8_TBL; DELETE FROM FLOAT8_TBL;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -14,8 +14,12 @@ INSERT INTO PATH_TBL VALUES ('(11,12,13,14)'); ...@@ -14,8 +14,12 @@ INSERT INTO PATH_TBL VALUES ('(11,12,13,14)');
-- bad values for parser testing -- bad values for parser testing
INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]'); INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
ERROR: invalid input syntax for type path: "[(,2),(3,4)]" ERROR: invalid input syntax for type path: "[(,2),(3,4)]"
LINE 1: INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
^
INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)'); INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
ERROR: invalid input syntax for type path: "[(1,2),(3,4)" ERROR: invalid input syntax for type path: "[(1,2),(3,4)"
LINE 1: INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
^
SELECT f1 FROM PATH_TBL; SELECT f1 FROM PATH_TBL;
f1 f1
--------------------------- ---------------------------
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -257,3 +257,5 @@ SELECT * FROM truncate_a; ...@@ -257,3 +257,5 @@ SELECT * FROM truncate_a;
DROP TABLE truncate_a; DROP TABLE truncate_a;
SELECT nextval('truncate_a_id1'); -- fail, seq should have been dropped SELECT nextval('truncate_a_id1'); -- fail, seq should have been dropped
ERROR: relation "truncate_a_id1" does not exist ERROR: relation "truncate_a_id1" does not exist
LINE 1: SELECT nextval('truncate_a_id1');
^
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment