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
-----
1
--
-- AGGREGATES
--
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
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
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
-------
3.4
SELECT avg(gpa) AS avg_3_4 FROM student;
avg_3_4
---------
3.4
(1 row)
QUERY: SELECT sum(four) AS sum_1500 FROM onek;
sum_1500
--------
1500
SELECT sum(four) AS sum_1500 FROM onek;
sum_1500
----------
1500
(1 row)
QUERY: SELECT sum(a) AS sum_198 FROM aggtest;
sum_198
-------
198
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)
QUERY: SELECT sum(b) AS avg_431_773 FROM aggtest;
avg_431_773
-----------
431.773
SELECT sum(gpa) AS avg_6_8 FROM student;
avg_6_8
---------
6.8
(1 row)
QUERY: SELECT sum(gpa) AS avg_6_8 FROM student;
avg_6_8
SELECT max(four) AS max_3 FROM onek;
max_3
-------
6.8
3
(1 row)
QUERY: SELECT max(four) AS max_3 FROM onek;
max_3
-----
3
SELECT max(a) AS max_100 FROM aggtest;
max_100
---------
100
(1 row)
QUERY: SELECT max(a) AS max_100 FROM aggtest;
max_100
-------
100
SELECT max(aggtest.b) AS max_324_78 FROM aggtest;
max_324_78
------------
324.78
(1 row)
QUERY: SELECT max(aggtest.b) AS max_324_78 FROM aggtest;
max_324_78
----------
324.78
SELECT max(student.gpa) AS max_3_7 FROM student;
max_3_7
---------
3.7
(1 row)
QUERY: SELECT max(student.gpa) AS max_3_7 FROM student;
max_3_7
-------
3.7
SELECT count(four) AS cnt_1000 FROM onek;
cnt_1000
----------
1000
(1 row)
QUERY: SELECT count(four) AS cnt_1000 FROM onek;
cnt_1000
--------
1000
(1 row)
QUERY: SELECT count(DISTINCT four) AS cnt_4 FROM onek;
cnt_4
-----
4
(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 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)
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
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)
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;
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
-- 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 INNER JOIN JOIN2_TBL USING (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.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
QUERY: SELECT '' AS "xxx", *
FROM JOIN_TBL JOIN JOIN2_TBL ON (JOIN_TBL.i = JOIN2_TBL.k);
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 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 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;
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)
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);
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
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)
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