Commit 260b6afc authored by Tom Lane's avatar Tom Lane

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???
parent 0e821fb7
QUERY: SELECT avg(four) AS avg_1 FROM onek; --
avg_1 -- AGGREGATES
----- --
1 SELECT avg(four) AS avg_1 FROM onek;
avg_1
-------
1
(1 row) (1 row)
QUERY: SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100; SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100;
avg_32 avg_32
------ --------
32 32
(1 row) (1 row)
QUERY: SELECT avg(b) AS avg_107_943 FROM aggtest; SELECT avg(b) AS avg_107_943 FROM aggtest;
avg_107_943 avg_107_943
----------- -------------
107.943 107.943
(1 row) (1 row)
QUERY: SELECT avg(gpa) AS avg_3_4 FROM student; SELECT avg(gpa) AS avg_3_4 FROM student;
avg_3_4 avg_3_4
------- ---------
3.4 3.4
(1 row) (1 row)
QUERY: SELECT sum(four) AS sum_1500 FROM onek; SELECT sum(four) AS sum_1500 FROM onek;
sum_1500 sum_1500
-------- ----------
1500 1500
(1 row) (1 row)
QUERY: SELECT sum(a) AS sum_198 FROM aggtest; SELECT sum(a) AS sum_198 FROM aggtest;
sum_198 sum_198
------- ---------
198 198
(1 row)
SELECT sum(b) AS avg_431_773 FROM aggtest;
avg_431_773
-------------
431.773
(1 row) (1 row)
QUERY: SELECT sum(b) AS avg_431_773 FROM aggtest; SELECT sum(gpa) AS avg_6_8 FROM student;
avg_431_773 avg_6_8
----------- ---------
431.773 6.8
(1 row) (1 row)
QUERY: SELECT sum(gpa) AS avg_6_8 FROM student; SELECT max(four) AS max_3 FROM onek;
avg_6_8 max_3
------- -------
6.8 3
(1 row) (1 row)
QUERY: SELECT max(four) AS max_3 FROM onek; SELECT max(a) AS max_100 FROM aggtest;
max_3 max_100
----- ---------
3 100
(1 row) (1 row)
QUERY: SELECT max(a) AS max_100 FROM aggtest; SELECT max(aggtest.b) AS max_324_78 FROM aggtest;
max_100 max_324_78
------- ------------
100 324.78
(1 row) (1 row)
QUERY: SELECT max(aggtest.b) AS max_324_78 FROM aggtest; SELECT max(student.gpa) AS max_3_7 FROM student;
max_324_78 max_3_7
---------- ---------
324.78 3.7
(1 row) (1 row)
QUERY: SELECT max(student.gpa) AS max_3_7 FROM student; SELECT count(four) AS cnt_1000 FROM onek;
max_3_7 cnt_1000
------- ----------
3.7 1000
(1 row) (1 row)
QUERY: SELECT count(four) AS cnt_1000 FROM onek; SELECT count(DISTINCT four) AS cnt_4 FROM onek;
cnt_1000 cnt_4
-------- -------
1000 4
(1 row) (1 row)
QUERY: SELECT count(DISTINCT four) AS cnt_4 FROM onek; select ten, count(*), sum(four) from onek group by ten;
cnt_4 ten | count | sum
----- -----+-------+-----
4 0 | 100 | 100
(1 row) 1 | 100 | 200
2 | 100 | 100
QUERY: select ten, count(*), sum(four) from onek group by ten; 3 | 100 | 200
ten|count|sum 4 | 100 | 100
---+-----+--- 5 | 100 | 200
0| 100|100 6 | 100 | 100
1| 100|200 7 | 100 | 200
2| 100|100 8 | 100 | 100
3| 100|200 9 | 100 | 200
4| 100|100
5| 100|200
6| 100|100
7| 100|200
8| 100|100
9| 100|200
(10 rows) (10 rows)
QUERY: select ten, count(four), sum(DISTINCT four) from onek group by ten; select ten, count(four), sum(DISTINCT four) from onek group by ten;
ten|count|sum ten | count | sum
---+-----+--- -----+-------+-----
0| 100| 2 0 | 100 | 2
1| 100| 4 1 | 100 | 4
2| 100| 2 2 | 100 | 2
3| 100| 4 3 | 100 | 4
4| 100| 2 4 | 100 | 2
5| 100| 4 5 | 100 | 4
6| 100| 2 6 | 100 | 2
7| 100| 4 7 | 100 | 4
8| 100| 2 8 | 100 | 2
9| 100| 4 9 | 100 | 4
(10 rows) (10 rows)
QUERY: SELECT newavg(four) AS avg_1 FROM onek; SELECT newavg(four) AS avg_1 FROM onek;
avg_1 avg_1
----- -------
1 1
(1 row) (1 row)
QUERY: SELECT newsum(four) AS sum_1500 FROM onek; SELECT newsum(four) AS sum_1500 FROM onek;
sum_1500 sum_1500
-------- ----------
1500 1500
(1 row) (1 row)
QUERY: SELECT newcnt(four) AS cnt_1000 FROM onek; SELECT newcnt(four) AS cnt_1000 FROM onek;
cnt_1000 cnt_1000
-------- ----------
1000 1000
(1 row) (1 row)
This diff is collapsed.
QUERY: SELECT b.* --
-- BTREE_INDEX
-- test retrieval of min/max keys for each index
--
SELECT b.*
FROM bt_i4_heap b FROM bt_i4_heap b
WHERE b.seqno < 1; WHERE b.seqno < 1;
seqno| random seqno | random
-----+---------- -------+------------
0|1935401906 0 | 1935401906
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_i4_heap b FROM bt_i4_heap b
WHERE b.seqno >= 9999; WHERE b.seqno >= 9999;
seqno| random seqno | random
-----+---------- -------+------------
9999|1227676208 9999 | 1227676208
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_i4_heap b FROM bt_i4_heap b
WHERE b.seqno = 4500; WHERE b.seqno = 4500;
seqno| random seqno | random
-----+---------- -------+------------
4500|2080851358 4500 | 2080851358
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_name_heap b FROM bt_name_heap b
WHERE b.seqno < '1'::name; WHERE b.seqno < '1'::name;
seqno| random seqno | random
-----+---------- -------+------------
0|1935401906 0 | 1935401906
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_name_heap b FROM bt_name_heap b
WHERE b.seqno >= '9999'::name; WHERE b.seqno >= '9999'::name;
seqno| random seqno | random
-----+---------- -------+------------
9999|1227676208 9999 | 1227676208
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_name_heap b FROM bt_name_heap b
WHERE b.seqno = '4500'::name; WHERE b.seqno = '4500'::name;
seqno| random seqno | random
-----+---------- -------+------------
4500|2080851358 4500 | 2080851358
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_txt_heap b FROM bt_txt_heap b
WHERE b.seqno < '1'::text; WHERE b.seqno < '1'::text;
seqno| random seqno | random
-----+---------- -------+------------
0|1935401906 0 | 1935401906
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_txt_heap b FROM bt_txt_heap b
WHERE b.seqno >= '9999'::text; WHERE b.seqno >= '9999'::text;
seqno| random seqno | random
-----+---------- -------+------------
9999|1227676208 9999 | 1227676208
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_txt_heap b FROM bt_txt_heap b
WHERE b.seqno = '4500'::text; WHERE b.seqno = '4500'::text;
seqno| random seqno | random
-----+---------- -------+------------
4500|2080851358 4500 | 2080851358
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_f8_heap b FROM bt_f8_heap b
WHERE b.seqno < '1'::float8; WHERE b.seqno < '1'::float8;
seqno| random seqno | random
-----+---------- -------+------------
0|1935401906 0 | 1935401906
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_f8_heap b FROM bt_f8_heap b
WHERE b.seqno >= '9999'::float8; WHERE b.seqno >= '9999'::float8;
seqno| random seqno | random
-----+---------- -------+------------
9999|1227676208 9999 | 1227676208
(1 row) (1 row)
QUERY: SELECT b.* SELECT b.*
FROM bt_f8_heap b FROM bt_f8_heap b
WHERE b.seqno = '4500'::float8; WHERE b.seqno = '4500'::float8;
seqno| random seqno | random
-----+---------- -------+------------
4500|2080851358 4500 | 2080851358
(1 row) (1 row)
QUERY: SELECT hash_i4_heap.* --
-- HASH_INDEX
-- grep 843938989 hash.data
--
SELECT hash_i4_heap.*
WHERE hash_i4_heap.random = 843938989; WHERE hash_i4_heap.random = 843938989;
seqno| random seqno | random
-----+--------- -------+-----------
15|843938989 15 | 843938989
(1 row) (1 row)
QUERY: SELECT hash_i4_heap.* --
-- hash index
-- grep 66766766 hash.data
--
SELECT hash_i4_heap.*
WHERE hash_i4_heap.random = 66766766; WHERE hash_i4_heap.random = 66766766;
seqno|random seqno | random
-----+------ -------+--------
(0 rows) (0 rows)
QUERY: SELECT hash_name_heap.* --
-- hash index
-- grep 1505703298 hash.data
--
SELECT hash_name_heap.*
WHERE hash_name_heap.random = '1505703298'::name; WHERE hash_name_heap.random = '1505703298'::name;
seqno| random seqno | random
-----+---------- -------+------------
9838|1505703298 9838 | 1505703298
(1 row) (1 row)
QUERY: SELECT hash_name_heap.* --
-- hash index
-- grep 7777777 hash.data
--
SELECT hash_name_heap.*
WHERE hash_name_heap.random = '7777777'::name; WHERE hash_name_heap.random = '7777777'::name;
seqno|random seqno | random
-----+------ -------+--------
(0 rows) (0 rows)
QUERY: SELECT hash_txt_heap.* --
-- hash index
-- grep 1351610853 hash.data
--
SELECT hash_txt_heap.*
WHERE hash_txt_heap.random = '1351610853'::text; WHERE hash_txt_heap.random = '1351610853'::text;
seqno| random seqno | random
-----+---------- -------+------------
5677|1351610853 5677 | 1351610853
(1 row) (1 row)
QUERY: SELECT hash_txt_heap.* --
-- hash index
-- grep 111111112222222233333333 hash.data
--
SELECT hash_txt_heap.*
WHERE hash_txt_heap.random = '111111112222222233333333'::text; WHERE hash_txt_heap.random = '111111112222222233333333'::text;
seqno|random seqno | random
-----+------ -------+--------
(0 rows) (0 rows)
QUERY: SELECT hash_f8_heap.* --
-- hash index
-- grep 444705537 hash.data
--
SELECT hash_f8_heap.*
WHERE hash_f8_heap.random = '444705537'::float8; WHERE hash_f8_heap.random = '444705537'::float8;
seqno| random seqno | random
-----+--------- -------+-----------
7853|444705537 7853 | 444705537
(1 row) (1 row)
QUERY: SELECT hash_f8_heap.* --
-- hash index
-- grep 88888888 hash.data
--
SELECT hash_f8_heap.*
WHERE hash_f8_heap.random = '88888888'::float8; WHERE hash_f8_heap.random = '88888888'::float8;
seqno|random seqno | random
-----+------ -------+--------
(0 rows) (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 SET random = 1
WHERE hash_i4_heap.seqno = 1492; 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 FROM hash_i4_heap h
WHERE h.random = 1; WHERE h.random = 1;
i1492|i1 i1492 | i1
-----+-- -------+----
1492| 1 1492 | 1
(1 row) (1 row)
QUERY: UPDATE hash_i4_heap UPDATE hash_i4_heap
SET seqno = 20000 SET seqno = 20000
WHERE hash_i4_heap.random = 1492795354; WHERE hash_i4_heap.random = 1492795354;
QUERY: SELECT h.seqno AS i20000 SELECT h.seqno AS i20000
FROM hash_i4_heap h FROM hash_i4_heap h
WHERE h.random = 1492795354; WHERE h.random = 1492795354;
i20000 i20000
------ --------
20000 20000
(1 row) (1 row)
QUERY: UPDATE hash_name_heap UPDATE hash_name_heap
SET random = '0123456789abcdef'::name SET random = '0123456789abcdef'::name
WHERE hash_name_heap.seqno = 6543; 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 FROM hash_name_heap h
WHERE h.random = '0123456789abcdef'::name; WHERE h.random = '0123456789abcdef'::name;
i6543|c0_to_f i6543 | c0_to_f
-----+---------------- -------+------------------
6543|0123456789abcdef 6543 | 0123456789abcdef
(1 row) (1 row)
QUERY: UPDATE hash_name_heap UPDATE hash_name_heap
SET seqno = 20000 SET seqno = 20000
WHERE hash_name_heap.random = '76652222'::name; 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 FROM hash_name_heap h
WHERE h.random = '76652222'::name; WHERE h.random = '76652222'::name;
emptyset emptyset
-------- ----------
(0 rows) (0 rows)
QUERY: UPDATE hash_txt_heap UPDATE hash_txt_heap
SET random = '0123456789abcdefghijklmnop'::text SET random = '0123456789abcdefghijklmnop'::text
WHERE hash_txt_heap.seqno = 4002; 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 FROM hash_txt_heap h
WHERE h.random = '0123456789abcdefghijklmnop'::text; WHERE h.random = '0123456789abcdefghijklmnop'::text;
i4002|c0_to_p i4002 | c0_to_p
-----+-------------------------- -------+----------------------------
4002|0123456789abcdefghijklmnop 4002 | 0123456789abcdefghijklmnop
(1 row) (1 row)
QUERY: UPDATE hash_txt_heap UPDATE hash_txt_heap
SET seqno = 20000 SET seqno = 20000
WHERE hash_txt_heap.random = '959363399'::text; WHERE hash_txt_heap.random = '959363399'::text;
QUERY: SELECT h.seqno AS t20000 SELECT h.seqno AS t20000
FROM hash_txt_heap h FROM hash_txt_heap h
WHERE h.random = '959363399'::text; WHERE h.random = '959363399'::text;
t20000 t20000
------ --------
20000 20000
(1 row) (1 row)
QUERY: UPDATE hash_f8_heap UPDATE hash_f8_heap
SET random = '-1234.1234'::float8 SET random = '-1234.1234'::float8
WHERE hash_f8_heap.seqno = 8906; 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 FROM hash_f8_heap h
WHERE h.random = '-1234.1234'::float8; WHERE h.random = '-1234.1234'::float8;
i8096|f1234_1234 i8096 | f1234_1234
-----+---------- -------+------------
8906|-1234.1234 8906 | -1234.1234
(1 row) (1 row)
QUERY: UPDATE hash_f8_heap UPDATE hash_f8_heap
SET seqno = 20000 SET seqno = 20000
WHERE hash_f8_heap.random = '488912369'::float8; WHERE hash_f8_heap.random = '488912369'::float8;
QUERY: SELECT h.seqno AS f20000 SELECT h.seqno AS f20000
FROM hash_f8_heap h FROM hash_f8_heap h
WHERE h.random = '488912369'::float8; WHERE h.random = '488912369'::float8;
f20000 f20000
------ --------
20000 20000
(1 row) (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;
QUERY: CREATE TABLE JOIN_TBL ( --
-- JOIN
-- Test join clauses
--
CREATE TABLE JOIN1_TBL (
i integer, i integer,
j integer, j integer,
x text t text
); );
QUERY: CREATE TABLE JOIN2_TBL ( CREATE TABLE JOIN2_TBL (
i integer, i integer,
k integer k integer
); );
QUERY: INSERT INTO JOIN_TBL VALUES (1, 3, 'one'); CREATE TABLE JOIN3_TBL (
QUERY: INSERT INTO JOIN_TBL VALUES (2, 2, 'two'); i integer,
QUERY: INSERT INTO JOIN_TBL VALUES (3, 1, 'three'); j integer,
QUERY: INSERT INTO JOIN_TBL VALUES (4, 0, 'four'); y integer
QUERY: INSERT INTO JOIN2_TBL VALUES (1, -1); );
QUERY: INSERT INTO JOIN2_TBL VALUES (2, 2); CREATE TABLE JOIN4_TBL (
QUERY: INSERT INTO JOIN2_TBL VALUES (3, -3); k integer,
QUERY: INSERT INTO JOIN2_TBL VALUES (2, 4); z integer
QUERY: SELECT '' AS "xxx", * );
FROM JOIN_TBL CROSS JOIN JOIN2_TBL; INSERT INTO JOIN1_TBL VALUES (1, 3, 'one');
xxx|i|j|x |i| k INSERT INTO JOIN1_TBL VALUES (2, 2, 'two');
---+-+-+-----+-+-- INSERT INTO JOIN1_TBL VALUES (3, 1, 'three');
|1|3|one |1|-1 INSERT INTO JOIN1_TBL VALUES (4, 0, 'four');
|2|2|two |1|-1 INSERT INTO JOIN2_TBL VALUES (1, -1);
|3|1|three|1|-1 INSERT INTO JOIN2_TBL VALUES (2, 2);
|4|0|four |1|-1 INSERT INTO JOIN2_TBL VALUES (3, -3);
|1|3|one |2| 2 INSERT INTO JOIN2_TBL VALUES (2, 4);
|2|2|two |2| 2 --
|3|1|three|2| 2 -- CROSS JOIN
|4|0|four |2| 2 -- Qualifications are not allowed on cross joins,
|1|3|one |3|-3 -- which degenerate into a standard unqualified inner join.
|2|2|two |3|-3 --
|3|1|three|3|-3 SELECT '' AS "xxx", *
|4|0|four |3|-3 FROM JOIN1_TBL CROSS JOIN JOIN2_TBL;
|1|3|one |2| 4 xxx | i | j | t | i | k
|2|2|two |2| 4 -----+---+---+-------+---+----
|3|1|three|2| 4 | 1 | 3 | one | 1 | -1
|4|0|four |2| 4 | 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) (16 rows)
QUERY: SELECT '' AS "xxx", * SELECT '' AS "xxx", i, k, t
FROM JOIN_TBL NATURAL JOIN JOIN2_TBL; 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
-- 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 ERROR: JOIN expressions are not yet implemented
QUERY: SELECT '' AS "xxx", * -- Same as above, slightly different syntax
FROM JOIN_TBL INNER JOIN JOIN2_TBL USING (i); SELECT '' AS "xxx", *
FROM JOIN1_TBL JOIN JOIN2_TBL USING (i);
ERROR: JOIN expressions are not yet implemented ERROR: JOIN expressions are not yet implemented
QUERY: SELECT '' AS "xxx", * --
FROM JOIN_TBL JOIN JOIN2_TBL ON (JOIN_TBL.i = JOIN2_TBL.i); -- 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 ERROR: JOIN expressions are not yet implemented
QUERY: SELECT '' AS "xxx", * SELECT '' AS "xxx", *
FROM JOIN_TBL JOIN JOIN2_TBL ON (JOIN_TBL.i = JOIN2_TBL.k); FROM JOIN1_TBL JOIN JOIN2_TBL ON (JOIN1_TBL.i = JOIN2_TBL.k);
ERROR: JOIN expressions are not yet implemented ERROR: JOIN expressions are not yet implemented
QUERY: SELECT '' AS "xxx", * SELECT '' AS "xxx", *
FROM JOIN_TBL CROSS JOIN JOIN2_TBL; FROM JOIN1_TBL CROSS JOIN JOIN2_TBL;
xxx|i|j|x |i| k xxx | i | j | t | i | k
---+-+-+-----+-+-- -----+---+---+-------+---+----
|1|3|one |1|-1 | 1 | 3 | one | 1 | -1
|2|2|two |1|-1 | 2 | 2 | two | 1 | -1
|3|1|three|1|-1 | 3 | 1 | three | 1 | -1
|4|0|four |1|-1 | 4 | 0 | four | 1 | -1
|1|3|one |2| 2 | 1 | 3 | one | 2 | 2
|2|2|two |2| 2 | 2 | 2 | two | 2 | 2
|3|1|three|2| 2 | 3 | 1 | three | 2 | 2
|4|0|four |2| 2 | 4 | 0 | four | 2 | 2
|1|3|one |3|-3 | 1 | 3 | one | 3 | -3
|2|2|two |3|-3 | 2 | 2 | two | 3 | -3
|3|1|three|3|-3 | 3 | 1 | three | 3 | -3
|4|0|four |3|-3 | 4 | 0 | four | 3 | -3
|1|3|one |2| 4 | 1 | 3 | one | 2 | 4
|2|2|two |2| 4 | 2 | 2 | two | 2 | 4
|3|1|three|2| 4 | 3 | 1 | three | 2 | 4
|4|0|four |2| 4 | 4 | 0 | four | 2 | 4
(16 rows) (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 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 NOTICE: OUTER JOIN not yet implemented
FROM JOIN1_TBL OUTER JOIN JOIN2_TBL USING (i);
ERROR: JOIN expressions are not yet implemented ERROR: JOIN expressions are not yet implemented
QUERY: SELECT '' AS "xxx", * SELECT '' AS "xxx", *
FROM JOIN_TBL LEFT OUTER JOIN JOIN2_TBL USING (i);
NOTICE: LEFT OUTER JOIN not yet implemented NOTICE: LEFT OUTER JOIN not yet implemented
FROM JOIN1_TBL LEFT OUTER JOIN JOIN2_TBL USING (i);
ERROR: JOIN expressions are not yet implemented ERROR: JOIN expressions are not yet implemented
QUERY: SELECT '' AS "xxx", * SELECT '' AS "xxx", *
FROM JOIN_TBL RIGHT OUTER JOIN JOIN2_TBL USING (i);
NOTICE: RIGHT OUTER JOIN not yet implemented NOTICE: RIGHT OUTER JOIN not yet implemented
FROM JOIN1_TBL RIGHT OUTER JOIN JOIN2_TBL USING (i);
ERROR: JOIN expressions are not yet implemented ERROR: JOIN expressions are not yet implemented
QUERY: SELECT '' AS "xxx", * SELECT '' AS "xxx", *
FROM JOIN_TBL FULL OUTER JOIN JOIN2_TBL USING (i);
NOTICE: FULL OUTER JOIN not yet implemented NOTICE: FULL OUTER JOIN not yet implemented
FROM JOIN1_TBL FULL OUTER JOIN JOIN2_TBL USING (i);
ERROR: JOIN expressions are not yet implemented 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;
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; ORDER BY unique1 LIMIT 2;
two|unique1|unique2|stringu1 two | unique1 | unique2 | stringu1
---+-------+-------+-------- -----+---------+---------+----------
| 51| 76|ZBAAAA | 51 | 76 | ZBAAAA
| 52| 985|ACAAAA | 52 | 985 | ACAAAA
(2 rows) (2 rows)
QUERY: SELECT ''::text AS five, unique1, unique2, stringu1 SELECT ''::text AS five, unique1, unique2, stringu1
FROM onek WHERE unique1 > 60 FROM onek WHERE unique1 > 60
ORDER BY unique1 LIMIT 5; ORDER BY unique1 LIMIT 5;
five|unique1|unique2|stringu1 five | unique1 | unique2 | stringu1
----+-------+-------+-------- ------+---------+---------+----------
| 61| 560|JCAAAA | 61 | 560 | JCAAAA
| 62| 633|KCAAAA | 62 | 633 | KCAAAA
| 63| 296|LCAAAA | 63 | 296 | LCAAAA
| 64| 479|MCAAAA | 64 | 479 | MCAAAA
| 65| 64|NCAAAA | 65 | 64 | NCAAAA
(5 rows) (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 FROM onek WHERE unique1 > 60 AND unique1 < 63
ORDER BY unique1 LIMIT 5; ORDER BY unique1 LIMIT 5;
two|unique1|unique2|stringu1 two | unique1 | unique2 | stringu1
---+-------+-------+-------- -----+---------+---------+----------
| 61| 560|JCAAAA | 61 | 560 | JCAAAA
| 62| 633|KCAAAA | 62 | 633 | KCAAAA
(2 rows) (2 rows)
QUERY: SELECT ''::text AS three, unique1, unique2, stringu1 SELECT ''::text AS three, unique1, unique2, stringu1
FROM onek WHERE unique1 > 100 FROM onek WHERE unique1 > 100
ORDER BY unique1 LIMIT 3 OFFSET 20; ORDER BY unique1 LIMIT 3 OFFSET 20;
three|unique1|unique2|stringu1 three | unique1 | unique2 | stringu1
-----+-------+-------+-------- -------+---------+---------+----------
| 121| 700|REAAAA | 121 | 700 | REAAAA
| 122| 519|SEAAAA | 122 | 519 | SEAAAA
| 123| 777|TEAAAA | 123 | 777 | TEAAAA
(3 rows) (3 rows)
QUERY: SELECT ''::text AS zero, unique1, unique2, stringu1 SELECT ''::text AS zero, unique1, unique2, stringu1
FROM onek WHERE unique1 < 50 FROM onek WHERE unique1 < 50
ORDER BY unique1 DESC LIMIT 8 OFFSET 99; ORDER BY unique1 DESC LIMIT 8 OFFSET 99;
zero|unique1|unique2|stringu1 zero | unique1 | unique2 | stringu1
----+-------+-------+-------- ------+---------+---------+----------
(0 rows) (0 rows)
QUERY: SELECT ''::text AS eleven, unique1, unique2, stringu1 SELECT ''::text AS eleven, unique1, unique2, stringu1
FROM onek WHERE unique1 < 50 FROM onek WHERE unique1 < 50
ORDER BY unique1 DESC LIMIT 20 OFFSET 39; ORDER BY unique1 DESC LIMIT 20 OFFSET 39;
eleven|unique1|unique2|stringu1 eleven | unique1 | unique2 | stringu1
------+-------+-------+-------- --------+---------+---------+----------
| 10| 520|KAAAAA | 10 | 520 | KAAAAA
| 9| 49|JAAAAA | 9 | 49 | JAAAAA
| 8| 653|IAAAAA | 8 | 653 | IAAAAA
| 7| 647|HAAAAA | 7 | 647 | HAAAAA
| 6| 978|GAAAAA | 6 | 978 | GAAAAA
| 5| 541|FAAAAA | 5 | 541 | FAAAAA
| 4| 833|EAAAAA | 4 | 833 | EAAAAA
| 3| 431|DAAAAA | 3 | 431 | DAAAAA
| 2| 326|CAAAAA | 2 | 326 | CAAAAA
| 1| 214|BAAAAA | 1 | 214 | BAAAAA
| 0| 998|AAAAAA | 0 | 998 | AAAAAA
(11 rows) (11 rows)
QUERY: SELECT ''::text AS ten, unique1, unique2, stringu1 SELECT ''::text AS ten, unique1, unique2, stringu1
FROM onek FROM onek
ORDER BY unique1 OFFSET 990; ORDER BY unique1 OFFSET 990;
ten|unique1|unique2|stringu1 ten | unique1 | unique2 | stringu1
---+-------+-------+-------- -----+---------+---------+----------
| 990| 369|CMAAAA | 990 | 369 | CMAAAA
| 991| 426|DMAAAA | 991 | 426 | DMAAAA
| 992| 363|EMAAAA | 992 | 363 | EMAAAA
| 993| 661|FMAAAA | 993 | 661 | FMAAAA
| 994| 695|GMAAAA | 994 | 695 | GMAAAA
| 995| 144|HMAAAA | 995 | 144 | HMAAAA
| 996| 258|IMAAAA | 996 | 258 | IMAAAA
| 997| 21|JMAAAA | 997 | 21 | JMAAAA
| 998| 549|KMAAAA | 998 | 549 | KMAAAA
| 999| 152|LMAAAA | 999 | 152 | LMAAAA
(10 rows) (10 rows)
QUERY: SELECT ''::text AS five, unique1, unique2, stringu1 SELECT ''::text AS five, unique1, unique2, stringu1
FROM onek FROM onek
ORDER BY unique1 OFFSET 990 LIMIT 5; ORDER BY unique1 OFFSET 990 LIMIT 5;
five|unique1|unique2|stringu1 five | unique1 | unique2 | stringu1
----+-------+-------+-------- ------+---------+---------+----------
| 990| 369|CMAAAA | 990 | 369 | CMAAAA
| 991| 426|DMAAAA | 991 | 426 | DMAAAA
| 992| 363|EMAAAA | 992 | 363 | EMAAAA
| 993| 661|FMAAAA | 993 | 661 | FMAAAA
| 994| 695|GMAAAA | 994 | 695 | GMAAAA
(5 rows) (5 rows)
QUERY: SELECT ''::text AS five, unique1, unique2, stringu1 SELECT ''::text AS five, unique1, unique2, stringu1
FROM onek FROM onek
ORDER BY unique1 LIMIT 5, 900; ORDER BY unique1 LIMIT 5, 900;
five|unique1|unique2|stringu1 five | unique1 | unique2 | stringu1
----+-------+-------+-------- ------+---------+---------+----------
| 900| 913|QIAAAA | 900 | 913 | QIAAAA
| 901| 931|RIAAAA | 901 | 931 | RIAAAA
| 902| 702|SIAAAA | 902 | 702 | SIAAAA
| 903| 641|TIAAAA | 903 | 641 | TIAAAA
| 904| 793|UIAAAA | 904 | 793 | UIAAAA
(5 rows) (5 rows)
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
QUERY: CREATE TABLE temptest(col int); --
QUERY: CREATE INDEX i_temptest ON temptest(col); -- TEMP
QUERY: CREATE TEMP TABLE temptest(col int); -- Test temp relations and indexes
QUERY: CREATE INDEX i_temptest ON temptest(col); --
QUERY: DROP INDEX i_temptest; -- test temp table/index masking
QUERY: DROP TABLE temptest; CREATE TABLE temptest(col int);
QUERY: DROP INDEX i_temptest; CREATE INDEX i_temptest ON temptest(col);
QUERY: DROP TABLE temptest; CREATE TEMP TABLE temptest(col int);
QUERY: CREATE TABLE temptest(col int); CREATE INDEX i_temptest ON temptest(col);
QUERY: INSERT INTO temptest VALUES (1); DROP INDEX i_temptest;
QUERY: CREATE TEMP TABLE temptest(col int); DROP TABLE temptest;
QUERY: INSERT INTO temptest VALUES (2); DROP INDEX i_temptest;
QUERY: SELECT * FROM temptest; DROP TABLE temptest;
col -- test temp table selects
--- CREATE TABLE temptest(col int);
2 INSERT INTO temptest VALUES (1);
CREATE TEMP TABLE temptest(col int);
INSERT INTO temptest VALUES (2);
SELECT * FROM temptest;
col
-----
2
(1 row) (1 row)
QUERY: DROP TABLE temptest; DROP TABLE temptest;
QUERY: SELECT * FROM temptest; SELECT * FROM temptest;
col col
--- -----
1 1
(1 row) (1 row)
QUERY: DROP TABLE temptest; DROP TABLE temptest;
QUERY: CREATE TEMP TABLE temptest(col int); CREATE TEMP TABLE temptest(col int);
QUERY: SELECT * FROM temptest; -- test temp table deletion
\c regression
SELECT * FROM temptest;
ERROR: Relation 'temptest' does not exist ERROR: Relation 'temptest' does not exist
QUERY: BEGIN; --
QUERY: SELECT * -- TRANSACTIONS
--
BEGIN;
SELECT *
INTO TABLE xacttest INTO TABLE xacttest
FROM aggtest; FROM aggtest;
QUERY: INSERT INTO xacttest (a, b) VALUES (777, 777.777); INSERT INTO xacttest (a, b) VALUES (777, 777.777);
QUERY: END; END;
QUERY: SELECT a FROM xacttest WHERE a > 100; -- should retrieve one value--
a SELECT a FROM xacttest WHERE a > 100;
--- a
777 -----
777
(1 row) (1 row)
QUERY: BEGIN; BEGIN;
QUERY: CREATE TABLE disappear (a int4); CREATE TABLE disappear (a int4);
QUERY: DELETE FROM aggtest; DELETE FROM aggtest;
QUERY: SELECT * FROM aggtest; -- should be empty
a|b SELECT * FROM aggtest;
-+- a | b
---+---
(0 rows) (0 rows)
QUERY: ABORT; ABORT;
QUERY: SELECT oid FROM pg_class WHERE relname = 'disappear'; -- should not exist
oid SELECT oid FROM pg_class WHERE relname = 'disappear';
--- oid
-----
(0 rows) (0 rows)
QUERY: SELECT * FROM aggtest; -- should have members again
a| b SELECT * FROM aggtest;
---+------- a | b
56| 7.8 -----+---------
100| 99.097 56 | 7.8
0|0.09561 100 | 99.097
42| 324.78 0 | 0.09561
42 | 324.78
(4 rows) (4 rows)
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