mirror of https://github.com/postgres/postgres
Update remaining tests for new psql, with the exception of 'arrays',
which is broken in some weird way that I don't understand. I think it may be exposing a bug in the new psql --- for one thing, I get different results when I run psql by hand than the regress script gets. What the heck???
This commit is contained in:
parent
0e821fb771
commit
260b6afc79
|
@ -1,132 +1,135 @@
|
|||
QUERY: SELECT avg(four) AS avg_1 FROM onek;
|
||||
avg_1
|
||||
-----
|
||||
1
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100;
|
||||
avg_32
|
||||
------
|
||||
32
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT avg(b) AS avg_107_943 FROM aggtest;
|
||||
avg_107_943
|
||||
-----------
|
||||
107.943
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT avg(gpa) AS avg_3_4 FROM student;
|
||||
avg_3_4
|
||||
--
|
||||
-- AGGREGATES
|
||||
--
|
||||
SELECT avg(four) AS avg_1 FROM onek;
|
||||
avg_1
|
||||
-------
|
||||
3.4
|
||||
1
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT sum(four) AS sum_1500 FROM onek;
|
||||
sum_1500
|
||||
SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100;
|
||||
avg_32
|
||||
--------
|
||||
1500
|
||||
32
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT sum(a) AS sum_198 FROM aggtest;
|
||||
sum_198
|
||||
-------
|
||||
198
|
||||
SELECT avg(b) AS avg_107_943 FROM aggtest;
|
||||
avg_107_943
|
||||
-------------
|
||||
107.943
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT sum(b) AS avg_431_773 FROM aggtest;
|
||||
avg_431_773
|
||||
-----------
|
||||
431.773
|
||||
SELECT avg(gpa) AS avg_3_4 FROM student;
|
||||
avg_3_4
|
||||
---------
|
||||
3.4
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT sum(gpa) AS avg_6_8 FROM student;
|
||||
avg_6_8
|
||||
-------
|
||||
6.8
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT max(four) AS max_3 FROM onek;
|
||||
max_3
|
||||
-----
|
||||
3
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT max(a) AS max_100 FROM aggtest;
|
||||
max_100
|
||||
-------
|
||||
100
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT max(aggtest.b) AS max_324_78 FROM aggtest;
|
||||
max_324_78
|
||||
SELECT sum(four) AS sum_1500 FROM onek;
|
||||
sum_1500
|
||||
----------
|
||||
324.78
|
||||
1500
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT max(student.gpa) AS max_3_7 FROM student;
|
||||
max_3_7
|
||||
SELECT sum(a) AS sum_198 FROM aggtest;
|
||||
sum_198
|
||||
---------
|
||||
198
|
||||
(1 row)
|
||||
|
||||
SELECT sum(b) AS avg_431_773 FROM aggtest;
|
||||
avg_431_773
|
||||
-------------
|
||||
431.773
|
||||
(1 row)
|
||||
|
||||
SELECT sum(gpa) AS avg_6_8 FROM student;
|
||||
avg_6_8
|
||||
---------
|
||||
6.8
|
||||
(1 row)
|
||||
|
||||
SELECT max(four) AS max_3 FROM onek;
|
||||
max_3
|
||||
-------
|
||||
3.7
|
||||
3
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT count(four) AS cnt_1000 FROM onek;
|
||||
cnt_1000
|
||||
--------
|
||||
1000
|
||||
SELECT max(a) AS max_100 FROM aggtest;
|
||||
max_100
|
||||
---------
|
||||
100
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT count(DISTINCT four) AS cnt_4 FROM onek;
|
||||
cnt_4
|
||||
-----
|
||||
4
|
||||
SELECT max(aggtest.b) AS max_324_78 FROM aggtest;
|
||||
max_324_78
|
||||
------------
|
||||
324.78
|
||||
(1 row)
|
||||
|
||||
QUERY: select ten, count(*), sum(four) from onek group by ten;
|
||||
ten|count|sum
|
||||
---+-----+---
|
||||
0| 100|100
|
||||
1| 100|200
|
||||
2| 100|100
|
||||
3| 100|200
|
||||
4| 100|100
|
||||
5| 100|200
|
||||
6| 100|100
|
||||
7| 100|200
|
||||
8| 100|100
|
||||
9| 100|200
|
||||
SELECT max(student.gpa) AS max_3_7 FROM student;
|
||||
max_3_7
|
||||
---------
|
||||
3.7
|
||||
(1 row)
|
||||
|
||||
SELECT count(four) AS cnt_1000 FROM onek;
|
||||
cnt_1000
|
||||
----------
|
||||
1000
|
||||
(1 row)
|
||||
|
||||
SELECT count(DISTINCT four) AS cnt_4 FROM onek;
|
||||
cnt_4
|
||||
-------
|
||||
4
|
||||
(1 row)
|
||||
|
||||
select ten, count(*), sum(four) from onek group by ten;
|
||||
ten | count | sum
|
||||
-----+-------+-----
|
||||
0 | 100 | 100
|
||||
1 | 100 | 200
|
||||
2 | 100 | 100
|
||||
3 | 100 | 200
|
||||
4 | 100 | 100
|
||||
5 | 100 | 200
|
||||
6 | 100 | 100
|
||||
7 | 100 | 200
|
||||
8 | 100 | 100
|
||||
9 | 100 | 200
|
||||
(10 rows)
|
||||
|
||||
QUERY: select ten, count(four), sum(DISTINCT four) from onek group by ten;
|
||||
ten|count|sum
|
||||
---+-----+---
|
||||
0| 100| 2
|
||||
1| 100| 4
|
||||
2| 100| 2
|
||||
3| 100| 4
|
||||
4| 100| 2
|
||||
5| 100| 4
|
||||
6| 100| 2
|
||||
7| 100| 4
|
||||
8| 100| 2
|
||||
9| 100| 4
|
||||
select ten, count(four), sum(DISTINCT four) from onek group by ten;
|
||||
ten | count | sum
|
||||
-----+-------+-----
|
||||
0 | 100 | 2
|
||||
1 | 100 | 4
|
||||
2 | 100 | 2
|
||||
3 | 100 | 4
|
||||
4 | 100 | 2
|
||||
5 | 100 | 4
|
||||
6 | 100 | 2
|
||||
7 | 100 | 4
|
||||
8 | 100 | 2
|
||||
9 | 100 | 4
|
||||
(10 rows)
|
||||
|
||||
QUERY: SELECT newavg(four) AS avg_1 FROM onek;
|
||||
avg_1
|
||||
-----
|
||||
1
|
||||
SELECT newavg(four) AS avg_1 FROM onek;
|
||||
avg_1
|
||||
-------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT newsum(four) AS sum_1500 FROM onek;
|
||||
sum_1500
|
||||
--------
|
||||
1500
|
||||
SELECT newsum(four) AS sum_1500 FROM onek;
|
||||
sum_1500
|
||||
----------
|
||||
1500
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT newcnt(four) AS cnt_1000 FROM onek;
|
||||
cnt_1000
|
||||
--------
|
||||
1000
|
||||
SELECT newcnt(four) AS cnt_1000 FROM onek;
|
||||
cnt_1000
|
||||
----------
|
||||
1000
|
||||
(1 row)
|
||||
|
||||
|
|
|
@ -1,253 +1,268 @@
|
|||
QUERY: CREATE TABLE tmp (initial int4);
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN a int4;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN b name;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN c text;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN d float8;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN e float4;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN f int2;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN g polygon;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN h abstime;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN i char;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN j abstime[];
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN k dt;
|
||||
--
|
||||
-- ALTER_TABLE
|
||||
-- add attribute
|
||||
--
|
||||
CREATE TABLE tmp (initial int4);
|
||||
ALTER TABLE tmp ADD COLUMN a int4;
|
||||
ALTER TABLE tmp ADD COLUMN b name;
|
||||
ALTER TABLE tmp ADD COLUMN c text;
|
||||
ALTER TABLE tmp ADD COLUMN d float8;
|
||||
ALTER TABLE tmp ADD COLUMN e float4;
|
||||
ALTER TABLE tmp ADD COLUMN f int2;
|
||||
ALTER TABLE tmp ADD COLUMN g polygon;
|
||||
ALTER TABLE tmp ADD COLUMN h abstime;
|
||||
ALTER TABLE tmp ADD COLUMN i char;
|
||||
ALTER TABLE tmp ADD COLUMN j abstime[];
|
||||
ALTER TABLE tmp ADD COLUMN k dt;
|
||||
ERROR: Unable to locate type name 'dt' in catalog
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN l tid;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN m xid;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN n oid8;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN p smgr;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN q point;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN r lseg;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN s path;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN t box;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN u tinterval;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN v datetime;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN w timespan;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN x float8[];
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN y float4[];
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN z int2[];
|
||||
QUERY: INSERT INTO tmp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u,
|
||||
ALTER TABLE tmp ADD COLUMN l tid;
|
||||
ALTER TABLE tmp ADD COLUMN m xid;
|
||||
ALTER TABLE tmp ADD COLUMN n oid8;
|
||||
--ALTER TABLE tmp ADD COLUMN o lock;
|
||||
ALTER TABLE tmp ADD COLUMN p smgr;
|
||||
ALTER TABLE tmp ADD COLUMN q point;
|
||||
ALTER TABLE tmp ADD COLUMN r lseg;
|
||||
ALTER TABLE tmp ADD COLUMN s path;
|
||||
ALTER TABLE tmp ADD COLUMN t box;
|
||||
ALTER TABLE tmp ADD COLUMN u tinterval;
|
||||
ALTER TABLE tmp ADD COLUMN v datetime;
|
||||
ALTER TABLE tmp ADD COLUMN w timespan;
|
||||
ALTER TABLE tmp ADD COLUMN x float8[];
|
||||
ALTER TABLE tmp ADD COLUMN y float4[];
|
||||
ALTER TABLE tmp ADD COLUMN z int2[];
|
||||
INSERT INTO tmp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u,
|
||||
v, w, x, y, z)
|
||||
VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
|
||||
'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}',
|
||||
VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
|
||||
'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}',
|
||||
314159, '(1,1)', 512,
|
||||
'1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
|
||||
'(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["current" "infinity"]',
|
||||
'1/3', '1,name', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
|
||||
ERROR: Relation 'tmp' does not have attribute 'k'
|
||||
QUERY: SELECT * FROM tmp;
|
||||
initial|a|b|c|d|e|f|g|h|i|j|l|m|n|p|q|r|s|t|u|v|w|x|y|z
|
||||
-------+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
||||
SELECT * FROM tmp;
|
||||
initial | a | b | c | d | e | f | g | h | i | j | l | m | n | p | q | r | s | t | u | v | w | x | y | z
|
||||
---------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
|
||||
(0 rows)
|
||||
|
||||
QUERY: DROP TABLE tmp;
|
||||
QUERY: CREATE TABLE tmp (
|
||||
DROP TABLE tmp;
|
||||
-- the wolf bug - schema mods caused inconsistent row descriptors
|
||||
CREATE TABLE tmp (
|
||||
initial int4
|
||||
);
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN a int4;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN b name;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN c text;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN d float8;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN e float4;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN f int2;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN g polygon;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN h abstime;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN i char;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN j abstime[];
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN k dt;
|
||||
ALTER TABLE tmp ADD COLUMN a int4;
|
||||
ALTER TABLE tmp ADD COLUMN b name;
|
||||
ALTER TABLE tmp ADD COLUMN c text;
|
||||
ALTER TABLE tmp ADD COLUMN d float8;
|
||||
ALTER TABLE tmp ADD COLUMN e float4;
|
||||
ALTER TABLE tmp ADD COLUMN f int2;
|
||||
ALTER TABLE tmp ADD COLUMN g polygon;
|
||||
ALTER TABLE tmp ADD COLUMN h abstime;
|
||||
ALTER TABLE tmp ADD COLUMN i char;
|
||||
ALTER TABLE tmp ADD COLUMN j abstime[];
|
||||
ALTER TABLE tmp ADD COLUMN k dt;
|
||||
ERROR: Unable to locate type name 'dt' in catalog
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN l tid;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN m xid;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN n oid8;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN p smgr;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN q point;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN r lseg;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN s path;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN t box;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN u tinterval;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN v datetime;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN w timespan;
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN x float8[];
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN y float4[];
|
||||
QUERY: ALTER TABLE tmp ADD COLUMN z int2[];
|
||||
QUERY: INSERT INTO tmp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u,
|
||||
ALTER TABLE tmp ADD COLUMN l tid;
|
||||
ALTER TABLE tmp ADD COLUMN m xid;
|
||||
ALTER TABLE tmp ADD COLUMN n oid8;
|
||||
--ALTER TABLE tmp ADD COLUMN o lock;
|
||||
ALTER TABLE tmp ADD COLUMN p smgr;
|
||||
ALTER TABLE tmp ADD COLUMN q point;
|
||||
ALTER TABLE tmp ADD COLUMN r lseg;
|
||||
ALTER TABLE tmp ADD COLUMN s path;
|
||||
ALTER TABLE tmp ADD COLUMN t box;
|
||||
ALTER TABLE tmp ADD COLUMN u tinterval;
|
||||
ALTER TABLE tmp ADD COLUMN v datetime;
|
||||
ALTER TABLE tmp ADD COLUMN w timespan;
|
||||
ALTER TABLE tmp ADD COLUMN x float8[];
|
||||
ALTER TABLE tmp ADD COLUMN y float4[];
|
||||
ALTER TABLE tmp ADD COLUMN z int2[];
|
||||
INSERT INTO tmp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u,
|
||||
v, w, x, y, z)
|
||||
VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
|
||||
VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
|
||||
'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}',
|
||||
314159, '(1,1)', 512,
|
||||
'1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
|
||||
'(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["current" "infinity"]',
|
||||
'1/3', '1,name', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
|
||||
ERROR: Relation 'tmp' does not have attribute 'k'
|
||||
QUERY: SELECT * FROM tmp;
|
||||
initial|a|b|c|d|e|f|g|h|i|j|l|m|n|p|q|r|s|t|u|v|w|x|y|z
|
||||
-------+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
||||
SELECT * FROM tmp;
|
||||
initial | a | b | c | d | e | f | g | h | i | j | l | m | n | p | q | r | s | t | u | v | w | x | y | z
|
||||
---------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
|
||||
(0 rows)
|
||||
|
||||
QUERY: DROP TABLE tmp;
|
||||
QUERY: ALTER TABLE tenk1 RENAME TO ten_k;
|
||||
QUERY: SELECT unique1 FROM ten_k WHERE unique1 < 20;
|
||||
unique1
|
||||
-------
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
DROP TABLE tmp;
|
||||
--
|
||||
-- rename -
|
||||
-- should preserve indices
|
||||
--
|
||||
ALTER TABLE tenk1 RENAME TO ten_k;
|
||||
-- 20 values, sorted
|
||||
SELECT unique1 FROM ten_k WHERE unique1 < 20;
|
||||
unique1
|
||||
---------
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
(20 rows)
|
||||
|
||||
QUERY: SELECT unique2 FROM ten_k WHERE unique2 < 20;
|
||||
unique2
|
||||
-------
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
-- 20 values, sorted
|
||||
SELECT unique2 FROM ten_k WHERE unique2 < 20;
|
||||
unique2
|
||||
---------
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
(20 rows)
|
||||
|
||||
QUERY: SELECT hundred FROM ten_k WHERE hundred = 50;
|
||||
hundred
|
||||
-------
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
-- 100 values, sorted
|
||||
SELECT hundred FROM ten_k WHERE hundred = 50;
|
||||
hundred
|
||||
---------
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
50
|
||||
(100 rows)
|
||||
|
||||
QUERY: ALTER TABLE ten_k RENAME TO tenk1;
|
||||
QUERY: SELECT unique1 FROM tenk1 WHERE unique1 < 5;
|
||||
unique1
|
||||
-------
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
ALTER TABLE ten_k RENAME TO tenk1;
|
||||
-- 5 values, sorted
|
||||
SELECT unique1 FROM tenk1 WHERE unique1 < 5;
|
||||
unique1
|
||||
---------
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
(5 rows)
|
||||
|
||||
|
|
|
@ -1,96 +1,100 @@
|
|||
QUERY: SELECT b.*
|
||||
--
|
||||
-- BTREE_INDEX
|
||||
-- test retrieval of min/max keys for each index
|
||||
--
|
||||
SELECT b.*
|
||||
FROM bt_i4_heap b
|
||||
WHERE b.seqno < 1;
|
||||
seqno| random
|
||||
-----+----------
|
||||
0|1935401906
|
||||
seqno | random
|
||||
-------+------------
|
||||
0 | 1935401906
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_i4_heap b
|
||||
WHERE b.seqno >= 9999;
|
||||
seqno| random
|
||||
-----+----------
|
||||
9999|1227676208
|
||||
seqno | random
|
||||
-------+------------
|
||||
9999 | 1227676208
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_i4_heap b
|
||||
WHERE b.seqno = 4500;
|
||||
seqno| random
|
||||
-----+----------
|
||||
4500|2080851358
|
||||
seqno | random
|
||||
-------+------------
|
||||
4500 | 2080851358
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_name_heap b
|
||||
WHERE b.seqno < '1'::name;
|
||||
seqno| random
|
||||
-----+----------
|
||||
0|1935401906
|
||||
seqno | random
|
||||
-------+------------
|
||||
0 | 1935401906
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_name_heap b
|
||||
WHERE b.seqno >= '9999'::name;
|
||||
seqno| random
|
||||
-----+----------
|
||||
9999|1227676208
|
||||
seqno | random
|
||||
-------+------------
|
||||
9999 | 1227676208
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_name_heap b
|
||||
WHERE b.seqno = '4500'::name;
|
||||
seqno| random
|
||||
-----+----------
|
||||
4500|2080851358
|
||||
seqno | random
|
||||
-------+------------
|
||||
4500 | 2080851358
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_txt_heap b
|
||||
WHERE b.seqno < '1'::text;
|
||||
seqno| random
|
||||
-----+----------
|
||||
0|1935401906
|
||||
seqno | random
|
||||
-------+------------
|
||||
0 | 1935401906
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_txt_heap b
|
||||
WHERE b.seqno >= '9999'::text;
|
||||
seqno| random
|
||||
-----+----------
|
||||
9999|1227676208
|
||||
seqno | random
|
||||
-------+------------
|
||||
9999 | 1227676208
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_txt_heap b
|
||||
WHERE b.seqno = '4500'::text;
|
||||
seqno| random
|
||||
-----+----------
|
||||
4500|2080851358
|
||||
seqno | random
|
||||
-------+------------
|
||||
4500 | 2080851358
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_f8_heap b
|
||||
WHERE b.seqno < '1'::float8;
|
||||
seqno| random
|
||||
-----+----------
|
||||
0|1935401906
|
||||
seqno | random
|
||||
-------+------------
|
||||
0 | 1935401906
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_f8_heap b
|
||||
WHERE b.seqno >= '9999'::float8;
|
||||
seqno| random
|
||||
-----+----------
|
||||
9999|1227676208
|
||||
seqno | random
|
||||
-------+------------
|
||||
9999 | 1227676208
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT b.*
|
||||
SELECT b.*
|
||||
FROM bt_f8_heap b
|
||||
WHERE b.seqno = '4500'::float8;
|
||||
seqno| random
|
||||
-----+----------
|
||||
4500|2080851358
|
||||
seqno | random
|
||||
-------+------------
|
||||
4500 | 2080851358
|
||||
(1 row)
|
||||
|
||||
|
|
|
@ -1,139 +1,198 @@
|
|||
QUERY: SELECT hash_i4_heap.*
|
||||
--
|
||||
-- HASH_INDEX
|
||||
-- grep 843938989 hash.data
|
||||
--
|
||||
SELECT hash_i4_heap.*
|
||||
WHERE hash_i4_heap.random = 843938989;
|
||||
seqno| random
|
||||
-----+---------
|
||||
15|843938989
|
||||
seqno | random
|
||||
-------+-----------
|
||||
15 | 843938989
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT hash_i4_heap.*
|
||||
--
|
||||
-- hash index
|
||||
-- grep 66766766 hash.data
|
||||
--
|
||||
SELECT hash_i4_heap.*
|
||||
WHERE hash_i4_heap.random = 66766766;
|
||||
seqno|random
|
||||
-----+------
|
||||
seqno | random
|
||||
-------+--------
|
||||
(0 rows)
|
||||
|
||||
QUERY: SELECT hash_name_heap.*
|
||||
--
|
||||
-- hash index
|
||||
-- grep 1505703298 hash.data
|
||||
--
|
||||
SELECT hash_name_heap.*
|
||||
WHERE hash_name_heap.random = '1505703298'::name;
|
||||
seqno| random
|
||||
-----+----------
|
||||
9838|1505703298
|
||||
seqno | random
|
||||
-------+------------
|
||||
9838 | 1505703298
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT hash_name_heap.*
|
||||
--
|
||||
-- hash index
|
||||
-- grep 7777777 hash.data
|
||||
--
|
||||
SELECT hash_name_heap.*
|
||||
WHERE hash_name_heap.random = '7777777'::name;
|
||||
seqno|random
|
||||
-----+------
|
||||
seqno | random
|
||||
-------+--------
|
||||
(0 rows)
|
||||
|
||||
QUERY: SELECT hash_txt_heap.*
|
||||
--
|
||||
-- hash index
|
||||
-- grep 1351610853 hash.data
|
||||
--
|
||||
SELECT hash_txt_heap.*
|
||||
WHERE hash_txt_heap.random = '1351610853'::text;
|
||||
seqno| random
|
||||
-----+----------
|
||||
5677|1351610853
|
||||
seqno | random
|
||||
-------+------------
|
||||
5677 | 1351610853
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT hash_txt_heap.*
|
||||
--
|
||||
-- hash index
|
||||
-- grep 111111112222222233333333 hash.data
|
||||
--
|
||||
SELECT hash_txt_heap.*
|
||||
WHERE hash_txt_heap.random = '111111112222222233333333'::text;
|
||||
seqno|random
|
||||
-----+------
|
||||
seqno | random
|
||||
-------+--------
|
||||
(0 rows)
|
||||
|
||||
QUERY: SELECT hash_f8_heap.*
|
||||
--
|
||||
-- hash index
|
||||
-- grep 444705537 hash.data
|
||||
--
|
||||
SELECT hash_f8_heap.*
|
||||
WHERE hash_f8_heap.random = '444705537'::float8;
|
||||
seqno| random
|
||||
-----+---------
|
||||
7853|444705537
|
||||
seqno | random
|
||||
-------+-----------
|
||||
7853 | 444705537
|
||||
(1 row)
|
||||
|
||||
QUERY: SELECT hash_f8_heap.*
|
||||
--
|
||||
-- hash index
|
||||
-- grep 88888888 hash.data
|
||||
--
|
||||
SELECT hash_f8_heap.*
|
||||
WHERE hash_f8_heap.random = '88888888'::float8;
|
||||
seqno|random
|
||||
-----+------
|
||||
seqno | random
|
||||
-------+--------
|
||||
(0 rows)
|
||||
|
||||
QUERY: UPDATE hash_i4_heap
|
||||
--
|
||||
-- hash index
|
||||
-- grep '^90[^0-9]' hashovfl.data
|
||||
--
|
||||
-- SELECT count(*) AS i988 FROM hash_ovfl_heap
|
||||
-- WHERE x = 90;
|
||||
--
|
||||
-- hash index
|
||||
-- grep '^1000[^0-9]' hashovfl.data
|
||||
--
|
||||
-- SELECT count(*) AS i0 FROM hash_ovfl_heap
|
||||
-- WHERE x = 1000;
|
||||
--
|
||||
-- HASH
|
||||
--
|
||||
UPDATE hash_i4_heap
|
||||
SET random = 1
|
||||
WHERE hash_i4_heap.seqno = 1492;
|
||||
QUERY: SELECT h.seqno AS i1492, h.random AS i1
|
||||
SELECT h.seqno AS i1492, h.random AS i1
|
||||
FROM hash_i4_heap h
|
||||
WHERE h.random = 1;
|
||||
i1492|i1
|
||||
-----+--
|
||||
1492| 1
|
||||
i1492 | i1
|
||||
-------+----
|
||||
1492 | 1
|
||||
(1 row)
|
||||
|
||||
QUERY: UPDATE hash_i4_heap
|
||||
SET seqno = 20000
|
||||
UPDATE hash_i4_heap
|
||||
SET seqno = 20000
|
||||
WHERE hash_i4_heap.random = 1492795354;
|
||||
QUERY: SELECT h.seqno AS i20000
|
||||
SELECT h.seqno AS i20000
|
||||
FROM hash_i4_heap h
|
||||
WHERE h.random = 1492795354;
|
||||
i20000
|
||||
------
|
||||
20000
|
||||
i20000
|
||||
--------
|
||||
20000
|
||||
(1 row)
|
||||
|
||||
QUERY: UPDATE hash_name_heap
|
||||
UPDATE hash_name_heap
|
||||
SET random = '0123456789abcdef'::name
|
||||
WHERE hash_name_heap.seqno = 6543;
|
||||
QUERY: SELECT h.seqno AS i6543, h.random AS c0_to_f
|
||||
SELECT h.seqno AS i6543, h.random AS c0_to_f
|
||||
FROM hash_name_heap h
|
||||
WHERE h.random = '0123456789abcdef'::name;
|
||||
i6543|c0_to_f
|
||||
-----+----------------
|
||||
6543|0123456789abcdef
|
||||
i6543 | c0_to_f
|
||||
-------+------------------
|
||||
6543 | 0123456789abcdef
|
||||
(1 row)
|
||||
|
||||
QUERY: UPDATE hash_name_heap
|
||||
UPDATE hash_name_heap
|
||||
SET seqno = 20000
|
||||
WHERE hash_name_heap.random = '76652222'::name;
|
||||
QUERY: SELECT h.seqno AS emptyset
|
||||
--
|
||||
-- this is the row we just replaced; index scan should return zero rows
|
||||
--
|
||||
SELECT h.seqno AS emptyset
|
||||
FROM hash_name_heap h
|
||||
WHERE h.random = '76652222'::name;
|
||||
emptyset
|
||||
--------
|
||||
emptyset
|
||||
----------
|
||||
(0 rows)
|
||||
|
||||
QUERY: UPDATE hash_txt_heap
|
||||
UPDATE hash_txt_heap
|
||||
SET random = '0123456789abcdefghijklmnop'::text
|
||||
WHERE hash_txt_heap.seqno = 4002;
|
||||
QUERY: SELECT h.seqno AS i4002, h.random AS c0_to_p
|
||||
SELECT h.seqno AS i4002, h.random AS c0_to_p
|
||||
FROM hash_txt_heap h
|
||||
WHERE h.random = '0123456789abcdefghijklmnop'::text;
|
||||
i4002|c0_to_p
|
||||
-----+--------------------------
|
||||
4002|0123456789abcdefghijklmnop
|
||||
i4002 | c0_to_p
|
||||
-------+----------------------------
|
||||
4002 | 0123456789abcdefghijklmnop
|
||||
(1 row)
|
||||
|
||||
QUERY: UPDATE hash_txt_heap
|
||||
UPDATE hash_txt_heap
|
||||
SET seqno = 20000
|
||||
WHERE hash_txt_heap.random = '959363399'::text;
|
||||
QUERY: SELECT h.seqno AS t20000
|
||||
SELECT h.seqno AS t20000
|
||||
FROM hash_txt_heap h
|
||||
WHERE h.random = '959363399'::text;
|
||||
t20000
|
||||
------
|
||||
20000
|
||||
t20000
|
||||
--------
|
||||
20000
|
||||
(1 row)
|
||||
|
||||
QUERY: UPDATE hash_f8_heap
|
||||
UPDATE hash_f8_heap
|
||||
SET random = '-1234.1234'::float8
|
||||
WHERE hash_f8_heap.seqno = 8906;
|
||||
QUERY: SELECT h.seqno AS i8096, h.random AS f1234_1234
|
||||
SELECT h.seqno AS i8096, h.random AS f1234_1234
|
||||
FROM hash_f8_heap h
|
||||
WHERE h.random = '-1234.1234'::float8;
|
||||
i8096|f1234_1234
|
||||
-----+----------
|
||||
8906|-1234.1234
|
||||
i8096 | f1234_1234
|
||||
-------+------------
|
||||
8906 | -1234.1234
|
||||
(1 row)
|
||||
|
||||
QUERY: UPDATE hash_f8_heap
|
||||
UPDATE hash_f8_heap
|
||||
SET seqno = 20000
|
||||
WHERE hash_f8_heap.random = '488912369'::float8;
|
||||
QUERY: SELECT h.seqno AS f20000
|
||||
SELECT h.seqno AS f20000
|
||||
FROM hash_f8_heap h
|
||||
WHERE h.random = '488912369'::float8;
|
||||
f20000
|
||||
------
|
||||
20000
|
||||
f20000
|
||||
--------
|
||||
20000
|
||||
(1 row)
|
||||
|
||||
-- UPDATE hash_ovfl_heap
|
||||
-- SET x = 1000
|
||||
-- WHERE x = 90;
|
||||
-- this vacuums the index as well
|
||||
-- VACUUM hash_ovfl_heap;
|
||||
-- SELECT count(*) AS i0 FROM hash_ovfl_heap
|
||||
-- WHERE x = 90;
|
||||
-- SELECT count(*) AS i988 FROM hash_ovfl_heap
|
||||
-- WHERE x = 1000;
|
||||
|
|
|
@ -1,94 +1,152 @@
|
|||
QUERY: CREATE TABLE JOIN_TBL (
|
||||
--
|
||||
-- JOIN
|
||||
-- Test join clauses
|
||||
--
|
||||
CREATE TABLE JOIN1_TBL (
|
||||
i integer,
|
||||
j integer,
|
||||
x text
|
||||
t text
|
||||
);
|
||||
QUERY: CREATE TABLE JOIN2_TBL (
|
||||
CREATE TABLE JOIN2_TBL (
|
||||
i integer,
|
||||
k integer
|
||||
);
|
||||
QUERY: INSERT INTO JOIN_TBL VALUES (1, 3, 'one');
|
||||
QUERY: INSERT INTO JOIN_TBL VALUES (2, 2, 'two');
|
||||
QUERY: INSERT INTO JOIN_TBL VALUES (3, 1, 'three');
|
||||
QUERY: INSERT INTO JOIN_TBL VALUES (4, 0, 'four');
|
||||
QUERY: INSERT INTO JOIN2_TBL VALUES (1, -1);
|
||||
QUERY: INSERT INTO JOIN2_TBL VALUES (2, 2);
|
||||
QUERY: INSERT INTO JOIN2_TBL VALUES (3, -3);
|
||||
QUERY: INSERT INTO JOIN2_TBL VALUES (2, 4);
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL CROSS JOIN JOIN2_TBL;
|
||||
xxx|i|j|x |i| k
|
||||
---+-+-+-----+-+--
|
||||
|1|3|one |1|-1
|
||||
|2|2|two |1|-1
|
||||
|3|1|three|1|-1
|
||||
|4|0|four |1|-1
|
||||
|1|3|one |2| 2
|
||||
|2|2|two |2| 2
|
||||
|3|1|three|2| 2
|
||||
|4|0|four |2| 2
|
||||
|1|3|one |3|-3
|
||||
|2|2|two |3|-3
|
||||
|3|1|three|3|-3
|
||||
|4|0|four |3|-3
|
||||
|1|3|one |2| 4
|
||||
|2|2|two |2| 4
|
||||
|3|1|three|2| 4
|
||||
|4|0|four |2| 4
|
||||
CREATE TABLE JOIN3_TBL (
|
||||
i integer,
|
||||
j integer,
|
||||
y integer
|
||||
);
|
||||
CREATE TABLE JOIN4_TBL (
|
||||
k integer,
|
||||
z integer
|
||||
);
|
||||
INSERT INTO JOIN1_TBL VALUES (1, 3, 'one');
|
||||
INSERT INTO JOIN1_TBL VALUES (2, 2, 'two');
|
||||
INSERT INTO JOIN1_TBL VALUES (3, 1, 'three');
|
||||
INSERT INTO JOIN1_TBL VALUES (4, 0, 'four');
|
||||
INSERT INTO JOIN2_TBL VALUES (1, -1);
|
||||
INSERT INTO JOIN2_TBL VALUES (2, 2);
|
||||
INSERT INTO JOIN2_TBL VALUES (3, -3);
|
||||
INSERT INTO JOIN2_TBL VALUES (2, 4);
|
||||
--
|
||||
-- CROSS JOIN
|
||||
-- Qualifications are not allowed on cross joins,
|
||||
-- which degenerate into a standard unqualified inner join.
|
||||
--
|
||||
SELECT '' AS "xxx", *
|
||||
FROM JOIN1_TBL CROSS JOIN JOIN2_TBL;
|
||||
xxx | i | j | t | i | k
|
||||
-----+---+---+-------+---+----
|
||||
| 1 | 3 | one | 1 | -1
|
||||
| 2 | 2 | two | 1 | -1
|
||||
| 3 | 1 | three | 1 | -1
|
||||
| 4 | 0 | four | 1 | -1
|
||||
| 1 | 3 | one | 2 | 2
|
||||
| 2 | 2 | two | 2 | 2
|
||||
| 3 | 1 | three | 2 | 2
|
||||
| 4 | 0 | four | 2 | 2
|
||||
| 1 | 3 | one | 3 | -3
|
||||
| 2 | 2 | two | 3 | -3
|
||||
| 3 | 1 | three | 3 | -3
|
||||
| 4 | 0 | four | 3 | -3
|
||||
| 1 | 3 | one | 2 | 4
|
||||
| 2 | 2 | two | 2 | 4
|
||||
| 3 | 1 | three | 2 | 4
|
||||
| 4 | 0 | four | 2 | 4
|
||||
(16 rows)
|
||||
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL NATURAL JOIN JOIN2_TBL;
|
||||
SELECT '' AS "xxx", i, k, t
|
||||
FROM JOIN1_TBL CROSS JOIN JOIN2_TBL;
|
||||
ERROR: Column 'i' is ambiguous
|
||||
SELECT '' AS "xxx", ii, tt, kk
|
||||
FROM JOIN1_TBL CROSS JOIN JOIN2_TBL AS JT (ii, jj, tt, ii2, kk);
|
||||
ERROR: parser: parse error at or near "("
|
||||
SELECT '' AS "xxx", jt.ii, jt.jj, jt.kk
|
||||
FROM JOIN1_TBL CROSS JOIN JOIN2_TBL AS JT (ii, jj, tt, ii2, kk);
|
||||
ERROR: parser: parse error at or near "("
|
||||
--
|
||||
--
|
||||
-- Inner joins (equi-joins)
|
||||
--
|
||||
--
|
||||
--
|
||||
-- Inner joins (equi-joins) with USING clause
|
||||
-- The USING syntax changes the shape of the resulting table
|
||||
-- by including a column in the USING clause only once in the result.
|
||||
--
|
||||
-- Inner equi-join on all columns with the same name
|
||||
SELECT '' AS "xxx", *
|
||||
FROM JOIN1_TBL NATURAL JOIN JOIN2_TBL;
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL INNER JOIN JOIN2_TBL USING (i);
|
||||
-- Inner equi-join on specified column
|
||||
SELECT '' AS "xxx", *
|
||||
FROM JOIN1_TBL INNER JOIN JOIN2_TBL USING (i);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL JOIN JOIN2_TBL ON (JOIN_TBL.i = JOIN2_TBL.i);
|
||||
-- Same as above, slightly different syntax
|
||||
SELECT '' AS "xxx", *
|
||||
FROM JOIN1_TBL JOIN JOIN2_TBL USING (i);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL JOIN JOIN2_TBL ON (JOIN_TBL.i = JOIN2_TBL.k);
|
||||
--
|
||||
-- Inner joins (equi-joins)
|
||||
--
|
||||
SELECT '' AS "xxx", *
|
||||
FROM JOIN1_TBL JOIN JOIN2_TBL ON (JOIN1_TBL.i = JOIN2_TBL.i);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL CROSS JOIN JOIN2_TBL;
|
||||
xxx|i|j|x |i| k
|
||||
---+-+-+-----+-+--
|
||||
|1|3|one |1|-1
|
||||
|2|2|two |1|-1
|
||||
|3|1|three|1|-1
|
||||
|4|0|four |1|-1
|
||||
|1|3|one |2| 2
|
||||
|2|2|two |2| 2
|
||||
|3|1|three|2| 2
|
||||
|4|0|four |2| 2
|
||||
|1|3|one |3|-3
|
||||
|2|2|two |3|-3
|
||||
|3|1|three|3|-3
|
||||
|4|0|four |3|-3
|
||||
|1|3|one |2| 4
|
||||
|2|2|two |2| 4
|
||||
|3|1|three|2| 4
|
||||
|4|0|four |2| 4
|
||||
SELECT '' AS "xxx", *
|
||||
FROM JOIN1_TBL JOIN JOIN2_TBL ON (JOIN1_TBL.i = JOIN2_TBL.k);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
SELECT '' AS "xxx", *
|
||||
FROM JOIN1_TBL CROSS JOIN JOIN2_TBL;
|
||||
xxx | i | j | t | i | k
|
||||
-----+---+---+-------+---+----
|
||||
| 1 | 3 | one | 1 | -1
|
||||
| 2 | 2 | two | 1 | -1
|
||||
| 3 | 1 | three | 1 | -1
|
||||
| 4 | 0 | four | 1 | -1
|
||||
| 1 | 3 | one | 2 | 2
|
||||
| 2 | 2 | two | 2 | 2
|
||||
| 3 | 1 | three | 2 | 2
|
||||
| 4 | 0 | four | 2 | 2
|
||||
| 1 | 3 | one | 3 | -3
|
||||
| 2 | 2 | two | 3 | -3
|
||||
| 3 | 1 | three | 3 | -3
|
||||
| 4 | 0 | four | 3 | -3
|
||||
| 1 | 3 | one | 2 | 4
|
||||
| 2 | 2 | two | 2 | 4
|
||||
| 3 | 1 | three | 2 | 4
|
||||
| 4 | 0 | four | 2 | 4
|
||||
(16 rows)
|
||||
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL JOIN JOIN2_TBL ON (JOIN_TBL.i <= JOIN2_TBL.k);
|
||||
--
|
||||
-- Non-equi-joins
|
||||
--
|
||||
SELECT '' AS "xxx", *
|
||||
FROM JOIN1_TBL JOIN JOIN2_TBL ON (JOIN1_TBL.i <= JOIN2_TBL.k);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL OUTER JOIN JOIN2_TBL USING (i);
|
||||
--
|
||||
-- Outer joins
|
||||
--
|
||||
SELECT '' AS "xxx", *
|
||||
NOTICE: OUTER JOIN not yet implemented
|
||||
FROM JOIN1_TBL OUTER JOIN JOIN2_TBL USING (i);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL LEFT OUTER JOIN JOIN2_TBL USING (i);
|
||||
SELECT '' AS "xxx", *
|
||||
NOTICE: LEFT OUTER JOIN not yet implemented
|
||||
FROM JOIN1_TBL LEFT OUTER JOIN JOIN2_TBL USING (i);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL RIGHT OUTER JOIN JOIN2_TBL USING (i);
|
||||
SELECT '' AS "xxx", *
|
||||
NOTICE: RIGHT OUTER JOIN not yet implemented
|
||||
FROM JOIN1_TBL RIGHT OUTER JOIN JOIN2_TBL USING (i);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: SELECT '' AS "xxx", *
|
||||
FROM JOIN_TBL FULL OUTER JOIN JOIN2_TBL USING (i);
|
||||
SELECT '' AS "xxx", *
|
||||
NOTICE: FULL OUTER JOIN not yet implemented
|
||||
FROM JOIN1_TBL FULL OUTER JOIN JOIN2_TBL USING (i);
|
||||
ERROR: JOIN expressions are not yet implemented
|
||||
QUERY: DROP TABLE JOIN_TBL;
|
||||
QUERY: DROP TABLE JOIN2_TBL;
|
||||
--
|
||||
-- More complicated constructs
|
||||
--
|
||||
--
|
||||
-- Clean up
|
||||
--
|
||||
DROP TABLE JOIN1_TBL;
|
||||
DROP TABLE JOIN2_TBL;
|
||||
|
|
|
@ -1,106 +1,110 @@
|
|||
QUERY: SELECT ''::text AS two, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 > 50
|
||||
--
|
||||
-- LIMIT
|
||||
-- Check the LIMIT/OFFSET feature of SELECT
|
||||
--
|
||||
SELECT ''::text AS two, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 > 50
|
||||
ORDER BY unique1 LIMIT 2;
|
||||
two|unique1|unique2|stringu1
|
||||
---+-------+-------+--------
|
||||
| 51| 76|ZBAAAA
|
||||
| 52| 985|ACAAAA
|
||||
two | unique1 | unique2 | stringu1
|
||||
-----+---------+---------+----------
|
||||
| 51 | 76 | ZBAAAA
|
||||
| 52 | 985 | ACAAAA
|
||||
(2 rows)
|
||||
|
||||
QUERY: SELECT ''::text AS five, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 > 60
|
||||
SELECT ''::text AS five, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 > 60
|
||||
ORDER BY unique1 LIMIT 5;
|
||||
five|unique1|unique2|stringu1
|
||||
----+-------+-------+--------
|
||||
| 61| 560|JCAAAA
|
||||
| 62| 633|KCAAAA
|
||||
| 63| 296|LCAAAA
|
||||
| 64| 479|MCAAAA
|
||||
| 65| 64|NCAAAA
|
||||
five | unique1 | unique2 | stringu1
|
||||
------+---------+---------+----------
|
||||
| 61 | 560 | JCAAAA
|
||||
| 62 | 633 | KCAAAA
|
||||
| 63 | 296 | LCAAAA
|
||||
| 64 | 479 | MCAAAA
|
||||
| 65 | 64 | NCAAAA
|
||||
(5 rows)
|
||||
|
||||
QUERY: SELECT ''::text AS two, unique1, unique2, stringu1
|
||||
SELECT ''::text AS two, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 > 60 AND unique1 < 63
|
||||
ORDER BY unique1 LIMIT 5;
|
||||
two|unique1|unique2|stringu1
|
||||
---+-------+-------+--------
|
||||
| 61| 560|JCAAAA
|
||||
| 62| 633|KCAAAA
|
||||
two | unique1 | unique2 | stringu1
|
||||
-----+---------+---------+----------
|
||||
| 61 | 560 | JCAAAA
|
||||
| 62 | 633 | KCAAAA
|
||||
(2 rows)
|
||||
|
||||
QUERY: SELECT ''::text AS three, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 > 100
|
||||
SELECT ''::text AS three, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 > 100
|
||||
ORDER BY unique1 LIMIT 3 OFFSET 20;
|
||||
three|unique1|unique2|stringu1
|
||||
-----+-------+-------+--------
|
||||
| 121| 700|REAAAA
|
||||
| 122| 519|SEAAAA
|
||||
| 123| 777|TEAAAA
|
||||
three | unique1 | unique2 | stringu1
|
||||
-------+---------+---------+----------
|
||||
| 121 | 700 | REAAAA
|
||||
| 122 | 519 | SEAAAA
|
||||
| 123 | 777 | TEAAAA
|
||||
(3 rows)
|
||||
|
||||
QUERY: SELECT ''::text AS zero, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 < 50
|
||||
SELECT ''::text AS zero, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 < 50
|
||||
ORDER BY unique1 DESC LIMIT 8 OFFSET 99;
|
||||
zero|unique1|unique2|stringu1
|
||||
----+-------+-------+--------
|
||||
zero | unique1 | unique2 | stringu1
|
||||
------+---------+---------+----------
|
||||
(0 rows)
|
||||
|
||||
QUERY: SELECT ''::text AS eleven, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 < 50
|
||||
SELECT ''::text AS eleven, unique1, unique2, stringu1
|
||||
FROM onek WHERE unique1 < 50
|
||||
ORDER BY unique1 DESC LIMIT 20 OFFSET 39;
|
||||
eleven|unique1|unique2|stringu1
|
||||
------+-------+-------+--------
|
||||
| 10| 520|KAAAAA
|
||||
| 9| 49|JAAAAA
|
||||
| 8| 653|IAAAAA
|
||||
| 7| 647|HAAAAA
|
||||
| 6| 978|GAAAAA
|
||||
| 5| 541|FAAAAA
|
||||
| 4| 833|EAAAAA
|
||||
| 3| 431|DAAAAA
|
||||
| 2| 326|CAAAAA
|
||||
| 1| 214|BAAAAA
|
||||
| 0| 998|AAAAAA
|
||||
eleven | unique1 | unique2 | stringu1
|
||||
--------+---------+---------+----------
|
||||
| 10 | 520 | KAAAAA
|
||||
| 9 | 49 | JAAAAA
|
||||
| 8 | 653 | IAAAAA
|
||||
| 7 | 647 | HAAAAA
|
||||
| 6 | 978 | GAAAAA
|
||||
| 5 | 541 | FAAAAA
|
||||
| 4 | 833 | EAAAAA
|
||||
| 3 | 431 | DAAAAA
|
||||
| 2 | 326 | CAAAAA
|
||||
| 1 | 214 | BAAAAA
|
||||
| 0 | 998 | AAAAAA
|
||||
(11 rows)
|
||||
|
||||
QUERY: SELECT ''::text AS ten, unique1, unique2, stringu1
|
||||
SELECT ''::text AS ten, unique1, unique2, stringu1
|
||||
FROM onek
|
||||
ORDER BY unique1 OFFSET 990;
|
||||
ten|unique1|unique2|stringu1
|
||||
---+-------+-------+--------
|
||||
| 990| 369|CMAAAA
|
||||
| 991| 426|DMAAAA
|
||||
| 992| 363|EMAAAA
|
||||
| 993| 661|FMAAAA
|
||||
| 994| 695|GMAAAA
|
||||
| 995| 144|HMAAAA
|
||||
| 996| 258|IMAAAA
|
||||
| 997| 21|JMAAAA
|
||||
| 998| 549|KMAAAA
|
||||
| 999| 152|LMAAAA
|
||||
ten | unique1 | unique2 | stringu1
|
||||
-----+---------+---------+----------
|
||||
| 990 | 369 | CMAAAA
|
||||
| 991 | 426 | DMAAAA
|
||||
| 992 | 363 | EMAAAA
|
||||
| 993 | 661 | FMAAAA
|
||||
| 994 | 695 | GMAAAA
|
||||
| 995 | 144 | HMAAAA
|
||||
| 996 | 258 | IMAAAA
|
||||
| 997 | 21 | JMAAAA
|
||||
| 998 | 549 | KMAAAA
|
||||
| 999 | 152 | LMAAAA
|
||||
(10 rows)
|
||||
|
||||
QUERY: SELECT ''::text AS five, unique1, unique2, stringu1
|
||||
SELECT ''::text AS five, unique1, unique2, stringu1
|
||||
FROM onek
|
||||
ORDER BY unique1 OFFSET 990 LIMIT 5;
|
||||
five|unique1|unique2|stringu1
|
||||
----+-------+-------+--------
|
||||
| 990| 369|CMAAAA
|
||||
| 991| 426|DMAAAA
|
||||
| 992| 363|EMAAAA
|
||||
| 993| 661|FMAAAA
|
||||
| 994| 695|GMAAAA
|
||||
five | unique1 | unique2 | stringu1
|
||||
------+---------+---------+----------
|
||||
| 990 | 369 | CMAAAA
|
||||
| 991 | 426 | DMAAAA
|
||||
| 992 | 363 | EMAAAA
|
||||
| 993 | 661 | FMAAAA
|
||||
| 994 | 695 | GMAAAA
|
||||
(5 rows)
|
||||
|
||||
QUERY: SELECT ''::text AS five, unique1, unique2, stringu1
|
||||
SELECT ''::text AS five, unique1, unique2, stringu1
|
||||
FROM onek
|
||||
ORDER BY unique1 LIMIT 5, 900;
|
||||
five|unique1|unique2|stringu1
|
||||
----+-------+-------+--------
|
||||
| 900| 913|QIAAAA
|
||||
| 901| 931|RIAAAA
|
||||
| 902| 702|SIAAAA
|
||||
| 903| 641|TIAAAA
|
||||
| 904| 793|UIAAAA
|
||||
five | unique1 | unique2 | stringu1
|
||||
------+---------+---------+----------
|
||||
| 900 | 913 | QIAAAA
|
||||
| 901 | 931 | RIAAAA
|
||||
| 902 | 702 | SIAAAA
|
||||
| 903 | 641 | TIAAAA
|
||||
| 904 | 793 | UIAAAA
|
||||
(5 rows)
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,119 +1,123 @@
|
|||
QUERY: BEGIN;
|
||||
QUERY: DECLARE foo13 CURSOR FOR
|
||||
--
|
||||
-- PORTALS_P2
|
||||
--
|
||||
-- EXTEND INDEX onek2_u1_prtl WHERE onek2.unique1 <= 60;
|
||||
BEGIN;
|
||||
DECLARE foo13 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 50;
|
||||
QUERY: DECLARE foo14 CURSOR FOR
|
||||
DECLARE foo14 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 51;
|
||||
QUERY: DECLARE foo15 CURSOR FOR
|
||||
DECLARE foo15 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 52;
|
||||
QUERY: DECLARE foo16 CURSOR FOR
|
||||
DECLARE foo16 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 53;
|
||||
QUERY: DECLARE foo17 CURSOR FOR
|
||||
DECLARE foo17 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 54;
|
||||
QUERY: DECLARE foo18 CURSOR FOR
|
||||
DECLARE foo18 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 55;
|
||||
QUERY: DECLARE foo19 CURSOR FOR
|
||||
DECLARE foo19 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 56;
|
||||
QUERY: DECLARE foo20 CURSOR FOR
|
||||
DECLARE foo20 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 57;
|
||||
QUERY: DECLARE foo21 CURSOR FOR
|
||||
DECLARE foo21 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 58;
|
||||
QUERY: DECLARE foo22 CURSOR FOR
|
||||
DECLARE foo22 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 59;
|
||||
QUERY: DECLARE foo23 CURSOR FOR
|
||||
DECLARE foo23 CURSOR FOR
|
||||
SELECT * FROM onek WHERE unique1 = 60;
|
||||
QUERY: DECLARE foo24 CURSOR FOR
|
||||
DECLARE foo24 CURSOR FOR
|
||||
SELECT * FROM onek2 WHERE unique1 = 50;
|
||||
QUERY: DECLARE foo25 CURSOR FOR
|
||||
DECLARE foo25 CURSOR FOR
|
||||
SELECT * FROM onek2 WHERE unique1 = 60;
|
||||
QUERY: FETCH all in foo13;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
50| 253| 0| 2| 0| 10| 0| 50| 50| 50| 50| 0| 1|YBAAAA |TJAAAA |HHHHxx
|
||||
FETCH all in foo13;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
50 | 253 | 0 | 2 | 0 | 10 | 0 | 50 | 50 | 50 | 50 | 0 | 1 | YBAAAA | TJAAAA | HHHHxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo14;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
51| 76| 1| 3| 1| 11| 1| 51| 51| 51| 51| 2| 3|ZBAAAA |YCAAAA |AAAAxx
|
||||
FETCH all in foo14;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
51 | 76 | 1 | 3 | 1 | 11 | 1 | 51 | 51 | 51 | 51 | 2 | 3 | ZBAAAA | YCAAAA | AAAAxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo15;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
52| 985| 0| 0| 2| 12| 2| 52| 52| 52| 52| 4| 5|ACAAAA |XLBAAA |HHHHxx
|
||||
FETCH all in foo15;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
52 | 985 | 0 | 0 | 2 | 12 | 2 | 52 | 52 | 52 | 52 | 4 | 5 | ACAAAA | XLBAAA | HHHHxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo16;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
53| 196| 1| 1| 3| 13| 3| 53| 53| 53| 53| 6| 7|BCAAAA |OHAAAA |AAAAxx
|
||||
FETCH all in foo16;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
53 | 196 | 1 | 1 | 3 | 13 | 3 | 53 | 53 | 53 | 53 | 6 | 7 | BCAAAA | OHAAAA | AAAAxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo17;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
54| 356| 0| 2| 4| 14| 4| 54| 54| 54| 54| 8| 9|CCAAAA |SNAAAA |AAAAxx
|
||||
FETCH all in foo17;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
54 | 356 | 0 | 2 | 4 | 14 | 4 | 54 | 54 | 54 | 54 | 8 | 9 | CCAAAA | SNAAAA | AAAAxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo18;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
55| 627| 1| 3| 5| 15| 5| 55| 55| 55| 55| 10| 11|DCAAAA |DYAAAA |VVVVxx
|
||||
FETCH all in foo18;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
55 | 627 | 1 | 3 | 5 | 15 | 5 | 55 | 55 | 55 | 55 | 10 | 11 | DCAAAA | DYAAAA | VVVVxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo19;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
56| 54| 0| 0| 6| 16| 6| 56| 56| 56| 56| 12| 13|ECAAAA |CCAAAA |OOOOxx
|
||||
FETCH all in foo19;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
56 | 54 | 0 | 0 | 6 | 16 | 6 | 56 | 56 | 56 | 56 | 12 | 13 | ECAAAA | CCAAAA | OOOOxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo20;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
57| 942| 1| 1| 7| 17| 7| 57| 57| 57| 57| 14| 15|FCAAAA |GKBAAA |OOOOxx
|
||||
FETCH all in foo20;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
57 | 942 | 1 | 1 | 7 | 17 | 7 | 57 | 57 | 57 | 57 | 14 | 15 | FCAAAA | GKBAAA | OOOOxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo21;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
58| 114| 0| 2| 8| 18| 8| 58| 58| 58| 58| 16| 17|GCAAAA |KEAAAA |OOOOxx
|
||||
FETCH all in foo21;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
58 | 114 | 0 | 2 | 8 | 18 | 8 | 58 | 58 | 58 | 58 | 16 | 17 | GCAAAA | KEAAAA | OOOOxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo22;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
59| 593| 1| 3| 9| 19| 9| 59| 59| 59| 59| 18| 19|HCAAAA |VWAAAA |HHHHxx
|
||||
FETCH all in foo22;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
59 | 593 | 1 | 3 | 9 | 19 | 9 | 59 | 59 | 59 | 59 | 18 | 19 | HCAAAA | VWAAAA | HHHHxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo23;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
60| 483| 0| 0| 0| 0| 0| 60| 60| 60| 60| 0| 1|ICAAAA |PSAAAA |VVVVxx
|
||||
FETCH all in foo23;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
60 | 483 | 0 | 0 | 0 | 0 | 0 | 60 | 60 | 60 | 60 | 0 | 1 | ICAAAA | PSAAAA | VVVVxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo24;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
50| 253| 0| 2| 0| 10| 0| 50| 50| 50| 50| 0| 1|YBAAAA |TJAAAA |HHHHxx
|
||||
FETCH all in foo24;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
50 | 253 | 0 | 2 | 0 | 10 | 0 | 50 | 50 | 50 | 50 | 0 | 1 | YBAAAA | TJAAAA | HHHHxx
|
||||
(1 row)
|
||||
|
||||
QUERY: FETCH all in foo25;
|
||||
unique1|unique2|two|four|ten|twenty|hundred|thousand|twothousand|fivethous|tenthous|odd|even|stringu1|stringu2|string4
|
||||
-------+-------+---+----+---+------+-------+--------+-----------+---------+--------+---+----+--------+--------+-------
|
||||
60| 483| 0| 0| 0| 0| 0| 60| 60| 60| 60| 0| 1|ICAAAA |PSAAAA |VVVVxx
|
||||
FETCH all in foo25;
|
||||
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
|
||||
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
|
||||
60 | 483 | 0 | 0 | 0 | 0 | 0 | 60 | 60 | 60 | 60 | 0 | 1 | ICAAAA | PSAAAA | VVVVxx
|
||||
(1 row)
|
||||
|
||||
QUERY: CLOSE foo13;
|
||||
QUERY: CLOSE foo14;
|
||||
QUERY: CLOSE foo15;
|
||||
QUERY: CLOSE foo16;
|
||||
QUERY: CLOSE foo17;
|
||||
QUERY: CLOSE foo18;
|
||||
QUERY: CLOSE foo19;
|
||||
QUERY: CLOSE foo20;
|
||||
QUERY: CLOSE foo21;
|
||||
QUERY: CLOSE foo22;
|
||||
QUERY: CLOSE foo23;
|
||||
QUERY: CLOSE foo24;
|
||||
QUERY: CLOSE foo25;
|
||||
QUERY: END;
|
||||
CLOSE foo13;
|
||||
CLOSE foo14;
|
||||
CLOSE foo15;
|
||||
CLOSE foo16;
|
||||
CLOSE foo17;
|
||||
CLOSE foo18;
|
||||
CLOSE foo19;
|
||||
CLOSE foo20;
|
||||
CLOSE foo21;
|
||||
CLOSE foo22;
|
||||
CLOSE foo23;
|
||||
CLOSE foo24;
|
||||
CLOSE foo25;
|
||||
END;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,29 +1,37 @@
|
|||
QUERY: CREATE TABLE temptest(col int);
|
||||
QUERY: CREATE INDEX i_temptest ON temptest(col);
|
||||
QUERY: CREATE TEMP TABLE temptest(col int);
|
||||
QUERY: CREATE INDEX i_temptest ON temptest(col);
|
||||
QUERY: DROP INDEX i_temptest;
|
||||
QUERY: DROP TABLE temptest;
|
||||
QUERY: DROP INDEX i_temptest;
|
||||
QUERY: DROP TABLE temptest;
|
||||
QUERY: CREATE TABLE temptest(col int);
|
||||
QUERY: INSERT INTO temptest VALUES (1);
|
||||
QUERY: CREATE TEMP TABLE temptest(col int);
|
||||
QUERY: INSERT INTO temptest VALUES (2);
|
||||
QUERY: SELECT * FROM temptest;
|
||||
col
|
||||
---
|
||||
2
|
||||
--
|
||||
-- TEMP
|
||||
-- Test temp relations and indexes
|
||||
--
|
||||
-- test temp table/index masking
|
||||
CREATE TABLE temptest(col int);
|
||||
CREATE INDEX i_temptest ON temptest(col);
|
||||
CREATE TEMP TABLE temptest(col int);
|
||||
CREATE INDEX i_temptest ON temptest(col);
|
||||
DROP INDEX i_temptest;
|
||||
DROP TABLE temptest;
|
||||
DROP INDEX i_temptest;
|
||||
DROP TABLE temptest;
|
||||
-- test temp table selects
|
||||
CREATE TABLE temptest(col int);
|
||||
INSERT INTO temptest VALUES (1);
|
||||
CREATE TEMP TABLE temptest(col int);
|
||||
INSERT INTO temptest VALUES (2);
|
||||
SELECT * FROM temptest;
|
||||
col
|
||||
-----
|
||||
2
|
||||
(1 row)
|
||||
|
||||
QUERY: DROP TABLE temptest;
|
||||
QUERY: SELECT * FROM temptest;
|
||||
col
|
||||
---
|
||||
1
|
||||
DROP TABLE temptest;
|
||||
SELECT * FROM temptest;
|
||||
col
|
||||
-----
|
||||
1
|
||||
(1 row)
|
||||
|
||||
QUERY: DROP TABLE temptest;
|
||||
QUERY: CREATE TEMP TABLE temptest(col int);
|
||||
QUERY: SELECT * FROM temptest;
|
||||
DROP TABLE temptest;
|
||||
CREATE TEMP TABLE temptest(col int);
|
||||
-- test temp table deletion
|
||||
\c regression
|
||||
SELECT * FROM temptest;
|
||||
ERROR: Relation 'temptest' does not exist
|
||||
|
|
|
@ -1,35 +1,42 @@
|
|||
QUERY: BEGIN;
|
||||
QUERY: SELECT *
|
||||
--
|
||||
-- TRANSACTIONS
|
||||
--
|
||||
BEGIN;
|
||||
SELECT *
|
||||
INTO TABLE xacttest
|
||||
FROM aggtest;
|
||||
QUERY: INSERT INTO xacttest (a, b) VALUES (777, 777.777);
|
||||
QUERY: END;
|
||||
QUERY: SELECT a FROM xacttest WHERE a > 100;
|
||||
a
|
||||
---
|
||||
777
|
||||
INSERT INTO xacttest (a, b) VALUES (777, 777.777);
|
||||
END;
|
||||
-- should retrieve one value--
|
||||
SELECT a FROM xacttest WHERE a > 100;
|
||||
a
|
||||
-----
|
||||
777
|
||||
(1 row)
|
||||
|
||||
QUERY: BEGIN;
|
||||
QUERY: CREATE TABLE disappear (a int4);
|
||||
QUERY: DELETE FROM aggtest;
|
||||
QUERY: SELECT * FROM aggtest;
|
||||
a|b
|
||||
-+-
|
||||
BEGIN;
|
||||
CREATE TABLE disappear (a int4);
|
||||
DELETE FROM aggtest;
|
||||
-- should be empty
|
||||
SELECT * FROM aggtest;
|
||||
a | b
|
||||
---+---
|
||||
(0 rows)
|
||||
|
||||
QUERY: ABORT;
|
||||
QUERY: SELECT oid FROM pg_class WHERE relname = 'disappear';
|
||||
oid
|
||||
---
|
||||
ABORT;
|
||||
-- should not exist
|
||||
SELECT oid FROM pg_class WHERE relname = 'disappear';
|
||||
oid
|
||||
-----
|
||||
(0 rows)
|
||||
|
||||
QUERY: SELECT * FROM aggtest;
|
||||
a| b
|
||||
---+-------
|
||||
56| 7.8
|
||||
100| 99.097
|
||||
0|0.09561
|
||||
42| 324.78
|
||||
-- should have members again
|
||||
SELECT * FROM aggtest;
|
||||
a | b
|
||||
-----+---------
|
||||
56 | 7.8
|
||||
100 | 99.097
|
||||
0 | 0.09561
|
||||
42 | 324.78
|
||||
(4 rows)
|
||||
|
||||
|
|
Loading…
Reference in New Issue