Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9bbca2c0
Commit
9bbca2c0
authored
Nov 09, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more union/intersect/except test cases, per suggestions
from Kevin O'Gorman.
parent
a1d13399
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
160 additions
and
0 deletions
+160
-0
src/test/regress/expected/union.out
src/test/regress/expected/union.out
+116
-0
src/test/regress/sql/union.sql
src/test/regress/sql/union.sql
+44
-0
No files found.
src/test/regress/expected/union.out
View file @
9bbca2c0
...
...
@@ -294,6 +294,26 @@ SELECT q2 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q1 FROM int8_tbl;
4567890123456789
(3 rows)
SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl;
q1
----
(0 rows)
SELECT q1 FROM int8_tbl EXCEPT ALL SELECT q2 FROM int8_tbl;
q1
------------------
123
4567890123456789
(2 rows)
SELECT q1 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q2 FROM int8_tbl;
q1
------------------
123
4567890123456789
4567890123456789
(3 rows)
--
-- Mixed types
--
...
...
@@ -312,3 +332,99 @@ SELECT f1 FROM float8_tbl EXCEPT SELECT f1 FROM int4_tbl;
-1.2345678901234e-200
(4 rows)
--
-- Operator precedence and (((((extra))))) parentheses
--
SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl;
q1
-------------------
123
4567890123456789
456
4567890123456789
123
4567890123456789
-4567890123456789
(7 rows)
SELECT q1 FROM int8_tbl INTERSECT (((SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl)));
q1
------------------
123
4567890123456789
(2 rows)
(((SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl))) UNION ALL SELECT q2 FROM int8_tbl;
q1
-------------------
123
4567890123456789
456
4567890123456789
123
4567890123456789
-4567890123456789
(7 rows)
SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl;
q1
-------------------
-4567890123456789
456
(2 rows)
SELECT q1 FROM int8_tbl UNION ALL (((SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl)));
q1
-------------------
123
123
4567890123456789
4567890123456789
4567890123456789
-4567890123456789
456
(7 rows)
(((SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) EXCEPT SELECT q1 FROM int8_tbl;
q1
-------------------
-4567890123456789
456
(2 rows)
--
-- Subqueries with ORDER BY & LIMIT clauses
--
-- In this syntax, ORDER BY/LIMIT apply to the result of the EXCEPT
SELECT q1,q2 FROM int8_tbl EXCEPT SELECT q2,q1 FROM int8_tbl
ORDER BY q2,q1;
q1 | q2
------------------+-------------------
4567890123456789 | -4567890123456789
123 | 456
(2 rows)
-- This should fail, because q2 isn't a name of an EXCEPT output column
SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1;
ERROR: Attribute 'q2' not found
-- But this should work:
SELECT q1 FROM int8_tbl EXCEPT (((SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1)));
q1
------------------
123
4567890123456789
(2 rows)
--
-- New syntaxes (7.1) permit new tests
--
(((((select * from int8_tbl)))));
q1 | q2
------------------+-------------------
123 | 456
123 | 4567890123456789
4567890123456789 | 123
4567890123456789 | 4567890123456789
4567890123456789 | -4567890123456789
(5 rows)
src/test/regress/sql/union.sql
View file @
9bbca2c0
...
...
@@ -98,6 +98,12 @@ SELECT q2 FROM int8_tbl EXCEPT ALL SELECT q1 FROM int8_tbl;
SELECT
q2
FROM
int8_tbl
EXCEPT
ALL
SELECT
DISTINCT
q1
FROM
int8_tbl
;
SELECT
q1
FROM
int8_tbl
EXCEPT
SELECT
q2
FROM
int8_tbl
;
SELECT
q1
FROM
int8_tbl
EXCEPT
ALL
SELECT
q2
FROM
int8_tbl
;
SELECT
q1
FROM
int8_tbl
EXCEPT
ALL
SELECT
DISTINCT
q2
FROM
int8_tbl
;
--
-- Mixed types
--
...
...
@@ -105,3 +111,41 @@ SELECT q2 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q1 FROM int8_tbl;
SELECT
f1
FROM
float8_tbl
INTERSECT
SELECT
f1
FROM
int4_tbl
;
SELECT
f1
FROM
float8_tbl
EXCEPT
SELECT
f1
FROM
int4_tbl
;
--
-- Operator precedence and (((((extra))))) parentheses
--
SELECT
q1
FROM
int8_tbl
INTERSECT
SELECT
q2
FROM
int8_tbl
UNION
ALL
SELECT
q2
FROM
int8_tbl
;
SELECT
q1
FROM
int8_tbl
INTERSECT
(((
SELECT
q2
FROM
int8_tbl
UNION
ALL
SELECT
q2
FROM
int8_tbl
)));
(((
SELECT
q1
FROM
int8_tbl
INTERSECT
SELECT
q2
FROM
int8_tbl
)))
UNION
ALL
SELECT
q2
FROM
int8_tbl
;
SELECT
q1
FROM
int8_tbl
UNION
ALL
SELECT
q2
FROM
int8_tbl
EXCEPT
SELECT
q1
FROM
int8_tbl
;
SELECT
q1
FROM
int8_tbl
UNION
ALL
(((
SELECT
q2
FROM
int8_tbl
EXCEPT
SELECT
q1
FROM
int8_tbl
)));
(((
SELECT
q1
FROM
int8_tbl
UNION
ALL
SELECT
q2
FROM
int8_tbl
)))
EXCEPT
SELECT
q1
FROM
int8_tbl
;
--
-- Subqueries with ORDER BY & LIMIT clauses
--
-- In this syntax, ORDER BY/LIMIT apply to the result of the EXCEPT
SELECT
q1
,
q2
FROM
int8_tbl
EXCEPT
SELECT
q2
,
q1
FROM
int8_tbl
ORDER
BY
q2
,
q1
;
-- This should fail, because q2 isn't a name of an EXCEPT output column
SELECT
q1
FROM
int8_tbl
EXCEPT
SELECT
q2
FROM
int8_tbl
ORDER
BY
q2
LIMIT
1
;
-- But this should work:
SELECT
q1
FROM
int8_tbl
EXCEPT
(((
SELECT
q2
FROM
int8_tbl
ORDER
BY
q2
LIMIT
1
)));
--
-- New syntaxes (7.1) permit new tests
--
(((((
select
*
from
int8_tbl
)))));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment