Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3955d66

Browse files
author
Thomas G. Lockhart
committed
Add test for UNION.
Add additional tests in strings for conversions of the "name" data type. Test SQL92 string functions such as SUBSTRING() and POSITION(). Fix geometry tests to reflect code fixed by Gautam. Update error messages.
1 parent f2764ee commit 3955d66

File tree

4 files changed

+418
-41
lines changed

4 files changed

+418
-41
lines changed

src/test/regress/expected/errors.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ERROR: attribute 'nonesuch' not found
1111
QUERY: select distinct on foobar from pg_database;
1212
ERROR: parser: parse error at or near "from"
1313
QUERY: select distinct on foobar * from pg_database;
14-
ERROR: The field specified in the UNIQUE ON clause is not in the targetlist
14+
ERROR: All fields in the UNIQUE ON clause must appear in the target list
1515
QUERY: delete from;
1616
ERROR: parser: parse error at or near ";"
1717
QUERY: delete from nonesuch;

src/test/regress/expected/geometry.out

+34-35
Original file line numberDiff line numberDiff line change
@@ -87,43 +87,42 @@ one|f1
8787

8888
QUERY: SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
8989
FROM LSEG_TBL l, POINT_TBL p;
90-
ERROR: There is no operator '#' for types 'lseg' and 'point'
91-
You will either have to retype this query using an explicit cast,
92-
or you will have to define the operator using CREATE OPERATOR
90+
ERROR: There is more than one possible operator '#' for types 'lseg' and 'point'
91+
You will have to retype this query using an explicit cast
9392
QUERY: SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
9493
FROM LSEG_TBL l, POINT_TBL p;
95-
thirty|f1 |s |closest
96-
------+----------+-----------------------------+------------------------------------
97-
|(0,0) |[(1,2),(3,4)] |(1,2)
98-
|(-10,0) |[(1,2),(3,4)] |(1,2)
99-
|(-3,4) |[(1,2),(3,4)] |(1,2)
100-
|(5.1,34.5)|[(1,2),(3,4)] |(3,4)
101-
|(-5,-12) |[(1,2),(3,4)] |(1,2)
102-
|(10,10) |[(1,2),(3,4)] |(3,4)
103-
|(0,0) |[(0,0),(6,6)] |(-0,0)
104-
|(-10,0) |[(0,0),(6,6)] |(0,0)
105-
|(-3,4) |[(0,0),(6,6)] |(0,0)
106-
|(5.1,34.5)|[(0,0),(6,6)] |(6,6)
107-
|(-5,-12) |[(0,0),(6,6)] |(0,0)
108-
|(10,10) |[(0,0),(6,6)] |(6,6)
109-
|(0,0) |[(10,-10),(-3,-4)] |(-3,-4)
110-
|(-10,0) |[(10,-10),(-3,-4)] |(-3,-4)
111-
|(-3,4) |[(10,-10),(-3,-4)] |(-3,-4)
112-
|(5.1,34.5)|[(10,-10),(-3,-4)] |(-3,-4)
113-
|(-5,-12) |[(10,-10),(-3,-4)] |(-3,-4)
114-
|(10,10) |[(10,-10),(-3,-4)] |(-3,-4)
115-
|(0,0) |[(-1000000,200),(300000,-40)]|(0.0028402365895872,15.384614860264)
116-
|(-10,0) |[(-1000000,200),(300000,-40)]|(-9.99715942258202,15.3864610140473)
117-
|(-3,4) |[(-1000000,200),(300000,-40)]|(-2.99789812267519,15.3851688427303)
118-
|(5.1,34.5)|[(-1000000,200),(300000,-40)]|(5.09647083221496,15.3836744976925)
119-
|(-5,-12) |[(-1000000,200),(300000,-40)]|(-4.99494420845634,15.3855375281616)
120-
|(10,10) |[(-1000000,200),(300000,-40)]|(10.000993741978,15.3827690473092)
121-
|(0,0) |[(11,22),(33,44)] |(11,22)
122-
|(-10,0) |[(11,22),(33,44)] |(11,22)
123-
|(-3,4) |[(11,22),(33,44)] |(11,22)
124-
|(5.1,34.5)|[(11,22),(33,44)] |(11,22)
125-
|(-5,-12) |[(11,22),(33,44)] |(11,22)
126-
|(10,10) |[(11,22),(33,44)] |(11,22)
94+
thirty|f1 |s |closest
95+
------+----------+-----------------------------+-------------------------------------
96+
|(0,0) |[(1,2),(3,4)] |(1,2)
97+
|(-10,0) |[(1,2),(3,4)] |(1,2)
98+
|(-3,4) |[(1,2),(3,4)] |(1,2)
99+
|(5.1,34.5)|[(1,2),(3,4)] |(3,4)
100+
|(-5,-12) |[(1,2),(3,4)] |(1,2)
101+
|(10,10) |[(1,2),(3,4)] |(3,4)
102+
|(0,0) |[(0,0),(6,6)] |(-0,0)
103+
|(-10,0) |[(0,0),(6,6)] |(0,0)
104+
|(-3,4) |[(0,0),(6,6)] |(0.5,0.5)
105+
|(5.1,34.5)|[(0,0),(6,6)] |(6,6)
106+
|(-5,-12) |[(0,0),(6,6)] |(0,0)
107+
|(10,10) |[(0,0),(6,6)] |(6,6)
108+
|(0,0) |[(10,-10),(-3,-4)] |(-2.04878048780488,-4.4390243902439)
109+
|(-10,0) |[(10,-10),(-3,-4)] |(-3,-4)
110+
|(-3,4) |[(10,-10),(-3,-4)] |(-3,-4)
111+
|(5.1,34.5)|[(10,-10),(-3,-4)] |(-3,-4)
112+
|(-5,-12) |[(10,-10),(-3,-4)] |(-1.60487804878049,-4.64390243902439)
113+
|(10,10) |[(10,-10),(-3,-4)] |(2.39024390243902,-6.48780487804878)
114+
|(0,0) |[(-1000000,200),(300000,-40)]|(0.0028402365895872,15.384614860264)
115+
|(-10,0) |[(-1000000,200),(300000,-40)]|(-9.99715942258202,15.3864610140473)
116+
|(-3,4) |[(-1000000,200),(300000,-40)]|(-2.99789812267519,15.3851688427303)
117+
|(5.1,34.5)|[(-1000000,200),(300000,-40)]|(5.09647083221496,15.3836744976925)
118+
|(-5,-12) |[(-1000000,200),(300000,-40)]|(-4.99494420845634,15.3855375281616)
119+
|(10,10) |[(-1000000,200),(300000,-40)]|(10.000993741978,15.3827690473092)
120+
|(0,0) |[(11,22),(33,44)] |(11,22)
121+
|(-10,0) |[(11,22),(33,44)] |(11,22)
122+
|(-3,4) |[(11,22),(33,44)] |(11,22)
123+
|(5.1,34.5)|[(11,22),(33,44)] |(14.3,25.3)
124+
|(-5,-12) |[(11,22),(33,44)] |(11,22)
125+
|(10,10) |[(11,22),(33,44)] |(11,22)
127126
(30 rows)
128127

129128
QUERY: SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;

src/test/regress/expected/strings.out

+142-5
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,146 @@ first line - next line - third line
99

1010
QUERY: SELECT 'first line'
1111
' - next line' /* this comment is not allowed here */
12-
' - third line';
12+
' - third line'
13+
AS "Illegal comment within continuation";
1314
ERROR: parser: parse error at or near "'"
14-
QUERY: SELECT text(f1) FROM CHAR_TBL;
15-
ERROR: function text(bpchar) does not exist
16-
QUERY: SELECT text(f1) FROM VARCHAR_TBL;
17-
ERROR: function text(varchar) does not exist
15+
QUERY: SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL;
16+
text(char)
17+
----------
18+
a
19+
ab
20+
abcd
21+
abcd
22+
(4 rows)
23+
24+
QUERY: SELECT CAST(f1 AS text) AS "text(varchar)" FROM VARCHAR_TBL;
25+
text(varchar)
26+
-------------
27+
a
28+
ab
29+
abcd
30+
abcd
31+
(4 rows)
32+
33+
QUERY: SELECT CAST(name 'namefield' AS text) AS "text(name)";
34+
text(name)
35+
----------
36+
namefield
37+
(1 row)
38+
39+
QUERY: SELECT CAST(f1 AS char) AS "char(text)" FROM TEXT_TBL;
40+
char(text)
41+
-----------------
42+
doh!
43+
hi de ho neighbor
44+
(2 rows)
45+
46+
QUERY: SELECT CAST(f1 AS char) AS "char(varchar)" FROM VARCHAR_TBL;
47+
char(varchar)
48+
-------------
49+
a
50+
ab
51+
abcd
52+
abcd
53+
(4 rows)
54+
55+
QUERY: SELECT CAST(name 'namefield' AS char) AS "char(name)";
56+
char(name)
57+
----------
58+
namefield
59+
(1 row)
60+
61+
QUERY: SELECT CAST(f1 AS varchar) AS "varchar(text)" FROM TEXT_TBL;
62+
varchar(text)
63+
-----------------
64+
doh!
65+
hi de ho neighbor
66+
(2 rows)
67+
68+
QUERY: SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL;
69+
varchar(char)
70+
-------------
71+
a
72+
ab
73+
abcd
74+
abcd
75+
(4 rows)
76+
77+
QUERY: SELECT CAST(name 'namefield' AS varchar) AS "varchar(name)";
78+
varchar(name)
79+
-------------
80+
namefield
81+
(1 row)
82+
83+
QUERY: SELECT TRIM(BOTH FROM ' bunch o blanks ') AS "bunch o blanks";
84+
bunch o blanks
85+
--------------
86+
bunch o blanks
87+
(1 row)
88+
89+
QUERY: SELECT TRIM(LEADING FROM ' bunch o blanks ') AS "bunch o blanks ";
90+
bunch o blanks
91+
----------------
92+
bunch o blanks
93+
(1 row)
94+
95+
QUERY: SELECT TRIM(TRAILING FROM ' bunch o blanks ') AS " bunch o blanks";
96+
bunch o blanks
97+
----------------
98+
bunch o blanks
99+
(1 row)
100+
101+
QUERY: SELECT TRIM(BOTH 'x' FROM 'xxxxxsome Xsxxxxx') AS "some Xs";
102+
some Xs
103+
-------
104+
some Xs
105+
(1 row)
106+
107+
QUERY: SELECT SUBSTRING('1234567890' FROM 3) AS "34567890";
108+
34567890
109+
--------
110+
34567890
111+
(1 row)
112+
113+
QUERY: SELECT SUBSTRING('1234567890' FROM 4 FOR 3) AS "456";
114+
456
115+
---
116+
456
117+
(1 row)
118+
119+
QUERY: SELECT POSITION('4' IN '1234567890') AS "4";
120+
4
121+
-
122+
4
123+
(1 row)
124+
125+
QUERY: SELECT POSITION(5 IN '1234567890') AS "5";
126+
5
127+
-
128+
5
129+
(1 row)
130+
131+
QUERY: SELECT 'unknown' || ' and unknown' AS "Concat unknown types";
132+
Concat unknown types
133+
--------------------
134+
unknown and unknown
135+
(1 row)
136+
137+
QUERY: SELECT text 'text' || ' and unknown' AS "Concat text to unknown type";
138+
Concat text to unknown type
139+
---------------------------
140+
text and unknown
141+
(1 row)
142+
143+
QUERY: SELECT text 'text' || char ' and char' AS "Concat text to char";
144+
Concat text to char
145+
-------------------
146+
text and char
147+
(1 row)
148+
149+
QUERY: SELECT text 'text' || varchar ' and varchar' AS "Concat text to varchar";
150+
Concat text to varchar
151+
----------------------
152+
text and varchar
153+
(1 row)
154+

0 commit comments

Comments
 (0)