diff options
author | Mason Sharp | 2011-01-12 15:19:57 +0000 |
---|---|---|
committer | Pavan Deolasee | 2011-05-19 17:41:34 +0000 |
commit | 4dad125a5f6a825bc20fba63fc660721b74b832c (patch) | |
tree | 90e4eb0c2c8dc1cb1cc25a1c6bafd9046a30c4ab | |
parent | 6fd97add5e5a87a2609018c57c2552c2831418d6 (diff) |
Updated regression tests.
In Postgres-XC, we cannot be sure of the return order of results, so
the tests were updated with ORDER BY added to many SELECT statements.
There are still many tests that fail, but this at least gives us a
better baseline to more easily find and fix the open bugs.
Written by Benny
167 files changed, 9766 insertions, 6401 deletions
diff --git a/src/test/regress/expected/abstime.out b/src/test/regress/expected/abstime.out index a04f091666..2c1f0a972b 100644 --- a/src/test/regress/expected/abstime.out +++ b/src/test/regress/expected/abstime.out @@ -43,80 +43,80 @@ LINE 1: INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format'); ^ INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843'); -- test abstime operators -SELECT '' AS eight, * FROM ABSTIME_TBL; +SELECT '' AS eight, * FROM ABSTIME_TBL ORDER BY f1; eight | f1 -------+------------------------------ + | -infinity + | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST | Sun Jan 14 03:14:21 1973 PST | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST | infinity - | -infinity - | Sat May 10 23:59:12 1947 PST | invalid (7 rows) SELECT '' AS six, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001'; + WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001' ORDER BY f1; six | f1 -----+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST | -infinity | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST + | Sun Jan 14 03:14:21 1973 PST + | Mon May 01 00:30:30 1995 PDT (5 rows) SELECT '' AS six, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 > abstime '-infinity'; + WHERE ABSTIME_TBL.f1 > abstime '-infinity' ORDER BY f1; six | f1 -----+------------------------------ + | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST | Sun Jan 14 03:14:21 1973 PST | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST | infinity - | Sat May 10 23:59:12 1947 PST | invalid (6 rows) SELECT '' AS six, * FROM ABSTIME_TBL - WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1; + WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1 ORDER BY f1; six | f1 -----+------------------------------ + | -infinity + | Wed Dec 31 16:00:00 1969 PST | Sun Jan 14 03:14:21 1973 PST | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST | infinity - | -infinity | invalid (6 rows) SELECT '' AS three, * FROM ABSTIME_TBL - WHERE abstime 'epoch' >= ABSTIME_TBL.f1; + WHERE abstime 'epoch' >= ABSTIME_TBL.f1 ORDER BY f1; three | f1 -------+------------------------------ - | Wed Dec 31 16:00:00 1969 PST | -infinity | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST (3 rows) SELECT '' AS four, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21'; + WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21' ORDER BY f1; four | f1 ------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST | -infinity | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST + | Sun Jan 14 03:14:21 1973 PST (4 rows) SELECT '' AS four, * FROM ABSTIME_TBL WHERE ABSTIME_TBL.f1 <?> - tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]'; + tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]' ORDER BY f1; four | f1 ------+------------------------------ + | Wed Dec 31 16:00:00 1969 PST | Sun Jan 14 03:14:21 1973 PST | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST (3 rows) SELECT '' AS four, f1 AS abstime, diff --git a/src/test/regress/expected/aggregates.out b/src/test/regress/expected/aggregates.out index a48b45007f..280bda5b54 100644 --- a/src/test/regress/expected/aggregates.out +++ b/src/test/regress/expected/aggregates.out @@ -277,7 +277,8 @@ SELECT sum2(q1,q2) FROM int8_tbl; -- this should work select ten, sum(distinct four) from onek a group by ten -having exists (select 1 from onek b where sum(distinct a.four) = b.four); +having exists (select 1 from onek b where sum(distinct a.four) = b.four) +order by ten; ten | sum -----+----- 0 | 2 @@ -486,14 +487,15 @@ select min(tenthous) from tenk1 where thousand = 33; -- check parameter propagation into an indexscan subquery select f1, (select min(unique1) from tenk1 where unique1 > f1) AS gt -from int4_tbl; +from int4_tbl +order by f1; f1 | gt -------------+---- + -2147483647 | 0 + -123456 | 0 0 | 1 123456 | - -123456 | 0 2147483647 | - -2147483647 | 0 (5 rows) -- check some cases that were handled incorrectly in 8.3.0 diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index b14d61fd34..85af220540 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -138,7 +138,7 @@ ANALYZE tenk1; set enable_seqscan to off; set enable_bitmapscan to off; -- 5 values, sorted -SELECT unique1 FROM tenk1 WHERE unique1 < 5; +SELECT unique1 FROM tenk1 WHERE unique1 < 5 ORDER BY unique1; unique1 --------- 0 @@ -639,13 +639,13 @@ insert into def_test default values; alter table def_test alter column c1 set default 10; alter table def_test alter column c2 set default 'new_default'; insert into def_test default values; -select * from def_test; +select * from def_test order by 1, 2; c1 | c2 ----+----------------- 5 | initial_default + 10 | new_default | initial_default | - 10 | new_default (4 rows) -- set defaults to an incorrect type: this should fail @@ -667,16 +667,16 @@ alter table def_view_test alter column c1 set default 45; insert into def_view_test default values; alter table def_view_test alter column c2 set default 'view_default'; insert into def_view_test default values; -select * from def_view_test; +select * from def_view_test order by 1, 2; c1 | c2 ----+----------------- 5 | initial_default + 10 | new_default + 45 | view_default + 45 | | initial_default | - 10 | new_default | - 45 | - 45 | view_default (7 rows) drop rule def_view_test_ins on def_view_test; @@ -951,7 +951,7 @@ insert into parent values (1, 2, 3); alter table parent drop a; create table child (d varchar(255)) inherits (parent); insert into child values (12, 13, 'testing'); -select * from parent; +select * from parent order by b; b | c ----+---- 2 | 3 @@ -965,7 +965,7 @@ select * from child; (1 row) alter table parent drop c; -select * from parent; +select * from parent order by b; b ---- 2 @@ -993,14 +993,14 @@ ERROR: column "........pg.dropped.1........" of relation "test" does not exist copy test from stdin; ERROR: extra data after last expected column CONTEXT: COPY test, line 1: "10 11 12" -select * from test; +select * from test order by b; b | c ---+--- 2 | 3 (1 row) copy test from stdin; -select * from test; +select * from test order by b; b | c ----+---- 2 | 3 @@ -1012,7 +1012,7 @@ ERROR: column "a" of relation "test" does not exist copy test("........pg.dropped.1........") from stdin; ERROR: column "........pg.dropped.1........" of relation "test" does not exist copy test(b,c) from stdin; -select * from test; +select * from test order by b; b | c ----+---- 2 | 3 @@ -1305,7 +1305,7 @@ insert into p1 values (1,2,'abc'); insert into c1 values(11,'xyz',33,0); -- should fail ERROR: new row for relation "c1" violates check constraint "p1_a1_check" insert into c1 values(11,'xyz',33,22); -select * from p1; +select * from p1 order by f1; f1 | a1 | f2 ----+----+----- 1 | 2 | abc @@ -1313,7 +1313,7 @@ select * from p1; (2 rows) update p1 set a1 = a1 + 1, f2 = upper(f2); -select * from p1; +select * from p1 order by f1; f1 | a1 | f2 ----+----+----- 1 | 3 | ABC @@ -1327,7 +1327,7 @@ NOTICE: drop cascades to table c1 create domain mytype as text; create temp table foo (f1 text, f2 mytype, f3 text); insert into foo values('bb','cc','dd'); -select * from foo; +select * from foo order by f1; f1 | f2 | f3 ----+----+---- bb | cc | dd @@ -1335,14 +1335,14 @@ select * from foo; drop domain mytype cascade; NOTICE: drop cascades to table foo column f2 -select * from foo; +select * from foo order by f1; f1 | f3 ----+---- bb | dd (1 row) insert into foo values('qq','rr'); -select * from foo; +select * from foo order by f1; f1 | f3 ----+---- bb | dd @@ -1350,7 +1350,7 @@ select * from foo; (2 rows) update foo set f3 = 'zz'; -select * from foo; +select * from foo order by f1; f1 | f3 ----+---- bb | zz @@ -1372,7 +1372,7 @@ create table anothertab (atcol1 serial8, atcol2 boolean, NOTICE: CREATE TABLE will create implicit sequence "anothertab_atcol1_seq" for serial column "anothertab.atcol1" insert into anothertab (atcol1, atcol2) values (default, true); insert into anothertab (atcol1, atcol2) values (default, false); -select * from anothertab; +select * from anothertab order by atcol1, atcol2; atcol1 | atcol2 --------+-------- 1 | t @@ -1382,7 +1382,7 @@ select * from anothertab; alter table anothertab alter column atcol1 type boolean; -- fails ERROR: column "atcol1" cannot be cast to type boolean alter table anothertab alter column atcol1 type integer; -select * from anothertab; +select * from anothertab order by atcol1, atcol2; atcol1 | atcol2 --------+-------- 1 | t @@ -1392,7 +1392,7 @@ select * from anothertab; insert into anothertab (atcol1, atcol2) values (45, null); -- fails ERROR: new row for relation "anothertab" violates check constraint "anothertab_chk" insert into anothertab (atcol1, atcol2) values (default, null); -select * from anothertab; +select * from anothertab order by atcol1, atcol2; atcol1 | atcol2 --------+-------- 1 | t @@ -1404,7 +1404,7 @@ alter table anothertab alter column atcol2 type text using case when atcol2 is true then 'IT WAS TRUE' when atcol2 is false then 'IT WAS FALSE' else 'IT WAS NULL!' end; -select * from anothertab; +select * from anothertab order by atcol1, atcol2; atcol1 | atcol2 --------+-------------- 1 | IT WAS TRUE @@ -1423,12 +1423,12 @@ HINT: No operator matches the given name and argument type(s). You might need t alter table anothertab drop constraint anothertab_chk; alter table anothertab alter column atcol1 type boolean using case when atcol1 % 2 = 0 then true else false end; -select * from anothertab; +select * from anothertab order by atcol1, atcol2; atcol1 | atcol2 --------+-------------- + f | IT WAS NULL! f | IT WAS TRUE t | IT WAS FALSE - f | IT WAS NULL! (3 rows) drop table anothertab; @@ -1436,7 +1436,7 @@ create table another (f1 int, f2 text); insert into another values(1, 'one'); insert into another values(2, 'two'); insert into another values(3, 'three'); -select * from another; +select * from another order by f1, f2; f1 | f2 ----+------- 1 | one @@ -1447,12 +1447,12 @@ select * from another; alter table another alter f1 type text using f2 || ' more', alter f2 type bigint using f1 * 10; -select * from another; +select * from another order by f1, f2; f1 | f2 ------------+---- one more | 10 - two more | 20 three more | 30 + two more | 20 (3 rows) drop table another; @@ -1514,7 +1514,7 @@ alter type alter1.ctype set schema alter2; drop schema alter1; insert into alter2.t1(f2) values(13); insert into alter2.t1(f2) values(14); -select * from alter2.t1; +select * from alter2.t1 order by f1, f2; f1 | f2 ----+---- 1 | 11 @@ -1523,7 +1523,7 @@ select * from alter2.t1; 4 | 14 (4 rows) -select * from alter2.v1; +select * from alter2.v1 order by f1, f2; f1 | f2 ----+---- 1 | 11 diff --git a/src/test/regress/expected/arrays.out b/src/test/regress/expected/arrays.out index 15f3f6082e..98aa95641d 100644 --- a/src/test/regress/expected/arrays.out +++ b/src/test/regress/expected/arrays.out @@ -26,12 +26,12 @@ INSERT INTO arrtest (a, b[1:2][1:2], c, d, e, f, g) '{"abc","abcde"}', '{"abc","abcde"}'); INSERT INTO arrtest (a, b[1:2], c, d[1:2]) VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}'); -SELECT * FROM arrtest; +SELECT * FROM arrtest ORDER BY a, b, c; a | b | c | d | e | f | g -------------+-----------------+-----------+---------------+-----------------+-----------------+------------- + {} | {3,4} | {foo,bar} | {bar,foo} | | | {1,2,3,4,5} | {{{0,0},{1,2}}} | {} | {} | [0:1]={1.1,2.2} | {} | {} {11,12,23} | {{3,4},{4,5}} | {foobar} | {{elt1,elt2}} | {3.4,6.7} | {"abc ",abcde} | {abc,abcde} - {} | {3,4} | {foo,bar} | {bar,foo} | | | (3 rows) SELECT arrtest.a[1], @@ -39,7 +39,8 @@ SELECT arrtest.a[1], arrtest.c[1], arrtest.d[1][1], arrtest.e[0] - FROM arrtest; + FROM arrtest + ORDER BY a, b, c; a | b | c | d | e ----+---+--------+------+----- 1 | 0 | | | 1.1 @@ -48,7 +49,8 @@ SELECT arrtest.a[1], (3 rows) SELECT a[1], b[1][1][1], c[1], d[1][1], e[0] - FROM arrtest; + FROM arrtest + ORDER BY a, b, c; a | b | c | d | e ----+---+--------+------+----- 1 | 0 | | | 1.1 @@ -60,30 +62,33 @@ SELECT a[1:3], b[1:1][1:2][1:2], c[1:2], d[1:1][1:2] - FROM arrtest; + FROM arrtest + ORDER BY a, b, c; a | b | c | d ------------+-----------------+-----------+--------------- + {} | {} | {foo,bar} | {} {1,2,3} | {{{0,0},{1,2}}} | {} | {} {11,12,23} | {} | {foobar} | {{elt1,elt2}} - {} | {} | {foo,bar} | {} (3 rows) SELECT array_ndims(a) AS a,array_ndims(b) AS b,array_ndims(c) AS c - FROM arrtest; + FROM arrtest + ORDER BY b; a | b | c ---+---+--- - 1 | 3 | - 1 | 2 | 1 | 1 | 1 + 1 | 2 | 1 + 1 | 3 | (3 rows) SELECT array_dims(a) AS a,array_dims(b) AS b,array_dims(c) AS c - FROM arrtest; + FROM arrtest + ORDER BY b; a | b | c -------+-----------------+------- [1:5] | [1:1][1:2][1:2] | - [1:3] | [1:2][1:2] | [1:1] | [1:2] | [1:2] + [1:3] | [1:2][1:2] | [1:1] (3 rows) -- returns nothing @@ -105,11 +110,11 @@ UPDATE arrtest UPDATE arrtest SET c[2:2] = '{"new_word"}' WHERE array_dims(c) is not null; -SELECT a,b,c FROM arrtest; +SELECT a,b,c FROM arrtest ORDER BY a, b, c; a | b | c ---------------+-----------------------+------------------- - {16,25,3,4,5} | {{{113,142},{1,147}}} | {} {} | {3,4} | {foo,new_word} + {16,25,3,4,5} | {{{113,142},{1,147}}} | {} {16,25,23} | {{3,4},{4,5}} | {foobar,new_word} (3 rows) @@ -117,34 +122,35 @@ SELECT a[1:3], b[1:1][1:2][1:2], c[1:2], d[1:1][2:2] - FROM arrtest; + FROM arrtest + ORDER BY a, b, c; a | b | c | d ------------+-----------------------+-------------------+---------- - {16,25,3} | {{{113,142},{1,147}}} | {} | {} {} | {} | {foo,new_word} | {} + {16,25,3} | {{{113,142},{1,147}}} | {} | {} {16,25,23} | {} | {foobar,new_word} | {{elt2}} (3 rows) INSERT INTO arrtest(a) VALUES('{1,null,3}'); -SELECT a FROM arrtest; +SELECT a FROM arrtest ORDER BY 1; a --------------- - {16,25,3,4,5} {} - {16,25,23} {1,NULL,3} + {16,25,3,4,5} + {16,25,23} (4 rows) UPDATE arrtest SET a[4] = NULL WHERE a[2] IS NULL; -SELECT a FROM arrtest WHERE a[2] IS NULL; +SELECT a FROM arrtest WHERE a[2] IS NULL ORDER BY 1; a ----------------- - [4:4]={NULL} {1,NULL,3,NULL} + [4:4]={NULL} (2 rows) DELETE FROM arrtest WHERE a[2] IS NULL AND b IS NULL; -SELECT a,b,c FROM arrtest; +SELECT a,b,c FROM arrtest ORDER BY a, b, c; a | b | c ---------------+-----------------------+------------------- {16,25,3,4,5} | {{{113,142},{1,147}}} | {} @@ -718,14 +724,14 @@ insert into arr_tbl values ('{1,5,3}'); insert into arr_tbl values ('{1,2,10}'); set enable_seqscan to off; set enable_bitmapscan to off; -select * from arr_tbl where f1 > '{1,2,3}' and f1 <= '{1,5,3}'; +select * from arr_tbl where f1 > '{1,2,3}' and f1 <= '{1,5,3}' ORDER BY 1; f1 ---------- {1,2,10} {1,5,3} (2 rows) -select * from arr_tbl where f1 >= '{1,2,3}' and f1 < '{1,5,3}'; +select * from arr_tbl where f1 >= '{1,2,3}' and f1 < '{1,5,3}' ORDER BY 1; f1 ---------- {1,2,3} diff --git a/src/test/regress/expected/bit.out b/src/test/regress/expected/bit.out index 3563d2366d..28bea52f12 100644 --- a/src/test/regress/expected/bit.out +++ b/src/test/regress/expected/bit.out @@ -14,12 +14,12 @@ INSERT INTO BIT_TABLE VALUES (B'101011111010'); -- too long ERROR: bit string length 12 does not match type bit(11) --INSERT INTO BIT_TABLE VALUES ('X554'); --INSERT INTO BIT_TABLE VALUES ('X555'); -SELECT * FROM BIT_TABLE; +SELECT * FROM BIT_TABLE ORDER BY b; b ------------- 00000000000 - 11011000000 01010101010 + 11011000000 (3 rows) CREATE TABLE VARBIT_TABLE(v BIT VARYING(11)); @@ -31,7 +31,7 @@ INSERT INTO VARBIT_TABLE VALUES (B'101011111010'); -- too long ERROR: bit string too long for type bit varying(11) --INSERT INTO VARBIT_TABLE VALUES ('X554'); --INSERT INTO VARBIT_TABLE VALUES ('X555'); -SELECT * FROM VARBIT_TABLE; +SELECT * FROM VARBIT_TABLE ORDER BY v; v ------------- @@ -62,16 +62,16 @@ SELECT v, b, (v || b) AS concat -- Length SELECT b, length(b) AS lb - FROM BIT_TABLE; + FROM BIT_TABLE ORDER BY b; b | lb -------------+---- 00000000000 | 11 - 11011000000 | 11 01010101010 | 11 + 11011000000 | 11 (3 rows) SELECT v, length(v) AS lv - FROM VARBIT_TABLE; + FROM VARBIT_TABLE ORDER BY v; v | lv -------------+---- | 0 @@ -85,19 +85,19 @@ SELECT b, SUBSTRING(b FROM 2 FOR 4) AS sub_2_4, SUBSTRING(b FROM 7 FOR 13) AS sub_7_13, SUBSTRING(b FROM 6) AS sub_6 - FROM BIT_TABLE; + FROM BIT_TABLE ORDER BY b; b | sub_2_4 | sub_7_13 | sub_6 -------------+---------+----------+-------- 00000000000 | 0000 | 00000 | 000000 - 11011000000 | 1011 | 00000 | 000000 01010101010 | 1010 | 01010 | 101010 + 11011000000 | 1011 | 00000 | 000000 (3 rows) SELECT v, SUBSTRING(v FROM 2 FOR 4) AS sub_2_4, SUBSTRING(v FROM 7 FOR 13) AS sub_7_13, SUBSTRING(v FROM 6) AS sub_6 - FROM VARBIT_TABLE; + FROM VARBIT_TABLE ORDER BY v; v | sub_2_4 | sub_7_13 | sub_6 -------------+---------+----------+-------- | | | @@ -111,50 +111,50 @@ DROP TABLE varbit_table; CREATE TABLE varbit_table (a BIT VARYING(16), b BIT VARYING(16)); COPY varbit_table FROM stdin; SELECT a, b, ~a AS "~ a", a & b AS "a & b", - a | b AS "a | b", a # b AS "a # b" FROM varbit_table; + a | b AS "a | b", a # b AS "a # b" FROM varbit_table ORDER BY a,b; a | b | ~ a | a & b | a | b | a # b ------------------+------------------+------------------+------------------+------------------+------------------ + 0000000000001111 | 0000000000010000 | 1111111111110000 | 0000000000000000 | 0000000000011111 | 0000000000011111 + 0000000100100011 | 1111111111111111 | 1111111011011100 | 0000000100100011 | 1111111111111111 | 1111111011011100 00001111 | 00010000 | 11110000 | 00000000 | 00011111 | 00011111 + 0001001000110100 | 1111111111110101 | 1110110111001011 | 0001001000110100 | 1111111111110101 | 1110110111000001 00011111 | 00010001 | 11100000 | 00010001 | 00011111 | 00001110 + 0010010001101000 | 0010010001101000 | 1101101110010111 | 0010010001101000 | 0010010001101000 | 0000000000000000 00101111 | 00010010 | 11010000 | 00000010 | 00111111 | 00111101 00111111 | 00010011 | 11000000 | 00010011 | 00111111 | 00101100 10001111 | 00000100 | 01110000 | 00000100 | 10001111 | 10001011 - 0000000000001111 | 0000000000010000 | 1111111111110000 | 0000000000000000 | 0000000000011111 | 0000000000011111 - 0000000100100011 | 1111111111111111 | 1111111011011100 | 0000000100100011 | 1111111111111111 | 1111111011011100 - 0010010001101000 | 0010010001101000 | 1101101110010111 | 0010010001101000 | 0010010001101000 | 0000000000000000 1111101001010000 | 0000010110101111 | 0000010110101111 | 0000000000000000 | 1111111111111111 | 1111111111111111 - 0001001000110100 | 1111111111110101 | 1110110111001011 | 0001001000110100 | 1111111111110101 | 1110110111000001 (10 rows) SELECT a,b,a<b AS "a<b",a<=b AS "a<=b",a=b AS "a=b", - a>=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM varbit_table; + a>=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM varbit_table ORDER BY a,b; a | b | a<b | a<=b | a=b | a>=b | a>b | a<>b ------------------+------------------+-----+------+-----+------+-----+------ + 0000000000001111 | 0000000000010000 | t | t | f | f | f | t + 0000000100100011 | 1111111111111111 | t | t | f | f | f | t 00001111 | 00010000 | t | t | f | f | f | t + 0001001000110100 | 1111111111110101 | t | t | f | f | f | t 00011111 | 00010001 | f | f | f | t | t | t + 0010010001101000 | 0010010001101000 | f | t | t | t | f | f 00101111 | 00010010 | f | f | f | t | t | t 00111111 | 00010011 | f | f | f | t | t | t 10001111 | 00000100 | f | f | f | t | t | t - 0000000000001111 | 0000000000010000 | t | t | f | f | f | t - 0000000100100011 | 1111111111111111 | t | t | f | f | f | t - 0010010001101000 | 0010010001101000 | f | t | t | t | f | f 1111101001010000 | 0000010110101111 | f | f | f | t | t | t - 0001001000110100 | 1111111111110101 | t | t | f | f | f | t (10 rows) -SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM varbit_table; +SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM varbit_table ORDER BY a,b; a | a<<4 | b | b>>2 ------------------+------------------+------------------+------------------ + 0000000000001111 | 0000000011110000 | 0000000000010000 | 0000000000000100 + 0000000100100011 | 0001001000110000 | 1111111111111111 | 0011111111111111 00001111 | 11110000 | 00010000 | 00000100 + 0001001000110100 | 0010001101000000 | 1111111111110101 | 0011111111111101 00011111 | 11110000 | 00010001 | 00000100 + 0010010001101000 | 0100011010000000 | 0010010001101000 | 0000100100011010 00101111 | 11110000 | 00010010 | 00000100 00111111 | 11110000 | 00010011 | 00000100 10001111 | 11110000 | 00000100 | 00000001 - 0000000000001111 | 0000000011110000 | 0000000000010000 | 0000000000000100 - 0000000100100011 | 0001001000110000 | 1111111111111111 | 0011111111111111 - 0010010001101000 | 0100011010000000 | 0010010001101000 | 0000100100011010 1111101001010000 | 1010010100000000 | 0000010110101111 | 0000000101101011 - 0001001000110100 | 0010001101000000 | 1111111111110101 | 0011111111111101 (10 rows) DROP TABLE varbit_table; @@ -163,50 +163,50 @@ DROP TABLE bit_table; CREATE TABLE bit_table (a BIT(16), b BIT(16)); COPY bit_table FROM stdin; SELECT a,b,~a AS "~ a",a & b AS "a & b", - a|b AS "a | b", a # b AS "a # b" FROM bit_table; + a|b AS "a | b", a # b AS "a # b" FROM bit_table ORDER BY a,b; a | b | ~ a | a & b | a | b | a # b ------------------+------------------+------------------+------------------+------------------+------------------ + 0000000000001111 | 0000000000010000 | 1111111111110000 | 0000000000000000 | 0000000000011111 | 0000000000011111 + 0000000100100011 | 1111111111111111 | 1111111011011100 | 0000000100100011 | 1111111111111111 | 1111111011011100 0000111100000000 | 0001000000000000 | 1111000011111111 | 0000000000000000 | 0001111100000000 | 0001111100000000 + 0001001000110100 | 1111111111110101 | 1110110111001011 | 0001001000110100 | 1111111111110101 | 1110110111000001 0001111100000000 | 0001000100000000 | 1110000011111111 | 0001000100000000 | 0001111100000000 | 0000111000000000 + 0010010001101000 | 0010010001101000 | 1101101110010111 | 0010010001101000 | 0010010001101000 | 0000000000000000 0010111100000000 | 0001001000000000 | 1101000011111111 | 0000001000000000 | 0011111100000000 | 0011110100000000 0011111100000000 | 0001001100000000 | 1100000011111111 | 0001001100000000 | 0011111100000000 | 0010110000000000 1000111100000000 | 0000010000000000 | 0111000011111111 | 0000010000000000 | 1000111100000000 | 1000101100000000 - 0000000000001111 | 0000000000010000 | 1111111111110000 | 0000000000000000 | 0000000000011111 | 0000000000011111 - 0000000100100011 | 1111111111111111 | 1111111011011100 | 0000000100100011 | 1111111111111111 | 1111111011011100 - 0010010001101000 | 0010010001101000 | 1101101110010111 | 0010010001101000 | 0010010001101000 | 0000000000000000 1111101001010000 | 0000010110101111 | 0000010110101111 | 0000000000000000 | 1111111111111111 | 1111111111111111 - 0001001000110100 | 1111111111110101 | 1110110111001011 | 0001001000110100 | 1111111111110101 | 1110110111000001 (10 rows) SELECT a,b,a<b AS "a<b",a<=b AS "a<=b",a=b AS "a=b", - a>=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM bit_table; + a>=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM bit_table ORDER BY a,b; a | b | a<b | a<=b | a=b | a>=b | a>b | a<>b ------------------+------------------+-----+------+-----+------+-----+------ + 0000000000001111 | 0000000000010000 | t | t | f | f | f | t + 0000000100100011 | 1111111111111111 | t | t | f | f | f | t 0000111100000000 | 0001000000000000 | t | t | f | f | f | t + 0001001000110100 | 1111111111110101 | t | t | f | f | f | t 0001111100000000 | 0001000100000000 | f | f | f | t | t | t + 0010010001101000 | 0010010001101000 | f | t | t | t | f | f 0010111100000000 | 0001001000000000 | f | f | f | t | t | t 0011111100000000 | 0001001100000000 | f | f | f | t | t | t 1000111100000000 | 0000010000000000 | f | f | f | t | t | t - 0000000000001111 | 0000000000010000 | t | t | f | f | f | t - 0000000100100011 | 1111111111111111 | t | t | f | f | f | t - 0010010001101000 | 0010010001101000 | f | t | t | t | f | f 1111101001010000 | 0000010110101111 | f | f | f | t | t | t - 0001001000110100 | 1111111111110101 | t | t | f | f | f | t (10 rows) -SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM bit_table; +SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM bit_table ORDER BY a,b; a | a<<4 | b | b>>2 ------------------+------------------+------------------+------------------ + 0000000000001111 | 0000000011110000 | 0000000000010000 | 0000000000000100 + 0000000100100011 | 0001001000110000 | 1111111111111111 | 0011111111111111 0000111100000000 | 1111000000000000 | 0001000000000000 | 0000010000000000 + 0001001000110100 | 0010001101000000 | 1111111111110101 | 0011111111111101 0001111100000000 | 1111000000000000 | 0001000100000000 | 0000010001000000 + 0010010001101000 | 0100011010000000 | 0010010001101000 | 0000100100011010 0010111100000000 | 1111000000000000 | 0001001000000000 | 0000010010000000 0011111100000000 | 1111000000000000 | 0001001100000000 | 0000010011000000 1000111100000000 | 1111000000000000 | 0000010000000000 | 0000000100000000 - 0000000000001111 | 0000000011110000 | 0000000000010000 | 0000000000000100 - 0000000100100011 | 0001001000110000 | 1111111111111111 | 0011111111111111 - 0010010001101000 | 0100011010000000 | 0010010001101000 | 0000100100011010 1111101001010000 | 1010010100000000 | 0000010110101111 | 0000000101101011 - 0001001000110100 | 0010001101000000 | 1111111111110101 | 0011111111111101 (10 rows) DROP TABLE bit_table; @@ -456,25 +456,25 @@ INSERT INTO BIT_SHIFT_TABLE SELECT b>>8 FROM BIT_SHIFT_TABLE; SELECT POSITION(B'1101' IN b), POSITION(B'11011' IN b), b - FROM BIT_SHIFT_TABLE ; + FROM BIT_SHIFT_TABLE ORDER BY b; position | position | b ----------+----------+------------------ - 1 | 1 | 1101100000000000 - 2 | 2 | 0110110000000000 - 3 | 3 | 0011011000000000 - 4 | 4 | 0001101100000000 - 5 | 5 | 0000110110000000 - 6 | 6 | 0000011011000000 - 7 | 7 | 0000001101100000 - 8 | 8 | 0000000110110000 - 9 | 9 | 0000000011011000 - 10 | 10 | 0000000001101100 - 11 | 11 | 0000000000110110 - 12 | 12 | 0000000000011011 - 13 | 0 | 0000000000001101 - 0 | 0 | 0000000000000110 - 0 | 0 | 0000000000000011 0 | 0 | 0000000000000001 + 0 | 0 | 0000000000000011 + 0 | 0 | 0000000000000110 + 13 | 0 | 0000000000001101 + 12 | 12 | 0000000000011011 + 11 | 11 | 0000000000110110 + 10 | 10 | 0000000001101100 + 9 | 9 | 0000000011011000 + 8 | 8 | 0000000110110000 + 7 | 7 | 0000001101100000 + 6 | 6 | 0000011011000000 + 5 | 5 | 0000110110000000 + 4 | 4 | 0001101100000000 + 3 | 3 | 0011011000000000 + 2 | 2 | 0110110000000000 + 1 | 1 | 1101100000000000 (16 rows) CREATE TABLE VARBIT_SHIFT_TABLE(v BIT VARYING(20)); @@ -486,25 +486,25 @@ INSERT INTO VARBIT_SHIFT_TABLE SELECT CAST(v || B'00000000' AS BIT VARYING(20)) SELECT POSITION(B'1101' IN v), POSITION(B'11011' IN v), v - FROM VARBIT_SHIFT_TABLE ; + FROM VARBIT_SHIFT_TABLE ORDER BY v; position | position | v ----------+----------+---------------------- - 1 | 1 | 11011 - 2 | 2 | 011011 - 3 | 3 | 0011011 - 4 | 4 | 00011011 - 5 | 5 | 000011011 - 6 | 6 | 0000011011 - 7 | 7 | 00000011011 - 8 | 8 | 000000011011 - 9 | 9 | 0000000011011 - 10 | 10 | 00000000011011 - 11 | 11 | 000000000011011 - 12 | 12 | 0000000000011011 - 13 | 13 | 00000000000011011 - 14 | 14 | 000000000000011011 - 15 | 15 | 0000000000000011011 16 | 16 | 00000000000000011011 + 15 | 15 | 0000000000000011011 + 14 | 14 | 000000000000011011 + 13 | 13 | 00000000000011011 + 12 | 12 | 0000000000011011 + 11 | 11 | 000000000011011 + 10 | 10 | 00000000011011 + 9 | 9 | 0000000011011 + 8 | 8 | 000000011011 + 7 | 7 | 00000011011 + 6 | 6 | 0000011011 + 5 | 5 | 000011011 + 4 | 4 | 00011011 + 3 | 3 | 0011011 + 2 | 2 | 011011 + 1 | 1 | 11011 (16 rows) DROP TABLE BIT_SHIFT_TABLE; diff --git a/src/test/regress/expected/box.out b/src/test/regress/expected/box.out index 2a94e33465..097bb4b794 100644 --- a/src/test/regress/expected/box.out +++ b/src/test/regress/expected/box.out @@ -41,30 +41,30 @@ SELECT '' AS four, * FROM BOX_TBL; (4 rows) SELECT '' AS four, b.*, area(b.f1) as barea - FROM BOX_TBL b; + FROM BOX_TBL b ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; four | f1 | barea ------+---------------------+------- | (2,2),(0,0) | 4 - | (3,3),(1,1) | 4 | (2.5,3.5),(2.5,2.5) | 0 + | (3,3),(1,1) | 4 | (3,3),(3,3) | 0 (4 rows) -- overlap SELECT '' AS three, b.f1 FROM BOX_TBL b - WHERE b.f1 && box '(2.5,2.5,1.0,1.0)'; + WHERE b.f1 && box '(2.5,2.5,1.0,1.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; three | f1 -------+--------------------- | (2,2),(0,0) - | (3,3),(1,1) | (2.5,3.5),(2.5,2.5) + | (3,3),(1,1) (3 rows) -- left-or-overlap (x only) SELECT '' AS two, b1.* FROM BOX_TBL b1 - WHERE b1.f1 &< box '(2.0,2.0,2.5,2.5)'; + WHERE b1.f1 &< box '(2.0,2.0,2.5,2.5)' ORDER BY (b1.f1[0])[0], (b1.f1[0])[1], (b1.f1[2])[0], (b1.f1[2])[1]; two | f1 -----+--------------------- | (2,2),(0,0) @@ -74,7 +74,7 @@ SELECT '' AS two, b1.* -- right-or-overlap (x only) SELECT '' AS two, b1.* FROM BOX_TBL b1 - WHERE b1.f1 &> box '(2.0,2.0,2.5,2.5)'; + WHERE b1.f1 &> box '(2.0,2.0,2.5,2.5)' ORDER BY (b1.f1[0])[0], (b1.f1[0])[1], (b1.f1[2])[0], (b1.f1[2])[1]; two | f1 -----+--------------------- | (2.5,3.5),(2.5,2.5) @@ -84,7 +84,7 @@ SELECT '' AS two, b1.* -- left of SELECT '' AS two, b.f1 FROM BOX_TBL b - WHERE b.f1 << box '(3.0,3.0,5.0,5.0)'; + WHERE b.f1 << box '(3.0,3.0,5.0,5.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; two | f1 -----+--------------------- | (2,2),(0,0) @@ -94,19 +94,19 @@ SELECT '' AS two, b.f1 -- area <= SELECT '' AS four, b.f1 FROM BOX_TBL b - WHERE b.f1 <= box '(3.0,3.0,5.0,5.0)'; + WHERE b.f1 <= box '(3.0,3.0,5.0,5.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; four | f1 ------+--------------------- | (2,2),(0,0) - | (3,3),(1,1) | (2.5,3.5),(2.5,2.5) + | (3,3),(1,1) | (3,3),(3,3) (4 rows) -- area < SELECT '' AS two, b.f1 FROM BOX_TBL b - WHERE b.f1 < box '(3.0,3.0,5.0,5.0)'; + WHERE b.f1 < box '(3.0,3.0,5.0,5.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; two | f1 -----+--------------------- | (2.5,3.5),(2.5,2.5) @@ -116,7 +116,7 @@ SELECT '' AS two, b.f1 -- area = SELECT '' AS two, b.f1 FROM BOX_TBL b - WHERE b.f1 = box '(3.0,3.0,5.0,5.0)'; + WHERE b.f1 = box '(3.0,3.0,5.0,5.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; two | f1 -----+------------- | (2,2),(0,0) @@ -126,7 +126,7 @@ SELECT '' AS two, b.f1 -- area > SELECT '' AS two, b.f1 FROM BOX_TBL b -- zero area - WHERE b.f1 > box '(3.5,3.0,4.5,3.0)'; + WHERE b.f1 > box '(3.5,3.0,4.5,3.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; two | f1 -----+------------- | (2,2),(0,0) @@ -136,19 +136,19 @@ SELECT '' AS two, b.f1 -- area >= SELECT '' AS four, b.f1 FROM BOX_TBL b -- zero area - WHERE b.f1 >= box '(3.5,3.0,4.5,3.0)'; + WHERE b.f1 >= box '(3.5,3.0,4.5,3.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; four | f1 ------+--------------------- | (2,2),(0,0) - | (3,3),(1,1) | (2.5,3.5),(2.5,2.5) + | (3,3),(1,1) | (3,3),(3,3) (4 rows) -- right of SELECT '' AS two, b.f1 FROM BOX_TBL b - WHERE box '(3.0,3.0,5.0,5.0)' >> b.f1; + WHERE box '(3.0,3.0,5.0,5.0)' >> b.f1 ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; two | f1 -----+--------------------- | (2,2),(0,0) @@ -158,7 +158,7 @@ SELECT '' AS two, b.f1 -- contained in SELECT '' AS three, b.f1 FROM BOX_TBL b - WHERE b.f1 <@ box '(0,0,3,3)'; + WHERE b.f1 <@ box '(0,0,3,3)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; three | f1 -------+------------- | (2,2),(0,0) @@ -169,7 +169,7 @@ SELECT '' AS three, b.f1 -- contains SELECT '' AS three, b.f1 FROM BOX_TBL b - WHERE box '(0,0,3,3)' @> b.f1; + WHERE box '(0,0,3,3)' @> b.f1 ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; three | f1 -------+------------- | (2,2),(0,0) @@ -180,7 +180,7 @@ SELECT '' AS three, b.f1 -- box equality SELECT '' AS one, b.f1 FROM BOX_TBL b - WHERE box '(1,1,3,3)' ~= b.f1; + WHERE box '(1,1,3,3)' ~= b.f1 ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; one | f1 -----+------------- | (3,3),(1,1) @@ -188,30 +188,31 @@ SELECT '' AS one, b.f1 -- center of box, left unary operator SELECT '' AS four, @@(b1.f1) AS p - FROM BOX_TBL b1; + FROM BOX_TBL b1 ORDER BY (b1.f1[0])[0], (b1.f1[0])[1], (b1.f1[2])[0], (b1.f1[2])[1]; four | p ------+--------- | (1,1) - | (2,2) | (2.5,3) + | (2,2) | (3,3) (4 rows) -- wholly-contained SELECT '' AS one, b1.*, b2.* FROM BOX_TBL b1, BOX_TBL b2 - WHERE b1.f1 @> b2.f1 and not b1.f1 ~= b2.f1; + WHERE b1.f1 @> b2.f1 and not b1.f1 ~= b2.f1 + ORDER BY (b1.f1[0])[0], (b1.f1[0])[1], (b1.f1[2])[0], (b1.f1[2])[1], (b2.f1[0])[0], (b2.f1[0])[1], (b2.f1[2])[0], (b2.f1[2])[1]; one | f1 | f1 -----+-------------+------------- | (3,3),(1,1) | (3,3),(3,3) (1 row) -SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL; +SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL ORDER BY (f1[0])[0], (f1[0])[1], (f1[2])[0], (f1[2])[1]; four | height | width ------+--------+------- | 2 | 2 - | 2 | 2 | 1 | 0 + | 2 | 2 | 0 | 0 (4 rows) diff --git a/src/test/regress/expected/case.out b/src/test/regress/expected/case.out index 9ec32b8bd2..6dd98ed81a 100644 --- a/src/test/regress/expected/case.out +++ b/src/test/regress/expected/case.out @@ -103,20 +103,22 @@ SELECT '' AS "Five", CASE WHEN i >= 3 THEN i END AS ">= 3 or Null" - FROM CASE_TBL; + FROM CASE_TBL + ORDER BY 2; Five | >= 3 or Null ------+-------------- - | - | | 3 | 4 + | + | (4 rows) SELECT '' AS "Five", CASE WHEN i >= 3 THEN (i + i) ELSE i END AS "Simplest Math" - FROM CASE_TBL; + FROM CASE_TBL + ORDER BY 2; Five | Simplest Math ------+--------------- | 1 @@ -132,7 +134,8 @@ SELECT '' AS "Five", i AS "Value", WHEN (i = 2) THEN 'two' ELSE 'big' END AS "Category" - FROM CASE_TBL; + FROM CASE_TBL + ORDER BY 2, 3; Five | Value | Category ------+-------+---------- | 1 | one @@ -148,13 +151,14 @@ SELECT '' AS "Five", WHEN ((i = 2) or (i = 2)) THEN 'two' ELSE 'big' END AS "Category" - FROM CASE_TBL; + FROM CASE_TBL + ORDER BY 2; Five | Category ------+---------- - | one - | two | big | big + | one + | two (4 rows) -- @@ -177,82 +181,86 @@ SELECT * FROM CASE_TBL WHERE NULLIF(f,i) = 2; (0 rows) SELECT COALESCE(a.f, b.i, b.j) - FROM CASE_TBL a, CASE2_TBL b; + FROM CASE_TBL a, CASE2_TBL b + ORDER BY coalesce; coalesce ---------- - 10.1 - 20.2 -30.3 - 1 - 10.1 - 20.2 -30.3 - 2 - 10.1 - 20.2 -30.3 - 3 - 10.1 - 20.2 -30.3 - 2 - 10.1 - 20.2 -30.3 + -30.3 + -6 + 1 1 + 2 + 2 + 3 + 10.1 + 10.1 + 10.1 + 10.1 + 10.1 10.1 20.2 - -30.3 - -6 + 20.2 + 20.2 + 20.2 + 20.2 + 20.2 (24 rows) SELECT * FROM CASE_TBL a, CASE2_TBL b - WHERE COALESCE(a.f, b.i, b.j) = 2; + WHERE COALESCE(a.f, b.i, b.j) = 2 + ORDER BY a.i, a.f, b.i, b.j; i | f | i | j ---+---+---+---- - 4 | | 2 | -2 4 | | 2 | -4 + 4 | | 2 | -2 (2 rows) SELECT '' AS Five, NULLIF(a.i,b.i) AS "NULLIF(a.i,b.i)", NULLIF(b.i, 4) AS "NULLIF(b.i,4)" - FROM CASE_TBL a, CASE2_TBL b; + FROM CASE_TBL a, CASE2_TBL b + ORDER BY 2, 3; five | NULLIF(a.i,b.i) | NULLIF(b.i,4) ------+-----------------+--------------- - | | 1 - | 2 | 1 - | 3 | 1 - | 4 | 1 | 1 | 2 - | | 2 - | 3 | 2 - | 4 | 2 - | 1 | 3 - | 2 | 3 - | | 3 - | 4 | 3 | 1 | 2 - | | 2 - | 3 | 2 - | 4 | 2 - | | 1 - | 2 | 1 - | 3 | 1 - | 4 | 1 + | 1 | 3 | 1 | + | 2 | 1 + | 2 | 1 + | 2 | 3 | 2 | + | 3 | 1 + | 3 | 1 + | 3 | 2 + | 3 | 2 | 3 | + | 4 | 1 + | 4 | 1 + | 4 | 2 + | 4 | 2 + | 4 | 3 | 4 | + | | 1 + | | 1 + | | 2 + | | 2 + | | 3 (24 rows) SELECT '' AS "Two", * FROM CASE_TBL a, CASE2_TBL b - WHERE COALESCE(f,b.i) = 2; + WHERE COALESCE(f,b.i) = 2 + ORDER BY a.i, a.f, b.i, b.j; Two | i | f | i | j -----+---+---+---+---- - | 4 | | 2 | -2 | 4 | | 2 | -4 + | 4 | | 2 | -2 (2 rows) -- @@ -261,25 +269,25 @@ SELECT '' AS "Two", * UPDATE CASE_TBL SET i = CASE WHEN i >= 3 THEN (- i) ELSE (2 * i) END; -SELECT * FROM CASE_TBL; +SELECT * FROM CASE_TBL ORDER BY i, f; i | f ----+------- + -4 | + -3 | -30.3 2 | 10.1 4 | 20.2 - -3 | -30.3 - -4 | (4 rows) UPDATE CASE_TBL SET i = CASE WHEN i >= 2 THEN (2 * i) ELSE (3 * i) END; -SELECT * FROM CASE_TBL; +SELECT * FROM CASE_TBL ORDER BY i, f; i | f -----+------- + -12 | + -9 | -30.3 4 | 10.1 8 | 20.2 - -9 | -30.3 - -12 | (4 rows) UPDATE CASE_TBL @@ -287,13 +295,13 @@ UPDATE CASE_TBL ELSE (3 * j) END FROM CASE2_TBL b WHERE j = -CASE_TBL.i; -SELECT * FROM CASE_TBL; +SELECT * FROM CASE_TBL ORDER BY i, f; i | f -----+------- - 8 | 20.2 - -9 | -30.3 -12 | + -9 | -30.3 -8 | 10.1 + 8 | 20.2 (4 rows) -- diff --git a/src/test/regress/expected/char.out b/src/test/regress/expected/char.out index a0ba3d4a8c..cf8eecaa69 100644 --- a/src/test/regress/expected/char.out +++ b/src/test/regress/expected/char.out @@ -25,28 +25,28 @@ INSERT INTO CHAR_TBL (f1) VALUES (''); INSERT INTO CHAR_TBL (f1) VALUES ('cd'); ERROR: value too long for type character(1) INSERT INTO CHAR_TBL (f1) VALUES ('c '); -SELECT '' AS seven, * FROM CHAR_TBL; +SELECT '' AS seven, * FROM CHAR_TBL ORDER BY f1; seven | f1 -------+---- - | a - | A + | | 1 | 2 | 3 - | + | A + | a | c (7 rows) SELECT '' AS six, c.* FROM CHAR_TBL c - WHERE c.f1 <> 'a'; + WHERE c.f1 <> 'a' ORDER BY f1; six | f1 -----+---- - | A + | | 1 | 2 | 3 - | + | A | c (6 rows) @@ -60,32 +60,32 @@ SELECT '' AS one, c.* SELECT '' AS five, c.* FROM CHAR_TBL c - WHERE c.f1 < 'a'; + WHERE c.f1 < 'a' ORDER BY f1; five | f1 ------+---- - | A + | | 1 | 2 | 3 - | + | A (5 rows) SELECT '' AS six, c.* FROM CHAR_TBL c - WHERE c.f1 <= 'a'; + WHERE c.f1 <= 'a' ORDER BY f1; six | f1 -----+---- - | a - | A + | | 1 | 2 | 3 - | + | A + | a (6 rows) SELECT '' AS one, c.* FROM CHAR_TBL c - WHERE c.f1 > 'a'; + WHERE c.f1 > 'a' ORDER BY f1; one | f1 -----+---- | c @@ -93,7 +93,7 @@ SELECT '' AS one, c.* SELECT '' AS two, c.* FROM CHAR_TBL c - WHERE c.f1 >= 'a'; + WHERE c.f1 >= 'a' ORDER BY f1; two | f1 -----+---- | a @@ -111,7 +111,7 @@ INSERT INTO CHAR_TBL (f1) VALUES ('abcd'); INSERT INTO CHAR_TBL (f1) VALUES ('abcde'); ERROR: value too long for type character(4) INSERT INTO CHAR_TBL (f1) VALUES ('abcd '); -SELECT '' AS four, * FROM CHAR_TBL; +SELECT '' AS four, * FROM CHAR_TBL ORDER BY f1; four | f1 ------+------ | a diff --git a/src/test/regress/expected/circle.out b/src/test/regress/expected/circle.out index 9ba4a0495d..2b098a8dc4 100644 --- a/src/test/regress/expected/circle.out +++ b/src/test/regress/expected/circle.out @@ -21,65 +21,65 @@ INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)'); ERROR: invalid input syntax for type circle: "(3,(1,2),3)" LINE 1: INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)'); ^ -SELECT * FROM CIRCLE_TBL; +SELECT * FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); f1 ---------------- - <(5,1),3> - <(1,2),100> - <(1,3),5> <(1,2),3> + <(1,3),5> + <(1,2),100> + <(5,1),3> <(100,200),10> <(100,1),115> (6 rows) SELECT '' AS six, center(f1) AS center - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); six | center -----+----------- - | (5,1) | (1,2) | (1,3) | (1,2) + | (5,1) | (100,200) | (100,1) (6 rows) SELECT '' AS six, radius(f1) AS radius - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); six | radius -----+-------- | 3 - | 100 | 5 + | 100 | 3 | 10 | 115 (6 rows) SELECT '' AS six, diameter(f1) AS diameter - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); six | diameter -----+---------- | 6 - | 200 | 10 + | 200 | 6 | 20 | 230 (6 rows) -SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5; +SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5 ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); two | f1 -----+----------- - | <(5,1),3> | <(1,2),3> + | <(5,1),3> (2 rows) -SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10; +SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10 ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); four | f1 ------+---------------- - | <(1,2),100> | <(1,3),5> + | <(1,2),100> | <(100,200),10> | <(100,1),115> (4 rows) diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index 9bf4764b68..2b4c0d2479 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -57,41 +57,41 @@ INSERT INTO clstr_tst (b, c) VALUES (8, 'ocho'); -- This entry is needed to test that TOASTED values are copied correctly. INSERT INTO clstr_tst (b, c, d) VALUES (6, 'seis', repeat('xyzzy', 100000)); CLUSTER clstr_tst_c ON clstr_tst; -SELECT a,b,c,substring(d for 30), length(d) from clstr_tst; +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY a, b, c; a | b | c | substring | length ----+----+---------------+--------------------------------+-------- - 10 | 14 | catorce | | - 18 | 5 | cinco | | - 9 | 4 | cuatro | | - 26 | 19 | diecinueve | | - 12 | 18 | dieciocho | | - 30 | 16 | dieciseis | | - 24 | 17 | diecisiete | | - 2 | 10 | diez | | - 23 | 12 | doce | | - 11 | 2 | dos | | - 25 | 9 | nueve | | - 31 | 8 | ocho | | 1 | 11 | once | | - 28 | 15 | quince | | - 32 | 6 | seis | xyzzyxyzzyxyzzyxyzzyxyzzyxyzzy | 500000 - 29 | 7 | siete | | - 15 | 13 | trece | | - 22 | 30 | treinta | | - 17 | 32 | treinta y dos | | + 2 | 10 | diez | | 3 | 31 | treinta y uno | | + 4 | 22 | veintidos | | 5 | 3 | tres | | - 20 | 1 | uno | | 6 | 20 | veinte | | + 7 | 23 | veintitres | | + 8 | 21 | veintiuno | | + 9 | 4 | cuatro | | + 10 | 14 | catorce | | + 11 | 2 | dos | | + 12 | 18 | dieciocho | | + 13 | 27 | veintisiete | | 14 | 25 | veinticinco | | - 21 | 24 | veinticuatro | | - 4 | 22 | veintidos | | - 19 | 29 | veintinueve | | + 15 | 13 | trece | | 16 | 28 | veintiocho | | + 17 | 32 | treinta y dos | | + 18 | 5 | cinco | | + 19 | 29 | veintinueve | | + 20 | 1 | uno | | + 21 | 24 | veinticuatro | | + 22 | 30 | treinta | | + 23 | 12 | doce | | + 24 | 17 | diecisiete | | + 25 | 9 | nueve | | + 26 | 19 | diecinueve | | 27 | 26 | veintiseis | | - 13 | 27 | veintisiete | | - 7 | 23 | veintitres | | - 8 | 21 | veintiuno | | + 28 | 15 | quince | | + 29 | 7 | siete | | + 30 | 16 | dieciseis | | + 31 | 8 | ocho | | + 32 | 6 | seis | xyzzyxyzzyxyzzyxyzzyxyzzyxyzzy | 500000 (32 rows) SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY a; @@ -207,42 +207,42 @@ SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY c; -- Verify that inheritance link still works INSERT INTO clstr_tst_inh VALUES (0, 100, 'in child table'); -SELECT a,b,c,substring(d for 30), length(d) from clstr_tst; +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY a, b, c; a | b | c | substring | length ----+-----+----------------+--------------------------------+-------- - 10 | 14 | catorce | | - 18 | 5 | cinco | | - 9 | 4 | cuatro | | - 26 | 19 | diecinueve | | - 12 | 18 | dieciocho | | - 30 | 16 | dieciseis | | - 24 | 17 | diecisiete | | - 2 | 10 | diez | | - 23 | 12 | doce | | - 11 | 2 | dos | | - 25 | 9 | nueve | | - 31 | 8 | ocho | | + 0 | 100 | in child table | | 1 | 11 | once | | - 28 | 15 | quince | | - 32 | 6 | seis | xyzzyxyzzyxyzzyxyzzyxyzzyxyzzy | 500000 - 29 | 7 | siete | | - 15 | 13 | trece | | - 22 | 30 | treinta | | - 17 | 32 | treinta y dos | | + 2 | 10 | diez | | 3 | 31 | treinta y uno | | + 4 | 22 | veintidos | | 5 | 3 | tres | | - 20 | 1 | uno | | 6 | 20 | veinte | | + 7 | 23 | veintitres | | + 8 | 21 | veintiuno | | + 9 | 4 | cuatro | | + 10 | 14 | catorce | | + 11 | 2 | dos | | + 12 | 18 | dieciocho | | + 13 | 27 | veintisiete | | 14 | 25 | veinticinco | | - 21 | 24 | veinticuatro | | - 4 | 22 | veintidos | | - 19 | 29 | veintinueve | | + 15 | 13 | trece | | 16 | 28 | veintiocho | | + 17 | 32 | treinta y dos | | + 18 | 5 | cinco | | + 19 | 29 | veintinueve | | + 20 | 1 | uno | | + 21 | 24 | veinticuatro | | + 22 | 30 | treinta | | + 23 | 12 | doce | | + 24 | 17 | diecisiete | | + 25 | 9 | nueve | | + 26 | 19 | diecinueve | | 27 | 26 | veintiseis | | - 13 | 27 | veintisiete | | - 7 | 23 | veintitres | | - 8 | 21 | veintiuno | | - 0 | 100 | in child table | | + 28 | 15 | quince | | + 29 | 7 | siete | | + 30 | 16 | dieciseis | | + 31 | 8 | ocho | | + 32 | 6 | seis | xyzzyxyzzyxyzzyxyzzyxyzzyxyzzy | 500000 (33 rows) -- Verify that foreign key link still works @@ -333,15 +333,16 @@ CLUSTER clstr_1_pkey ON clstr_1; CLUSTER clstr_2 USING clstr_2_pkey; SELECT * FROM clstr_1 UNION ALL SELECT * FROM clstr_2 UNION ALL - SELECT * FROM clstr_3; + SELECT * FROM clstr_3 + ORDER BY 1; a --- 1 - 2 + 1 1 2 2 - 1 + 2 (6 rows) -- revert to the original state @@ -360,15 +361,16 @@ SET SESSION AUTHORIZATION clstr_user; CLUSTER; SELECT * FROM clstr_1 UNION ALL SELECT * FROM clstr_2 UNION ALL - SELECT * FROM clstr_3; + SELECT * FROM clstr_3 + ORDER BY 1; a --- 1 + 1 + 1 2 2 - 1 2 - 1 (6 rows) -- cluster a single table using the indisclustered bit previously set @@ -376,7 +378,8 @@ DELETE FROM clstr_1; INSERT INTO clstr_1 VALUES (2); INSERT INTO clstr_1 VALUES (1); CLUSTER clstr_1; -SELECT * FROM clstr_1; +SELECT * FROM clstr_1 +ORDER BY 1; a --- 1 @@ -402,18 +405,18 @@ UPDATE clustertest SET key = 35 WHERE key = 40; UPDATE clustertest SET key = 60 WHERE key = 50; UPDATE clustertest SET key = 70 WHERE key = 60; UPDATE clustertest SET key = 80 WHERE key = 70; -SELECT * FROM clustertest; +SELECT * FROM clustertest ORDER BY 1; key ----- 20 30 - 100 35 80 + 100 (5 rows) CLUSTER clustertest_pkey ON clustertest; -SELECT * FROM clustertest; +SELECT * FROM clustertest ORDER BY 1; key ----- 20 @@ -424,7 +427,7 @@ SELECT * FROM clustertest; (5 rows) COMMIT; -SELECT * FROM clustertest; +SELECT * FROM clustertest ORDER BY 1; key ----- 20 diff --git a/src/test/regress/expected/combocid.out b/src/test/regress/expected/combocid.out index b63894c283..f234ff4801 100644 --- a/src/test/regress/expected/combocid.out +++ b/src/test/regress/expected/combocid.out @@ -16,7 +16,7 @@ INSERT INTO combocidtest SELECT 1 LIMIT 0; INSERT INTO combocidtest SELECT 1 LIMIT 0; INSERT INTO combocidtest VALUES (1); INSERT INTO combocidtest VALUES (2); -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,1) | 10 | 1 @@ -26,7 +26,7 @@ SELECT ctid,cmin,* FROM combocidtest; SAVEPOINT s1; UPDATE combocidtest SET foobar = foobar + 10; -- here we should see only updated tuples -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,3) | 12 | 11 @@ -35,7 +35,7 @@ SELECT ctid,cmin,* FROM combocidtest; ROLLBACK TO s1; -- now we should see old tuples, but with combo CIDs starting at 0 -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,1) | 0 | 1 @@ -54,7 +54,7 @@ SELECT ctid,cmin,* FROM combocidtest; -- Test combo cids with portals BEGIN; INSERT INTO combocidtest VALUES (333); -DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest; +DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; DELETE FROM combocidtest; FETCH ALL FROM c; ctid | cmin | foobar @@ -65,7 +65,7 @@ FETCH ALL FROM c; (3 rows) ROLLBACK; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,1) | 1 | 1 @@ -86,7 +86,7 @@ INSERT INTO combocidtest SELECT 1 LIMIT 0; INSERT INTO combocidtest SELECT 1 LIMIT 0; INSERT INTO combocidtest SELECT 1 LIMIT 0; INSERT INTO combocidtest VALUES (444); -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,1) | 1 | 1 @@ -104,7 +104,7 @@ SELECT ctid,cmin,* FROM combocidtest FOR UPDATE; (0,6) | 10 | 444 (3 rows) -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,1) | 1 | 1 @@ -114,7 +114,7 @@ SELECT ctid,cmin,* FROM combocidtest; -- but this does UPDATE combocidtest SET foobar = foobar + 10; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,7) | 12 | 11 @@ -123,7 +123,7 @@ SELECT ctid,cmin,* FROM combocidtest; (3 rows) ROLLBACK TO s1; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,1) | 12 | 1 @@ -132,7 +132,7 @@ SELECT ctid,cmin,* FROM combocidtest; (3 rows) COMMIT; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ctid | cmin | foobar -------+------+-------- (0,1) | 12 | 1 diff --git a/src/test/regress/expected/constraints.out b/src/test/regress/expected/constraints.out new file mode 100644 index 0000000000..d7a988ab93 --- /dev/null +++ b/src/test/regress/expected/constraints.out @@ -0,0 +1,377 @@ +-- +-- CONSTRAINTS +-- Constraints can be specified with: +-- - DEFAULT clause +-- - CHECK clauses +-- - PRIMARY KEY clauses +-- - UNIQUE clauses +-- +-- +-- DEFAULT syntax +-- +CREATE TABLE DEFAULT_TBL (i int DEFAULT 100, + x text DEFAULT 'vadim', f float8 DEFAULT 123.456); +INSERT INTO DEFAULT_TBL VALUES (1, 'thomas', 57.0613); +INSERT INTO DEFAULT_TBL VALUES (1, 'bruce'); +INSERT INTO DEFAULT_TBL (i, f) VALUES (2, 987.654); +INSERT INTO DEFAULT_TBL (x) VALUES ('marc'); +INSERT INTO DEFAULT_TBL VALUES (3, null, 1.0); +SELECT '' AS five, * FROM DEFAULT_TBL ORDER BY i,x,f; + five | i | x | f +------+-----+--------+--------- + | 1 | bruce | 123.456 + | 1 | thomas | 57.0613 + | 2 | vadim | 987.654 + | 3 | | 1 + | 100 | marc | 123.456 +(5 rows) + +CREATE SEQUENCE DEFAULT_SEQ; +CREATE TABLE DEFAULTEXPR_TBL (i1 int DEFAULT 100 + (200-199) * 2, + i2 int DEFAULT nextval('default_seq')); +INSERT INTO DEFAULTEXPR_TBL VALUES (-1, -2); +INSERT INTO DEFAULTEXPR_TBL (i1) VALUES (-3); +INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (-4); +INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (NULL); +SELECT '' AS four, * FROM DEFAULTEXPR_TBL ORDER BY i1,i2; + four | i1 | i2 +------+-----+---- + | -3 | 1 + | -1 | -2 + | 102 | -4 + | 102 | +(4 rows) + +-- syntax errors +-- test for extraneous comma +CREATE TABLE error_tbl (i int DEFAULT (100, )); +ERROR: syntax error at or near ")" +LINE 1: CREATE TABLE error_tbl (i int DEFAULT (100, )); + ^ +-- this will fail because gram.y uses b_expr not a_expr for defaults, +-- to avoid a shift/reduce conflict that arises from NOT NULL being +-- part of the column definition syntax: +CREATE TABLE error_tbl (b1 bool DEFAULT 1 IN (1, 2)); +ERROR: syntax error at or near "IN" +LINE 1: CREATE TABLE error_tbl (b1 bool DEFAULT 1 IN (1, 2)); + ^ +-- this should work, however: +CREATE TABLE error_tbl (b1 bool DEFAULT (1 IN (1, 2))); +DROP TABLE error_tbl; +-- +-- CHECK syntax +-- +CREATE TABLE CHECK_TBL (x int, + CONSTRAINT CHECK_CON CHECK (x > 3)); +INSERT INTO CHECK_TBL VALUES (5); +INSERT INTO CHECK_TBL VALUES (4); +INSERT INTO CHECK_TBL VALUES (3); +ERROR: new row for relation "check_tbl" violates check constraint "check_con" +INSERT INTO CHECK_TBL VALUES (2); +ERROR: new row for relation "check_tbl" violates check constraint "check_con" +INSERT INTO CHECK_TBL VALUES (6); +INSERT INTO CHECK_TBL VALUES (1); +ERROR: new row for relation "check_tbl" violates check constraint "check_con" +SELECT '' AS three, * FROM CHECK_TBL ORDER BY x; + three | x +-------+--- + | 4 + | 5 + | 6 +(3 rows) + +CREATE SEQUENCE CHECK_SEQ; +CREATE TABLE CHECK2_TBL (x int, y text, z int, + CONSTRAINT SEQUENCE_CON + CHECK (x > 3 and y <> 'check failed' and z < 8)); +INSERT INTO CHECK2_TBL VALUES (4, 'check ok', -2); +INSERT INTO CHECK2_TBL VALUES (1, 'x check failed', -2); +ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" +INSERT INTO CHECK2_TBL VALUES (5, 'z check failed', 10); +ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" +INSERT INTO CHECK2_TBL VALUES (0, 'check failed', -2); +ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" +INSERT INTO CHECK2_TBL VALUES (6, 'check failed', 11); +ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" +INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7); +SELECT '' AS two, * from CHECK2_TBL ORDER BY x,y,z; + two | x | y | z +-----+---+----------+---- + | 4 | check ok | -2 + | 7 | check ok | 7 +(2 rows) + +-- +-- Check constraints on INSERT +-- +CREATE SEQUENCE INSERT_SEQ; +CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'), + y TEXT DEFAULT '-NULL-', + z INT DEFAULT -1 * currval('insert_seq'), + CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8), + CHECK (x + z = 0)); +INSERT INTO INSERT_TBL(x,z) VALUES (2, -2); +ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" +SELECT '' AS zero, * FROM INSERT_TBL order by x,y,z; + zero | x | y | z +------+---+---+--- +(0 rows) + +SELECT 'one' AS one, nextval('insert_seq'); + one | nextval +-----+--------- + one | 1 +(1 row) + +INSERT INTO INSERT_TBL(y) VALUES ('Y'); +ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" +INSERT INTO INSERT_TBL(y) VALUES ('Y'); +INSERT INTO INSERT_TBL(x,z) VALUES (1, -2); +ERROR: new row for relation "insert_tbl" violates check constraint "insert_tbl_check" +INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7); +INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5); +ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" +INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7); +INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; + four | x | y | z +------+---+---------------+---- + | 3 | Y | -3 + | 4 | -!NULL- | -4 + | 7 | !check failed | -7 + | 7 | -NULL- | -7 +(4 rows) + +INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4); +ERROR: new row for relation "insert_tbl" violates check constraint "insert_tbl_check" +INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed'); +ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" +INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed'); +INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); +SELECT '' AS six, * FROM INSERT_TBL order by x,y,z; + six | x | y | z +-----+---+---------------+---- + | 3 | Y | -3 + | 4 | -!NULL- | -4 + | 5 | !check failed | -5 + | 6 | -!NULL- | -6 + | 7 | !check failed | -7 + | 7 | -NULL- | -7 +(6 rows) + +SELECT 'seven' AS one, nextval('insert_seq'); + one | nextval +-------+--------- + seven | 7 +(1 row) + +INSERT INTO INSERT_TBL(y) VALUES ('Y'); +ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" +SELECT 'eight' AS one, currval('insert_seq'); + one | currval +-------+--------- + eight | 8 +(1 row) + +-- According to SQL92, it is OK to insert a record that gives rise to NULL +-- constraint-condition results. Postgres used to reject this, but it +-- was wrong: +INSERT INTO INSERT_TBL VALUES (null, null, null); +SELECT '' AS nine, * FROM INSERT_TBL order by x,y,z; + nine | x | y | z +------+---+---------------+---- + | 3 | Y | -3 + | 4 | -!NULL- | -4 + | 5 | !check failed | -5 + | 6 | -!NULL- | -6 + | 7 | !check failed | -7 + | 7 | -NULL- | -7 + | | | +(7 rows) + +-- +-- Check inheritance of defaults and constraints +-- +CREATE TABLE INSERT_CHILD (cx INT default 42, + cy INT CHECK (cy > x)) + INHERITS (INSERT_TBL); +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11); +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6); +ERROR: new row for relation "insert_child" violates check constraint "insert_child_check" +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7); +ERROR: new row for relation "insert_child" violates check constraint "insert_tbl_check" +INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7); +ERROR: new row for relation "insert_child" violates check constraint "insert_con" +SELECT * FROM INSERT_CHILD order by 1,2,3; + x | y | z | cx | cy +---+--------+----+----+---- + 7 | -NULL- | -7 | 42 | 11 +(1 row) + +DROP TABLE INSERT_CHILD; +-- +-- Check constraints on INSERT INTO +-- +DELETE FROM INSERT_TBL; +ALTER SEQUENCE INSERT_SEQ RESTART WITH 4; +CREATE TABLE tmp (xd INT, yd TEXT, zd INT); +INSERT INTO tmp VALUES (null, 'Y', null); +INSERT INTO tmp VALUES (5, '!check failed', null); +INSERT INTO tmp VALUES (null, 'try again', null); +INSERT INTO INSERT_TBL(y) select yd from tmp; +SELECT '' AS three, * FROM INSERT_TBL order by x,y,z; + three | x | y | z +-------+---+---------------+---- + | 4 | Y | -4 + | 5 | !check failed | -5 + | 6 | try again | -6 +(3 rows) + +INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again'; +INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again'; +INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again'; +ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; + four | x | y | z +------+---+---------------+---- + | 4 | Y | -4 + | 5 | !check failed | -5 + | 6 | try again | -6 + | 7 | try again | -7 + | | try again | +(5 rows) + +DROP TABLE tmp; +-- +-- Check constraints on UPDATE +-- +UPDATE INSERT_TBL SET x = NULL WHERE x = 5; +UPDATE INSERT_TBL SET x = 6 WHERE x = 6; +UPDATE INSERT_TBL SET x = -z, z = -x; +UPDATE INSERT_TBL SET x = z, z = x; +ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" +SELECT * FROM INSERT_TBL order by x,y,z; + x | y | z +---+---------------+---- + 4 | Y | -4 + 5 | !check failed | + 6 | try again | -6 + 7 | try again | -7 + | try again | +(5 rows) + +-- DROP TABLE INSERT_TBL; +-- +-- Check constraints on COPY FROM +-- +CREATE TABLE COPY_TBL (x INT, y TEXT, z INT, + CONSTRAINT COPY_CON + CHECK (x > 3 AND y <> 'check failed' AND x < 7 )); +COPY COPY_TBL FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/constro.data'; +SELECT '' AS two, * FROM COPY_TBL order by x,y,z; + two | x | y | z +-----+---+---------------+--- + | 4 | !check failed | 5 + | 6 | OK | 4 +(2 rows) + +COPY COPY_TBL FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/constrf.data'; +ERROR: new row for relation "copy_tbl" violates check constraint "copy_con" +CONTEXT: COPY copy_tbl, line 2: "7 check failed 6" +SELECT * FROM COPY_TBL order by x,y,z; + x | y | z +---+---------------+--- + 4 | !check failed | 5 + 6 | OK | 4 +(2 rows) + +-- +-- Primary keys +-- +CREATE TABLE PRIMARY_TBL (i int PRIMARY KEY, t text); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "primary_tbl_pkey" for table "primary_tbl" +INSERT INTO PRIMARY_TBL VALUES (1, 'one'); +INSERT INTO PRIMARY_TBL VALUES (2, 'two'); +INSERT INTO PRIMARY_TBL VALUES (1, 'three'); +ERROR: duplicate key value violates unique constraint "primary_tbl_pkey" +INSERT INTO PRIMARY_TBL VALUES (4, 'three'); +INSERT INTO PRIMARY_TBL VALUES (5, 'one'); +INSERT INTO PRIMARY_TBL (t) VALUES ('six'); +ERROR: null value in column "i" violates not-null constraint +SELECT '' AS four, * FROM PRIMARY_TBL order by i,t; + four | i | t +------+---+------- + | 1 | one + | 2 | two + | 4 | three + | 5 | one +(4 rows) + +DROP TABLE PRIMARY_TBL; +CREATE TABLE PRIMARY_TBL (i int, t text, + PRIMARY KEY(i,t)); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "primary_tbl_pkey" for table "primary_tbl" +INSERT INTO PRIMARY_TBL VALUES (1, 'one'); +INSERT INTO PRIMARY_TBL VALUES (2, 'two'); +INSERT INTO PRIMARY_TBL VALUES (1, 'three'); +INSERT INTO PRIMARY_TBL VALUES (4, 'three'); +INSERT INTO PRIMARY_TBL VALUES (5, 'one'); +INSERT INTO PRIMARY_TBL (t) VALUES ('six'); +ERROR: null value in column "i" violates not-null constraint +SELECT '' AS three, * FROM PRIMARY_TBL order by i,t; + three | i | t +-------+---+------- + | 1 | one + | 1 | three + | 2 | two + | 4 | three + | 5 | one +(5 rows) + +DROP TABLE PRIMARY_TBL; +-- +-- Unique keys +-- +CREATE TABLE UNIQUE_TBL (i int UNIQUE, t text); +NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_key" for table "unique_tbl" +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +INSERT INTO UNIQUE_TBL VALUES (2, 'two'); +INSERT INTO UNIQUE_TBL VALUES (1, 'three'); +ERROR: duplicate key value violates unique constraint "unique_tbl_i_key" +INSERT INTO UNIQUE_TBL VALUES (4, 'four'); +INSERT INTO UNIQUE_TBL VALUES (5, 'one'); +INSERT INTO UNIQUE_TBL (t) VALUES ('six'); +INSERT INTO UNIQUE_TBL (t) VALUES ('seven'); +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; + five | i | t +------+---+------- + | 1 | one + | 2 | two + | 4 | four + | 5 | one + | | seven + | | six +(6 rows) + +DROP TABLE UNIQUE_TBL; +CREATE TABLE UNIQUE_TBL (i int, t text, + UNIQUE(i,t)); +NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_key" for table "unique_tbl" +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +INSERT INTO UNIQUE_TBL VALUES (2, 'two'); +INSERT INTO UNIQUE_TBL VALUES (1, 'three'); +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +ERROR: duplicate key value violates unique constraint "unique_tbl_i_key" +INSERT INTO UNIQUE_TBL VALUES (5, 'one'); +INSERT INTO UNIQUE_TBL (t) VALUES ('six'); +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; + five | i | t +------+---+------- + | 1 | one + | 1 | three + | 2 | two + | 5 | one + | | six +(5 rows) + +DROP TABLE UNIQUE_TBL; diff --git a/src/test/regress/expected/copy.out b/src/test/regress/expected/copy.out new file mode 100644 index 0000000000..96c639d72b --- /dev/null +++ b/src/test/regress/expected/copy.out @@ -0,0 +1,73 @@ +-- +-- COPY +-- +-- CLASS POPULATION +-- (any resemblance to real life is purely coincidental) +-- +COPY aggtest FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/agg.data'; +COPY onek FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/onek.data'; +COPY onek TO '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; +DELETE FROM onek; +COPY onek FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; +COPY tenk1 FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/tenk.data'; +COPY slow_emp4000 FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/rect.data'; +COPY person FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/person.data'; +COPY emp FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/emp.data'; +COPY student FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/student.data'; +COPY stud_emp FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/stud_emp.data'; +COPY road FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/streets.data'; +COPY real_city FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/real_city.data'; +COPY hash_i4_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; +COPY hash_name_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; +COPY hash_txt_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; +COPY hash_f8_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; +COPY test_tsvector FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/tsearch.data'; +-- the data in this file has a lot of duplicates in the index key +-- fields, leading to long bucket chains and lots of table expansion. +-- this is therefore a stress test of the bucket overflow code (unlike +-- the data in hash.data, which has unique index keys). +-- +-- COPY hash_ovfl_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hashovfl.data'; +COPY bt_i4_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/desc.data'; +COPY bt_name_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; +COPY bt_txt_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/desc.data'; +COPY bt_f8_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; +COPY array_op_test FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/array.data'; +COPY array_index_op_test FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/array.data'; +--- test copying in CSV mode with various styles +--- of embedded line ending characters +create temp table copytest ( + style text, + test text, + filler int); +insert into copytest values('DOS',E'abc\r\ndef',1); +insert into copytest values('Unix',E'abc\ndef',2); +insert into copytest values('Mac',E'abc\rdef',3); +insert into copytest values(E'esc\\ape',E'a\\r\\\r\\\n\\nb',4); +copy copytest to '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/copytest.csv' csv; +create temp table copytest2 (like copytest); +copy copytest2 from '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/copytest.csv' csv; +select * from copytest except select * from copytest2; + style | test | filler +-------+------+-------- +(0 rows) + +truncate copytest2; +--- same test but with an escape char different from quote char +copy copytest to '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/copytest.csv' csv quote '''' escape E'\\'; +copy copytest2 from '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/copytest.csv' csv quote '''' escape E'\\'; +select * from copytest except select * from copytest2; + style | test | filler +-------+------+-------- +(0 rows) + +-- test header line feature +create temp table copytest3 ( + c1 int, + "col with , comma" text, + "col with "" quote" int); +copy copytest3 from stdin csv header; +copy copytest3 to stdout csv header; +c1,"col with , comma","col with "" quote" +1,a,1 +2,b,2 diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index 7f374ac1a6..18293a9cb9 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -51,16 +51,14 @@ COPY x (b, c, d, e) from stdin with oids delimiter ',' null 'x'; COPY x from stdin WITH DELIMITER AS ';' NULL AS ''; COPY x from stdin WITH DELIMITER AS ':' NULL AS E'\\X'; -- check results of copy in -SELECT * FROM x; +SELECT * FROM x ORDER BY a, b; a | b | c | d | e -------+----+------------+--------+---------------------- - 9999 | | \N | NN | before trigger fired - 10000 | 21 | 31 | 41 | before trigger fired - 10001 | 22 | 32 | 42 | before trigger fired - 10002 | 23 | 33 | 43 | before trigger fired - 10003 | 24 | 34 | 44 | before trigger fired - 10004 | 25 | 35 | 45 | before trigger fired - 10005 | 26 | 36 | 46 | before trigger fired + 1 | 1 | stuff | test_1 | after trigger fired + 2 | 2 | stuff | test_2 | after trigger fired + 3 | 3 | stuff | test_3 | after trigger fired + 4 | 4 | stuff | test_4 | after trigger fired + 5 | 5 | stuff | test_5 | after trigger fired 6 | | 45 | 80 | before trigger fired 7 | | x | \x | before trigger fired 8 | | , | \, | before trigger fired @@ -74,11 +72,13 @@ SELECT * FROM x; 4006 | 6 | BackslashN | \N | before trigger fired 4007 | 7 | XX | XX | before trigger fired 4008 | 8 | Delimiter | : | before trigger fired - 1 | 1 | stuff | test_1 | after trigger fired - 2 | 2 | stuff | test_2 | after trigger fired - 3 | 3 | stuff | test_3 | after trigger fired - 4 | 4 | stuff | test_4 | after trigger fired - 5 | 5 | stuff | test_5 | after trigger fired + 9999 | | \N | NN | before trigger fired + 10000 | 21 | 31 | 41 | before trigger fired + 10001 | 22 | 32 | 42 | before trigger fired + 10002 | 23 | 33 | 43 | before trigger fired + 10003 | 24 | 34 | 44 | before trigger fired + 10004 | 25 | 35 | 45 | before trigger fired + 10005 | 26 | 36 | 46 | before trigger fired (25 rows) -- COPY w/ oids on a table w/o oids should fail diff --git a/src/test/regress/expected/create_cast.out b/src/test/regress/expected/create_cast.out index 67eaab2316..56cd86e00b 100644 --- a/src/test/regress/expected/create_cast.out +++ b/src/test/regress/expected/create_cast.out @@ -53,7 +53,7 @@ SELECT casttestfunc('foo'::text); -- Should work now SELECT 1234::int4::casttesttype; -- No cast yet, should fail ERROR: cannot cast type integer to casttesttype LINE 1: SELECT 1234::int4::casttesttype; - ^ + ^ CREATE CAST (int4 AS casttesttype) WITH INOUT; SELECT 1234::int4::casttesttype; -- Should work now casttesttype diff --git a/src/test/regress/expected/create_function_1.out b/src/test/regress/expected/create_function_1.out new file mode 100644 index 0000000000..e30788de54 --- /dev/null +++ b/src/test/regress/expected/create_function_1.out @@ -0,0 +1,82 @@ +-- +-- CREATE_FUNCTION_1 +-- +CREATE FUNCTION widget_in(cstring) + RETURNS widget + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; +NOTICE: type "widget" is not yet defined +DETAIL: Creating a shell type definition. +CREATE FUNCTION widget_out(widget) + RETURNS cstring + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; +NOTICE: argument type widget is only a shell +CREATE FUNCTION int44in(cstring) + RETURNS city_budget + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; +NOTICE: type "city_budget" is not yet defined +DETAIL: Creating a shell type definition. +CREATE FUNCTION int44out(city_budget) + RETURNS cstring + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; +NOTICE: argument type city_budget is only a shell +CREATE FUNCTION check_primary_key () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/refint.so' + LANGUAGE C; +CREATE FUNCTION check_foreign_key () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/refint.so' + LANGUAGE C; +CREATE FUNCTION autoinc () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/autoinc.so' + LANGUAGE C; +CREATE FUNCTION funny_dup17 () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; +CREATE FUNCTION ttdummy () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; +CREATE FUNCTION set_ttdummy (int4) + RETURNS int4 + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; +-- Things that shouldn't work: +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'SELECT ''not an integer'';'; +ERROR: return type mismatch in function declared to return integer +DETAIL: Actual return type is unknown. +CONTEXT: SQL function "test1" +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'not even SQL'; +ERROR: syntax error at or near "not" +LINE 2: AS 'not even SQL'; + ^ +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'SELECT 1, 2, 3;'; +ERROR: return type mismatch in function declared to return integer +DETAIL: Final statement must return exactly one column. +CONTEXT: SQL function "test1" +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'SELECT $2;'; +ERROR: there is no parameter $2 +LINE 2: AS 'SELECT $2;'; + ^ +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'a', 'b'; +ERROR: only one AS item needed for language "sql" +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C + AS 'nosuchfile'; +ERROR: could not access file "nosuchfile": No such file or directory +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so', 'nosuchsymbol'; +ERROR: could not find function "nosuchsymbol" in file "/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so" +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal + AS 'nosuch'; +ERROR: there is no built-in function named "nosuch" diff --git a/src/test/regress/expected/create_function_2.out b/src/test/regress/expected/create_function_2.out new file mode 100644 index 0000000000..a9031f1b30 --- /dev/null +++ b/src/test/regress/expected/create_function_2.out @@ -0,0 +1,57 @@ +-- +-- CREATE_FUNCTION_2 +-- +CREATE FUNCTION hobbies(person) + RETURNS setof hobbies_r + AS 'select * from hobbies_r where person = $1.name' + LANGUAGE SQL; +CREATE FUNCTION hobby_construct(text, text) + RETURNS hobbies_r + AS 'select $1 as name, $2 as hobby' + LANGUAGE SQL; +CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE) + RETURNS hobbies_r.person%TYPE + AS 'select person from hobbies_r where name = $1' + LANGUAGE SQL; +NOTICE: type reference hobbies_r.name%TYPE converted to text +NOTICE: type reference hobbies_r.person%TYPE converted to text +CREATE FUNCTION equipment(hobbies_r) + RETURNS setof equipment_r + AS 'select * from equipment_r where hobby = $1.name' + LANGUAGE SQL; +CREATE FUNCTION user_relns() + RETURNS setof name + AS 'select relname + from pg_class c, pg_namespace n + where relnamespace = n.oid and + (nspname !~ ''pg_.*'' and nspname <> ''information_schema'') and + relkind <> ''i'' ' + LANGUAGE SQL; +CREATE FUNCTION pt_in_widget(point, widget) + RETURNS bool + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; +CREATE FUNCTION overpaid(emp) + RETURNS bool + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; +CREATE FUNCTION boxarea(box) + RETURNS float8 + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; +CREATE FUNCTION interpt_pp(path, path) + RETURNS point + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; +CREATE FUNCTION reverse_name(name) + RETURNS name + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; +CREATE FUNCTION oldstyle_length(int4, text) + RETURNS int4 + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; +-- +-- Function dynamic loading +-- +LOAD '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so'; diff --git a/src/test/regress/expected/create_view.out b/src/test/regress/expected/create_view.out index 04383e43d2..38dc832c60 100644 --- a/src/test/regress/expected/create_view.out +++ b/src/test/regress/expected/create_view.out @@ -29,7 +29,7 @@ CREATE OR REPLACE VIEW viewtest AS SELECT * FROM viewtest_tbl; CREATE OR REPLACE VIEW viewtest AS SELECT * FROM viewtest_tbl WHERE a > 10; -SELECT * FROM viewtest; +SELECT * FROM viewtest ORDER BY a; a | b ----+---- 15 | 20 @@ -38,12 +38,12 @@ SELECT * FROM viewtest; CREATE OR REPLACE VIEW viewtest AS SELECT a, b FROM viewtest_tbl WHERE a > 5 ORDER BY b DESC; -SELECT * FROM viewtest; +SELECT * FROM viewtest ORDER BY a; a | b ----+---- - 20 | 25 - 15 | 20 10 | 15 + 15 | 20 + 20 | 25 (3 rows) -- should fail diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out index b603745077..4451150fed 100644 --- a/src/test/regress/expected/date.out +++ b/src/test/regress/expected/date.out @@ -21,7 +21,7 @@ INSERT INTO DATE_TBL VALUES ('2000-04-03'); INSERT INTO DATE_TBL VALUES ('2038-04-08'); INSERT INTO DATE_TBL VALUES ('2039-04-09'); INSERT INTO DATE_TBL VALUES ('2040-04-10'); -SELECT f1 AS "Fifteen" FROM DATE_TBL; +SELECT f1 AS "Fifteen" FROM DATE_TBL ORDER BY f1; Fifteen ------------ 04-09-1957 @@ -41,7 +41,7 @@ SELECT f1 AS "Fifteen" FROM DATE_TBL; 04-10-2040 (15 rows) -SELECT f1 AS "Nine" FROM DATE_TBL WHERE f1 < '2000-01-01'; +SELECT f1 AS "Nine" FROM DATE_TBL WHERE f1 < '2000-01-01' ORDER BY f1; Nine ------------ 04-09-1957 @@ -56,7 +56,7 @@ SELECT f1 AS "Nine" FROM DATE_TBL WHERE f1 < '2000-01-01'; (9 rows) SELECT f1 AS "Three" FROM DATE_TBL - WHERE f1 BETWEEN '2000-01-01' AND '2001-01-01'; + WHERE f1 BETWEEN '2000-01-01' AND '2001-01-01' ORDER BY f1; Three ------------ 04-01-2000 @@ -821,7 +821,7 @@ RESET datestyle; -- Simple math -- Leave most of it for the horology tests -- -SELECT f1 - date '2000-01-01' AS "Days From 2K" FROM DATE_TBL; +SELECT f1 - date '2000-01-01' AS "Days From 2K" FROM DATE_TBL ORDER BY f1; Days From 2K -------------- -15607 @@ -841,7 +841,7 @@ SELECT f1 - date '2000-01-01' AS "Days From 2K" FROM DATE_TBL; 14710 (15 rows) -SELECT f1 - date 'epoch' AS "Days From Epoch" FROM DATE_TBL; +SELECT f1 - date 'epoch' AS "Days From Epoch" FROM DATE_TBL ORDER BY f1; Days From Epoch ----------------- -4650 diff --git a/src/test/regress/expected/delete.out b/src/test/regress/expected/delete.out index 7fc028cfed..2bf6d5bcaa 100644 --- a/src/test/regress/expected/delete.out +++ b/src/test/regress/expected/delete.out @@ -19,7 +19,7 @@ LINE 1: DELETE FROM delete_test dt WHERE delete_test.a > 25; ^ HINT: Perhaps you meant to reference the table alias "dt". ROLLBACK; -SELECT * FROM delete_test; +SELECT * FROM delete_test ORDER BY id; id | a ----+---- 1 | 10 diff --git a/src/test/regress/expected/domain.out b/src/test/regress/expected/domain.out index fd88b16cce..ec0813cc9c 100644 --- a/src/test/regress/expected/domain.out +++ b/src/test/regress/expected/domain.out @@ -51,7 +51,7 @@ COPY basictest (testvarchar) FROM stdin; -- fail ERROR: value too long for type character varying(5) CONTEXT: COPY basictest, line 1, column testvarchar: "notsoshorttext" COPY basictest (testvarchar) FROM stdin; -select * from basictest; +select * from basictest order by 1, 2, 3, 4; testint4 | testtext | testvarchar | testnumeric ----------+----------+-------------+------------- 88 | haha | short | 123.12 @@ -107,23 +107,23 @@ INSERT INTO domarrtest values ('{2,2}', '{{"a"},{"c"}}'); INSERT INTO domarrtest values (NULL, '{{"a","b","c"},{"d","e","f"}}'); INSERT INTO domarrtest values (NULL, '{{"toolong","b","c"},{"d","e","f"}}'); ERROR: value too long for type character varying(4) -select * from domarrtest; +select * from domarrtest order by 1, 2; testint4arr | testchar4arr ---------------+--------------------- {2,2} | {{a,b},{c,d}} - {{2,2},{2,2}} | {{a,b}} {2,2} | {{a,b},{c,d},{e,f}} {2,2} | {{a},{c}} + {{2,2},{2,2}} | {{a,b}} | {{a,b,c},{d,e,f}} (5 rows) -select testint4arr[1], testchar4arr[2:2] from domarrtest; +select testint4arr[1], testchar4arr[2:2] from domarrtest order by 1, 2; testint4arr | testchar4arr -------------+-------------- + 2 | {{c}} 2 | {{c,d}} - | {} 2 | {{c,d}} - 2 | {{c}} + | {} | {{d,e,f}} (5 rows) @@ -131,15 +131,15 @@ COPY domarrtest FROM stdin; COPY domarrtest FROM stdin; -- fail ERROR: value too long for type character varying(4) CONTEXT: COPY domarrtest, line 1, column testchar4arr: "{qwerty,w,e}" -select * from domarrtest; +select * from domarrtest order by 1, 2; testint4arr | testchar4arr ---------------+--------------------- {2,2} | {{a,b},{c,d}} - {{2,2},{2,2}} | {{a,b}} {2,2} | {{a,b},{c,d},{e,f}} {2,2} | {{a},{c}} - | {{a,b,c},{d,e,f}} + {{2,2},{2,2}} | {{a,b}} {3,4} | {q,w,e} + | {{a,b,c},{d,e,f}} | (7 rows) @@ -181,7 +181,7 @@ CONTEXT: COPY nulltest, line 1, column col5: null input COPY nulltest FROM stdin; ERROR: new row for relation "nulltest" violates check constraint "nulltest_col5_check" CONTEXT: COPY nulltest, line 3: "a b c \N a" -select * from nulltest; +select * from nulltest order by 1, 2, 3, 4, 5; col1 | col2 | col3 | col4 | col5 ------+------+------+------+------ a | b | c | d | c @@ -237,7 +237,7 @@ insert into defaulttest default values; insert into defaulttest default values; -- Test defaults with copy COPY defaulttest(col5) FROM stdin; -select * from defaulttest; +select * from defaulttest order by 1,2,3,4,5,6,7,8; col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 ------+------+------+------+------+------+------+------- 3 | 12 | 5 | 1 | 3 | 88 | 8000 | 12.12 @@ -280,7 +280,7 @@ select * from domdeftest; alter domain ddef1 set default '42'; insert into domdeftest default values; -select * from domdeftest; +select * from domdeftest order by 1; col1 ------ 3 @@ -322,33 +322,33 @@ create domain dom as integer; create view domview as select cast(col1 as dom) from domtab; insert into domtab (col1) values (null); insert into domtab (col1) values (5); -select * from domview; +select * from domview order by 1; col1 ------ - 5 + (2 rows) alter domain dom set not null; select * from domview; -- fail ERROR: domain dom does not allow null values alter domain dom drop not null; -select * from domview; +select * from domview order by 1; col1 ------ - 5 + (2 rows) alter domain dom add constraint domchkgt6 check(value > 6); select * from domview; --fail ERROR: value for domain dom violates check constraint "domchkgt6" alter domain dom drop constraint domchkgt6 restrict; -select * from domview; +select * from domview order by 1; col1 ------ - 5 + (2 rows) -- cleanup diff --git a/src/test/regress/expected/enum.out b/src/test/regress/expected/enum.out index 56240c0e7a..38234c0024 100644 --- a/src/test/regress/expected/enum.out +++ b/src/test/regress/expected/enum.out @@ -30,7 +30,7 @@ LINE 1: SELECT 'mauve'::rainbow; CREATE TABLE enumtest (col rainbow); INSERT INTO enumtest values ('red'), ('orange'), ('yellow'), ('green'); COPY enumtest FROM stdin; -SELECT * FROM enumtest; +SELECT * FROM enumtest ORDER BY col; col -------- red diff --git a/src/test/regress/expected/float4.out b/src/test/regress/expected/float4.out index 2c19e7eb08..e4d0b3df34 100644 --- a/src/test/regress/expected/float4.out +++ b/src/test/regress/expected/float4.out @@ -119,23 +119,23 @@ SELECT 'nan'::float4 / 'nan'::float4; NaN (1 row) -SELECT '' AS five, * FROM FLOAT4_TBL; +SELECT '' AS five, * FROM FLOAT4_TBL ORDER BY f1; five | f1 ------+------------- + | -34.84 | 0 + | 1.23457e-20 | 1004.3 - | -34.84 | 1.23457e+20 - | 1.23457e-20 (5 rows) -SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <> '1004.3'; +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <> '1004.3' ORDER BY f1; four | f1 ------+------------- - | 0 | -34.84 - | 1.23457e+20 + | 0 | 1.23457e-20 + | 1.23457e+20 (4 rows) SELECT '' AS one, f.* FROM FLOAT4_TBL f WHERE f.f1 = '1004.3'; @@ -144,110 +144,110 @@ SELECT '' AS one, f.* FROM FLOAT4_TBL f WHERE f.f1 = '1004.3'; | 1004.3 (1 row) -SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE '1004.3' > f.f1; +SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE '1004.3' > f.f1 ORDER BY f1; three | f1 -------+------------- - | 0 | -34.84 + | 0 | 1.23457e-20 (3 rows) -SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE f.f1 < '1004.3'; +SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE f.f1 < '1004.3' ORDER BY f1; three | f1 -------+------------- - | 0 | -34.84 + | 0 | 1.23457e-20 (3 rows) -SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE '1004.3' >= f.f1; +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE '1004.3' >= f.f1 ORDER BY f1; four | f1 ------+------------- - | 0 - | 1004.3 | -34.84 + | 0 | 1.23457e-20 + | 1004.3 (4 rows) -SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <= '1004.3'; +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <= '1004.3' ORDER BY f1; four | f1 ------+------------- - | 0 - | 1004.3 | -34.84 + | 0 | 1.23457e-20 + | 1004.3 (4 rows) SELECT '' AS three, f.f1, f.f1 * '-10' AS x FROM FLOAT4_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | x -------+-------------+-------------- + | 1.23457e-20 | -1.23457e-19 | 1004.3 | -10043 | 1.23457e+20 | -1.23457e+21 - | 1.23457e-20 | -1.23457e-19 (3 rows) SELECT '' AS three, f.f1, f.f1 + '-10' AS x FROM FLOAT4_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | x -------+-------------+------------- + | 1.23457e-20 | -10 | 1004.3 | 994.3 | 1.23457e+20 | 1.23457e+20 - | 1.23457e-20 | -10 (3 rows) SELECT '' AS three, f.f1, f.f1 / '-10' AS x FROM FLOAT4_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | x -------+-------------+-------------- + | 1.23457e-20 | -1.23457e-21 | 1004.3 | -100.43 | 1.23457e+20 | -1.23457e+19 - | 1.23457e-20 | -1.23457e-21 (3 rows) SELECT '' AS three, f.f1, f.f1 - '-10' AS x FROM FLOAT4_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | x -------+-------------+------------- + | 1.23457e-20 | 10 | 1004.3 | 1014.3 | 1.23457e+20 | 1.23457e+20 - | 1.23457e-20 | 10 (3 rows) -- test divide by zero SELECT '' AS bad, f.f1 / '0.0' from FLOAT4_TBL f; ERROR: division by zero -SELECT '' AS five, * FROM FLOAT4_TBL; +SELECT '' AS five, * FROM FLOAT4_TBL ORDER BY f1; five | f1 ------+------------- + | -34.84 | 0 + | 1.23457e-20 | 1004.3 - | -34.84 | 1.23457e+20 - | 1.23457e-20 (5 rows) -- test the unary float4abs operator -SELECT '' AS five, f.f1, @f.f1 AS abs_f1 FROM FLOAT4_TBL f; +SELECT '' AS five, f.f1, @f.f1 AS abs_f1 FROM FLOAT4_TBL f ORDER BY f1; five | f1 | abs_f1 ------+-------------+------------- + | -34.84 | 34.84 | 0 | 0 + | 1.23457e-20 | 1.23457e-20 | 1004.3 | 1004.3 - | -34.84 | 34.84 | 1.23457e+20 | 1.23457e+20 - | 1.23457e-20 | 1.23457e-20 (5 rows) UPDATE FLOAT4_TBL SET f1 = FLOAT4_TBL.f1 * '-1' WHERE FLOAT4_TBL.f1 > '0.0'; -SELECT '' AS five, * FROM FLOAT4_TBL; +SELECT '' AS five, * FROM FLOAT4_TBL ORDER BY f1; five | f1 ------+-------------- - | 0 - | -34.84 - | -1004.3 | -1.23457e+20 + | -1004.3 + | -34.84 | -1.23457e-20 + | 0 (5 rows) diff --git a/src/test/regress/expected/float8.out b/src/test/regress/expected/float8.out index e9e71bb7aa..b748ce87bd 100644 --- a/src/test/regress/expected/float8.out +++ b/src/test/regress/expected/float8.out @@ -119,23 +119,23 @@ SELECT 'nan'::float8 / 'nan'::float8; NaN (1 row) -SELECT '' AS five, * FROM FLOAT8_TBL; +SELECT '' AS five, * FROM FLOAT8_TBL ORDER BY f1; five | f1 ------+---------------------- + | -34.84 | 0 + | 1.2345678901234e-200 | 1004.3 - | -34.84 | 1.2345678901234e+200 - | 1.2345678901234e-200 (5 rows) -SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <> '1004.3'; +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <> '1004.3' ORDER BY f1; four | f1 ------+---------------------- - | 0 | -34.84 - | 1.2345678901234e+200 + | 0 | 1.2345678901234e-200 + | 1.2345678901234e+200 (4 rows) SELECT '' AS one, f.* FROM FLOAT8_TBL f WHERE f.f1 = '1004.3'; @@ -144,78 +144,78 @@ SELECT '' AS one, f.* FROM FLOAT8_TBL f WHERE f.f1 = '1004.3'; | 1004.3 (1 row) -SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1; +SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1 ORDER BY f1; three | f1 -------+---------------------- - | 0 | -34.84 + | 0 | 1.2345678901234e-200 (3 rows) -SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE f.f1 < '1004.3'; +SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE f.f1 < '1004.3' ORDER BY f1; three | f1 -------+---------------------- - | 0 | -34.84 + | 0 | 1.2345678901234e-200 (3 rows) -SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE '1004.3' >= f.f1; +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE '1004.3' >= f.f1 ORDER BY f1; four | f1 ------+---------------------- - | 0 - | 1004.3 | -34.84 + | 0 | 1.2345678901234e-200 + | 1004.3 (4 rows) -SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <= '1004.3'; +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <= '1004.3' ORDER BY f1; four | f1 ------+---------------------- - | 0 - | 1004.3 | -34.84 + | 0 | 1.2345678901234e-200 + | 1004.3 (4 rows) SELECT '' AS three, f.f1, f.f1 * '-10' AS x FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | x -------+----------------------+----------------------- + | 1.2345678901234e-200 | -1.2345678901234e-199 | 1004.3 | -10043 | 1.2345678901234e+200 | -1.2345678901234e+201 - | 1.2345678901234e-200 | -1.2345678901234e-199 (3 rows) SELECT '' AS three, f.f1, f.f1 + '-10' AS x FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | x -------+----------------------+---------------------- + | 1.2345678901234e-200 | -10 | 1004.3 | 994.3 | 1.2345678901234e+200 | 1.2345678901234e+200 - | 1.2345678901234e-200 | -10 (3 rows) SELECT '' AS three, f.f1, f.f1 / '-10' AS x FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | x -------+----------------------+----------------------- + | 1.2345678901234e-200 | -1.2345678901234e-201 | 1004.3 | -100.43 | 1.2345678901234e+200 | -1.2345678901234e+199 - | 1.2345678901234e-200 | -1.2345678901234e-201 (3 rows) SELECT '' AS three, f.f1, f.f1 - '-10' AS x FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | x -------+----------------------+---------------------- + | 1.2345678901234e-200 | 10 | 1004.3 | 1014.3 | 1.2345678901234e+200 | 1.2345678901234e+200 - | 1.2345678901234e-200 | 10 (3 rows) SELECT '' AS one, f.f1 ^ '2.0' AS square_f1 @@ -227,79 +227,79 @@ SELECT '' AS one, f.f1 ^ '2.0' AS square_f1 -- absolute value SELECT '' AS five, f.f1, @f.f1 AS abs_f1 - FROM FLOAT8_TBL f; + FROM FLOAT8_TBL f ORDER BY f1; five | f1 | abs_f1 ------+----------------------+---------------------- + | -34.84 | 34.84 | 0 | 0 + | 1.2345678901234e-200 | 1.2345678901234e-200 | 1004.3 | 1004.3 - | -34.84 | 34.84 | 1.2345678901234e+200 | 1.2345678901234e+200 - | 1.2345678901234e-200 | 1.2345678901234e-200 (5 rows) -- truncate SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1 - FROM FLOAT8_TBL f; + FROM FLOAT8_TBL f ORDER BY f1; five | f1 | trunc_f1 ------+----------------------+---------------------- + | -34.84 | -34 | 0 | 0 + | 1.2345678901234e-200 | 0 | 1004.3 | 1004 - | -34.84 | -34 | 1.2345678901234e+200 | 1.2345678901234e+200 - | 1.2345678901234e-200 | 0 (5 rows) -- round SELECT '' AS five, f.f1, round(f.f1) AS round_f1 - FROM FLOAT8_TBL f; + FROM FLOAT8_TBL f ORDER BY f1; five | f1 | round_f1 ------+----------------------+---------------------- + | -34.84 | -35 | 0 | 0 + | 1.2345678901234e-200 | 0 | 1004.3 | 1004 - | -34.84 | -35 | 1.2345678901234e+200 | 1.2345678901234e+200 - | 1.2345678901234e-200 | 0 (5 rows) -- ceil / ceiling -select ceil(f1) as ceil_f1 from float8_tbl f; +select ceil(f1) as ceil_f1 from float8_tbl f ORDER BY f1; ceil_f1 ---------------------- + -34 0 + 1 1005 - -34 1.2345678901234e+200 - 1 (5 rows) -select ceiling(f1) as ceiling_f1 from float8_tbl f; +select ceiling(f1) as ceiling_f1 from float8_tbl f ORDER BY f1; ceiling_f1 ---------------------- + -34 0 + 1 1005 - -34 1.2345678901234e+200 - 1 (5 rows) -- floor -select floor(f1) as floor_f1 from float8_tbl f; +select floor(f1) as floor_f1 from float8_tbl f ORDER BY f1; floor_f1 ---------------------- + -35 + 0 0 1004 - -35 1.2345678901234e+200 - 0 (5 rows) -- sign -select sign(f1) as sign_f1 from float8_tbl f; +select sign(f1) as sign_f1 from float8_tbl f ORDER BY f1; sign_f1 --------- + -1 0 1 - -1 1 1 (5 rows) @@ -319,12 +319,12 @@ SELECT |/ float8 '64' AS eight; SELECT '' AS three, f.f1, |/f.f1 AS sqrt_f1 FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | sqrt_f1 -------+----------------------+----------------------- + | 1.2345678901234e-200 | 1.11111110611109e-100 | 1004.3 | 31.6906926399535 | 1.2345678901234e+200 | 1.11111110611109e+100 - | 1.2345678901234e-200 | 1.11111110611109e-100 (3 rows) -- power @@ -337,12 +337,12 @@ SELECT power(float8 '144', float8 '0.5'); -- take exp of ln(f.f1) SELECT '' AS three, f.f1, exp(ln(f.f1)) AS exp_ln_f1 FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; three | f1 | exp_ln_f1 -------+----------------------+----------------------- + | 1.2345678901234e-200 | 1.23456789012339e-200 | 1004.3 | 1004.3 | 1.2345678901234e+200 | 1.23456789012338e+200 - | 1.2345678901234e-200 | 1.23456789012339e-200 (3 rows) -- cube root @@ -352,32 +352,33 @@ SELECT ||/ float8 '27' AS three; 3 (1 row) -SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f; +SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f ORDER BY f1; five | f1 | cbrt_f1 ------+----------------------+---------------------- + | -34.84 | -3.26607421344208 | 0 | 0 + | 1.2345678901234e-200 | 2.3112042409018e-67 | 1004.3 | 10.014312837827 - | -34.84 | -3.26607421344208 | 1.2345678901234e+200 | 4.97933859234765e+66 - | 1.2345678901234e-200 | 2.3112042409018e-67 (5 rows) -SELECT '' AS five, * FROM FLOAT8_TBL; +SELECT '' AS five, * FROM FLOAT8_TBL ORDER BY f1; five | f1 ------+---------------------- + | -34.84 | 0 + | 1.2345678901234e-200 | 1004.3 - | -34.84 | 1.2345678901234e+200 - | 1.2345678901234e-200 (5 rows) UPDATE FLOAT8_TBL SET f1 = FLOAT8_TBL.f1 * '-1' WHERE FLOAT8_TBL.f1 > '0.0'; -SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f; + +SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f ORDER BY f1; ERROR: value out of range: overflow -SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f; +SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f ORDER BY f1; ERROR: value out of range: overflow SELECT 0 ^ 0 + 0 ^ 1 + 0 ^ 0.0 + 0 ^ 0.5; ?column? @@ -387,20 +388,20 @@ SELECT 0 ^ 0 + 0 ^ 1 + 0 ^ 0.0 + 0 ^ 0.5; SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ; ERROR: cannot take logarithm of zero -SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ; +SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0'; ERROR: cannot take logarithm of a negative number -SELECT '' AS bad, exp(f.f1) from FLOAT8_TBL f; +SELECT '' AS bad, exp(f.f1) from FLOAT8_TBL f ORDER BY f1; ERROR: value out of range: underflow SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f; ERROR: division by zero -SELECT '' AS five, * FROM FLOAT8_TBL; +SELECT '' AS five, * FROM FLOAT8_TBL ORDER BY f1; five | f1 ------+----------------------- - | 0 - | -34.84 - | -1004.3 | -1.2345678901234e+200 + | -1004.3 + | -34.84 | -1.2345678901234e-200 + | 0 (5 rows) -- test for over- and underflow @@ -428,13 +429,13 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-1004.30'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e+200'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e-200'); -SELECT '' AS five, * FROM FLOAT8_TBL; +SELECT '' AS five, * FROM FLOAT8_TBL ORDER BY f1; five | f1 ------+----------------------- - | 0 - | -34.84 - | -1004.3 | -1.2345678901234e+200 + | -1004.3 + | -34.84 | -1.2345678901234e-200 + | 0 (5 rows) diff --git a/src/test/regress/expected/foreign_key.out b/src/test/regress/expected/foreign_key.out index c805322b6d..900386cbcf 100644 --- a/src/test/regress/expected/foreign_key.out +++ b/src/test/regress/expected/foreign_key.out @@ -24,7 +24,7 @@ INSERT INTO FKTABLE VALUES (100, 2); ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_ftest1_fkey" DETAIL: Key (ftest1)=(100) is not present in table "pktable". -- Check FKTABLE -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2; ftest1 | ftest2 --------+-------- 1 | 2 @@ -36,7 +36,7 @@ SELECT * FROM FKTABLE; -- Delete a row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=1; -- Check FKTABLE for removal of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2; ftest1 | ftest2 --------+-------- 2 | 3 @@ -47,12 +47,12 @@ SELECT * FROM FKTABLE; -- Update a row from PK TABLE UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; -- Check FKTABLE for update of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2; ftest1 | ftest2 --------+-------- + 1 | 3 3 | 4 | 1 - 1 | 3 (3 rows) DROP TABLE FKTABLE; @@ -96,7 +96,7 @@ INSERT INTO FKTABLE VALUES (1, NULL, 4); ERROR: insert or update on table "fktable" violates foreign key constraint "constrname" DETAIL: MATCH FULL does not allow mixing of null and nonnull key values. -- Check FKTABLE -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- 1 | 2 | 4 @@ -109,7 +109,7 @@ SELECT * FROM FKTABLE; -- Delete a row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=1 and ptest2=2; -- Check FKTABLE for removal of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- 1 | 3 | 5 @@ -122,7 +122,7 @@ SELECT * FROM FKTABLE; -- Delete another row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=5 and ptest2=10; -- Check FKTABLE (should be no change) -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- 1 | 3 | 5 @@ -135,7 +135,7 @@ SELECT * FROM FKTABLE; -- Update a row from PK TABLE UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; -- Check FKTABLE for update of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- 1 | 3 | 5 @@ -148,16 +148,16 @@ SELECT * FROM FKTABLE; -- Try altering the column type where foreign keys are involved ALTER TABLE PKTABLE ALTER COLUMN ptest1 TYPE bigint; ALTER TABLE FKTABLE ALTER COLUMN ftest1 TYPE bigint; -SELECT * FROM PKTABLE; +SELECT * FROM PKTABLE ORDER BY 1, 2, 3; ptest1 | ptest2 | ptest3 --------+--------+--------- 1 | 3 | Test1-2 + 1 | 4 | Test2 3 | 6 | Test3 4 | 8 | Test4 - 1 | 4 | Test2 (4 rows) -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- 1 | 3 | 5 @@ -206,7 +206,7 @@ INSERT INTO FKTABLE VALUES (1, NULL, 4); ERROR: insert or update on table "fktable" violates foreign key constraint "constrname2" DETAIL: MATCH FULL does not allow mixing of null and nonnull key values. -- Check FKTABLE -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- 1 | 2 | 4 @@ -219,40 +219,40 @@ SELECT * FROM FKTABLE; -- Delete a row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=1 and ptest2=2; -- Check FKTABLE to check for removal -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- + -1 | -2 | 4 1 | 3 | 5 2 | 4 | 8 3 | 6 | 12 | | 0 - -1 | -2 | 4 (5 rows) -- Delete another row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=5 and ptest2=10; -- Check FKTABLE (should be no change) -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- + -1 | -2 | 4 1 | 3 | 5 2 | 4 | 8 3 | 6 | 12 | | 0 - -1 | -2 | 4 (5 rows) -- Update a row from PK TABLE UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; -- Check FKTABLE for update of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; ftest1 | ftest2 | ftest3 --------+--------+-------- + -1 | -2 | 4 + -1 | -2 | 8 1 | 3 | 5 3 | 6 | 12 | | 0 - -1 | -2 | 4 - -1 | -2 | 8 (5 rows) -- this should fail for lack of CASCADE @@ -285,7 +285,7 @@ INSERT INTO FKTABLE VALUES (100, 2); ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_ftest1_fkey" DETAIL: Key (ftest1)=(100) is not present in table "pktable". -- Check FKTABLE -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2; ftest1 | ftest2 --------+-------- 1 | 2 @@ -295,7 +295,7 @@ SELECT * FROM FKTABLE; (4 rows) -- Check PKTABLE -SELECT * FROM PKTABLE; +SELECT * FROM PKTABLE ORDER BY 1, 2; ptest1 | ptest2 --------+-------- 1 | Test1 @@ -312,7 +312,7 @@ DETAIL: Key (ptest1)=(1) is still referenced from table "fktable". -- Delete a row from PK TABLE (should succeed) DELETE FROM PKTABLE WHERE ptest1=5; -- Check PKTABLE for deletes -SELECT * FROM PKTABLE; +SELECT * FROM PKTABLE ORDER BY 1, 2; ptest1 | ptest2 --------+-------- 1 | Test1 @@ -328,13 +328,13 @@ DETAIL: Key (ptest1)=(2) is still referenced from table "fktable". -- Update a row from PK TABLE (should succeed) UPDATE PKTABLE SET ptest1=0 WHERE ptest1=4; -- Check PKTABLE for updates -SELECT * FROM PKTABLE; +SELECT * FROM PKTABLE ORDER BY 1, 2; ptest1 | ptest2 --------+-------- + 0 | Test4 1 | Test1 2 | Test2 3 | Test3 - 0 | Test4 (4 rows) DROP TABLE FKTABLE; @@ -361,12 +361,12 @@ INSERT INTO FKTABLE VALUES (1, 2, 7, 6); ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3" DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in table "pktable". -- Show FKTABLE -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- 1 | 2 | 3 | 1 - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 (5 rows) @@ -384,7 +384,7 @@ DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from table "fkta -- Try to delete something that should work DELETE FROM PKTABLE where ptest1=2; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- 1 | 2 | 3 | test1 @@ -392,12 +392,12 @@ SELECT * from PKTABLE; 1 | 3 | 4 | test3 (3 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- 1 | 2 | 3 | 1 - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 (5 rows) @@ -426,12 +426,12 @@ INSERT INTO FKTABLE VALUES (1, 2, 7, 6); ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3" DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in table "pktable". -- Show FKTABLE -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- 1 | 2 | 3 | 1 - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 (5 rows) @@ -441,41 +441,41 @@ UPDATE PKTABLE set ptest2=5 where ptest2=2; -- Try to update something that should not cascade UPDATE PKTABLE set ptest1=1 WHERE ptest2=3; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- - 2 | 4 | 5 | test4 - 1 | 5 | 3 | test1 1 | 3 | 3 | test2 1 | 3 | 4 | test3 + 1 | 5 | 3 | test1 + 2 | 4 | 5 | test4 (4 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- - | 2 | 3 | 2 + 1 | 5 | 3 | 1 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 - 1 | 5 | 3 | 1 (5 rows) -- Try to delete something that should cascade DELETE FROM PKTABLE where ptest1=1 and ptest2=5 and ptest3=3; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- - 2 | 4 | 5 | test4 1 | 3 | 3 | test2 1 | 3 | 4 | test3 + 2 | 4 | 5 | test4 (3 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 (4 rows) @@ -483,18 +483,18 @@ SELECT * from FKTABLE; -- Try to delete something that should not have a cascade DELETE FROM PKTABLE where ptest1=2; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- 1 | 3 | 3 | test2 1 | 3 | 4 | test3 (2 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 (4 rows) @@ -524,13 +524,13 @@ INSERT INTO FKTABLE VALUES (1, 2, 7, 6); ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3" DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in table "pktable". -- Show FKTABLE -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- 1 | 2 | 3 | 1 2 | 3 | 4 | 1 - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 (6 rows) @@ -540,67 +540,67 @@ UPDATE PKTABLE set ptest2=5 where ptest2=2; -- Try to update something that should not set null UPDATE PKTABLE set ptest2=2 WHERE ptest2=3 and ptest1=1; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- + 1 | 2 | 3 | test2 + 1 | 5 | 3 | test1 2 | 3 | 4 | test3 2 | 4 | 5 | test4 - 1 | 5 | 3 | test1 - 1 | 2 | 3 | test2 (4 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- + 1 | | 3 | 1 2 | 3 | 4 | 1 - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 - 1 | | 3 | 1 (6 rows) -- Try to delete something that should set default DELETE FROM PKTABLE where ptest1=2 and ptest2=3 and ptest3=4; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- - 2 | 4 | 5 | test4 - 1 | 5 | 3 | test1 1 | 2 | 3 | test2 + 1 | 5 | 3 | test1 + 2 | 4 | 5 | test4 (3 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- - | 2 | 3 | 2 + 0 | | | 1 + 1 | | 3 | 1 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 - 1 | | 3 | 1 - 0 | | | 1 (6 rows) -- Try to delete something that should not set default DELETE FROM PKTABLE where ptest2=5; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- - 2 | 4 | 5 | test4 1 | 2 | 3 | test2 + 2 | 4 | 5 | test4 (2 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- - | 2 | 3 | 2 + 0 | | | 1 + 1 | | 3 | 1 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 - 1 | | 3 | 1 - 0 | | | 1 (6 rows) DROP TABLE FKTABLE; @@ -630,14 +630,14 @@ INSERT INTO FKTABLE VALUES (1, 2, 7, 6); ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3" DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in table "pktable". -- Show FKTABLE -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- 1 | 2 | 3 | 1 2 | 3 | 4 | 1 2 | 4 | 5 | 1 - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 (7 rows) @@ -652,72 +652,72 @@ UPDATE PKTABLE set ptest2=10 where ptest2=4; -- Try to update something that should not set default UPDATE PKTABLE set ptest2=2 WHERE ptest2=3 and ptest1=1; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- - 2 | 3 | 4 | test3 - 2 | -1 | 5 | test5 0 | 5 | 10 | test1 - 2 | 10 | 5 | test4 1 | 2 | 3 | test2 + 2 | -1 | 5 | test5 + 2 | 3 | 4 | test3 + 2 | 10 | 5 | test4 (5 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- + 0 | -1 | | 1 + 2 | -1 | 5 | 1 2 | 3 | 4 | 1 - | 2 | 3 | 2 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 - 0 | -1 | | 1 - 2 | -1 | 5 | 1 (7 rows) -- Try to delete something that should set null DELETE FROM PKTABLE where ptest1=2 and ptest2=3 and ptest3=4; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- - 2 | -1 | 5 | test5 0 | 5 | 10 | test1 - 2 | 10 | 5 | test4 1 | 2 | 3 | test2 + 2 | -1 | 5 | test5 + 2 | 10 | 5 | test4 (4 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- - | 2 | 3 | 2 + 0 | -1 | | 1 + 2 | -1 | 5 | 1 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 - 0 | -1 | | 1 - 2 | -1 | 5 | 1 | | | 1 (7 rows) -- Try to delete something that should not set null DELETE FROM PKTABLE where ptest2=5; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; ptest1 | ptest2 | ptest3 | ptest4 --------+--------+--------+-------- + 1 | 2 | 3 | test2 2 | -1 | 5 | test5 2 | 10 | 5 | test4 - 1 | 2 | 3 | test2 (3 rows) -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; ftest1 | ftest2 | ftest3 | ftest4 --------+--------+--------+-------- - | 2 | 3 | 2 + 0 | -1 | | 1 + 2 | -1 | 5 | 1 2 | | 3 | 3 + | 2 | 3 | 2 | 2 | 7 | 4 | 3 | 4 | 5 - 0 | -1 | | 1 - 2 | -1 | 5 | 1 | | | 1 (7 rows) @@ -1240,7 +1240,7 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tasks_pkey" for INSERT INTO tasks VALUES (1,1,NULL,NULL); INSERT INTO tasks VALUES (2,2,2,NULL); INSERT INTO tasks VALUES (3,3,3,3); -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; id | owner | worker | checked_by ----+-------+--------+------------ 1 | 1 | | @@ -1249,7 +1249,7 @@ SELECT * FROM tasks; (3 rows) UPDATE users SET id = 4 WHERE id = 3; -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; id | owner | worker | checked_by ----+-------+--------+------------ 1 | 1 | | @@ -1258,7 +1258,7 @@ SELECT * FROM tasks; (3 rows) DELETE FROM users WHERE id = 4; -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; id | owner | worker | checked_by ----+-------+--------+------------ 1 | 1 | | @@ -1269,21 +1269,21 @@ SELECT * FROM tasks; -- could fail with only 2 changes to make, if row was already updated BEGIN; UPDATE tasks set id=id WHERE id=2; -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; id | owner | worker | checked_by ----+-------+--------+------------ 1 | 1 | | - 3 | | | 2 | 2 | 2 | + 3 | | | (3 rows) DELETE FROM users WHERE id = 2; -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; id | owner | worker | checked_by ----+-------+--------+------------ 1 | 1 | | - 3 | | | 2 | | | + 3 | | | (3 rows) COMMIT; diff --git a/src/test/regress/expected/geometry.out b/src/test/regress/expected/geometry.out index 6910e54ec6..966c73921b 100644 --- a/src/test/regress/expected/geometry.out +++ b/src/test/regress/expected/geometry.out @@ -8,7 +8,7 @@ SET extra_float_digits TO -3; -- Points -- SELECT '' AS four, center(f1) AS center - FROM BOX_TBL; + FROM BOX_TBL ORDER BY (center(f1))[0], (center(f1))[1]; four | center ------+--------- | (1,1) @@ -18,7 +18,7 @@ SELECT '' AS four, center(f1) AS center (4 rows) SELECT '' AS four, (@@ f1) AS center - FROM BOX_TBL; + FROM BOX_TBL ORDER BY (center(f1))[0], (center(f1))[1]; four | center ------+--------- | (1,1) @@ -28,32 +28,32 @@ SELECT '' AS four, (@@ f1) AS center (4 rows) SELECT '' AS six, point(f1) AS center - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[1], radius(f1); six | center -----+----------- - | (5,1) | (1,2) - | (1,3) | (1,2) - | (100,200) + | (1,3) + | (5,1) | (100,1) + | (100,200) (6 rows) SELECT '' AS six, (@@ f1) AS center - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[1], radius(f1); six | center -----+----------- - | (5,1) | (1,2) - | (1,3) | (1,2) - | (100,200) + | (1,3) + | (5,1) | (100,1) + | (100,200) (6 rows) SELECT '' AS two, (@@ f1) AS center FROM POLYGON_TBL - WHERE (# f1) > 2; + WHERE (# f1) > 2 ORDER BY ID; two | center -----+------------------------------- | (1.33333333333,1.33333333333) @@ -63,27 +63,27 @@ SELECT '' AS two, (@@ f1) AS center -- "is horizontal" function SELECT '' AS two, p1.f1 FROM POINT_TBL p1 - WHERE ishorizontal(p1.f1, point '(0,0)'); + WHERE ishorizontal(p1.f1, point '(0,0)') ORDER BY f1[0], f1[1]; two | f1 -----+--------- - | (0,0) | (-10,0) + | (0,0) (2 rows) -- "is horizontal" operator SELECT '' AS two, p1.f1 FROM POINT_TBL p1 - WHERE p1.f1 ?- point '(0,0)'; + WHERE p1.f1 ?- point '(0,0)' ORDER BY f1[0], f1[1]; two | f1 -----+--------- - | (0,0) | (-10,0) + | (0,0) (2 rows) -- "is vertical" function SELECT '' AS one, p1.f1 FROM POINT_TBL p1 - WHERE isvertical(p1.f1, point '(5.1,34.5)'); + WHERE isvertical(p1.f1, point '(5.1,34.5)') ORDER BY f1[0], f1[1]; one | f1 -----+------------ | (5.1,34.5) @@ -92,7 +92,7 @@ SELECT '' AS one, p1.f1 -- "is vertical" operator SELECT '' AS one, p1.f1 FROM POINT_TBL p1 - WHERE p1.f1 ?| point '(5.1,34.5)'; + WHERE p1.f1 ?| point '(5.1,34.5)' ORDER BY f1[0], f1[1]; one | f1 -----+------------ | (5.1,34.5) @@ -103,45 +103,45 @@ SELECT '' AS one, p1.f1 -- -- intersection SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection - FROM LSEG_TBL l, POINT_TBL p; + FROM LSEG_TBL l, POINT_TBL p ORDER BY (l.s[0])[0], (l.s[0])[1], p.f1[0], p.f1[1]; ERROR: operator does not exist: lseg # point LINE 1: SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. -- closest point SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest - FROM LSEG_TBL l, POINT_TBL p; + FROM LSEG_TBL l, POINT_TBL p ORDER BY (l.s[0])[0], (l.s[0])[1], p.f1[0], p.f1[1]; thirty | f1 | s | closest --------+------------+-------------------------------+---------------------------------- - | (0,0) | [(1,2),(3,4)] | (1,2) - | (0,0) | [(0,0),(6,6)] | (-0,0) - | (0,0) | [(10,-10),(-3,-4)] | (-2.0487804878,-4.43902439024) + | (-10,0) | [(-1000000,200),(300000,-40)] | (-9.99715942258,15.386461014) + | (-5,-12) | [(-1000000,200),(300000,-40)] | (-4.99494420846,15.3855375282) + | (-3,4) | [(-1000000,200),(300000,-40)] | (-2.99789812268,15.3851688427) | (0,0) | [(-1000000,200),(300000,-40)] | (0.00284023658959,15.3846148603) - | (0,0) | [(11,22),(33,44)] | (11,22) - | (-10,0) | [(1,2),(3,4)] | (1,2) + | (5.1,34.5) | [(-1000000,200),(300000,-40)] | (5.09647083221,15.3836744977) + | (10,10) | [(-1000000,200),(300000,-40)] | (10.000993742,15.3827690473) | (-10,0) | [(0,0),(6,6)] | (0,0) - | (-10,0) | [(10,-10),(-3,-4)] | (-3,-4) - | (-10,0) | [(-1000000,200),(300000,-40)] | (-9.99715942258,15.386461014) - | (-10,0) | [(11,22),(33,44)] | (11,22) - | (-3,4) | [(1,2),(3,4)] | (1,2) + | (-5,-12) | [(0,0),(6,6)] | (0,0) | (-3,4) | [(0,0),(6,6)] | (0.5,0.5) - | (-3,4) | [(10,-10),(-3,-4)] | (-3,-4) - | (-3,4) | [(-1000000,200),(300000,-40)] | (-2.99789812268,15.3851688427) - | (-3,4) | [(11,22),(33,44)] | (11,22) - | (5.1,34.5) | [(1,2),(3,4)] | (3,4) + | (0,0) | [(0,0),(6,6)] | (-0,0) | (5.1,34.5) | [(0,0),(6,6)] | (6,6) - | (5.1,34.5) | [(10,-10),(-3,-4)] | (-3,-4) - | (5.1,34.5) | [(-1000000,200),(300000,-40)] | (5.09647083221,15.3836744977) - | (5.1,34.5) | [(11,22),(33,44)] | (14.3,25.3) + | (10,10) | [(0,0),(6,6)] | (6,6) + | (-10,0) | [(1,2),(3,4)] | (1,2) | (-5,-12) | [(1,2),(3,4)] | (1,2) - | (-5,-12) | [(0,0),(6,6)] | (0,0) - | (-5,-12) | [(10,-10),(-3,-4)] | (-1.60487804878,-4.64390243902) - | (-5,-12) | [(-1000000,200),(300000,-40)] | (-4.99494420846,15.3855375282) - | (-5,-12) | [(11,22),(33,44)] | (11,22) + | (-3,4) | [(1,2),(3,4)] | (1,2) + | (0,0) | [(1,2),(3,4)] | (1,2) + | (5.1,34.5) | [(1,2),(3,4)] | (3,4) | (10,10) | [(1,2),(3,4)] | (3,4) - | (10,10) | [(0,0),(6,6)] | (6,6) + | (-10,0) | [(10,-10),(-3,-4)] | (-3,-4) + | (-5,-12) | [(10,-10),(-3,-4)] | (-1.60487804878,-4.64390243902) + | (-3,4) | [(10,-10),(-3,-4)] | (-3,-4) + | (0,0) | [(10,-10),(-3,-4)] | (-2.0487804878,-4.43902439024) + | (5.1,34.5) | [(10,-10),(-3,-4)] | (-3,-4) | (10,10) | [(10,-10),(-3,-4)] | (2.39024390244,-6.48780487805) - | (10,10) | [(-1000000,200),(300000,-40)] | (10.000993742,15.3827690473) + | (-10,0) | [(11,22),(33,44)] | (11,22) + | (-5,-12) | [(11,22),(33,44)] | (11,22) + | (-3,4) | [(11,22),(33,44)] | (11,22) + | (0,0) | [(11,22),(33,44)] | (11,22) + | (5.1,34.5) | [(11,22),(33,44)] | (14.3,25.3) | (10,10) | [(11,22),(33,44)] | (11,22) (30 rows) @@ -151,140 +151,140 @@ SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest -- -- Boxes -- -SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL; +SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); six | box -----+---------------------------------------------------------------- - | (7.12132034356,3.12132034356),(2.87867965644,-1.12132034356) - | (71.7106781187,72.7106781187),(-69.7106781187,-68.7106781187) - | (4.53553390593,6.53553390593),(-2.53553390593,-0.535533905933) | (3.12132034356,4.12132034356),(-1.12132034356,-0.12132034356) + | (4.53553390593,6.53553390593),(-2.53553390593,-0.535533905933) + | (71.7106781187,72.7106781187),(-69.7106781187,-68.7106781187) + | (7.12132034356,3.12132034356),(2.87867965644,-1.12132034356) | (107.071067812,207.071067812),(92.9289321881,192.928932188) | (181.317279836,82.3172798365),(18.6827201635,-80.3172798365) (6 rows) -- translation SELECT '' AS twentyfour, b.f1 + p.f1 AS translation - FROM BOX_TBL b, POINT_TBL p; + FROM BOX_TBL b, POINT_TBL p ORDER BY (center(b.f1))[0], (center(b.f1))[1], p.f1[0], p.f1[1]; twentyfour | translation ------------+------------------------- - | (2,2),(0,0) - | (3,3),(1,1) - | (2.5,3.5),(2.5,2.5) - | (3,3),(3,3) | (-8,2),(-10,0) - | (-7,3),(-9,1) - | (-7.5,3.5),(-7.5,2.5) - | (-7,3),(-7,3) + | (-3,-10),(-5,-12) | (-1,6),(-3,4) - | (0,7),(-2,5) - | (-0.5,7.5),(-0.5,6.5) - | (0,7),(0,7) + | (2,2),(0,0) | (7.1,36.5),(5.1,34.5) - | (8.1,37.5),(6.1,35.5) - | (7.6,38),(7.6,37) - | (8.1,37.5),(8.1,37.5) - | (-3,-10),(-5,-12) - | (-2,-9),(-4,-11) - | (-2.5,-8.5),(-2.5,-9.5) - | (-2,-9),(-2,-9) | (12,12),(10,10) + | (-7,3),(-9,1) + | (-2,-9),(-4,-11) + | (0,7),(-2,5) + | (3,3),(1,1) + | (8.1,37.5),(6.1,35.5) | (13,13),(11,11) + | (-7.5,3.5),(-7.5,2.5) + | (-2.5,-8.5),(-2.5,-9.5) + | (-0.5,7.5),(-0.5,6.5) + | (2.5,3.5),(2.5,2.5) + | (7.6,38),(7.6,37) | (12.5,13.5),(12.5,12.5) + | (-7,3),(-7,3) + | (-2,-9),(-2,-9) + | (0,7),(0,7) + | (3,3),(3,3) + | (8.1,37.5),(8.1,37.5) | (13,13),(13,13) (24 rows) SELECT '' AS twentyfour, b.f1 - p.f1 AS translation - FROM BOX_TBL b, POINT_TBL p; + FROM BOX_TBL b, POINT_TBL p ORDER BY (center(b.f1))[0], (center(b.f1))[1], p.f1[0], p.f1[1]; twentyfour | translation ------------+--------------------------- - | (2,2),(0,0) - | (3,3),(1,1) - | (2.5,3.5),(2.5,2.5) - | (3,3),(3,3) | (12,2),(10,0) - | (13,3),(11,1) - | (12.5,3.5),(12.5,2.5) - | (13,3),(13,3) + | (7,14),(5,12) | (5,-2),(3,-4) - | (6,-1),(4,-3) - | (5.5,-0.5),(5.5,-1.5) - | (6,-1),(6,-1) + | (2,2),(0,0) | (-3.1,-32.5),(-5.1,-34.5) - | (-2.1,-31.5),(-4.1,-33.5) - | (-2.6,-31),(-2.6,-32) - | (-2.1,-31.5),(-2.1,-31.5) - | (7,14),(5,12) - | (8,15),(6,13) - | (7.5,15.5),(7.5,14.5) - | (8,15),(8,15) | (-8,-8),(-10,-10) + | (13,3),(11,1) + | (8,15),(6,13) + | (6,-1),(4,-3) + | (3,3),(1,1) + | (-2.1,-31.5),(-4.1,-33.5) | (-7,-7),(-9,-9) + | (12.5,3.5),(12.5,2.5) + | (7.5,15.5),(7.5,14.5) + | (5.5,-0.5),(5.5,-1.5) + | (2.5,3.5),(2.5,2.5) + | (-2.6,-31),(-2.6,-32) | (-7.5,-6.5),(-7.5,-7.5) + | (13,3),(13,3) + | (8,15),(8,15) + | (6,-1),(6,-1) + | (3,3),(3,3) + | (-2.1,-31.5),(-2.1,-31.5) | (-7,-7),(-7,-7) (24 rows) -- scaling and rotation SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation - FROM BOX_TBL b, POINT_TBL p; + FROM BOX_TBL b, POINT_TBL p ORDER BY (center(b.f1))[0], (center(b.f1))[1], p.f1[0], p.f1[1]; twentyfour | rotation ------------+----------------------------- - | (0,0),(0,0) - | (0,0),(0,0) - | (0,0),(0,0) - | (0,0),(0,0) | (-0,0),(-20,-20) - | (-10,-10),(-30,-30) - | (-25,-25),(-25,-35) - | (-30,-30),(-30,-30) + | (14,-0),(0,-34) | (-0,2),(-14,0) - | (-7,3),(-21,1) - | (-17.5,2.5),(-21.5,-0.5) - | (-21,3),(-21,3) + | (0,0),(0,0) | (0,79.2),(-58.8,0) - | (-29.4,118.8),(-88.2,39.6) - | (-73.5,104.1),(-108,99) - | (-88.2,118.8),(-88.2,118.8) - | (14,-0),(0,-34) - | (21,-17),(7,-51) - | (29.5,-42.5),(17.5,-47.5) - | (21,-51),(21,-51) | (0,40),(0,0) + | (-10,-10),(-30,-30) + | (21,-17),(7,-51) + | (-7,3),(-21,1) + | (0,0),(0,0) + | (-29.4,118.8),(-88.2,39.6) | (0,60),(0,20) + | (-25,-25),(-25,-35) + | (29.5,-42.5),(17.5,-47.5) + | (-17.5,2.5),(-21.5,-0.5) + | (0,0),(0,0) + | (-73.5,104.1),(-108,99) | (0,60),(-10,50) + | (-30,-30),(-30,-30) + | (21,-51),(21,-51) + | (-21,3),(-21,3) + | (0,0),(0,0) + | (-88.2,118.8),(-88.2,118.8) | (0,60),(0,60) (24 rows) SELECT '' AS twenty, b.f1 / p.f1 AS rotation FROM BOX_TBL b, POINT_TBL p - WHERE (p.f1 <-> point '(0,0)') >= 1; + WHERE (p.f1 <-> point '(0,0)') >= 1 ORDER BY (center(b.f1))[0], (center(b.f1))[1], p.f1[0], p.f1[1]; twenty | rotation --------+---------------------------------------------------------------------- | (0,-0),(-0.2,-0.2) - | (-0.1,-0.1),(-0.3,-0.3) - | (-0.25,-0.25),(-0.25,-0.35) - | (-0.3,-0.3),(-0.3,-0.3) + | (-0,0.0828402366864),(-0.201183431953,0) | (0.08,-0),(0,-0.56) - | (0.12,-0.28),(0.04,-0.84) - | (0.26,-0.7),(0.1,-0.82) - | (0.12,-0.84),(0.12,-0.84) | (0.0651176557644,0),(0,-0.0483449262493) - | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374) - | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117) - | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374) - | (-0,0.0828402366864),(-0.201183431953,0) - | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432) - | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414) - | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503) | (0.2,0),(0,0) + | (-0.1,-0.1),(-0.3,-0.3) + | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432) + | (0.12,-0.28),(0.04,-0.84) + | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374) | (0.3,0),(0.1,0) + | (-0.25,-0.25),(-0.25,-0.35) + | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414) + | (0.26,-0.7),(0.1,-0.82) + | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117) | (0.3,0.05),(0.25,0) + | (-0.3,-0.3),(-0.3,-0.3) + | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503) + | (0.12,-0.84),(0.12,-0.84) + | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374) | (0.3,0),(0.3,0) (20 rows) -- -- Paths -- -SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL; +SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL ORDER BY ID; eight | npoints | path -------+---------+--------------------------- | 2 | [(1,2),(3,4)] @@ -297,7 +297,7 @@ SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL; | 2 | ((11,12),(13,14)) (8 rows) -SELECT '' AS four, path(f1) FROM POLYGON_TBL; +SELECT '' AS four, path(f1) FROM POLYGON_TBL ORDER BY ID; four | path ------+--------------------- | ((2,0),(2,4),(0,0)) @@ -308,7 +308,7 @@ SELECT '' AS four, path(f1) FROM POLYGON_TBL; -- translation SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add - FROM PATH_TBL p1; + FROM PATH_TBL p1 ORDER BY ID; eight | dist_add -------+----------------------------------- | [(11,12),(13,14)] @@ -323,7 +323,7 @@ SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add -- scaling and rotation SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul - FROM PATH_TBL p1; + FROM PATH_TBL p1 ORDER BY ID; eight | dist_mul -------+------------------------------ | [(4,3),(10,5)] @@ -341,67 +341,67 @@ SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul -- -- containment SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 @> p.f1 AS contains - FROM POLYGON_TBL poly, POINT_TBL p; + FROM POLYGON_TBL poly, POINT_TBL p ORDER BY poly.ID, p.f1[0], p.f1[1]; twentyfour | f1 | f1 | contains ------------+------------+---------------------+---------- - | (0,0) | ((2,0),(2,4),(0,0)) | t - | (0,0) | ((3,1),(3,3),(1,0)) | f - | (0,0) | ((0,0)) | t - | (0,0) | ((0,1),(0,1)) | f | (-10,0) | ((2,0),(2,4),(0,0)) | f - | (-10,0) | ((3,1),(3,3),(1,0)) | f - | (-10,0) | ((0,0)) | f - | (-10,0) | ((0,1),(0,1)) | f + | (-5,-12) | ((2,0),(2,4),(0,0)) | f | (-3,4) | ((2,0),(2,4),(0,0)) | f - | (-3,4) | ((3,1),(3,3),(1,0)) | f - | (-3,4) | ((0,0)) | f - | (-3,4) | ((0,1),(0,1)) | f + | (0,0) | ((2,0),(2,4),(0,0)) | t | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f - | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f - | (5.1,34.5) | ((0,0)) | f - | (5.1,34.5) | ((0,1),(0,1)) | f - | (-5,-12) | ((2,0),(2,4),(0,0)) | f - | (-5,-12) | ((3,1),(3,3),(1,0)) | f - | (-5,-12) | ((0,0)) | f - | (-5,-12) | ((0,1),(0,1)) | f | (10,10) | ((2,0),(2,4),(0,0)) | f + | (-10,0) | ((3,1),(3,3),(1,0)) | f + | (-5,-12) | ((3,1),(3,3),(1,0)) | f + | (-3,4) | ((3,1),(3,3),(1,0)) | f + | (0,0) | ((3,1),(3,3),(1,0)) | f + | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f | (10,10) | ((3,1),(3,3),(1,0)) | f + | (-10,0) | ((0,0)) | f + | (-5,-12) | ((0,0)) | f + | (-3,4) | ((0,0)) | f + | (0,0) | ((0,0)) | t + | (5.1,34.5) | ((0,0)) | f | (10,10) | ((0,0)) | f + | (-10,0) | ((0,1),(0,1)) | f + | (-5,-12) | ((0,1),(0,1)) | f + | (-3,4) | ((0,1),(0,1)) | f + | (0,0) | ((0,1),(0,1)) | f + | (5.1,34.5) | ((0,1),(0,1)) | f | (10,10) | ((0,1),(0,1)) | f (24 rows) SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 <@ poly.f1 AS contained - FROM POLYGON_TBL poly, POINT_TBL p; + FROM POLYGON_TBL poly, POINT_TBL p ORDER BY poly.ID, p.f1[0], p.f1[1]; twentyfour | f1 | f1 | contained ------------+------------+---------------------+----------- - | (0,0) | ((2,0),(2,4),(0,0)) | t - | (0,0) | ((3,1),(3,3),(1,0)) | f - | (0,0) | ((0,0)) | t - | (0,0) | ((0,1),(0,1)) | f | (-10,0) | ((2,0),(2,4),(0,0)) | f - | (-10,0) | ((3,1),(3,3),(1,0)) | f - | (-10,0) | ((0,0)) | f - | (-10,0) | ((0,1),(0,1)) | f + | (-5,-12) | ((2,0),(2,4),(0,0)) | f | (-3,4) | ((2,0),(2,4),(0,0)) | f - | (-3,4) | ((3,1),(3,3),(1,0)) | f - | (-3,4) | ((0,0)) | f - | (-3,4) | ((0,1),(0,1)) | f + | (0,0) | ((2,0),(2,4),(0,0)) | t | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f - | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f - | (5.1,34.5) | ((0,0)) | f - | (5.1,34.5) | ((0,1),(0,1)) | f - | (-5,-12) | ((2,0),(2,4),(0,0)) | f - | (-5,-12) | ((3,1),(3,3),(1,0)) | f - | (-5,-12) | ((0,0)) | f - | (-5,-12) | ((0,1),(0,1)) | f | (10,10) | ((2,0),(2,4),(0,0)) | f + | (-10,0) | ((3,1),(3,3),(1,0)) | f + | (-5,-12) | ((3,1),(3,3),(1,0)) | f + | (-3,4) | ((3,1),(3,3),(1,0)) | f + | (0,0) | ((3,1),(3,3),(1,0)) | f + | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f | (10,10) | ((3,1),(3,3),(1,0)) | f + | (-10,0) | ((0,0)) | f + | (-5,-12) | ((0,0)) | f + | (-3,4) | ((0,0)) | f + | (0,0) | ((0,0)) | t + | (5.1,34.5) | ((0,0)) | f | (10,10) | ((0,0)) | f + | (-10,0) | ((0,1),(0,1)) | f + | (-5,-12) | ((0,1),(0,1)) | f + | (-3,4) | ((0,1),(0,1)) | f + | (0,0) | ((0,1),(0,1)) | f + | (5.1,34.5) | ((0,1),(0,1)) | f | (10,10) | ((0,1),(0,1)) | f (24 rows) SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon - FROM POLYGON_TBL; + FROM POLYGON_TBL ORDER BY ID; four | npoints | polygon ------+---------+--------------------- | 3 | ((2,0),(2,4),(0,0)) @@ -411,7 +411,7 @@ SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon (4 rows) SELECT '' AS four, polygon(f1) - FROM BOX_TBL; + FROM BOX_TBL ORDER BY (center(f1))[0], (center(f1))[1]; four | polygon ------+------------------------------------------- | ((0,0),(0,2),(2,2),(2,0)) @@ -421,7 +421,7 @@ SELECT '' AS four, polygon(f1) (4 rows) SELECT '' AS four, polygon(f1) - FROM PATH_TBL WHERE isclosed(f1); + FROM PATH_TBL WHERE isclosed(f1) ORDER BY ID; four | polygon ------+------------------- | ((1,2),(3,4)) @@ -432,7 +432,7 @@ SELECT '' AS four, polygon(f1) SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon FROM PATH_TBL - WHERE isopen(f1); + WHERE isopen(f1) ORDER BY ID; four | open_path | polygon ------+---------------------------+--------------------------- | [(1,2),(3,4)] | ((1,2),(3,4)) @@ -443,47 +443,47 @@ SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon -- convert circles to polygons using the default number of points SELECT '' AS six, polygon(f1) - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[1], radius(f1); six | polygon -----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - | ((2,1),(2.40192378865,2.5),(3.5,3.59807621135),(5,4),(6.5,3.59807621135),(7.59807621135,2.5),(8,1),(7.59807621135,-0.5),(6.5,-1.59807621135),(5,-2),(3.5,-1.59807621135),(2.40192378865,-0.5)) + | ((-2,2),(-1.59807621135,3.5),(-0.5,4.59807621135),(1,5),(2.5,4.59807621135),(3.59807621135,3.5),(4,2),(3.59807621135,0.5),(2.5,-0.598076211353),(1,-1),(-0.5,-0.598076211353),(-1.59807621135,0.5)) | ((-99,2),(-85.6025403784,52),(-49,88.6025403784),(1,102),(51,88.6025403784),(87.6025403784,52),(101,2),(87.6025403784,-48),(51,-84.6025403784),(1,-98),(-49,-84.6025403784),(-85.6025403784,-48)) | ((-4,3),(-3.33012701892,5.5),(-1.5,7.33012701892),(1,8),(3.5,7.33012701892),(5.33012701892,5.5),(6,3),(5.33012701892,0.5),(3.5,-1.33012701892),(1,-2),(-1.5,-1.33012701892),(-3.33012701892,0.5)) - | ((-2,2),(-1.59807621135,3.5),(-0.5,4.59807621135),(1,5),(2.5,4.59807621135),(3.59807621135,3.5),(4,2),(3.59807621135,0.5),(2.5,-0.598076211353),(1,-1),(-0.5,-0.598076211353),(-1.59807621135,0.5)) - | ((90,200),(91.3397459622,205),(95,208.660254038),(100,210),(105,208.660254038),(108.660254038,205),(110,200),(108.660254038,195),(105,191.339745962),(100,190),(95,191.339745962),(91.3397459622,195)) + | ((2,1),(2.40192378865,2.5),(3.5,3.59807621135),(5,4),(6.5,3.59807621135),(7.59807621135,2.5),(8,1),(7.59807621135,-0.5),(6.5,-1.59807621135),(5,-2),(3.5,-1.59807621135),(2.40192378865,-0.5)) | ((-15,1),(0.40707856479,58.5),(42.5,100.592921435),(100,116),(157.5,100.592921435),(199.592921435,58.5),(215,1),(199.592921435,-56.5),(157.5,-98.5929214352),(100,-114),(42.5,-98.5929214352),(0.40707856479,-56.5)) + | ((90,200),(91.3397459622,205),(95,208.660254038),(100,210),(105,208.660254038),(108.660254038,205),(110,200),(108.660254038,195),(105,191.339745962),(100,190),(95,191.339745962),(91.3397459622,195)) (6 rows) -- convert the circle to an 8-point polygon SELECT '' AS six, polygon(8, f1) - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[1], radius(f1); six | polygon -----+------------------------------------------------------------------------------------------------------------------------------------------------------------------ - | ((2,1),(2.87867965644,3.12132034356),(5,4),(7.12132034356,3.12132034356),(8,1),(7.12132034356,-1.12132034356),(5,-2),(2.87867965644,-1.12132034356)) + | ((-2,2),(-1.12132034356,4.12132034356),(1,5),(3.12132034356,4.12132034356),(4,2),(3.12132034356,-0.12132034356),(1,-1),(-1.12132034356,-0.12132034356)) | ((-99,2),(-69.7106781187,72.7106781187),(1,102),(71.7106781187,72.7106781187),(101,2),(71.7106781187,-68.7106781187),(1,-98),(-69.7106781187,-68.7106781187)) | ((-4,3),(-2.53553390593,6.53553390593),(1,8),(4.53553390593,6.53553390593),(6,3),(4.53553390593,-0.535533905933),(1,-2),(-2.53553390593,-0.535533905933)) - | ((-2,2),(-1.12132034356,4.12132034356),(1,5),(3.12132034356,4.12132034356),(4,2),(3.12132034356,-0.12132034356),(1,-1),(-1.12132034356,-0.12132034356)) - | ((90,200),(92.9289321881,207.071067812),(100,210),(107.071067812,207.071067812),(110,200),(107.071067812,192.928932188),(100,190),(92.9289321881,192.928932188)) + | ((2,1),(2.87867965644,3.12132034356),(5,4),(7.12132034356,3.12132034356),(8,1),(7.12132034356,-1.12132034356),(5,-2),(2.87867965644,-1.12132034356)) | ((-15,1),(18.6827201635,82.3172798365),(100,116),(181.317279836,82.3172798365),(215,1),(181.317279836,-80.3172798365),(100,-114),(18.6827201635,-80.3172798365)) + | ((90,200),(92.9289321881,207.071067812),(100,210),(107.071067812,207.071067812),(110,200),(107.071067812,192.928932188),(100,190),(92.9289321881,192.928932188)) (6 rows) -- -- Circles -- SELECT '' AS six, circle(f1, 50.0) - FROM POINT_TBL; + FROM POINT_TBL ORDER BY f1[0], f1[1]; six | circle -----+----------------- - | <(0,0),50> | <(-10,0),50> + | <(-5,-12),50> | <(-3,4),50> + | <(0,0),50> | <(5.1,34.5),50> - | <(-5,-12),50> | <(10,10),50> (6 rows) SELECT '' AS four, circle(f1) - FROM BOX_TBL; + FROM BOX_TBL ORDER BY (center(f1))[0], (center(f1))[1]; four | circle ------+----------------------- | <(1,1),1.41421356237> @@ -494,7 +494,7 @@ SELECT '' AS four, circle(f1) SELECT '' AS two, circle(f1) FROM POLYGON_TBL - WHERE (# f1) >= 3; + WHERE (# f1) >= 3 ORDER BY ID; two | circle -----+----------------------------------------------- | <(1.33333333333,1.33333333333),2.04168905064> diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out index 26d7541b72..d81600230a 100644 --- a/src/test/regress/expected/horology.out +++ b/src/test/regress/expected/horology.out @@ -414,34 +414,34 @@ SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_ Sat Jan 01 08:00:00 1994 PST (1 row) -SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL ORDER BY d1; 64 | one_year ----+----------------------------- | -infinity - | infinity + | Thu Feb 16 17:32:01 0096 BC + | Sun Feb 16 17:32:01 0098 + | Fri Feb 16 17:32:01 0598 + | Wed Feb 16 17:32:01 1098 + | Sun Feb 16 17:32:01 1698 + | Fri Feb 16 17:32:01 1798 + | Wed Feb 16 17:32:01 1898 | Fri Jan 01 00:00:00 1971 - | Tue Feb 10 17:32:01 1998 - | Tue Feb 10 17:32:01 1998 - | Tue Feb 10 17:32:02 1998 - | Tue Feb 10 17:32:01.4 1998 - | Tue Feb 10 17:32:01.5 1998 - | Tue Feb 10 17:32:01.6 1998 + | Fri Feb 28 17:32:01 1997 + | Fri Feb 28 17:32:01 1997 + | Sat Mar 01 17:32:01 1997 + | Tue Dec 30 17:32:01 1997 + | Wed Dec 31 17:32:01 1997 + | Thu Jan 01 17:32:01 1998 | Fri Jan 02 00:00:00 1998 | Fri Jan 02 03:04:05 1998 + | Tue Feb 10 17:32:00 1998 + | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 - | Wed Jun 10 17:32:01 1998 - | Sun Sep 22 18:19:20 2002 - | Thu Mar 15 08:14:01 2001 - | Thu Mar 15 13:14:02 2001 - | Thu Mar 15 12:14:03 2001 - | Thu Mar 15 03:14:04 2001 - | Thu Mar 15 02:14:05 2001 | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 - | Tue Feb 10 17:32:00 1998 | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 @@ -451,67 +451,66 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL; | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998 - | Wed Jun 10 18:32:01 1998 | Tue Feb 10 17:32:01 1998 + | Tue Feb 10 17:32:01 1998 + | Tue Feb 10 17:32:01.4 1998 + | Tue Feb 10 17:32:01.5 1998 + | Tue Feb 10 17:32:01.6 1998 + | Tue Feb 10 17:32:02 1998 | Wed Feb 11 17:32:01 1998 | Thu Feb 12 17:32:01 1998 | Fri Feb 13 17:32:01 1998 | Sat Feb 14 17:32:01 1998 | Sun Feb 15 17:32:01 1998 | Mon Feb 16 17:32:01 1998 - | Thu Feb 16 17:32:01 0096 BC - | Sun Feb 16 17:32:01 0098 - | Fri Feb 16 17:32:01 0598 - | Wed Feb 16 17:32:01 1098 - | Sun Feb 16 17:32:01 1698 - | Fri Feb 16 17:32:01 1798 - | Wed Feb 16 17:32:01 1898 | Mon Feb 16 17:32:01 1998 - | Sun Feb 16 17:32:01 2098 - | Fri Feb 28 17:32:01 1997 - | Fri Feb 28 17:32:01 1997 - | Sat Mar 01 17:32:01 1997 - | Tue Dec 30 17:32:01 1997 - | Wed Dec 31 17:32:01 1997 - | Thu Jan 01 17:32:01 1998 | Sat Feb 28 17:32:01 1998 | Sun Mar 01 17:32:01 1998 + | Wed Jun 10 17:32:01 1998 + | Wed Jun 10 18:32:01 1998 | Wed Dec 30 17:32:01 1998 | Thu Dec 31 17:32:01 1998 | Sun Dec 31 17:32:01 2000 | Mon Jan 01 17:32:01 2001 + | Thu Mar 15 02:14:05 2001 + | Thu Mar 15 03:14:04 2001 + | Thu Mar 15 08:14:01 2001 + | Thu Mar 15 12:14:03 2001 + | Thu Mar 15 13:14:02 2001 | Mon Dec 31 17:32:01 2001 | Tue Jan 01 17:32:01 2002 + | Sun Sep 22 18:19:20 2002 + | Sun Feb 16 17:32:01 2098 + | infinity (65 rows) -SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL ORDER BY d1; 64 | one_year ----+----------------------------- | -infinity - | infinity + | Mon Feb 16 17:32:01 0098 BC + | Thu Feb 16 17:32:01 0096 + | Tue Feb 16 17:32:01 0596 + | Sun Feb 16 17:32:01 1096 + | Thu Feb 16 17:32:01 1696 + | Tue Feb 16 17:32:01 1796 + | Sun Feb 16 17:32:01 1896 | Wed Jan 01 00:00:00 1969 - | Sat Feb 10 17:32:01 1996 - | Sat Feb 10 17:32:01 1996 - | Sat Feb 10 17:32:02 1996 - | Sat Feb 10 17:32:01.4 1996 - | Sat Feb 10 17:32:01.5 1996 - | Sat Feb 10 17:32:01.6 1996 + | Tue Feb 28 17:32:01 1995 + | Tue Feb 28 17:32:01 1995 + | Wed Mar 01 17:32:01 1995 + | Sat Dec 30 17:32:01 1995 + | Sun Dec 31 17:32:01 1995 + | Mon Jan 01 17:32:01 1996 | Tue Jan 02 00:00:00 1996 | Tue Jan 02 03:04:05 1996 + | Sat Feb 10 17:32:00 1996 | Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996 - | Mon Jun 10 17:32:01 1996 - | Fri Sep 22 18:19:20 2000 - | Mon Mar 15 08:14:01 1999 - | Mon Mar 15 13:14:02 1999 - | Mon Mar 15 12:14:03 1999 - | Mon Mar 15 03:14:04 1999 - | Mon Mar 15 02:14:05 1999 | Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996 - | Sat Feb 10 17:32:00 1996 | Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996 @@ -521,37 +520,38 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL; | Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996 - | Mon Jun 10 18:32:01 1996 | Sat Feb 10 17:32:01 1996 + | Sat Feb 10 17:32:01 1996 + | Sat Feb 10 17:32:01 1996 + | Sat Feb 10 17:32:01.4 1996 + | Sat Feb 10 17:32:01.5 1996 + | Sat Feb 10 17:32:01.6 1996 + | Sat Feb 10 17:32:02 1996 | Sun Feb 11 17:32:01 1996 | Mon Feb 12 17:32:01 1996 | Tue Feb 13 17:32:01 1996 | Wed Feb 14 17:32:01 1996 | Thu Feb 15 17:32:01 1996 | Fri Feb 16 17:32:01 1996 - | Mon Feb 16 17:32:01 0098 BC - | Thu Feb 16 17:32:01 0096 - | Tue Feb 16 17:32:01 0596 - | Sun Feb 16 17:32:01 1096 - | Thu Feb 16 17:32:01 1696 - | Tue Feb 16 17:32:01 1796 - | Sun Feb 16 17:32:01 1896 | Fri Feb 16 17:32:01 1996 - | Thu Feb 16 17:32:01 2096 - | Tue Feb 28 17:32:01 1995 - | Tue Feb 28 17:32:01 1995 - | Wed Mar 01 17:32:01 1995 - | Sat Dec 30 17:32:01 1995 - | Sun Dec 31 17:32:01 1995 - | Mon Jan 01 17:32:01 1996 | Wed Feb 28 17:32:01 1996 | Fri Mar 01 17:32:01 1996 + | Mon Jun 10 17:32:01 1996 + | Mon Jun 10 18:32:01 1996 | Mon Dec 30 17:32:01 1996 | Tue Dec 31 17:32:01 1996 | Thu Dec 31 17:32:01 1998 | Fri Jan 01 17:32:01 1999 + | Mon Mar 15 02:14:05 1999 + | Mon Mar 15 03:14:04 1999 + | Mon Mar 15 08:14:01 1999 + | Mon Mar 15 12:14:03 1999 + | Mon Mar 15 13:14:02 1999 | Fri Dec 31 17:32:01 1999 | Sat Jan 01 17:32:01 2000 + | Fri Sep 22 18:19:20 2000 + | Thu Feb 16 17:32:01 2096 + | infinity (65 rows) SELECT timestamp with time zone '1996-03-01' - interval '1 second' AS "Feb 29"; @@ -659,146 +659,146 @@ SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_ Sat Jan 01 08:00:00 1994 PST (1 row) -SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; +SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL ORDER BY d1; 64 | one_year ----+--------------------------------- | -infinity - | infinity + | Thu Feb 16 17:32:01 0096 PST BC + | Sun Feb 16 17:32:01 0098 PST + | Fri Feb 16 17:32:01 0598 PST + | Wed Feb 16 17:32:01 1098 PST + | Sun Feb 16 17:32:01 1698 PST + | Fri Feb 16 17:32:01 1798 PST + | Wed Feb 16 17:32:01 1898 PST | Thu Dec 31 16:00:00 1970 PST - | Tue Feb 10 17:32:01 1998 PST - | Tue Feb 10 17:32:01 1998 PST - | Tue Feb 10 17:32:02 1998 PST - | Tue Feb 10 17:32:01.4 1998 PST - | Tue Feb 10 17:32:01.5 1998 PST - | Tue Feb 10 17:32:01.6 1998 PST + | Fri Feb 28 17:32:01 1997 PST + | Fri Feb 28 17:32:01 1997 PST + | Sat Mar 01 17:32:01 1997 PST + | Tue Dec 30 17:32:01 1997 PST + | Wed Dec 31 17:32:01 1997 PST + | Thu Jan 01 17:32:01 1998 PST | Fri Jan 02 00:00:00 1998 PST | Fri Jan 02 03:04:05 1998 PST + | Tue Feb 10 09:32:01 1998 PST + | Tue Feb 10 09:32:01 1998 PST + | Tue Feb 10 09:32:01 1998 PST + | Tue Feb 10 14:32:01 1998 PST + | Tue Feb 10 17:32:00 1998 PST + | Tue Feb 10 17:32:01 1998 PST + | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST - | Wed Jun 10 17:32:01 1998 PDT - | Sun Sep 22 18:19:20 2002 PDT - | Thu Mar 15 08:14:01 2001 PST - | Thu Mar 15 04:14:02 2001 PST - | Thu Mar 15 02:14:03 2001 PST - | Thu Mar 15 03:14:04 2001 PST - | Thu Mar 15 01:14:05 2001 PST | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST - | Tue Feb 10 17:32:00 1998 PST | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST - | Tue Feb 10 09:32:01 1998 PST - | Tue Feb 10 09:32:01 1998 PST - | Tue Feb 10 09:32:01 1998 PST - | Tue Feb 10 14:32:01 1998 PST - | Fri Jul 10 14:32:01 1998 PDT - | Wed Jun 10 18:32:01 1998 PDT | Tue Feb 10 17:32:01 1998 PST + | Tue Feb 10 17:32:01.4 1998 PST + | Tue Feb 10 17:32:01.5 1998 PST + | Tue Feb 10 17:32:01.6 1998 PST + | Tue Feb 10 17:32:02 1998 PST | Wed Feb 11 17:32:01 1998 PST | Thu Feb 12 17:32:01 1998 PST | Fri Feb 13 17:32:01 1998 PST | Sat Feb 14 17:32:01 1998 PST | Sun Feb 15 17:32:01 1998 PST | Mon Feb 16 17:32:01 1998 PST - | Thu Feb 16 17:32:01 0096 PST BC - | Sun Feb 16 17:32:01 0098 PST - | Fri Feb 16 17:32:01 0598 PST - | Wed Feb 16 17:32:01 1098 PST - | Sun Feb 16 17:32:01 1698 PST - | Fri Feb 16 17:32:01 1798 PST - | Wed Feb 16 17:32:01 1898 PST | Mon Feb 16 17:32:01 1998 PST - | Sun Feb 16 17:32:01 2098 PST - | Fri Feb 28 17:32:01 1997 PST - | Fri Feb 28 17:32:01 1997 PST - | Sat Mar 01 17:32:01 1997 PST - | Tue Dec 30 17:32:01 1997 PST - | Wed Dec 31 17:32:01 1997 PST - | Thu Jan 01 17:32:01 1998 PST | Sat Feb 28 17:32:01 1998 PST | Sun Mar 01 17:32:01 1998 PST + | Wed Jun 10 17:32:01 1998 PDT + | Wed Jun 10 18:32:01 1998 PDT + | Fri Jul 10 14:32:01 1998 PDT | Wed Dec 30 17:32:01 1998 PST | Thu Dec 31 17:32:01 1998 PST | Sun Dec 31 17:32:01 2000 PST | Mon Jan 01 17:32:01 2001 PST + | Thu Mar 15 01:14:05 2001 PST + | Thu Mar 15 02:14:03 2001 PST + | Thu Mar 15 03:14:04 2001 PST + | Thu Mar 15 04:14:02 2001 PST + | Thu Mar 15 08:14:01 2001 PST | Mon Dec 31 17:32:01 2001 PST | Tue Jan 01 17:32:01 2002 PST + | Sun Sep 22 18:19:20 2002 PDT + | Sun Feb 16 17:32:01 2098 PST + | infinity (66 rows) -SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; +SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL ORDER BY d1; 64 | one_year ----+--------------------------------- | -infinity - | infinity + | Mon Feb 16 17:32:01 0098 PST BC + | Thu Feb 16 17:32:01 0096 PST + | Tue Feb 16 17:32:01 0596 PST + | Sun Feb 16 17:32:01 1096 PST + | Thu Feb 16 17:32:01 1696 PST + | Tue Feb 16 17:32:01 1796 PST + | Sun Feb 16 17:32:01 1896 PST | Tue Dec 31 16:00:00 1968 PST - | Sat Feb 10 17:32:01 1996 PST - | Sat Feb 10 17:32:01 1996 PST - | Sat Feb 10 17:32:02 1996 PST - | Sat Feb 10 17:32:01.4 1996 PST - | Sat Feb 10 17:32:01.5 1996 PST - | Sat Feb 10 17:32:01.6 1996 PST + | Tue Feb 28 17:32:01 1995 PST + | Tue Feb 28 17:32:01 1995 PST + | Wed Mar 01 17:32:01 1995 PST + | Sat Dec 30 17:32:01 1995 PST + | Sun Dec 31 17:32:01 1995 PST + | Mon Jan 01 17:32:01 1996 PST | Tue Jan 02 00:00:00 1996 PST | Tue Jan 02 03:04:05 1996 PST + | Sat Feb 10 09:32:01 1996 PST + | Sat Feb 10 09:32:01 1996 PST + | Sat Feb 10 09:32:01 1996 PST + | Sat Feb 10 14:32:01 1996 PST + | Sat Feb 10 17:32:00 1996 PST + | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST - | Mon Jun 10 17:32:01 1996 PDT - | Fri Sep 22 18:19:20 2000 PDT - | Mon Mar 15 08:14:01 1999 PST - | Mon Mar 15 04:14:02 1999 PST - | Mon Mar 15 02:14:03 1999 PST - | Mon Mar 15 03:14:04 1999 PST - | Mon Mar 15 01:14:05 1999 PST | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST - | Sat Feb 10 17:32:00 1996 PST | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST - | Sat Feb 10 09:32:01 1996 PST - | Sat Feb 10 09:32:01 1996 PST - | Sat Feb 10 09:32:01 1996 PST - | Sat Feb 10 14:32:01 1996 PST - | Wed Jul 10 14:32:01 1996 PDT - | Mon Jun 10 18:32:01 1996 PDT | Sat Feb 10 17:32:01 1996 PST + | Sat Feb 10 17:32:01 1996 PST + | Sat Feb 10 17:32:01.4 1996 PST + | Sat Feb 10 17:32:01.5 1996 PST + | Sat Feb 10 17:32:01.6 1996 PST + | Sat Feb 10 17:32:02 1996 PST | Sun Feb 11 17:32:01 1996 PST | Mon Feb 12 17:32:01 1996 PST | Tue Feb 13 17:32:01 1996 PST | Wed Feb 14 17:32:01 1996 PST | Thu Feb 15 17:32:01 1996 PST | Fri Feb 16 17:32:01 1996 PST - | Mon Feb 16 17:32:01 0098 PST BC - | Thu Feb 16 17:32:01 0096 PST - | Tue Feb 16 17:32:01 0596 PST - | Sun Feb 16 17:32:01 1096 PST - | Thu Feb 16 17:32:01 1696 PST - | Tue Feb 16 17:32:01 1796 PST - | Sun Feb 16 17:32:01 1896 PST | Fri Feb 16 17:32:01 1996 PST - | Thu Feb 16 17:32:01 2096 PST - | Tue Feb 28 17:32:01 1995 PST - | Tue Feb 28 17:32:01 1995 PST - | Wed Mar 01 17:32:01 1995 PST - | Sat Dec 30 17:32:01 1995 PST - | Sun Dec 31 17:32:01 1995 PST - | Mon Jan 01 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST + | Mon Jun 10 17:32:01 1996 PDT + | Mon Jun 10 18:32:01 1996 PDT + | Wed Jul 10 14:32:01 1996 PDT | Mon Dec 30 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | Thu Dec 31 17:32:01 1998 PST | Fri Jan 01 17:32:01 1999 PST + | Mon Mar 15 01:14:05 1999 PST + | Mon Mar 15 02:14:03 1999 PST + | Mon Mar 15 03:14:04 1999 PST + | Mon Mar 15 04:14:02 1999 PST + | Mon Mar 15 08:14:01 1999 PST | Fri Dec 31 17:32:01 1999 PST | Sat Jan 01 17:32:01 2000 PST + | Fri Sep 22 18:19:20 2000 PDT + | Thu Feb 16 17:32:01 2096 PST + | infinity (66 rows) -- @@ -1350,7 +1350,7 @@ CREATE TABLE TEMP_TIMESTAMP (f1 timestamp with time zone); INSERT INTO TEMP_TIMESTAMP (f1) SELECT d1 FROM TIMESTAMP_TBL WHERE d1 BETWEEN '13-jun-1957' AND '1-jan-1997' - OR d1 BETWEEN '1-jan-1999' AND '1-jan-2010'; + OR d1 BETWEEN '1-jan-1999' AND '1-jan-2010' ; SELECT '' AS "16", f1 AS "timestamp" FROM TEMP_TIMESTAMP ORDER BY "timestamp"; @@ -2023,42 +2023,42 @@ SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime -- therefore, should not show up in the results. SELECT '' AS three, * FROM ABSTIME_TBL WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years - < abstime 'Jan 14 14:00:00 1977'; + < abstime 'Jan 14 14:00:00 1977' ORDER BY f1; three | f1 -------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST + | Sun Jan 14 03:14:21 1973 PST (3 rows) SELECT '' AS three, * FROM ABSTIME_TBL WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years - < abstime 'Jan 14 14:00:00 1971'; + < abstime 'Jan 14 14:00:00 1971' ORDER BY f1; three | f1 -------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST + | Sun Jan 14 03:14:21 1973 PST (3 rows) SELECT '' AS three, * FROM ABSTIME_TBL WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years - < abstime 'Jan 14 14:00:00 1971'; + < abstime 'Jan 14 14:00:00 1971' ORDER BY f1; three | f1 -------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST + | Sun Jan 14 03:14:21 1973 PST (3 rows) SELECT '' AS three, * FROM ABSTIME_TBL WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years - < abstime 'Jan 14 14:00:00 1977'; + < abstime 'Jan 14 14:00:00 1977' ORDER BY f1; three | f1 -------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST + | Sun Jan 14 03:14:21 1973 PST (3 rows) -- @@ -2124,7 +2124,7 @@ SELECT '' AS four, f1 AS abstime, date(f1) AS date (4 rows) SELECT '' AS two, d1 AS "timestamp", abstime(d1) AS abstime - FROM TIMESTAMP_TBL WHERE NOT isfinite(d1); + FROM TIMESTAMP_TBL WHERE NOT isfinite(d1) ORDER BY d1; two | timestamp | abstime -----+-----------+----------- | -infinity | -infinity @@ -2132,34 +2132,34 @@ SELECT '' AS two, d1 AS "timestamp", abstime(d1) AS abstime (2 rows) SELECT '' AS three, f1 as abstime, cast(f1 as timestamp) AS "timestamp" - FROM ABSTIME_TBL WHERE NOT isfinite(f1); + FROM ABSTIME_TBL WHERE NOT isfinite(f1) ORDER BY f1; ERROR: cannot convert abstime "invalid" to timestamp SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime - FROM INTERVAL_TBL; + FROM INTERVAL_TBL ORDER BY f1; ten | interval | reltime -----+-------------------------------+------------------------------- + | @ 14 secs ago | @ 14 secs ago | @ 1 min | @ 1 min | @ 5 hours | @ 5 hours + | @ 1 day 2 hours 3 mins 4 secs | @ 1 day 2 hours 3 mins 4 secs | @ 10 days | @ 10 days - | @ 34 years | @ 34 years | @ 3 mons | @ 3 mons - | @ 14 secs ago | @ 14 secs ago - | @ 1 day 2 hours 3 mins 4 secs | @ 1 day 2 hours 3 mins 4 secs - | @ 6 years | @ 6 years | @ 5 mons | @ 5 mons | @ 5 mons 12 hours | @ 5 mons 12 hours + | @ 6 years | @ 6 years + | @ 34 years | @ 34 years (10 rows) SELECT '' AS six, f1 as reltime, CAST(f1 AS interval) AS interval - FROM RELTIME_TBL; + FROM RELTIME_TBL ORDER BY f1; six | reltime | interval -----+---------------+--------------- + | @ 14 secs ago | @ 14 secs ago | @ 1 min | @ 1 min | @ 5 hours | @ 5 hours | @ 10 days | @ 10 days - | @ 34 years | @ 34 years | @ 3 mons | @ 3 mons - | @ 14 secs ago | @ 14 secs ago + | @ 34 years | @ 34 years (6 rows) DROP TABLE TEMP_TIMESTAMP; @@ -2173,34 +2173,34 @@ SHOW DateStyle; Postgres, MDY (1 row) -SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL ORDER BY d1; 64 | us_postgres ----+----------------------------- | -infinity - | infinity + | Tue Feb 16 17:32:01 0097 BC + | Sat Feb 16 17:32:01 0097 + | Thu Feb 16 17:32:01 0597 + | Tue Feb 16 17:32:01 1097 + | Sat Feb 16 17:32:01 1697 + | Thu Feb 16 17:32:01 1797 + | Tue Feb 16 17:32:01 1897 | Thu Jan 01 00:00:00 1970 - | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:02 1997 - | Mon Feb 10 17:32:01.4 1997 - | Mon Feb 10 17:32:01.5 1997 - | Mon Feb 10 17:32:01.6 1997 + | Wed Feb 28 17:32:01 1996 + | Thu Feb 29 17:32:01 1996 + | Fri Mar 01 17:32:01 1996 + | Mon Dec 30 17:32:01 1996 + | Tue Dec 31 17:32:01 1996 + | Wed Jan 01 17:32:01 1997 | Thu Jan 02 00:00:00 1997 | Thu Jan 02 03:04:05 1997 + | Mon Feb 10 17:32:00 1997 + | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 17:32:01 1997 - | Sat Sep 22 18:19:20 2001 - | Wed Mar 15 08:14:01 2000 - | Wed Mar 15 13:14:02 2000 - | Wed Mar 15 12:14:03 2000 - | Wed Mar 15 03:14:04 2000 - | Wed Mar 15 02:14:05 2000 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:00 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 @@ -2210,80 +2210,79 @@ SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 18:32:01 1997 | Mon Feb 10 17:32:01 1997 + | Mon Feb 10 17:32:01 1997 + | Mon Feb 10 17:32:01.4 1997 + | Mon Feb 10 17:32:01.5 1997 + | Mon Feb 10 17:32:01.6 1997 + | Mon Feb 10 17:32:02 1997 | Tue Feb 11 17:32:01 1997 | Wed Feb 12 17:32:01 1997 | Thu Feb 13 17:32:01 1997 | Fri Feb 14 17:32:01 1997 | Sat Feb 15 17:32:01 1997 | Sun Feb 16 17:32:01 1997 - | Tue Feb 16 17:32:01 0097 BC - | Sat Feb 16 17:32:01 0097 - | Thu Feb 16 17:32:01 0597 - | Tue Feb 16 17:32:01 1097 - | Sat Feb 16 17:32:01 1697 - | Thu Feb 16 17:32:01 1797 - | Tue Feb 16 17:32:01 1897 | Sun Feb 16 17:32:01 1997 - | Sat Feb 16 17:32:01 2097 - | Wed Feb 28 17:32:01 1996 - | Thu Feb 29 17:32:01 1996 - | Fri Mar 01 17:32:01 1996 - | Mon Dec 30 17:32:01 1996 - | Tue Dec 31 17:32:01 1996 - | Wed Jan 01 17:32:01 1997 | Fri Feb 28 17:32:01 1997 | Sat Mar 01 17:32:01 1997 + | Tue Jun 10 17:32:01 1997 + | Tue Jun 10 18:32:01 1997 | Tue Dec 30 17:32:01 1997 | Wed Dec 31 17:32:01 1997 | Fri Dec 31 17:32:01 1999 | Sat Jan 01 17:32:01 2000 + | Wed Mar 15 02:14:05 2000 + | Wed Mar 15 03:14:04 2000 + | Wed Mar 15 08:14:01 2000 + | Wed Mar 15 12:14:03 2000 + | Wed Mar 15 13:14:02 2000 | Sun Dec 31 17:32:01 2000 | Mon Jan 01 17:32:01 2001 + | Sat Sep 22 18:19:20 2001 + | Sat Feb 16 17:32:01 2097 + | infinity (65 rows) -SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL ORDER BY f1; seven | us_postgres -------+------------------------------ + | -infinity + | Sat May 10 23:59:12 1947 PST + | Wed Dec 31 16:00:00 1969 PST | Sun Jan 14 03:14:21 1973 PST | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST | infinity - | -infinity - | Sat May 10 23:59:12 1947 PST | invalid (7 rows) SET DateStyle TO 'US,ISO'; -SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL ORDER BY d1; 64 | us_iso ----+------------------------ | -infinity - | infinity + | 0097-02-16 17:32:01 BC + | 0097-02-16 17:32:01 + | 0597-02-16 17:32:01 + | 1097-02-16 17:32:01 + | 1697-02-16 17:32:01 + | 1797-02-16 17:32:01 + | 1897-02-16 17:32:01 | 1970-01-01 00:00:00 - | 1997-02-10 17:32:01 - | 1997-02-10 17:32:01 - | 1997-02-10 17:32:02 - | 1997-02-10 17:32:01.4 - | 1997-02-10 17:32:01.5 - | 1997-02-10 17:32:01.6 + | 1996-02-28 17:32:01 + | 1996-02-29 17:32:01 + | 1996-03-01 17:32:01 + | 1996-12-30 17:32:01 + | 1996-12-31 17:32:01 + | 1997-01-01 17:32:01 | 1997-01-02 00:00:00 | 1997-01-02 03:04:05 + | 1997-02-10 17:32:00 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 - | 1997-06-10 17:32:01 - | 2001-09-22 18:19:20 - | 2000-03-15 08:14:01 - | 2000-03-15 13:14:02 - | 2000-03-15 12:14:03 - | 2000-03-15 03:14:04 - | 2000-03-15 02:14:05 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 - | 1997-02-10 17:32:00 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 @@ -2293,48 +2292,49 @@ SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 - | 1997-06-10 18:32:01 | 1997-02-10 17:32:01 + | 1997-02-10 17:32:01 + | 1997-02-10 17:32:01 + | 1997-02-10 17:32:01.4 + | 1997-02-10 17:32:01.5 + | 1997-02-10 17:32:01.6 + | 1997-02-10 17:32:02 | 1997-02-11 17:32:01 | 1997-02-12 17:32:01 | 1997-02-13 17:32:01 | 1997-02-14 17:32:01 | 1997-02-15 17:32:01 | 1997-02-16 17:32:01 - | 0097-02-16 17:32:01 BC - | 0097-02-16 17:32:01 - | 0597-02-16 17:32:01 - | 1097-02-16 17:32:01 - | 1697-02-16 17:32:01 - | 1797-02-16 17:32:01 - | 1897-02-16 17:32:01 | 1997-02-16 17:32:01 - | 2097-02-16 17:32:01 - | 1996-02-28 17:32:01 - | 1996-02-29 17:32:01 - | 1996-03-01 17:32:01 - | 1996-12-30 17:32:01 - | 1996-12-31 17:32:01 - | 1997-01-01 17:32:01 | 1997-02-28 17:32:01 | 1997-03-01 17:32:01 + | 1997-06-10 17:32:01 + | 1997-06-10 18:32:01 | 1997-12-30 17:32:01 | 1997-12-31 17:32:01 | 1999-12-31 17:32:01 | 2000-01-01 17:32:01 + | 2000-03-15 02:14:05 + | 2000-03-15 03:14:04 + | 2000-03-15 08:14:01 + | 2000-03-15 12:14:03 + | 2000-03-15 13:14:02 | 2000-12-31 17:32:01 | 2001-01-01 17:32:01 + | 2001-09-22 18:19:20 + | 2097-02-16 17:32:01 + | infinity (65 rows) -SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL ORDER BY f1; seven | us_iso -------+------------------------ + | -infinity + | 1947-05-10 23:59:12-08 + | 1969-12-31 16:00:00-08 | 1973-01-14 03:14:21-08 | 1995-05-01 00:30:30-07 - | 1969-12-31 16:00:00-08 | infinity - | -infinity - | 1947-05-10 23:59:12-08 | invalid (7 rows) @@ -2345,34 +2345,35 @@ SHOW DateStyle; SQL, MDY (1 row) -SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL ORDER BY d1; 64 | us_sql ----+------------------------ | -infinity - | infinity + | 02/16/0097 17:32:01 BC + | 02/16/0097 17:32:01 + | 02/16/0597 17:32:01 + | 02/16/1097 17:32:01 + | 02/16/1697 17:32:01 + | 02/16/1797 17:32:01 + | 02/16/1897 17:32:01 | 01/01/1970 00:00:00 - | 02/10/1997 17:32:01 - | 02/10/1997 17:32:01 - | 02/10/1997 17:32:02 - | 02/10/1997 17:32:01.4 - | 02/10/1997 17:32:01.5 - | 02/10/1997 17:32:01.6 + | 02/28/1996 17:32:01 + | 02/29/1996 17:32:01 + | 03/01/1996 17:32:01 + | 12/30/1996 17:32:01 + | 12/31/1996 17:32:01 + | 01/01/1997 17:32:01 | 01/02/1997 00:00:00 | 01/02/1997 03:04:05 + | 02/10/1997 17:32:00 + | 02/10/1997 17:32:01 + | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 - | 06/10/1997 17:32:01 - | 09/22/2001 18:19:20 - | 03/15/2000 08:14:01 - | 03/15/2000 13:14:02 - | 03/15/2000 12:14:03 - | 03/15/2000 03:14:04 - | 03/15/2000 02:14:05 | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 - | 02/10/1997 17:32:00 | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 @@ -2382,48 +2383,47 @@ SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 | 02/10/1997 17:32:01 - | 06/10/1997 18:32:01 | 02/10/1997 17:32:01 + | 02/10/1997 17:32:01.4 + | 02/10/1997 17:32:01.5 + | 02/10/1997 17:32:01.6 + | 02/10/1997 17:32:02 | 02/11/1997 17:32:01 | 02/12/1997 17:32:01 | 02/13/1997 17:32:01 | 02/14/1997 17:32:01 | 02/15/1997 17:32:01 | 02/16/1997 17:32:01 - | 02/16/0097 17:32:01 BC - | 02/16/0097 17:32:01 - | 02/16/0597 17:32:01 - | 02/16/1097 17:32:01 - | 02/16/1697 17:32:01 - | 02/16/1797 17:32:01 - | 02/16/1897 17:32:01 | 02/16/1997 17:32:01 - | 02/16/2097 17:32:01 - | 02/28/1996 17:32:01 - | 02/29/1996 17:32:01 - | 03/01/1996 17:32:01 - | 12/30/1996 17:32:01 - | 12/31/1996 17:32:01 - | 01/01/1997 17:32:01 | 02/28/1997 17:32:01 | 03/01/1997 17:32:01 + | 06/10/1997 17:32:01 + | 06/10/1997 18:32:01 | 12/30/1997 17:32:01 | 12/31/1997 17:32:01 | 12/31/1999 17:32:01 | 01/01/2000 17:32:01 + | 03/15/2000 02:14:05 + | 03/15/2000 03:14:04 + | 03/15/2000 08:14:01 + | 03/15/2000 12:14:03 + | 03/15/2000 13:14:02 | 12/31/2000 17:32:01 | 01/01/2001 17:32:01 + | 09/22/2001 18:19:20 + | 02/16/2097 17:32:01 + | infinity (65 rows) -SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL ORDER BY f1; seven | us_sql -------+------------------------- + | -infinity + | 05/10/1947 23:59:12 PST + | 12/31/1969 16:00:00 PST | 01/14/1973 03:14:21 PST | 05/01/1995 00:30:30 PDT - | 12/31/1969 16:00:00 PST | infinity - | -infinity - | 05/10/1947 23:59:12 PST | invalid (7 rows) @@ -2441,34 +2441,35 @@ SELECT count(*) as one FROM TIMESTAMP_TBL WHERE d1 = 'Jun 13 1957'; 1 (1 row) -SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL; +SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL ORDER BY d1; 65 | european_postgres ----+----------------------------- | -infinity - | infinity + | Tue 16 Feb 17:32:01 0097 BC + | Sat 16 Feb 17:32:01 0097 + | Thu 16 Feb 17:32:01 0597 + | Tue 16 Feb 17:32:01 1097 + | Sat 16 Feb 17:32:01 1697 + | Thu 16 Feb 17:32:01 1797 + | Tue 16 Feb 17:32:01 1897 + | Thu 13 Jun 00:00:00 1957 | Thu 01 Jan 00:00:00 1970 - | Mon 10 Feb 17:32:01 1997 - | Mon 10 Feb 17:32:01 1997 - | Mon 10 Feb 17:32:02 1997 - | Mon 10 Feb 17:32:01.4 1997 - | Mon 10 Feb 17:32:01.5 1997 - | Mon 10 Feb 17:32:01.6 1997 + | Wed 28 Feb 17:32:01 1996 + | Thu 29 Feb 17:32:01 1996 + | Fri 01 Mar 17:32:01 1996 + | Mon 30 Dec 17:32:01 1996 + | Tue 31 Dec 17:32:01 1996 + | Wed 01 Jan 17:32:01 1997 | Thu 02 Jan 00:00:00 1997 | Thu 02 Jan 03:04:05 1997 + | Mon 10 Feb 17:32:00 1997 + | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 - | Tue 10 Jun 17:32:01 1997 - | Sat 22 Sep 18:19:20 2001 - | Wed 15 Mar 08:14:01 2000 - | Wed 15 Mar 13:14:02 2000 - | Wed 15 Mar 12:14:03 2000 - | Wed 15 Mar 03:14:04 2000 - | Wed 15 Mar 02:14:05 2000 | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 - | Mon 10 Feb 17:32:00 1997 | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 @@ -2478,49 +2479,48 @@ SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL; | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997 - | Tue 10 Jun 18:32:01 1997 | Mon 10 Feb 17:32:01 1997 + | Mon 10 Feb 17:32:01 1997 + | Mon 10 Feb 17:32:01.4 1997 + | Mon 10 Feb 17:32:01.5 1997 + | Mon 10 Feb 17:32:01.6 1997 + | Mon 10 Feb 17:32:02 1997 | Tue 11 Feb 17:32:01 1997 | Wed 12 Feb 17:32:01 1997 | Thu 13 Feb 17:32:01 1997 | Fri 14 Feb 17:32:01 1997 | Sat 15 Feb 17:32:01 1997 | Sun 16 Feb 17:32:01 1997 - | Tue 16 Feb 17:32:01 0097 BC - | Sat 16 Feb 17:32:01 0097 - | Thu 16 Feb 17:32:01 0597 - | Tue 16 Feb 17:32:01 1097 - | Sat 16 Feb 17:32:01 1697 - | Thu 16 Feb 17:32:01 1797 - | Tue 16 Feb 17:32:01 1897 | Sun 16 Feb 17:32:01 1997 - | Sat 16 Feb 17:32:01 2097 - | Wed 28 Feb 17:32:01 1996 - | Thu 29 Feb 17:32:01 1996 - | Fri 01 Mar 17:32:01 1996 - | Mon 30 Dec 17:32:01 1996 - | Tue 31 Dec 17:32:01 1996 - | Wed 01 Jan 17:32:01 1997 | Fri 28 Feb 17:32:01 1997 | Sat 01 Mar 17:32:01 1997 + | Tue 10 Jun 17:32:01 1997 + | Tue 10 Jun 18:32:01 1997 | Tue 30 Dec 17:32:01 1997 | Wed 31 Dec 17:32:01 1997 | Fri 31 Dec 17:32:01 1999 | Sat 01 Jan 17:32:01 2000 + | Wed 15 Mar 02:14:05 2000 + | Wed 15 Mar 03:14:04 2000 + | Wed 15 Mar 08:14:01 2000 + | Wed 15 Mar 12:14:03 2000 + | Wed 15 Mar 13:14:02 2000 | Sun 31 Dec 17:32:01 2000 | Mon 01 Jan 17:32:01 2001 - | Thu 13 Jun 00:00:00 1957 + | Sat 22 Sep 18:19:20 2001 + | Sat 16 Feb 17:32:01 2097 + | infinity (66 rows) -SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL ORDER BY f1; seven | european_postgres -------+------------------------------ + | -infinity + | Sat 10 May 23:59:12 1947 PST + | Wed 31 Dec 16:00:00 1969 PST | Sun 14 Jan 03:14:21 1973 PST | Mon 01 May 00:30:30 1995 PDT - | Wed 31 Dec 16:00:00 1969 PST | infinity - | -infinity - | Sat 10 May 23:59:12 1947 PST | invalid (7 rows) @@ -2531,34 +2531,35 @@ SHOW DateStyle; ISO, DMY (1 row) -SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; +SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL ORDER BY d1; 65 | european_iso ----+------------------------ | -infinity - | infinity + | 0097-02-16 17:32:01 BC + | 0097-02-16 17:32:01 + | 0597-02-16 17:32:01 + | 1097-02-16 17:32:01 + | 1697-02-16 17:32:01 + | 1797-02-16 17:32:01 + | 1897-02-16 17:32:01 + | 1957-06-13 00:00:00 | 1970-01-01 00:00:00 - | 1997-02-10 17:32:01 - | 1997-02-10 17:32:01 - | 1997-02-10 17:32:02 - | 1997-02-10 17:32:01.4 - | 1997-02-10 17:32:01.5 - | 1997-02-10 17:32:01.6 + | 1996-02-28 17:32:01 + | 1996-02-29 17:32:01 + | 1996-03-01 17:32:01 + | 1996-12-30 17:32:01 + | 1996-12-31 17:32:01 + | 1997-01-01 17:32:01 | 1997-01-02 00:00:00 | 1997-01-02 03:04:05 + | 1997-02-10 17:32:00 + | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 - | 1997-06-10 17:32:01 - | 2001-09-22 18:19:20 - | 2000-03-15 08:14:01 - | 2000-03-15 13:14:02 - | 2000-03-15 12:14:03 - | 2000-03-15 03:14:04 - | 2000-03-15 02:14:05 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 - | 1997-02-10 17:32:00 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 @@ -2568,49 +2569,48 @@ SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 | 1997-02-10 17:32:01 - | 1997-06-10 18:32:01 | 1997-02-10 17:32:01 + | 1997-02-10 17:32:01 + | 1997-02-10 17:32:01.4 + | 1997-02-10 17:32:01.5 + | 1997-02-10 17:32:01.6 + | 1997-02-10 17:32:02 | 1997-02-11 17:32:01 | 1997-02-12 17:32:01 | 1997-02-13 17:32:01 | 1997-02-14 17:32:01 | 1997-02-15 17:32:01 | 1997-02-16 17:32:01 - | 0097-02-16 17:32:01 BC - | 0097-02-16 17:32:01 - | 0597-02-16 17:32:01 - | 1097-02-16 17:32:01 - | 1697-02-16 17:32:01 - | 1797-02-16 17:32:01 - | 1897-02-16 17:32:01 | 1997-02-16 17:32:01 - | 2097-02-16 17:32:01 - | 1996-02-28 17:32:01 - | 1996-02-29 17:32:01 - | 1996-03-01 17:32:01 - | 1996-12-30 17:32:01 - | 1996-12-31 17:32:01 - | 1997-01-01 17:32:01 | 1997-02-28 17:32:01 | 1997-03-01 17:32:01 + | 1997-06-10 17:32:01 + | 1997-06-10 18:32:01 | 1997-12-30 17:32:01 | 1997-12-31 17:32:01 | 1999-12-31 17:32:01 | 2000-01-01 17:32:01 + | 2000-03-15 02:14:05 + | 2000-03-15 03:14:04 + | 2000-03-15 08:14:01 + | 2000-03-15 12:14:03 + | 2000-03-15 13:14:02 | 2000-12-31 17:32:01 | 2001-01-01 17:32:01 - | 1957-06-13 00:00:00 + | 2001-09-22 18:19:20 + | 2097-02-16 17:32:01 + | infinity (66 rows) -SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL ORDER BY f1; seven | european_iso -------+------------------------ + | -infinity + | 1947-05-10 23:59:12-08 + | 1969-12-31 16:00:00-08 | 1973-01-14 03:14:21-08 | 1995-05-01 00:30:30-07 - | 1969-12-31 16:00:00-08 | infinity - | -infinity - | 1947-05-10 23:59:12-08 | invalid (7 rows) @@ -2621,34 +2621,34 @@ SHOW DateStyle; SQL, DMY (1 row) -SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; +SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL ORDER BY d1; 65 | european_sql ----+------------------------ | -infinity - | infinity + | 16/02/0097 17:32:01 BC + | 16/02/0097 17:32:01 + | 16/02/0597 17:32:01 + | 16/02/1097 17:32:01 + | 16/02/1697 17:32:01 + | 16/02/1797 17:32:01 + | 16/02/1897 17:32:01 + | 13/06/1957 00:00:00 | 01/01/1970 00:00:00 - | 10/02/1997 17:32:01 - | 10/02/1997 17:32:01 - | 10/02/1997 17:32:02 - | 10/02/1997 17:32:01.4 - | 10/02/1997 17:32:01.5 - | 10/02/1997 17:32:01.6 + | 28/02/1996 17:32:01 + | 29/02/1996 17:32:01 + | 01/03/1996 17:32:01 + | 30/12/1996 17:32:01 + | 31/12/1996 17:32:01 + | 01/01/1997 17:32:01 | 02/01/1997 00:00:00 | 02/01/1997 03:04:05 + | 10/02/1997 17:32:00 | 10/02/1997 17:32:01 | 10/02/1997 17:32:01 | 10/02/1997 17:32:01 | 10/02/1997 17:32:01 - | 10/06/1997 17:32:01 - | 22/09/2001 18:19:20 - | 15/03/2000 08:14:01 - | 15/03/2000 13:14:02 - | 15/03/2000 12:14:03 - | 15/03/2000 03:14:04 - | 15/03/2000 02:14:05 | 10/02/1997 17:32:01 | 10/02/1997 17:32:01 - | 10/02/1997 17:32:00 | 10/02/1997 17:32:01 | 10/02/1997 17:32:01 | 10/02/1997 17:32:01 @@ -2658,49 +2658,49 @@ SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; | 10/02/1997 17:32:01 | 10/02/1997 17:32:01 | 10/02/1997 17:32:01 - | 10/06/1997 18:32:01 | 10/02/1997 17:32:01 + | 10/02/1997 17:32:01 + | 10/02/1997 17:32:01 + | 10/02/1997 17:32:01.4 + | 10/02/1997 17:32:01.5 + | 10/02/1997 17:32:01.6 + | 10/02/1997 17:32:02 | 11/02/1997 17:32:01 | 12/02/1997 17:32:01 | 13/02/1997 17:32:01 | 14/02/1997 17:32:01 | 15/02/1997 17:32:01 | 16/02/1997 17:32:01 - | 16/02/0097 17:32:01 BC - | 16/02/0097 17:32:01 - | 16/02/0597 17:32:01 - | 16/02/1097 17:32:01 - | 16/02/1697 17:32:01 - | 16/02/1797 17:32:01 - | 16/02/1897 17:32:01 | 16/02/1997 17:32:01 - | 16/02/2097 17:32:01 - | 28/02/1996 17:32:01 - | 29/02/1996 17:32:01 - | 01/03/1996 17:32:01 - | 30/12/1996 17:32:01 - | 31/12/1996 17:32:01 - | 01/01/1997 17:32:01 | 28/02/1997 17:32:01 | 01/03/1997 17:32:01 + | 10/06/1997 17:32:01 + | 10/06/1997 18:32:01 | 30/12/1997 17:32:01 | 31/12/1997 17:32:01 | 31/12/1999 17:32:01 | 01/01/2000 17:32:01 + | 15/03/2000 02:14:05 + | 15/03/2000 03:14:04 + | 15/03/2000 08:14:01 + | 15/03/2000 12:14:03 + | 15/03/2000 13:14:02 | 31/12/2000 17:32:01 | 01/01/2001 17:32:01 - | 13/06/1957 00:00:00 + | 22/09/2001 18:19:20 + | 16/02/2097 17:32:01 + | infinity (66 rows) -SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL ORDER BY f1; seven | european_sql -------+------------------------- + | -infinity + | 10/05/1947 23:59:12 PST + | 31/12/1969 16:00:00 PST | 14/01/1973 03:14:21 PST | 01/05/1995 00:30:30 PDT - | 31/12/1969 16:00:00 PST | infinity - | -infinity - | 10/05/1947 23:59:12 PST | invalid (7 rows) diff --git a/src/test/regress/expected/inet.out b/src/test/regress/expected/inet.out index abb59d4acf..4ca764043a 100644 --- a/src/test/regress/expected/inet.out +++ b/src/test/regress/expected/inet.out @@ -66,114 +66,114 @@ SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL; (17 rows) -- now test some support functions -SELECT '' AS ten, i AS inet, host(i), text(i), family(i) FROM INET_TBL; +SELECT '' AS ten, i AS inet, host(i), text(i), family(i) FROM INET_TBL ORDER BY i; ten | inet | host | text | family -----+------------------+---------------+------------------+-------- - | 192.168.1.226/24 | 192.168.1.226 | 192.168.1.226/24 | 4 - | 192.168.1.226 | 192.168.1.226 | 192.168.1.226/32 | 4 - | 192.168.1.0/24 | 192.168.1.0 | 192.168.1.0/24 | 4 - | 192.168.1.0/25 | 192.168.1.0 | 192.168.1.0/25 | 4 - | 192.168.1.255/24 | 192.168.1.255 | 192.168.1.255/24 | 4 - | 192.168.1.255/25 | 192.168.1.255 | 192.168.1.255/25 | 4 + | 9.1.2.3/8 | 9.1.2.3 | 9.1.2.3/8 | 4 | 10.1.2.3/8 | 10.1.2.3 | 10.1.2.3/8 | 4 | 10.1.2.3/8 | 10.1.2.3 | 10.1.2.3/8 | 4 - | 10.1.2.3 | 10.1.2.3 | 10.1.2.3/32 | 4 - | 10.1.2.3/24 | 10.1.2.3 | 10.1.2.3/24 | 4 - | 10.1.2.3/16 | 10.1.2.3 | 10.1.2.3/16 | 4 | 10.1.2.3/8 | 10.1.2.3 | 10.1.2.3/8 | 4 + | 10.1.2.3/16 | 10.1.2.3 | 10.1.2.3/16 | 4 + | 10.1.2.3/24 | 10.1.2.3 | 10.1.2.3/24 | 4 + | 10.1.2.3 | 10.1.2.3 | 10.1.2.3/32 | 4 | 11.1.2.3/8 | 11.1.2.3 | 11.1.2.3/8 | 4 - | 9.1.2.3/8 | 9.1.2.3 | 9.1.2.3/8 | 4 + | 192.168.1.0/24 | 192.168.1.0 | 192.168.1.0/24 | 4 + | 192.168.1.226/24 | 192.168.1.226 | 192.168.1.226/24 | 4 + | 192.168.1.255/24 | 192.168.1.255 | 192.168.1.255/24 | 4 + | 192.168.1.0/25 | 192.168.1.0 | 192.168.1.0/25 | 4 + | 192.168.1.255/25 | 192.168.1.255 | 192.168.1.255/25 | 4 + | 192.168.1.226 | 192.168.1.226 | 192.168.1.226/32 | 4 + | ::4.3.2.1/24 | ::4.3.2.1 | ::4.3.2.1/24 | 6 | 10:23::f1/64 | 10:23::f1 | 10:23::f1/64 | 6 | 10:23::ffff | 10:23::ffff | 10:23::ffff/128 | 6 - | ::4.3.2.1/24 | ::4.3.2.1 | ::4.3.2.1/24 | 6 (17 rows) SELECT '' AS ten, c AS cidr, broadcast(c), - i AS inet, broadcast(i) FROM INET_TBL; + i AS inet, broadcast(i) FROM INET_TBL ORDER BY i, c; ten | cidr | broadcast | inet | broadcast -----+--------------------+------------------+------------------+--------------------------------------- - | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.226/24 | 192.168.1.255/24 - | 192.168.1.0/26 | 192.168.1.63/26 | 192.168.1.226 | 192.168.1.226 - | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.255/24 - | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/25 | 192.168.1.127/25 - | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.255/24 | 192.168.1.255/24 - | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.255/25 | 192.168.1.255/25 + | 10.0.0.0/8 | 10.255.255.255/8 | 9.1.2.3/8 | 9.255.255.255/8 + | 10.0.0.0/8 | 10.255.255.255/8 | 10.1.2.3/8 | 10.255.255.255/8 | 10.0.0.0/8 | 10.255.255.255/8 | 10.1.2.3/8 | 10.255.255.255/8 | 10.0.0.0/32 | 10.0.0.0 | 10.1.2.3/8 | 10.255.255.255/8 - | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3 | 10.1.2.3 - | 10.1.2.0/24 | 10.1.2.255/24 | 10.1.2.3/24 | 10.1.2.255/24 | 10.1.0.0/16 | 10.1.255.255/16 | 10.1.2.3/16 | 10.1.255.255/16 - | 10.0.0.0/8 | 10.255.255.255/8 | 10.1.2.3/8 | 10.255.255.255/8 + | 10.1.2.0/24 | 10.1.2.255/24 | 10.1.2.3/24 | 10.1.2.255/24 + | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3 | 10.1.2.3 | 10.0.0.0/8 | 10.255.255.255/8 | 11.1.2.3/8 | 11.255.255.255/8 - | 10.0.0.0/8 | 10.255.255.255/8 | 9.1.2.3/8 | 9.255.255.255/8 + | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.255/24 + | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.226/24 | 192.168.1.255/24 + | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.255/24 | 192.168.1.255/24 + | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/25 | 192.168.1.127/25 + | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.255/25 | 192.168.1.255/25 + | 192.168.1.0/26 | 192.168.1.63/26 | 192.168.1.226 | 192.168.1.226 + | ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4 | ::4.3.2.1/24 | 0:ff:ffff:ffff:ffff:ffff:ffff:ffff/24 | 10:23::f1/128 | 10:23::f1 | 10:23::f1/64 | 10:23::ffff:ffff:ffff:ffff/64 | 10:23::8000/113 | 10:23::ffff/113 | 10:23::ffff | 10:23::ffff - | ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4 | ::4.3.2.1/24 | 0:ff:ffff:ffff:ffff:ffff:ffff:ffff/24 (17 rows) SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)", - i AS inet, network(i) AS "network(inet)" FROM INET_TBL; + i AS inet, network(i) AS "network(inet)" FROM INET_TBL ORDER BY i, c; ten | cidr | network(cidr) | inet | network(inet) -----+--------------------+--------------------+------------------+------------------ - | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.226/24 | 192.168.1.0/24 - | 192.168.1.0/26 | 192.168.1.0/26 | 192.168.1.226 | 192.168.1.226/32 - | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 - | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/25 | 192.168.1.0/25 - | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/24 - | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.255/25 | 192.168.1.128/25 + | 10.0.0.0/8 | 10.0.0.0/8 | 9.1.2.3/8 | 9.0.0.0/8 + | 10.0.0.0/8 | 10.0.0.0/8 | 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8 | 10.0.0.0/8 | 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/32 | 10.0.0.0/32 | 10.1.2.3/8 | 10.0.0.0/8 - | 10.1.2.3/32 | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3/32 - | 10.1.2.0/24 | 10.1.2.0/24 | 10.1.2.3/24 | 10.1.2.0/24 | 10.1.0.0/16 | 10.1.0.0/16 | 10.1.2.3/16 | 10.1.0.0/16 - | 10.0.0.0/8 | 10.0.0.0/8 | 10.1.2.3/8 | 10.0.0.0/8 + | 10.1.2.0/24 | 10.1.2.0/24 | 10.1.2.3/24 | 10.1.2.0/24 + | 10.1.2.3/32 | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3/32 | 10.0.0.0/8 | 10.0.0.0/8 | 11.1.2.3/8 | 11.0.0.0/8 - | 10.0.0.0/8 | 10.0.0.0/8 | 9.1.2.3/8 | 9.0.0.0/8 + | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 + | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.226/24 | 192.168.1.0/24 + | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/24 + | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/25 | 192.168.1.0/25 + | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.255/25 | 192.168.1.128/25 + | 192.168.1.0/26 | 192.168.1.0/26 | 192.168.1.226 | 192.168.1.226/32 + | ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4/128 | ::4.3.2.1/24 | ::/24 | 10:23::f1/128 | 10:23::f1/128 | 10:23::f1/64 | 10:23::/64 | 10:23::8000/113 | 10:23::8000/113 | 10:23::ffff | 10:23::ffff/128 - | ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4/128 | ::4.3.2.1/24 | ::/24 (17 rows) SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)", - i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL; + i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL ORDER BY i, c; ten | cidr | masklen(cidr) | inet | masklen(inet) -----+--------------------+---------------+------------------+--------------- - | 192.168.1.0/24 | 24 | 192.168.1.226/24 | 24 - | 192.168.1.0/26 | 26 | 192.168.1.226 | 32 - | 192.168.1.0/24 | 24 | 192.168.1.0/24 | 24 - | 192.168.1.0/24 | 24 | 192.168.1.0/25 | 25 - | 192.168.1.0/24 | 24 | 192.168.1.255/24 | 24 - | 192.168.1.0/24 | 24 | 192.168.1.255/25 | 25 + | 10.0.0.0/8 | 8 | 9.1.2.3/8 | 8 + | 10.0.0.0/8 | 8 | 10.1.2.3/8 | 8 | 10.0.0.0/8 | 8 | 10.1.2.3/8 | 8 | 10.0.0.0/32 | 32 | 10.1.2.3/8 | 8 - | 10.1.2.3/32 | 32 | 10.1.2.3 | 32 - | 10.1.2.0/24 | 24 | 10.1.2.3/24 | 24 | 10.1.0.0/16 | 16 | 10.1.2.3/16 | 16 - | 10.0.0.0/8 | 8 | 10.1.2.3/8 | 8 + | 10.1.2.0/24 | 24 | 10.1.2.3/24 | 24 + | 10.1.2.3/32 | 32 | 10.1.2.3 | 32 | 10.0.0.0/8 | 8 | 11.1.2.3/8 | 8 - | 10.0.0.0/8 | 8 | 9.1.2.3/8 | 8 + | 192.168.1.0/24 | 24 | 192.168.1.0/24 | 24 + | 192.168.1.0/24 | 24 | 192.168.1.226/24 | 24 + | 192.168.1.0/24 | 24 | 192.168.1.255/24 | 24 + | 192.168.1.0/24 | 24 | 192.168.1.0/25 | 25 + | 192.168.1.0/24 | 24 | 192.168.1.255/25 | 25 + | 192.168.1.0/26 | 26 | 192.168.1.226 | 32 + | ::ffff:1.2.3.4/128 | 128 | ::4.3.2.1/24 | 24 | 10:23::f1/128 | 128 | 10:23::f1/64 | 64 | 10:23::8000/113 | 113 | 10:23::ffff | 128 - | ::ffff:1.2.3.4/128 | 128 | ::4.3.2.1/24 | 24 (17 rows) SELECT '' AS four, c AS cidr, masklen(c) AS "masklen(cidr)", i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL - WHERE masklen(c) <= 8; + WHERE masklen(c) <= 8 ORDER BY i, c; four | cidr | masklen(cidr) | inet | masklen(inet) ------+------------+---------------+------------+--------------- + | 10.0.0.0/8 | 8 | 9.1.2.3/8 | 8 | 10.0.0.0/8 | 8 | 10.1.2.3/8 | 8 | 10.0.0.0/8 | 8 | 10.1.2.3/8 | 8 | 10.0.0.0/8 | 8 | 11.1.2.3/8 | 8 - | 10.0.0.0/8 | 8 | 9.1.2.3/8 | 8 (4 rows) SELECT '' AS six, c AS cidr, i AS inet FROM INET_TBL - WHERE c = i; + WHERE c = i ORDER BY i, c; six | cidr | inet -----+----------------+---------------- - | 192.168.1.0/24 | 192.168.1.0/24 | 10.1.2.3/32 | 10.1.2.3 + | 192.168.1.0/24 | 192.168.1.0/24 (2 rows) SELECT '' AS ten, i, c, @@ -181,38 +181,33 @@ SELECT '' AS ten, i, c, i >= c AS ge, i > c AS gt, i <> c AS ne, i << c AS sb, i <<= c AS sbe, i >> c AS sup, i >>= c AS spe - FROM INET_TBL; + FROM INET_TBL ORDER BY i, c; ten | i | c | lt | le | eq | ge | gt | ne | sb | sbe | sup | spe -----+------------------+--------------------+----+----+----+----+----+----+----+-----+-----+----- - | 192.168.1.226/24 | 192.168.1.0/24 | f | f | f | t | t | t | f | t | f | t - | 192.168.1.226 | 192.168.1.0/26 | f | f | f | t | t | t | f | f | f | f - | 192.168.1.0/24 | 192.168.1.0/24 | f | t | t | t | f | f | f | t | f | t - | 192.168.1.0/25 | 192.168.1.0/24 | f | f | f | t | t | t | t | t | f | f - | 192.168.1.255/24 | 192.168.1.0/24 | f | f | f | t | t | t | f | t | f | t - | 192.168.1.255/25 | 192.168.1.0/24 | f | f | f | t | t | t | t | t | f | f + | 9.1.2.3/8 | 10.0.0.0/8 | t | t | f | f | f | t | f | f | f | f + | 10.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | t | f | t | 10.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | t | f | t | 10.1.2.3/8 | 10.0.0.0/32 | t | t | f | f | f | t | f | f | t | t - | 10.1.2.3 | 10.1.2.3/32 | f | t | t | t | f | f | f | t | f | t - | 10.1.2.3/24 | 10.1.2.0/24 | f | f | f | t | t | t | f | t | f | t | 10.1.2.3/16 | 10.1.0.0/16 | f | f | f | t | t | t | f | t | f | t - | 10.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | t | f | t + | 10.1.2.3/24 | 10.1.2.0/24 | f | f | f | t | t | t | f | t | f | t + | 10.1.2.3 | 10.1.2.3/32 | f | t | t | t | f | f | f | t | f | t | 11.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | f | f | f - | 9.1.2.3/8 | 10.0.0.0/8 | t | t | f | f | f | t | f | f | f | f + | 192.168.1.0/24 | 192.168.1.0/24 | f | t | t | t | f | f | f | t | f | t + | 192.168.1.226/24 | 192.168.1.0/24 | f | f | f | t | t | t | f | t | f | t + | 192.168.1.255/24 | 192.168.1.0/24 | f | f | f | t | t | t | f | t | f | t + | 192.168.1.0/25 | 192.168.1.0/24 | f | f | f | t | t | t | t | t | f | f + | 192.168.1.255/25 | 192.168.1.0/24 | f | f | f | t | t | t | t | t | f | f + | 192.168.1.226 | 192.168.1.0/26 | f | f | f | t | t | t | f | f | f | f + | ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | t | t | f | f | f | t | f | f | t | t | 10:23::f1/64 | 10:23::f1/128 | t | t | f | f | f | t | f | f | t | t | 10:23::ffff | 10:23::8000/113 | f | f | f | t | t | t | t | t | f | f - | ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | t | t | f | f | f | t | f | f | t | t (17 rows) -- check the conversion to/from text and set_netmask -SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL; +SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL ORDER BY i; ten | set_masklen -----+------------------ - | 192.168.1.226/24 - | 192.168.1.226/24 - | 192.168.1.0/24 - | 192.168.1.0/24 - | 192.168.1.255/24 - | 192.168.1.255/24 + | 9.1.2.3/24 | 10.1.2.3/24 | 10.1.2.3/24 | 10.1.2.3/24 @@ -220,16 +215,21 @@ SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL; | 10.1.2.3/24 | 10.1.2.3/24 | 11.1.2.3/24 - | 9.1.2.3/24 + | 192.168.1.0/24 + | 192.168.1.226/24 + | 192.168.1.255/24 + | 192.168.1.0/24 + | 192.168.1.255/24 + | 192.168.1.226/24 + | ::4.3.2.1/24 | 10:23::f1/24 | 10:23::ffff/24 - | ::4.3.2.1/24 (17 rows) -- check that index works correctly CREATE INDEX inet_idx1 ON inet_tbl(i); SET enable_seqscan TO off; -SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr; +SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr ORDER BY i, c; c | i ----------------+------------------ 192.168.1.0/24 | 192.168.1.0/25 @@ -237,7 +237,7 @@ SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr; 192.168.1.0/26 | 192.168.1.226 (3 rows) -SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr; +SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr ORDER BY i; c | i ----------------+------------------ 192.168.1.0/24 | 192.168.1.0/24 @@ -251,136 +251,136 @@ SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr; SET enable_seqscan TO on; DROP INDEX inet_idx1; -- simple tests of inet boolean and arithmetic operators -SELECT i, ~i AS "~i" FROM inet_tbl; +SELECT i, ~i AS "~i" FROM inet_tbl ORDER BY i; i | ~i ------------------+-------------------------------------------- - 192.168.1.226/24 | 63.87.254.29/24 - 192.168.1.226 | 63.87.254.29 - 192.168.1.0/24 | 63.87.254.255/24 - 192.168.1.0/25 | 63.87.254.255/25 - 192.168.1.255/24 | 63.87.254.0/24 - 192.168.1.255/25 | 63.87.254.0/25 + 9.1.2.3/8 | 246.254.253.252/8 10.1.2.3/8 | 245.254.253.252/8 10.1.2.3/8 | 245.254.253.252/8 - 10.1.2.3 | 245.254.253.252 - 10.1.2.3/24 | 245.254.253.252/24 - 10.1.2.3/16 | 245.254.253.252/16 10.1.2.3/8 | 245.254.253.252/8 + 10.1.2.3/16 | 245.254.253.252/16 + 10.1.2.3/24 | 245.254.253.252/24 + 10.1.2.3 | 245.254.253.252 11.1.2.3/8 | 244.254.253.252/8 - 9.1.2.3/8 | 246.254.253.252/8 + 192.168.1.0/24 | 63.87.254.255/24 + 192.168.1.226/24 | 63.87.254.29/24 + 192.168.1.255/24 | 63.87.254.0/24 + 192.168.1.0/25 | 63.87.254.255/25 + 192.168.1.255/25 | 63.87.254.0/25 + 192.168.1.226 | 63.87.254.29 + ::4.3.2.1/24 | ffff:ffff:ffff:ffff:ffff:ffff:fbfc:fdfe/24 10:23::f1/64 | ffef:ffdc:ffff:ffff:ffff:ffff:ffff:ff0e/64 10:23::ffff | ffef:ffdc:ffff:ffff:ffff:ffff:ffff:0 - ::4.3.2.1/24 | ffff:ffff:ffff:ffff:ffff:ffff:fbfc:fdfe/24 (17 rows) -SELECT i, c, i & c AS "and" FROM inet_tbl; +SELECT i, c, i & c AS "and" FROM inet_tbl ORDER BY i, c; i | c | and ------------------+--------------------+---------------- - 192.168.1.226/24 | 192.168.1.0/24 | 192.168.1.0/24 - 192.168.1.226 | 192.168.1.0/26 | 192.168.1.0 - 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 - 192.168.1.0/25 | 192.168.1.0/24 | 192.168.1.0/25 - 192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.0/24 - 192.168.1.255/25 | 192.168.1.0/24 | 192.168.1.0/25 + 9.1.2.3/8 | 10.0.0.0/8 | 8.0.0.0/8 + 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8 10.1.2.3/8 | 10.0.0.0/32 | 10.0.0.0 - 10.1.2.3 | 10.1.2.3/32 | 10.1.2.3 - 10.1.2.3/24 | 10.1.2.0/24 | 10.1.2.0/24 10.1.2.3/16 | 10.1.0.0/16 | 10.1.0.0/16 - 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8 + 10.1.2.3/24 | 10.1.2.0/24 | 10.1.2.0/24 + 10.1.2.3 | 10.1.2.3/32 | 10.1.2.3 11.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8 - 9.1.2.3/8 | 10.0.0.0/8 | 8.0.0.0/8 + 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 + 192.168.1.226/24 | 192.168.1.0/24 | 192.168.1.0/24 + 192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.0/24 + 192.168.1.0/25 | 192.168.1.0/24 | 192.168.1.0/25 + 192.168.1.255/25 | 192.168.1.0/24 | 192.168.1.0/25 + 192.168.1.226 | 192.168.1.0/26 | 192.168.1.0 + ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | ::0.2.2.0 10:23::f1/64 | 10:23::f1/128 | 10:23::f1 10:23::ffff | 10:23::8000/113 | 10:23::8000 - ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | ::0.2.2.0 (17 rows) -SELECT i, c, i | c AS "or" FROM inet_tbl; +SELECT i, c, i | c AS "or" FROM inet_tbl ORDER BY i, c; i | c | or ------------------+--------------------+------------------ - 192.168.1.226/24 | 192.168.1.0/24 | 192.168.1.226/24 - 192.168.1.226 | 192.168.1.0/26 | 192.168.1.226 - 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 - 192.168.1.0/25 | 192.168.1.0/24 | 192.168.1.0/25 - 192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.255/24 - 192.168.1.255/25 | 192.168.1.0/24 | 192.168.1.255/25 + 9.1.2.3/8 | 10.0.0.0/8 | 11.1.2.3/8 + 10.1.2.3/8 | 10.0.0.0/8 | 10.1.2.3/8 10.1.2.3/8 | 10.0.0.0/8 | 10.1.2.3/8 10.1.2.3/8 | 10.0.0.0/32 | 10.1.2.3 - 10.1.2.3 | 10.1.2.3/32 | 10.1.2.3 - 10.1.2.3/24 | 10.1.2.0/24 | 10.1.2.3/24 10.1.2.3/16 | 10.1.0.0/16 | 10.1.2.3/16 - 10.1.2.3/8 | 10.0.0.0/8 | 10.1.2.3/8 + 10.1.2.3/24 | 10.1.2.0/24 | 10.1.2.3/24 + 10.1.2.3 | 10.1.2.3/32 | 10.1.2.3 11.1.2.3/8 | 10.0.0.0/8 | 11.1.2.3/8 - 9.1.2.3/8 | 10.0.0.0/8 | 11.1.2.3/8 + 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 + 192.168.1.226/24 | 192.168.1.0/24 | 192.168.1.226/24 + 192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.255/24 + 192.168.1.0/25 | 192.168.1.0/24 | 192.168.1.0/25 + 192.168.1.255/25 | 192.168.1.0/24 | 192.168.1.255/25 + 192.168.1.226 | 192.168.1.0/26 | 192.168.1.226 + ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | ::ffff:5.3.3.5 10:23::f1/64 | 10:23::f1/128 | 10:23::f1 10:23::ffff | 10:23::8000/113 | 10:23::ffff - ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | ::ffff:5.3.3.5 (17 rows) -SELECT i, i + 500 AS "i+500" FROM inet_tbl; +SELECT i, i + 500 AS "i+500" FROM inet_tbl ORDER BY i; i | i+500 ------------------+------------------ - 192.168.1.226/24 | 192.168.3.214/24 - 192.168.1.226 | 192.168.3.214 - 192.168.1.0/24 | 192.168.2.244/24 - 192.168.1.0/25 | 192.168.2.244/25 - 192.168.1.255/24 | 192.168.3.243/24 - 192.168.1.255/25 | 192.168.3.243/25 + 9.1.2.3/8 | 9.1.3.247/8 10.1.2.3/8 | 10.1.3.247/8 10.1.2.3/8 | 10.1.3.247/8 - 10.1.2.3 | 10.1.3.247 - 10.1.2.3/24 | 10.1.3.247/24 - 10.1.2.3/16 | 10.1.3.247/16 10.1.2.3/8 | 10.1.3.247/8 + 10.1.2.3/16 | 10.1.3.247/16 + 10.1.2.3/24 | 10.1.3.247/24 + 10.1.2.3 | 10.1.3.247 11.1.2.3/8 | 11.1.3.247/8 - 9.1.2.3/8 | 9.1.3.247/8 + 192.168.1.0/24 | 192.168.2.244/24 + 192.168.1.226/24 | 192.168.3.214/24 + 192.168.1.255/24 | 192.168.3.243/24 + 192.168.1.0/25 | 192.168.2.244/25 + 192.168.1.255/25 | 192.168.3.243/25 + 192.168.1.226 | 192.168.3.214 + ::4.3.2.1/24 | ::4.3.3.245/24 10:23::f1/64 | 10:23::2e5/64 10:23::ffff | 10:23::1:1f3 - ::4.3.2.1/24 | ::4.3.3.245/24 (17 rows) -SELECT i, i - 500 AS "i-500" FROM inet_tbl; +SELECT i, i - 500 AS "i-500" FROM inet_tbl ORDER BY i; i | i-500 ------------------+---------------------------------------- - 192.168.1.226/24 | 192.167.255.238/24 - 192.168.1.226 | 192.167.255.238 - 192.168.1.0/24 | 192.167.255.12/24 - 192.168.1.0/25 | 192.167.255.12/25 - 192.168.1.255/24 | 192.168.0.11/24 - 192.168.1.255/25 | 192.168.0.11/25 + 9.1.2.3/8 | 9.1.0.15/8 10.1.2.3/8 | 10.1.0.15/8 10.1.2.3/8 | 10.1.0.15/8 - 10.1.2.3 | 10.1.0.15 - 10.1.2.3/24 | 10.1.0.15/24 - 10.1.2.3/16 | 10.1.0.15/16 10.1.2.3/8 | 10.1.0.15/8 + 10.1.2.3/16 | 10.1.0.15/16 + 10.1.2.3/24 | 10.1.0.15/24 + 10.1.2.3 | 10.1.0.15 11.1.2.3/8 | 11.1.0.15/8 - 9.1.2.3/8 | 9.1.0.15/8 + 192.168.1.0/24 | 192.167.255.12/24 + 192.168.1.226/24 | 192.167.255.238/24 + 192.168.1.255/24 | 192.168.0.11/24 + 192.168.1.0/25 | 192.167.255.12/25 + 192.168.1.255/25 | 192.168.0.11/25 + 192.168.1.226 | 192.167.255.238 + ::4.3.2.1/24 | ::4.3.0.13/24 10:23::f1/64 | 10:22:ffff:ffff:ffff:ffff:ffff:fefd/64 10:23::ffff | 10:23::fe0b - ::4.3.2.1/24 | ::4.3.0.13/24 (17 rows) -SELECT i, c, i - c AS "minus" FROM inet_tbl; +SELECT i, c, i - c AS "minus" FROM inet_tbl ORDER BY i, c; i | c | minus ------------------+--------------------+------------------ - 192.168.1.226/24 | 192.168.1.0/24 | 226 - 192.168.1.226 | 192.168.1.0/26 | 226 - 192.168.1.0/24 | 192.168.1.0/24 | 0 - 192.168.1.0/25 | 192.168.1.0/24 | 0 - 192.168.1.255/24 | 192.168.1.0/24 | 255 - 192.168.1.255/25 | 192.168.1.0/24 | 255 + 9.1.2.3/8 | 10.0.0.0/8 | -16711165 + 10.1.2.3/8 | 10.0.0.0/8 | 66051 10.1.2.3/8 | 10.0.0.0/8 | 66051 10.1.2.3/8 | 10.0.0.0/32 | 66051 - 10.1.2.3 | 10.1.2.3/32 | 0 - 10.1.2.3/24 | 10.1.2.0/24 | 3 10.1.2.3/16 | 10.1.0.0/16 | 515 - 10.1.2.3/8 | 10.0.0.0/8 | 66051 + 10.1.2.3/24 | 10.1.2.0/24 | 3 + 10.1.2.3 | 10.1.2.3/32 | 0 11.1.2.3/8 | 10.0.0.0/8 | 16843267 - 9.1.2.3/8 | 10.0.0.0/8 | -16711165 + 192.168.1.0/24 | 192.168.1.0/24 | 0 + 192.168.1.226/24 | 192.168.1.0/24 | 226 + 192.168.1.255/24 | 192.168.1.0/24 | 255 + 192.168.1.0/25 | 192.168.1.0/24 | 0 + 192.168.1.255/25 | 192.168.1.0/24 | 255 + 192.168.1.226 | 192.168.1.0/26 | 226 + ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | -281470631346435 10:23::f1/64 | 10:23::f1/128 | 0 10:23::ffff | 10:23::8000/113 | 32767 - ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | -281470631346435 (17 rows) SELECT '127.0.0.1'::inet + 257; diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index 100edb3539..6c6301bfa9 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -31,7 +31,7 @@ INSERT INTO d(aa) VALUES('ddddd'); INSERT INTO d(aa) VALUES('dddddd'); INSERT INTO d(aa) VALUES('ddddddd'); INSERT INTO d(aa) VALUES('dddddddd'); -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+---------- a | aaa @@ -60,7 +60,7 @@ SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; d | dddddddd (24 rows) -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+----------+---- b | bbb | @@ -77,7 +77,7 @@ SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; d | dddddddd | (12 rows) -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----------+---- c | ccc | @@ -94,7 +94,7 @@ SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; d | dddddddd | (12 rows) -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+----------+----+----+---- d | ddd | | | @@ -105,7 +105,7 @@ SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; d | dddddddd | | | (6 rows) -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+---------- a | aaa @@ -116,7 +116,7 @@ SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; a | aaaaaaaa (6 rows) -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+----------+---- b | bbb | @@ -127,7 +127,7 @@ SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; b | bbbbbbbb | (6 rows) -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----------+---- c | ccc | @@ -138,7 +138,7 @@ SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; c | cccccccc | (6 rows) -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+----------+----+----+---- d | ddd | | | @@ -154,7 +154,7 @@ UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa'; UPDATE b SET aa='zzz' WHERE aa='aaa'; UPDATE ONLY b SET aa='zzz' WHERE aa='aaa'; UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%'; -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+---------- a | zzzz @@ -183,7 +183,7 @@ SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; d | dddddddd (24 rows) -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+----------+---- b | bbb | @@ -200,7 +200,7 @@ SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; d | dddddddd | (12 rows) -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----------+---- c | ccc | @@ -217,7 +217,7 @@ SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; d | dddddddd | (12 rows) -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+----------+----+----+---- d | ddd | | | @@ -228,7 +228,7 @@ SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; d | dddddddd | | | (6 rows) -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+-------- a | zzzz @@ -239,7 +239,7 @@ SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; a | zzzzzz (6 rows) -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+----------+---- b | bbb | @@ -250,7 +250,7 @@ SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; b | bbbbbbbb | (6 rows) -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----------+---- c | ccc | @@ -261,7 +261,7 @@ SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; c | cccccccc | (6 rows) -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+----------+----+----+---- d | ddd | | | @@ -273,7 +273,7 @@ SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; (6 rows) UPDATE b SET aa='new'; -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+---------- a | zzzz @@ -302,7 +302,7 @@ SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; d | new (24 rows) -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+-----+---- b | new | @@ -319,7 +319,7 @@ SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; d | new | (12 rows) -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----------+---- c | ccc | @@ -336,7 +336,7 @@ SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; d | new | (12 rows) -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+-----+----+----+---- d | new | | | @@ -347,7 +347,7 @@ SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; d | new | | | (6 rows) -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+-------- a | zzzz @@ -358,7 +358,7 @@ SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; a | zzzzzz (6 rows) -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+-----+---- b | new | @@ -369,7 +369,7 @@ SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; b | new | (6 rows) -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----------+---- c | ccc | @@ -380,7 +380,7 @@ SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; c | cccccccc | (6 rows) -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+-----+----+----+---- d | new | | | @@ -393,7 +393,7 @@ SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; UPDATE a SET aa='new'; DELETE FROM ONLY c WHERE aa='new'; -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+----- a | new @@ -416,7 +416,7 @@ SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; d | new (18 rows) -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+-----+---- b | new | @@ -433,7 +433,7 @@ SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; d | new | (12 rows) -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+-----+---- d | new | @@ -444,7 +444,7 @@ SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; d | new | (6 rows) -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+-----+----+----+---- d | new | | | @@ -455,7 +455,7 @@ SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; d | new | | | (6 rows) -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+----- a | new @@ -466,7 +466,7 @@ SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; a | new (6 rows) -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+-----+---- b | new | @@ -477,12 +477,12 @@ SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; b | new | (6 rows) -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----+---- (0 rows) -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+-----+----+----+---- d | new | | | @@ -494,42 +494,42 @@ SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; (6 rows) DELETE FROM a; -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+---- (0 rows) -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+----+---- (0 rows) -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----+---- (0 rows) -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+----+----+----+---- (0 rows) -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; relname | aa ---------+---- (0 rows) -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; relname | aa | bb ---------+----+---- (0 rows) -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; relname | aa | cc ---------+----+---- (0 rows) -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; relname | aa | bb | cc | dd ---------+----+----+----+---- (0 rows) @@ -625,7 +625,7 @@ INSERT INTO inhg VALUES ('x', 'text', 'y'); /* Succeeds */ INSERT INTO inhg VALUES ('x', 'text', 'y'); /* Succeeds -- Unique constraints not copied */ INSERT INTO inhg VALUES ('x', 'foo', 'y'); /* fails due to constraint */ ERROR: new row for relation "inhg" violates check constraint "foo" -SELECT * FROM inhg; /* Two records with three columns in order x=x, xx=text, y=y */ +SELECT * FROM inhg ORDER BY 1,2,3; /* Two records with three columns in order x=x, xx=text, y=y */ x | xx | y ---+------+--- x | text | y diff --git a/src/test/regress/expected/int2.out b/src/test/regress/expected/int2.out index 61ac956cb7..8685c0c5ea 100644 --- a/src/test/regress/expected/int2.out +++ b/src/test/regress/expected/int2.out @@ -43,91 +43,91 @@ INSERT INTO INT2_TBL(f1) VALUES (''); ERROR: invalid input syntax for integer: "" LINE 1: INSERT INTO INT2_TBL(f1) VALUES (''); ^ -SELECT '' AS five, * FROM INT2_TBL; +SELECT '' AS five, * FROM INT2_TBL ORDER BY f1; five | f1 ------+-------- + | -32767 + | -1234 | 0 | 1234 - | -1234 | 32767 - | -32767 (5 rows) -SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int2 '0'; +SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int2 '0' ORDER BY f1; four | f1 ------+-------- - | 1234 + | -32767 | -1234 + | 1234 | 32767 - | -32767 (4 rows) -SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int4 '0'; +SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int4 '0' ORDER BY f1; four | f1 ------+-------- - | 1234 + | -32767 | -1234 + | 1234 | 32767 - | -32767 (4 rows) -SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int2 '0'; +SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int2 '0' ORDER BY f1; one | f1 -----+---- | 0 (1 row) -SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int4 '0'; +SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int4 '0' ORDER BY f1; one | f1 -----+---- | 0 (1 row) -SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int2 '0'; +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int2 '0' ORDER BY f1; two | f1 -----+-------- - | -1234 | -32767 + | -1234 (2 rows) -SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int4 '0'; +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int4 '0' ORDER BY f1; two | f1 -----+-------- - | -1234 | -32767 + | -1234 (2 rows) -SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int2 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int2 '0' ORDER BY f1; three | f1 -------+-------- - | 0 - | -1234 | -32767 + | -1234 + | 0 (3 rows) -SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int4 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int4 '0' ORDER BY f1; three | f1 -------+-------- - | 0 - | -1234 | -32767 + | -1234 + | 0 (3 rows) -SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int2 '0'; +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int2 '0' ORDER BY f1; two | f1 -----+------- | 1234 | 32767 (2 rows) -SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int4 '0'; +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int4 '0' ORDER BY f1; two | f1 -----+------- | 1234 | 32767 (2 rows) -SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0' ORDER BY f1; three | f1 -------+------- | 0 @@ -135,7 +135,7 @@ SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0'; | 32767 (3 rows) -SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0' ORDER BY f1; three | f1 -------+------- | 0 @@ -144,103 +144,103 @@ SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0'; (3 rows) -- positive odds -SELECT '' AS one, i.* FROM INT2_TBL i WHERE (i.f1 % int2 '2') = int2 '1'; +SELECT '' AS one, i.* FROM INT2_TBL i WHERE (i.f1 % int2 '2') = int2 '1' ORDER BY f1; one | f1 -----+------- | 32767 (1 row) -- any evens -SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0' ORDER BY f1; three | f1 -------+------- + | -1234 | 0 | 1234 - | -1234 (3 rows) -SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i ORDER BY f1; ERROR: smallint out of range SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i -WHERE abs(f1) < 16384; +WHERE abs(f1) < 16384 ORDER BY f1; five | f1 | x ------+-------+------- + | -1234 | -2468 | 0 | 0 | 1234 | 2468 - | -1234 | -2468 (3 rows) -SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i ORDER BY f1; five | f1 | x ------+--------+-------- + | -32767 | -65534 + | -1234 | -2468 | 0 | 0 | 1234 | 2468 - | -1234 | -2468 | 32767 | 65534 - | -32767 | -65534 (5 rows) -SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i ORDER BY f1; ERROR: smallint out of range SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i -WHERE f1 < 32766; +WHERE f1 < 32766 ORDER BY f1; five | f1 | x ------+--------+-------- + | -32767 | -32765 + | -1234 | -1232 | 0 | 2 | 1234 | 1236 - | -1234 | -1232 - | -32767 | -32765 (4 rows) -SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i ORDER BY f1; five | f1 | x ------+--------+-------- + | -32767 | -32765 + | -1234 | -1232 | 0 | 2 | 1234 | 1236 - | -1234 | -1232 | 32767 | 32769 - | -32767 | -32765 (5 rows) -SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i ORDER BY f1; ERROR: smallint out of range SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i -WHERE f1 > -32767; +WHERE f1 > -32767 ORDER BY f1; five | f1 | x ------+-------+------- + | -1234 | -1236 | 0 | -2 | 1234 | 1232 - | -1234 | -1236 | 32767 | 32765 (4 rows) -SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i ORDER BY f1; five | f1 | x ------+--------+-------- + | -32767 | -32769 + | -1234 | -1236 | 0 | -2 | 1234 | 1232 - | -1234 | -1236 | 32767 | 32765 - | -32767 | -32769 (5 rows) -SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i ORDER BY f1; five | f1 | x ------+--------+-------- + | -32767 | -16383 + | -1234 | -617 | 0 | 0 | 1234 | 617 - | -1234 | -617 | 32767 | 16383 - | -32767 | -16383 (5 rows) -SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT2_TBL i ORDER BY f1; five | f1 | x ------+--------+-------- + | -32767 | -16383 + | -1234 | -617 | 0 | 0 | 1234 | 617 - | -1234 | -617 | 32767 | 16383 - | -32767 | -16383 (5 rows) diff --git a/src/test/regress/expected/int4.out b/src/test/regress/expected/int4.out index a21bbda2c9..95eb195aa6 100644 --- a/src/test/regress/expected/int4.out +++ b/src/test/regress/expected/int4.out @@ -53,22 +53,22 @@ SELECT '' AS five, * FROM INT4_TBL; | -2147483647 (5 rows) -SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int2 '0'; +SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int2 '0' ORDER BY f1; four | f1 ------+------------- - | 123456 + | -2147483647 | -123456 + | 123456 | 2147483647 - | -2147483647 (4 rows) -SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int4 '0'; +SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int4 '0' ORDER BY f1; four | f1 ------+------------- - | 123456 + | -2147483647 | -123456 + | 123456 | 2147483647 - | -2147483647 (4 rows) SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int2 '0'; @@ -83,51 +83,51 @@ SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int4 '0'; | 0 (1 row) -SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int2 '0'; +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int2 '0' ORDER BY f1; two | f1 -----+------------- - | -123456 | -2147483647 + | -123456 (2 rows) -SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int4 '0'; +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int4 '0' ORDER BY f1; two | f1 -----+------------- - | -123456 | -2147483647 + | -123456 (2 rows) -SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int2 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int2 '0' ORDER BY f1; three | f1 -------+------------- - | 0 - | -123456 | -2147483647 + | -123456 + | 0 (3 rows) -SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int4 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int4 '0' ORDER BY f1; three | f1 -------+------------- - | 0 - | -123456 | -2147483647 + | -123456 + | 0 (3 rows) -SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int2 '0'; +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int2 '0' ORDER BY f1; two | f1 -----+------------ | 123456 | 2147483647 (2 rows) -SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int4 '0'; +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int4 '0' ORDER BY f1; two | f1 -----+------------ | 123456 | 2147483647 (2 rows) -SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0' ORDER BY f1; three | f1 -------+------------ | 0 @@ -135,7 +135,7 @@ SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0'; | 2147483647 (3 rows) -SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0' ORDER BY f1; three | f1 -------+------------ | 0 @@ -144,109 +144,109 @@ SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0'; (3 rows) -- positive odds -SELECT '' AS one, i.* FROM INT4_TBL i WHERE (i.f1 % int2 '2') = int2 '1'; +SELECT '' AS one, i.* FROM INT4_TBL i WHERE (i.f1 % int2 '2') = int2 '1' ORDER BY f1; one | f1 -----+------------ | 2147483647 (1 row) -- any evens -SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0' ORDER BY f1; three | f1 -------+--------- + | -123456 | 0 | 123456 - | -123456 (3 rows) -SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i ORDER BY f1; ERROR: integer out of range SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i -WHERE abs(f1) < 1073741824; +WHERE abs(f1) < 1073741824 ORDER BY f1; five | f1 | x ------+---------+--------- + | -123456 | -246912 | 0 | 0 | 123456 | 246912 - | -123456 | -246912 (3 rows) -SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i ORDER BY f1; ERROR: integer out of range SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i -WHERE abs(f1) < 1073741824; +WHERE abs(f1) < 1073741824 ORDER BY f1; five | f1 | x ------+---------+--------- + | -123456 | -246912 | 0 | 0 | 123456 | 246912 - | -123456 | -246912 (3 rows) -SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i ORDER BY f1; ERROR: integer out of range SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i -WHERE f1 < 2147483646; +WHERE f1 < 2147483646 ORDER BY f1; five | f1 | x ------+-------------+------------- + | -2147483647 | -2147483645 + | -123456 | -123454 | 0 | 2 | 123456 | 123458 - | -123456 | -123454 - | -2147483647 | -2147483645 (4 rows) -SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i ORDER BY f1; ERROR: integer out of range SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i -WHERE f1 < 2147483646; +WHERE f1 < 2147483646 ORDER BY f1; five | f1 | x ------+-------------+------------- + | -2147483647 | -2147483645 + | -123456 | -123454 | 0 | 2 | 123456 | 123458 - | -123456 | -123454 - | -2147483647 | -2147483645 (4 rows) -SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i ORDER BY f1; ERROR: integer out of range SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i -WHERE f1 > -2147483647; +WHERE f1 > -2147483647 ORDER BY f1; five | f1 | x ------+------------+------------ + | -123456 | -123458 | 0 | -2 | 123456 | 123454 - | -123456 | -123458 | 2147483647 | 2147483645 (4 rows) -SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i ORDER BY f1; ERROR: integer out of range SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i -WHERE f1 > -2147483647; +WHERE f1 > -2147483647 ORDER BY f1; five | f1 | x ------+------------+------------ + | -123456 | -123458 | 0 | -2 | 123456 | 123454 - | -123456 | -123458 | 2147483647 | 2147483645 (4 rows) -SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i ORDER BY f1; five | f1 | x ------+-------------+------------- + | -2147483647 | -1073741823 + | -123456 | -61728 | 0 | 0 | 123456 | 61728 - | -123456 | -61728 | 2147483647 | 1073741823 - | -2147483647 | -1073741823 (5 rows) -SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i ORDER BY f1; five | f1 | x ------+-------------+------------- + | -2147483647 | -1073741823 + | -123456 | -61728 | 0 | 0 | 123456 | 61728 - | -123456 | -61728 | 2147483647 | 1073741823 - | -2147483647 | -1073741823 (5 rows) -- diff --git a/src/test/regress/expected/int8.out b/src/test/regress/expected/int8.out index c8e2dad683..579c4d8ed5 100644 --- a/src/test/regress/expected/int8.out +++ b/src/test/regress/expected/int8.out @@ -37,56 +37,56 @@ INSERT INTO INT8_TBL(q1) VALUES (''); ERROR: invalid input syntax for integer: "" LINE 1: INSERT INTO INT8_TBL(q1) VALUES (''); ^ -SELECT * FROM INT8_TBL; +SELECT * FROM INT8_TBL ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (5 rows) -- int8/int8 cmp -SELECT * FROM INT8_TBL WHERE q2 = 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 = 4567890123456789 ORDER BY q1,q2; q1 | q2 ------------------+------------------ 123 | 4567890123456789 4567890123456789 | 4567890123456789 (2 rows) -SELECT * FROM INT8_TBL WHERE q2 <> 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 <> 4567890123456789 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 456 - 4567890123456789 | 123 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 (3 rows) -SELECT * FROM INT8_TBL WHERE q2 < 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 < 4567890123456789 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 456 - 4567890123456789 | 123 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 (3 rows) -SELECT * FROM INT8_TBL WHERE q2 > 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 > 4567890123456789 ORDER BY q1,q2; q1 | q2 ----+---- (0 rows) -SELECT * FROM INT8_TBL WHERE q2 <= 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 <= 4567890123456789 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (5 rows) -SELECT * FROM INT8_TBL WHERE q2 >= 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 >= 4567890123456789 ORDER BY q1,q2; q1 | q2 ------------------+------------------ 123 | 4567890123456789 @@ -94,44 +94,44 @@ SELECT * FROM INT8_TBL WHERE q2 >= 4567890123456789; (2 rows) -- int8/int4 cmp -SELECT * FROM INT8_TBL WHERE q2 = 456; +SELECT * FROM INT8_TBL WHERE q2 = 456 ORDER BY q1,q2; q1 | q2 -----+----- 123 | 456 (1 row) -SELECT * FROM INT8_TBL WHERE q2 <> 456; +SELECT * FROM INT8_TBL WHERE q2 <> 456 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (4 rows) -SELECT * FROM INT8_TBL WHERE q2 < 456; +SELECT * FROM INT8_TBL WHERE q2 < 456 ORDER BY q1,q2; q1 | q2 ------------------+------------------- - 4567890123456789 | 123 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 (2 rows) -SELECT * FROM INT8_TBL WHERE q2 > 456; +SELECT * FROM INT8_TBL WHERE q2 > 456 ORDER BY q1,q2; q1 | q2 ------------------+------------------ 123 | 4567890123456789 4567890123456789 | 4567890123456789 (2 rows) -SELECT * FROM INT8_TBL WHERE q2 <= 456; +SELECT * FROM INT8_TBL WHERE q2 <= 456 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 456 - 4567890123456789 | 123 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 (3 rows) -SELECT * FROM INT8_TBL WHERE q2 >= 456; +SELECT * FROM INT8_TBL WHERE q2 >= 456 ORDER BY q1,q2; q1 | q2 ------------------+------------------ 123 | 456 @@ -140,45 +140,45 @@ SELECT * FROM INT8_TBL WHERE q2 >= 456; (3 rows) -- int4/int8 cmp -SELECT * FROM INT8_TBL WHERE 123 = q1; +SELECT * FROM INT8_TBL WHERE 123 = q1 ORDER BY q1,q2; q1 | q2 -----+------------------ 123 | 456 123 | 4567890123456789 (2 rows) -SELECT * FROM INT8_TBL WHERE 123 <> q1; +SELECT * FROM INT8_TBL WHERE 123 <> q1 ORDER BY q1,q2; q1 | q2 ------------------+------------------- + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (3 rows) -SELECT * FROM INT8_TBL WHERE 123 < q1; +SELECT * FROM INT8_TBL WHERE 123 < q1 ORDER BY q1,q2; q1 | q2 ------------------+------------------- + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (3 rows) -SELECT * FROM INT8_TBL WHERE 123 > q1; +SELECT * FROM INT8_TBL WHERE 123 > q1 ORDER BY q1,q2; q1 | q2 ----+---- (0 rows) -SELECT * FROM INT8_TBL WHERE 123 <= q1; +SELECT * FROM INT8_TBL WHERE 123 <= q1 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (5 rows) -SELECT * FROM INT8_TBL WHERE 123 >= q1; +SELECT * FROM INT8_TBL WHERE 123 >= q1 ORDER BY q1,q2; q1 | q2 -----+------------------ 123 | 456 @@ -186,44 +186,44 @@ SELECT * FROM INT8_TBL WHERE 123 >= q1; (2 rows) -- int8/int2 cmp -SELECT * FROM INT8_TBL WHERE q2 = '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 = '456'::int2 ORDER BY q1,q2; q1 | q2 -----+----- 123 | 456 (1 row) -SELECT * FROM INT8_TBL WHERE q2 <> '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 <> '456'::int2 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (4 rows) -SELECT * FROM INT8_TBL WHERE q2 < '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 < '456'::int2 ORDER BY q1,q2; q1 | q2 ------------------+------------------- - 4567890123456789 | 123 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 (2 rows) -SELECT * FROM INT8_TBL WHERE q2 > '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 > '456'::int2 ORDER BY q1,q2; q1 | q2 ------------------+------------------ 123 | 4567890123456789 4567890123456789 | 4567890123456789 (2 rows) -SELECT * FROM INT8_TBL WHERE q2 <= '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 <= '456'::int2 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 456 - 4567890123456789 | 123 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 (3 rows) -SELECT * FROM INT8_TBL WHERE q2 >= '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 >= '456'::int2 ORDER BY q1,q2; q1 | q2 ------------------+------------------ 123 | 456 @@ -232,52 +232,52 @@ SELECT * FROM INT8_TBL WHERE q2 >= '456'::int2; (3 rows) -- int2/int8 cmp -SELECT * FROM INT8_TBL WHERE '123'::int2 = q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 = q1 ORDER BY q1,q2; q1 | q2 -----+------------------ 123 | 456 123 | 4567890123456789 (2 rows) -SELECT * FROM INT8_TBL WHERE '123'::int2 <> q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 <> q1 ORDER BY q1,q2; q1 | q2 ------------------+------------------- + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (3 rows) -SELECT * FROM INT8_TBL WHERE '123'::int2 < q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 < q1 ORDER BY q1,q2; q1 | q2 ------------------+------------------- + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (3 rows) -SELECT * FROM INT8_TBL WHERE '123'::int2 > q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 > q1 ORDER BY q1,q2; q1 | q2 ----+---- (0 rows) -SELECT * FROM INT8_TBL WHERE '123'::int2 <= q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 <= q1 ORDER BY q1,q2; q1 | q2 ------------------+------------------- 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (5 rows) -SELECT * FROM INT8_TBL WHERE '123'::int2 >= q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 >= q1 ORDER BY q1,q2; q1 | q2 -----+------------------ 123 | 456 123 | 4567890123456789 (2 rows) -SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL; +SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL ORDER BY q1; five | plus | minus ------+------------------+------------------- | 123 | -123 @@ -287,30 +287,30 @@ SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL; | 4567890123456789 | -4567890123456789 (5 rows) -SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL; +SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL ORDER BY q1,q2; five | q1 | q2 | plus ------+------------------+-------------------+------------------ | 123 | 456 | 579 | 123 | 4567890123456789 | 4567890123456912 + | 4567890123456789 | -4567890123456789 | 0 | 4567890123456789 | 123 | 4567890123456912 | 4567890123456789 | 4567890123456789 | 9135780246913578 - | 4567890123456789 | -4567890123456789 | 0 (5 rows) -SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL; +SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL ORDER BY q1,q2; five | q1 | q2 | minus ------+------------------+-------------------+------------------- | 123 | 456 | -333 | 123 | 4567890123456789 | -4567890123456666 + | 4567890123456789 | -4567890123456789 | 9135780246913578 | 4567890123456789 | 123 | 4567890123456666 | 4567890123456789 | 4567890123456789 | 0 - | 4567890123456789 | -4567890123456789 | 9135780246913578 (5 rows) -SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL; +SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL ORDER BY q1,q2; ERROR: bigint out of range SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL - WHERE q1 < 1000 or (q2 > 0 and q2 < 1000); + WHERE q1 < 1000 or (q2 > 0 and q2 < 1000) ORDER BY q1,q2; three | q1 | q2 | multiply -------+------------------+------------------+-------------------- | 123 | 456 | 56088 @@ -318,17 +318,17 @@ SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL | 4567890123456789 | 123 | 561850485185185047 (3 rows) -SELECT '' AS five, q1, q2, q1 / q2 AS divide, q1 % q2 AS mod FROM INT8_TBL; +SELECT '' AS five, q1, q2, q1 / q2 AS divide, q1 % q2 AS mod FROM INT8_TBL ORDER BY q1,q2; five | q1 | q2 | divide | mod ------+------------------+-------------------+----------------+----- | 123 | 456 | 0 | 123 | 123 | 4567890123456789 | 0 | 123 + | 4567890123456789 | -4567890123456789 | -1 | 0 | 4567890123456789 | 123 | 37137318076884 | 57 | 4567890123456789 | 4567890123456789 | 1 | 0 - | 4567890123456789 | -4567890123456789 | -1 | 0 (5 rows) -SELECT '' AS five, q1, float8(q1) FROM INT8_TBL; +SELECT '' AS five, q1, float8(q1) FROM INT8_TBL ORDER BY q1; five | q1 | float8 ------+------------------+---------------------- | 123 | 123 @@ -338,17 +338,17 @@ SELECT '' AS five, q1, float8(q1) FROM INT8_TBL; | 4567890123456789 | 4.56789012345679e+15 (5 rows) -SELECT '' AS five, q2, float8(q2) FROM INT8_TBL; +SELECT '' AS five, q2, float8(q2) FROM INT8_TBL ORDER BY q2; five | q2 | float8 ------+-------------------+----------------------- + | -4567890123456789 | -4.56789012345679e+15 + | 123 | 123 | 456 | 456 | 4567890123456789 | 4.56789012345679e+15 - | 123 | 123 | 4567890123456789 | 4.56789012345679e+15 - | -4567890123456789 | -4.56789012345679e+15 (5 rows) -SELECT 37 + q1 AS plus4 FROM INT8_TBL; +SELECT 37 + q1 AS plus4 FROM INT8_TBL ORDER BY q1; plus4 ------------------ 160 @@ -358,7 +358,7 @@ SELECT 37 + q1 AS plus4 FROM INT8_TBL; 4567890123456826 (5 rows) -SELECT 37 - q1 AS minus4 FROM INT8_TBL; +SELECT 37 - q1 AS minus4 FROM INT8_TBL ORDER BY q1; minus4 ------------------- -86 @@ -368,7 +368,7 @@ SELECT 37 - q1 AS minus4 FROM INT8_TBL; -4567890123456752 (5 rows) -SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL; +SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL ORDER BY q1; five | twice int4 ------+------------------ | 246 @@ -378,7 +378,7 @@ SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL; | 9135780246913578 (5 rows) -SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL; +SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL ORDER BY q1; five | twice int4 ------+------------------ | 246 @@ -389,7 +389,7 @@ SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL; (5 rows) -- int8 op int4 -SELECT q1 + 42::int4 AS "8plus4", q1 - 42::int4 AS "8minus4", q1 * 42::int4 AS "8mul4", q1 / 42::int4 AS "8div4" FROM INT8_TBL; +SELECT q1 + 42::int4 AS "8plus4", q1 - 42::int4 AS "8minus4", q1 * 42::int4 AS "8mul4", q1 / 42::int4 AS "8div4" FROM INT8_TBL ORDER BY q1; 8plus4 | 8minus4 | 8mul4 | 8div4 ------------------+------------------+--------------------+----------------- 165 | 81 | 5166 | 2 @@ -400,7 +400,7 @@ SELECT q1 + 42::int4 AS "8plus4", q1 - 42::int4 AS "8minus4", q1 * 42::int4 AS " (5 rows) -- int4 op int8 -SELECT 246::int4 + q1 AS "4plus8", 246::int4 - q1 AS "4minus8", 246::int4 * q1 AS "4mul8", 246::int4 / q1 AS "4div8" FROM INT8_TBL; +SELECT 246::int4 + q1 AS "4plus8", 246::int4 - q1 AS "4minus8", 246::int4 * q1 AS "4mul8", 246::int4 / q1 AS "4div8" FROM INT8_TBL ORDER BY q1; 4plus8 | 4minus8 | 4mul8 | 4div8 ------------------+-------------------+---------------------+------- 369 | 123 | 30258 | 2 @@ -411,7 +411,7 @@ SELECT 246::int4 + q1 AS "4plus8", 246::int4 - q1 AS "4minus8", 246::int4 * q1 A (5 rows) -- int8 op int2 -SELECT q1 + 42::int2 AS "8plus2", q1 - 42::int2 AS "8minus2", q1 * 42::int2 AS "8mul2", q1 / 42::int2 AS "8div2" FROM INT8_TBL; +SELECT q1 + 42::int2 AS "8plus2", q1 - 42::int2 AS "8minus2", q1 * 42::int2 AS "8mul2", q1 / 42::int2 AS "8div2" FROM INT8_TBL ORDER BY q1; 8plus2 | 8minus2 | 8mul2 | 8div2 ------------------+------------------+--------------------+----------------- 165 | 81 | 5166 | 2 @@ -422,7 +422,7 @@ SELECT q1 + 42::int2 AS "8plus2", q1 - 42::int2 AS "8minus2", q1 * 42::int2 AS " (5 rows) -- int2 op int8 -SELECT 246::int2 + q1 AS "2plus8", 246::int2 - q1 AS "2minus8", 246::int2 * q1 AS "2mul8", 246::int2 / q1 AS "2div8" FROM INT8_TBL; +SELECT 246::int2 + q1 AS "2plus8", 246::int2 - q1 AS "2minus8", 246::int2 * q1 AS "2mul8", 246::int2 / q1 AS "2div8" FROM INT8_TBL ORDER BY q1; 2plus8 | 2minus8 | 2mul8 | 2div8 ------------------+-------------------+---------------------+------- 369 | 123 | 30258 | 2 @@ -432,14 +432,14 @@ SELECT 246::int2 + q1 AS "2plus8", 246::int2 - q1 AS "2minus8", 246::int2 * q1 A 4567890123457035 | -4567890123456543 | 1123700970370370094 | 0 (5 rows) -SELECT q2, abs(q2) FROM INT8_TBL; +SELECT q2, abs(q2) FROM INT8_TBL ORDER BY q2; q2 | abs -------------------+------------------ + -4567890123456789 | 4567890123456789 + 123 | 123 456 | 456 4567890123456789 | 4567890123456789 - 123 | 123 4567890123456789 | 4567890123456789 - -4567890123456789 | 4567890123456789 (5 rows) SELECT min(q1), min(q2) FROM INT8_TBL; @@ -457,177 +457,177 @@ SELECT max(q1), max(q2) FROM INT8_TBL; -- TO_CHAR() -- SELECT '' AS to_char_1, to_char(q1, '9G999G999G999G999G999'), to_char(q2, '9,999,999,999,999,999') - FROM INT8_TBL; + FROM INT8_TBL ORDER BY q1,q2; to_char_1 | to_char | to_char -----------+------------------------+------------------------ | 123 | 456 | 123 | 4,567,890,123,456,789 + | 4,567,890,123,456,789 | -4,567,890,123,456,789 | 4,567,890,123,456,789 | 123 | 4,567,890,123,456,789 | 4,567,890,123,456,789 - | 4,567,890,123,456,789 | -4,567,890,123,456,789 (5 rows) SELECT '' AS to_char_2, to_char(q1, '9G999G999G999G999G999D999G999'), to_char(q2, '9,999,999,999,999,999.999,999') - FROM INT8_TBL; + FROM INT8_TBL ORDER BY q1,q2; to_char_2 | to_char | to_char -----------+--------------------------------+-------------------------------- | 123.000,000 | 456.000,000 | 123.000,000 | 4,567,890,123,456,789.000,000 + | 4,567,890,123,456,789.000,000 | -4,567,890,123,456,789.000,000 | 4,567,890,123,456,789.000,000 | 123.000,000 | 4,567,890,123,456,789.000,000 | 4,567,890,123,456,789.000,000 - | 4,567,890,123,456,789.000,000 | -4,567,890,123,456,789.000,000 (5 rows) SELECT '' AS to_char_3, to_char( (q1 * -1), '9999999999999999PR'), to_char( (q2 * -1), '9999999999999999.999PR') - FROM INT8_TBL; + FROM INT8_TBL ORDER BY q1,q2; to_char_3 | to_char | to_char -----------+--------------------+------------------------ | <123> | <456.000> | <123> | <4567890123456789.000> + | <4567890123456789> | 4567890123456789.000 | <4567890123456789> | <123.000> | <4567890123456789> | <4567890123456789.000> - | <4567890123456789> | 4567890123456789.000 (5 rows) SELECT '' AS to_char_4, to_char( (q1 * -1), '9999999999999999S'), to_char( (q2 * -1), 'S9999999999999999') - FROM INT8_TBL; + FROM INT8_TBL ORDER BY q1,q2; to_char_4 | to_char | to_char -----------+-------------------+------------------- | 123- | -456 | 123- | -4567890123456789 + | 4567890123456789- | +4567890123456789 | 4567890123456789- | -123 | 4567890123456789- | -4567890123456789 - | 4567890123456789- | +4567890123456789 (5 rows) -SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL ORDER BY q2; to_char_5 | to_char -----------+------------------- + | -4567890123456789 + | 123 | 456 | 4567890123456789 - | 123 | 4567890123456789 - | -4567890123456789 (5 rows) -SELECT '' AS to_char_6, to_char(q2, 'FMS9999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_6, to_char(q2, 'FMS9999999999999999') FROM INT8_TBL ORDER BY q2; to_char_6 | to_char -----------+------------------- + | -4567890123456789 + | +123 | +456 | +4567890123456789 - | +123 | +4567890123456789 - | -4567890123456789 (5 rows) -SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL; +SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL ORDER BY q2; to_char_7 | to_char -----------+-------------------- + | <4567890123456789> + | 123RD | 456TH | 4567890123456789TH - | 123RD | 4567890123456789TH - | <4567890123456789> (5 rows) -SELECT '' AS to_char_8, to_char(q2, 'SG9999999999999999th') FROM INT8_TBL; +SELECT '' AS to_char_8, to_char(q2, 'SG9999999999999999th') FROM INT8_TBL ORDER BY q2; to_char_8 | to_char -----------+--------------------- + | -4567890123456789 + | + 123rd | + 456th | +4567890123456789th - | + 123rd | +4567890123456789th - | -4567890123456789 (5 rows) -SELECT '' AS to_char_9, to_char(q2, '0999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_9, to_char(q2, '0999999999999999') FROM INT8_TBL ORDER BY q2; to_char_9 | to_char -----------+------------------- + | -4567890123456789 + | 0000000000000123 | 0000000000000456 | 4567890123456789 - | 0000000000000123 | 4567890123456789 - | -4567890123456789 (5 rows) -SELECT '' AS to_char_10, to_char(q2, 'S0999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_10, to_char(q2, 'S0999999999999999') FROM INT8_TBL ORDER BY q2; to_char_10 | to_char ------------+------------------- + | -4567890123456789 + | +0000000000000123 | +0000000000000456 | +4567890123456789 - | +0000000000000123 | +4567890123456789 - | -4567890123456789 (5 rows) -SELECT '' AS to_char_11, to_char(q2, 'FM0999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_11, to_char(q2, 'FM0999999999999999') FROM INT8_TBL ORDER BY q2; to_char_11 | to_char ------------+------------------- + | -4567890123456789 + | 0000000000000123 | 0000000000000456 | 4567890123456789 - | 0000000000000123 | 4567890123456789 - | -4567890123456789 (5 rows) -SELECT '' AS to_char_12, to_char(q2, 'FM9999999999999999.000') FROM INT8_TBL; +SELECT '' AS to_char_12, to_char(q2, 'FM9999999999999999.000') FROM INT8_TBL ORDER BY q2; to_char_12 | to_char ------------+----------------------- + | -4567890123456789.000 + | 123.000 | 456.000 | 4567890123456789.000 - | 123.000 | 4567890123456789.000 - | -4567890123456789.000 (5 rows) -SELECT '' AS to_char_13, to_char(q2, 'L9999999999999999.000') FROM INT8_TBL; +SELECT '' AS to_char_13, to_char(q2, 'L9999999999999999.000') FROM INT8_TBL ORDER BY q2; to_char_13 | to_char ------------+------------------------ + | -4567890123456789.000 + | 123.000 | 456.000 | 4567890123456789.000 - | 123.000 | 4567890123456789.000 - | -4567890123456789.000 (5 rows) -SELECT '' AS to_char_14, to_char(q2, 'FM9999999999999999.999') FROM INT8_TBL; +SELECT '' AS to_char_14, to_char(q2, 'FM9999999999999999.999') FROM INT8_TBL ORDER BY q2; to_char_14 | to_char ------------+-------------------- + | -4567890123456789. + | 123. | 456. | 4567890123456789. - | 123. | 4567890123456789. - | -4567890123456789. (5 rows) -SELECT '' AS to_char_15, to_char(q2, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9') FROM INT8_TBL; +SELECT '' AS to_char_15, to_char(q2, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9') FROM INT8_TBL ORDER BY q2; to_char_15 | to_char ------------+------------------------------------------- + | -4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0 + | +1 2 3 . 0 0 0 | +4 5 6 . 0 0 0 | +4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0 - | +1 2 3 . 0 0 0 | +4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0 - | -4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0 (5 rows) -SELECT '' AS to_char_16, to_char(q2, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL; +SELECT '' AS to_char_16, to_char(q2, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL ORDER BY q2; to_char_16 | to_char ------------+----------------------------------------------------------- + | -45678 text 9012 9999 345 "text between quote marks" 6789 + | text 9999 "text between quote marks" 123 | text 9999 "text between quote marks" 456 | 45678 text 9012 9999 345 "text between quote marks" 6789 - | text 9999 "text between quote marks" 123 | 45678 text 9012 9999 345 "text between quote marks" 6789 - | -45678 text 9012 9999 345 "text between quote marks" 6789 (5 rows) -SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL; +SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL ORDER BY q2; to_char_17 | to_char ------------+------------------- + | 456789-0123456789 + | + 123 | + 456 | 456789+0123456789 - | + 123 | 456789+0123456789 - | 456789-0123456789 (5 rows) -- check min/max values and overflow behavior @@ -703,21 +703,21 @@ select '100'::int2 * '9223372036854775800'::int8; ERROR: bigint out of range select '100'::int2 / '0'::int8; ERROR: division by zero -SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 = 456; +SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 = 456 ORDER BY q1; q1 ----- 123 (1 row) -SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 <> 456; +SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 <> 456 ORDER BY q1; ERROR: integer out of range -SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 = 456; +SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 = 456 ORDER BY q1; q1 ----- 123 (1 row) -SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 <> 456; +SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 <> 456 ORDER BY q1; ERROR: smallint out of range SELECT CAST('42'::int2 AS int8), CAST('-37'::int2 AS int8); int8 | int8 @@ -725,14 +725,14 @@ SELECT CAST('42'::int2 AS int8), CAST('-37'::int2 AS int8); 42 | -37 (1 row) -SELECT CAST(q1 AS float4), CAST(q2 AS float8) FROM INT8_TBL; +SELECT CAST(q1 AS float4), CAST(q2 AS float8) FROM INT8_TBL ORDER BY q1,q2; q1 | q2 -------------+----------------------- 123 | 456 123 | 4.56789012345679e+15 + 4.56789e+15 | -4.56789012345679e+15 4.56789e+15 | 123 4.56789e+15 | 4.56789012345679e+15 - 4.56789e+15 | -4.56789012345679e+15 (5 rows) SELECT CAST('36854775807.0'::float4 AS int8); @@ -743,26 +743,26 @@ SELECT CAST('36854775807.0'::float4 AS int8); SELECT CAST('922337203685477580700.0'::float8 AS int8); ERROR: bigint out of range -SELECT CAST(q1 AS oid) FROM INT8_TBL; +SELECT CAST(q1 AS oid) FROM INT8_TBL ORDER BY q1; ERROR: OID out of range -SELECT oid::int8 FROM pg_class WHERE relname = 'pg_class'; +SELECT oid::int8 FROM pg_class WHERE relname = 'pg_class' ORDER BY oid; oid ------ 1259 (1 row) -- bit operations -SELECT q1, q2, q1 & q2 AS "and", q1 | q2 AS "or", q1 # q2 AS "xor", ~q1 AS "not" FROM INT8_TBL; +SELECT q1, q2, q1 & q2 AS "and", q1 | q2 AS "or", q1 # q2 AS "xor", ~q1 AS "not" FROM INT8_TBL ORDER BY q1,q2; q1 | q2 | and | or | xor | not ------------------+-------------------+------------------+------------------+------------------+------------------- 123 | 456 | 72 | 507 | 435 | -124 123 | 4567890123456789 | 17 | 4567890123456895 | 4567890123456878 | -124 + 4567890123456789 | -4567890123456789 | 1 | -1 | -2 | -4567890123456790 4567890123456789 | 123 | 17 | 4567890123456895 | 4567890123456878 | -4567890123456790 4567890123456789 | 4567890123456789 | 4567890123456789 | 4567890123456789 | 0 | -4567890123456790 - 4567890123456789 | -4567890123456789 | 1 | -1 | -2 | -4567890123456790 (5 rows) -SELECT q1, q1 << 2 AS "shl", q1 >> 3 AS "shr" FROM INT8_TBL; +SELECT q1, q1 << 2 AS "shl", q1 >> 3 AS "shr" FROM INT8_TBL ORDER BY q1; q1 | shl | shr ------------------+-------------------+----------------- 123 | 492 | 15 diff --git a/src/test/regress/expected/interval.out b/src/test/regress/expected/interval.out index a6f50b4622..f96f48e08e 100644 --- a/src/test/regress/expected/interval.out +++ b/src/test/regress/expected/interval.out @@ -73,85 +73,85 @@ ERROR: invalid input syntax for type interval: "@ 30 eons ago" LINE 1: INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 30 eons ago'); ^ -- test interval operators -SELECT '' AS ten, * FROM INTERVAL_TBL; +SELECT '' AS ten, * FROM INTERVAL_TBL ORDER BY f1; ten | f1 -----+----------------- + | -00:00:14 | 00:01:00 | 05:00:00 + | 1 day 02:03:04 | 10 days - | 34 years | 3 mons - | -00:00:14 - | 1 day 02:03:04 - | 6 years | 5 mons | 5 mons 12:00:00 + | 6 years + | 34 years (10 rows) SELECT '' AS nine, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 <> interval '@ 10 days'; + WHERE INTERVAL_TBL.f1 <> interval '@ 10 days' ORDER BY f1; nine | f1 ------+----------------- + | -00:00:14 | 00:01:00 | 05:00:00 - | 34 years - | 3 mons - | -00:00:14 | 1 day 02:03:04 - | 6 years + | 3 mons | 5 mons | 5 mons 12:00:00 + | 6 years + | 34 years (9 rows) SELECT '' AS three, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 <= interval '@ 5 hours'; + WHERE INTERVAL_TBL.f1 <= interval '@ 5 hours' ORDER BY f1; three | f1 -------+----------- + | -00:00:14 | 00:01:00 | 05:00:00 - | -00:00:14 (3 rows) SELECT '' AS three, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 < interval '@ 1 day'; + WHERE INTERVAL_TBL.f1 < interval '@ 1 day' ORDER BY f1; three | f1 -------+----------- + | -00:00:14 | 00:01:00 | 05:00:00 - | -00:00:14 (3 rows) SELECT '' AS one, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 = interval '@ 34 years'; + WHERE INTERVAL_TBL.f1 = interval '@ 34 years' ORDER BY f1; one | f1 -----+---------- | 34 years (1 row) SELECT '' AS five, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 >= interval '@ 1 month'; + WHERE INTERVAL_TBL.f1 >= interval '@ 1 month' ORDER BY f1; five | f1 ------+----------------- - | 34 years | 3 mons - | 6 years | 5 mons | 5 mons 12:00:00 + | 6 years + | 34 years (5 rows) SELECT '' AS nine, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 > interval '@ 3 seconds ago'; + WHERE INTERVAL_TBL.f1 > interval '@ 3 seconds ago' ORDER BY f1; nine | f1 ------+----------------- | 00:01:00 | 05:00:00 + | 1 day 02:03:04 | 10 days - | 34 years | 3 mons - | 1 day 02:03:04 - | 6 years | 5 mons | 5 mons 12:00:00 + | 6 years + | 34 years (9 rows) SELECT '' AS fortyfive, r1.*, r2.* @@ -217,77 +217,77 @@ SELECT '' AS fortyfive, r1.*, r2.* CREATE TABLE INTERVAL_MULDIV_TBL (span interval); COPY INTERVAL_MULDIV_TBL FROM STDIN; SELECT span * 0.3 AS product -FROM INTERVAL_MULDIV_TBL; +FROM INTERVAL_MULDIV_TBL ORDER BY span; product ------------------------------------ - 1 year 12 days 122:24:00 -1 years -12 days +93:36:00 - -3 days -14:24:00 - 2 mons 13 days 01:22:28.8 -10 mons +120 days 37:28:21.6567 + -3 days -14:24:00 1 mon 6 days + 2 mons 13 days 01:22:28.8 4 mons 6 days + 1 year 12 days 122:24:00 24 years 11 mons 320 days 16:48:00 (8 rows) SELECT span * 8.2 AS product -FROM INTERVAL_MULDIV_TBL; +FROM INTERVAL_MULDIV_TBL ORDER BY span; product --------------------------------------------- - 28 years 104 days 2961:36:00 -28 years -104 days +2942:24:00 - -98 days -09:36:00 - 6 years 1 mon -197 days +93:34:27.2 -24 years -7 mons +3946 days 640:15:11.9498 + -98 days -09:36:00 2 years 8 mons 24 days + 6 years 1 mon -197 days +93:34:27.2 9 years 6 mons 24 days + 28 years 104 days 2961:36:00 682 years 7 mons 8215 days 19:12:00 (8 rows) SELECT span / 10 AS quotient -FROM INTERVAL_MULDIV_TBL; +FROM INTERVAL_MULDIV_TBL ORDER BY span; quotient ---------------------------------- - 4 mons 4 days 40:48:00 -4 mons -4 days +31:12:00 - -1 days -04:48:00 - 25 days -15:32:30.4 -3 mons +30 days 12:29:27.2189 + -1 days -04:48:00 12 days + 25 days -15:32:30.4 1 mon 12 days + 4 mons 4 days 40:48:00 8 years 3 mons 126 days 21:36:00 (8 rows) SELECT span / 100 AS quotient -FROM INTERVAL_MULDIV_TBL; +FROM INTERVAL_MULDIV_TBL ORDER BY span; quotient ------------------------- - 12 days 13:40:48 -12 days -06:28:48 - -02:52:48 - 2 days 10:26:44.96 -6 days +01:14:56.72189 + -02:52:48 1 day 04:48:00 + 2 days 10:26:44.96 4 days 04:48:00 + 12 days 13:40:48 9 mons 39 days 16:33:36 (8 rows) DROP TABLE INTERVAL_MULDIV_TBL; SET DATESTYLE = 'postgres'; SET IntervalStyle to postgres_verbose; -SELECT '' AS ten, * FROM INTERVAL_TBL; +SELECT '' AS ten, * FROM INTERVAL_TBL ORDER BY f1; ten | f1 -----+------------------------------- + | @ 14 secs ago | @ 1 min | @ 5 hours + | @ 1 day 2 hours 3 mins 4 secs | @ 10 days - | @ 34 years | @ 3 mons - | @ 14 secs ago - | @ 1 day 2 hours 3 mins 4 secs - | @ 6 years | @ 5 mons | @ 5 mons 12 hours + | @ 6 years + | @ 34 years (10 rows) -- test avg(interval), which is somewhat fragile since people have been diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index 8e6fc13bb3..b8f1baacae 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -37,9 +37,11 @@ INSERT INTO J2_TBL VALUES (NULL, 0); -- before diving into more complex join syntax. -- SELECT '' AS "xxx", * - FROM J1_TBL AS tx; + FROM J1_TBL AS tx + ORDER BY i, j, t; xxx | i | j | t -----+---+---+------- + | 0 | | zero | 1 | 4 | one | 2 | 3 | two | 3 | 2 | three @@ -48,15 +50,16 @@ SELECT '' AS "xxx", * | 6 | 6 | six | 7 | 7 | seven | 8 | 8 | eight - | 0 | | zero - | | | null | | 0 | zero + | | | null (11 rows) SELECT '' AS "xxx", * - FROM J1_TBL tx; + FROM J1_TBL tx + ORDER BY i, j, t; xxx | i | j | t -----+---+---+------- + | 0 | | zero | 1 | 4 | one | 2 | 3 | two | 3 | 2 | three @@ -65,15 +68,16 @@ SELECT '' AS "xxx", * | 6 | 6 | six | 7 | 7 | seven | 8 | 8 | eight - | 0 | | zero - | | | null | | 0 | zero + | | | null (11 rows) SELECT '' AS "xxx", * - FROM J1_TBL AS t1 (a, b, c); + FROM J1_TBL AS t1 (a, b, c) + ORDER BY a, b, c; xxx | a | b | c -----+---+---+------- + | 0 | | zero | 1 | 4 | one | 2 | 3 | two | 3 | 2 | three @@ -82,15 +86,16 @@ SELECT '' AS "xxx", * | 6 | 6 | six | 7 | 7 | seven | 8 | 8 | eight - | 0 | | zero - | | | null | | 0 | zero + | | | null (11 rows) SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b, c); + FROM J1_TBL t1 (a, b, c) + ORDER BY a, b, c; xxx | a | b | c -----+---+---+------- + | 0 | | zero | 1 | 4 | one | 2 | 3 | two | 3 | 2 | three @@ -99,119 +104,120 @@ SELECT '' AS "xxx", * | 6 | 6 | six | 7 | 7 | seven | 8 | 8 | eight - | 0 | | zero - | | | null | | 0 | zero + | | | null (11 rows) SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e); + FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e) + ORDER BY a, b, c, d, e; xxx | a | b | c | d | e -----+---+---+-------+---+---- - | 1 | 4 | one | 1 | -1 - | 2 | 3 | two | 1 | -1 - | 3 | 2 | three | 1 | -1 - | 4 | 1 | four | 1 | -1 - | 5 | 0 | five | 1 | -1 - | 6 | 6 | six | 1 | -1 - | 7 | 7 | seven | 1 | -1 - | 8 | 8 | eight | 1 | -1 + | 0 | | zero | 0 | | 0 | | zero | 1 | -1 - | | | null | 1 | -1 - | | 0 | zero | 1 | -1 - | 1 | 4 | one | 2 | 2 - | 2 | 3 | two | 2 | 2 - | 3 | 2 | three | 2 | 2 - | 4 | 1 | four | 2 | 2 - | 5 | 0 | five | 2 | 2 - | 6 | 6 | six | 2 | 2 - | 7 | 7 | seven | 2 | 2 - | 8 | 8 | eight | 2 | 2 | 0 | | zero | 2 | 2 - | | | null | 2 | 2 - | | 0 | zero | 2 | 2 - | 1 | 4 | one | 3 | -3 - | 2 | 3 | two | 3 | -3 - | 3 | 2 | three | 3 | -3 - | 4 | 1 | four | 3 | -3 - | 5 | 0 | five | 3 | -3 - | 6 | 6 | six | 3 | -3 - | 7 | 7 | seven | 3 | -3 - | 8 | 8 | eight | 3 | -3 - | 0 | | zero | 3 | -3 - | | | null | 3 | -3 - | | 0 | zero | 3 | -3 - | 1 | 4 | one | 2 | 4 - | 2 | 3 | two | 2 | 4 - | 3 | 2 | three | 2 | 4 - | 4 | 1 | four | 2 | 4 - | 5 | 0 | five | 2 | 4 - | 6 | 6 | six | 2 | 4 - | 7 | 7 | seven | 2 | 4 - | 8 | 8 | eight | 2 | 4 | 0 | | zero | 2 | 4 - | | | null | 2 | 4 - | | 0 | zero | 2 | 4 - | 1 | 4 | one | 5 | -5 - | 2 | 3 | two | 5 | -5 - | 3 | 2 | three | 5 | -5 - | 4 | 1 | four | 5 | -5 - | 5 | 0 | five | 5 | -5 - | 6 | 6 | six | 5 | -5 - | 7 | 7 | seven | 5 | -5 - | 8 | 8 | eight | 5 | -5 + | 0 | | zero | 3 | -3 | 0 | | zero | 5 | -5 - | | | null | 5 | -5 - | | 0 | zero | 5 | -5 - | 1 | 4 | one | 5 | -5 - | 2 | 3 | two | 5 | -5 - | 3 | 2 | three | 5 | -5 - | 4 | 1 | four | 5 | -5 - | 5 | 0 | five | 5 | -5 - | 6 | 6 | six | 5 | -5 - | 7 | 7 | seven | 5 | -5 - | 8 | 8 | eight | 5 | -5 | 0 | | zero | 5 | -5 - | | | null | 5 | -5 - | | 0 | zero | 5 | -5 + | 0 | | zero | | 0 + | 0 | | zero | | | 1 | 4 | one | 0 | - | 2 | 3 | two | 0 | - | 3 | 2 | three | 0 | - | 4 | 1 | four | 0 | - | 5 | 0 | five | 0 | - | 6 | 6 | six | 0 | - | 7 | 7 | seven | 0 | - | 8 | 8 | eight | 0 | - | 0 | | zero | 0 | - | | | null | 0 | - | | 0 | zero | 0 | + | 1 | 4 | one | 1 | -1 + | 1 | 4 | one | 2 | 2 + | 1 | 4 | one | 2 | 4 + | 1 | 4 | one | 3 | -3 + | 1 | 4 | one | 5 | -5 + | 1 | 4 | one | 5 | -5 + | 1 | 4 | one | | 0 | 1 | 4 | one | | + | 2 | 3 | two | 0 | + | 2 | 3 | two | 1 | -1 + | 2 | 3 | two | 2 | 2 + | 2 | 3 | two | 2 | 4 + | 2 | 3 | two | 3 | -3 + | 2 | 3 | two | 5 | -5 + | 2 | 3 | two | 5 | -5 + | 2 | 3 | two | | 0 | 2 | 3 | two | | + | 3 | 2 | three | 0 | + | 3 | 2 | three | 1 | -1 + | 3 | 2 | three | 2 | 2 + | 3 | 2 | three | 2 | 4 + | 3 | 2 | three | 3 | -3 + | 3 | 2 | three | 5 | -5 + | 3 | 2 | three | 5 | -5 + | 3 | 2 | three | | 0 | 3 | 2 | three | | + | 4 | 1 | four | 0 | + | 4 | 1 | four | 1 | -1 + | 4 | 1 | four | 2 | 2 + | 4 | 1 | four | 2 | 4 + | 4 | 1 | four | 3 | -3 + | 4 | 1 | four | 5 | -5 + | 4 | 1 | four | 5 | -5 + | 4 | 1 | four | | 0 | 4 | 1 | four | | + | 5 | 0 | five | 0 | + | 5 | 0 | five | 1 | -1 + | 5 | 0 | five | 2 | 2 + | 5 | 0 | five | 2 | 4 + | 5 | 0 | five | 3 | -3 + | 5 | 0 | five | 5 | -5 + | 5 | 0 | five | 5 | -5 + | 5 | 0 | five | | 0 | 5 | 0 | five | | + | 6 | 6 | six | 0 | + | 6 | 6 | six | 1 | -1 + | 6 | 6 | six | 2 | 2 + | 6 | 6 | six | 2 | 4 + | 6 | 6 | six | 3 | -3 + | 6 | 6 | six | 5 | -5 + | 6 | 6 | six | 5 | -5 + | 6 | 6 | six | | 0 | 6 | 6 | six | | + | 7 | 7 | seven | 0 | + | 7 | 7 | seven | 1 | -1 + | 7 | 7 | seven | 2 | 2 + | 7 | 7 | seven | 2 | 4 + | 7 | 7 | seven | 3 | -3 + | 7 | 7 | seven | 5 | -5 + | 7 | 7 | seven | 5 | -5 + | 7 | 7 | seven | | 0 | 7 | 7 | seven | | + | 8 | 8 | eight | 0 | + | 8 | 8 | eight | 1 | -1 + | 8 | 8 | eight | 2 | 2 + | 8 | 8 | eight | 2 | 4 + | 8 | 8 | eight | 3 | -3 + | 8 | 8 | eight | 5 | -5 + | 8 | 8 | eight | 5 | -5 + | 8 | 8 | eight | | 0 | 8 | 8 | eight | | - | 0 | | zero | | - | | | null | | + | | 0 | zero | 0 | + | | 0 | zero | 1 | -1 + | | 0 | zero | 2 | 2 + | | 0 | zero | 2 | 4 + | | 0 | zero | 3 | -3 + | | 0 | zero | 5 | -5 + | | 0 | zero | 5 | -5 + | | 0 | zero | | 0 | | 0 | zero | | - | 1 | 4 | one | | 0 - | 2 | 3 | two | | 0 - | 3 | 2 | three | | 0 - | 4 | 1 | four | | 0 - | 5 | 0 | five | | 0 - | 6 | 6 | six | | 0 - | 7 | 7 | seven | | 0 - | 8 | 8 | eight | | 0 - | 0 | | zero | | 0 + | | | null | 0 | + | | | null | 1 | -1 + | | | null | 2 | 2 + | | | null | 2 | 4 + | | | null | 3 | -3 + | | | null | 5 | -5 + | | | null | 5 | -5 | | | null | | 0 - | | 0 | zero | | 0 + | | | null | | (99 rows) SELECT '' AS "xxx", t1.a, t2.e FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e) - WHERE t1.a = t2.d; + WHERE t1.a = t2.d + ORDER BY a, e; xxx | a | e -----+---+---- | 0 | @@ -229,108 +235,109 @@ SELECT '' AS "xxx", t1.a, t2.e -- which degenerate into a standard unqualified inner join. -- SELECT '' AS "xxx", * - FROM J1_TBL CROSS JOIN J2_TBL; + FROM J1_TBL CROSS JOIN J2_TBL + ORDER BY J1_TBL.i, J1_TBL.j, J1_TBL.t, J2_TBL.i, J2_TBL.k; xxx | i | j | t | i | k -----+---+---+-------+---+---- - | 1 | 4 | one | 1 | -1 - | 2 | 3 | two | 1 | -1 - | 3 | 2 | three | 1 | -1 - | 4 | 1 | four | 1 | -1 - | 5 | 0 | five | 1 | -1 - | 6 | 6 | six | 1 | -1 - | 7 | 7 | seven | 1 | -1 - | 8 | 8 | eight | 1 | -1 + | 0 | | zero | 0 | | 0 | | zero | 1 | -1 - | | | null | 1 | -1 - | | 0 | zero | 1 | -1 - | 1 | 4 | one | 2 | 2 - | 2 | 3 | two | 2 | 2 - | 3 | 2 | three | 2 | 2 - | 4 | 1 | four | 2 | 2 - | 5 | 0 | five | 2 | 2 - | 6 | 6 | six | 2 | 2 - | 7 | 7 | seven | 2 | 2 - | 8 | 8 | eight | 2 | 2 | 0 | | zero | 2 | 2 - | | | null | 2 | 2 - | | 0 | zero | 2 | 2 - | 1 | 4 | one | 3 | -3 - | 2 | 3 | two | 3 | -3 - | 3 | 2 | three | 3 | -3 - | 4 | 1 | four | 3 | -3 - | 5 | 0 | five | 3 | -3 - | 6 | 6 | six | 3 | -3 - | 7 | 7 | seven | 3 | -3 - | 8 | 8 | eight | 3 | -3 - | 0 | | zero | 3 | -3 - | | | null | 3 | -3 - | | 0 | zero | 3 | -3 - | 1 | 4 | one | 2 | 4 - | 2 | 3 | two | 2 | 4 - | 3 | 2 | three | 2 | 4 - | 4 | 1 | four | 2 | 4 - | 5 | 0 | five | 2 | 4 - | 6 | 6 | six | 2 | 4 - | 7 | 7 | seven | 2 | 4 - | 8 | 8 | eight | 2 | 4 | 0 | | zero | 2 | 4 - | | | null | 2 | 4 - | | 0 | zero | 2 | 4 - | 1 | 4 | one | 5 | -5 - | 2 | 3 | two | 5 | -5 - | 3 | 2 | three | 5 | -5 - | 4 | 1 | four | 5 | -5 - | 5 | 0 | five | 5 | -5 - | 6 | 6 | six | 5 | -5 - | 7 | 7 | seven | 5 | -5 - | 8 | 8 | eight | 5 | -5 + | 0 | | zero | 3 | -3 | 0 | | zero | 5 | -5 - | | | null | 5 | -5 - | | 0 | zero | 5 | -5 - | 1 | 4 | one | 5 | -5 - | 2 | 3 | two | 5 | -5 - | 3 | 2 | three | 5 | -5 - | 4 | 1 | four | 5 | -5 - | 5 | 0 | five | 5 | -5 - | 6 | 6 | six | 5 | -5 - | 7 | 7 | seven | 5 | -5 - | 8 | 8 | eight | 5 | -5 | 0 | | zero | 5 | -5 - | | | null | 5 | -5 - | | 0 | zero | 5 | -5 + | 0 | | zero | | 0 + | 0 | | zero | | | 1 | 4 | one | 0 | - | 2 | 3 | two | 0 | - | 3 | 2 | three | 0 | - | 4 | 1 | four | 0 | - | 5 | 0 | five | 0 | - | 6 | 6 | six | 0 | - | 7 | 7 | seven | 0 | - | 8 | 8 | eight | 0 | - | 0 | | zero | 0 | - | | | null | 0 | - | | 0 | zero | 0 | + | 1 | 4 | one | 1 | -1 + | 1 | 4 | one | 2 | 2 + | 1 | 4 | one | 2 | 4 + | 1 | 4 | one | 3 | -3 + | 1 | 4 | one | 5 | -5 + | 1 | 4 | one | 5 | -5 + | 1 | 4 | one | | 0 | 1 | 4 | one | | + | 2 | 3 | two | 0 | + | 2 | 3 | two | 1 | -1 + | 2 | 3 | two | 2 | 2 + | 2 | 3 | two | 2 | 4 + | 2 | 3 | two | 3 | -3 + | 2 | 3 | two | 5 | -5 + | 2 | 3 | two | 5 | -5 + | 2 | 3 | two | | 0 | 2 | 3 | two | | + | 3 | 2 | three | 0 | + | 3 | 2 | three | 1 | -1 + | 3 | 2 | three | 2 | 2 + | 3 | 2 | three | 2 | 4 + | 3 | 2 | three | 3 | -3 + | 3 | 2 | three | 5 | -5 + | 3 | 2 | three | 5 | -5 + | 3 | 2 | three | | 0 | 3 | 2 | three | | + | 4 | 1 | four | 0 | + | 4 | 1 | four | 1 | -1 + | 4 | 1 | four | 2 | 2 + | 4 | 1 | four | 2 | 4 + | 4 | 1 | four | 3 | -3 + | 4 | 1 | four | 5 | -5 + | 4 | 1 | four | 5 | -5 + | 4 | 1 | four | | 0 | 4 | 1 | four | | + | 5 | 0 | five | 0 | + | 5 | 0 | five | 1 | -1 + | 5 | 0 | five | 2 | 2 + | 5 | 0 | five | 2 | 4 + | 5 | 0 | five | 3 | -3 + | 5 | 0 | five | 5 | -5 + | 5 | 0 | five | 5 | -5 + | 5 | 0 | five | | 0 | 5 | 0 | five | | + | 6 | 6 | six | 0 | + | 6 | 6 | six | 1 | -1 + | 6 | 6 | six | 2 | 2 + | 6 | 6 | six | 2 | 4 + | 6 | 6 | six | 3 | -3 + | 6 | 6 | six | 5 | -5 + | 6 | 6 | six | 5 | -5 + | 6 | 6 | six | | 0 | 6 | 6 | six | | + | 7 | 7 | seven | 0 | + | 7 | 7 | seven | 1 | -1 + | 7 | 7 | seven | 2 | 2 + | 7 | 7 | seven | 2 | 4 + | 7 | 7 | seven | 3 | -3 + | 7 | 7 | seven | 5 | -5 + | 7 | 7 | seven | 5 | -5 + | 7 | 7 | seven | | 0 | 7 | 7 | seven | | + | 8 | 8 | eight | 0 | + | 8 | 8 | eight | 1 | -1 + | 8 | 8 | eight | 2 | 2 + | 8 | 8 | eight | 2 | 4 + | 8 | 8 | eight | 3 | -3 + | 8 | 8 | eight | 5 | -5 + | 8 | 8 | eight | 5 | -5 + | 8 | 8 | eight | | 0 | 8 | 8 | eight | | - | 0 | | zero | | - | | | null | | + | | 0 | zero | 0 | + | | 0 | zero | 1 | -1 + | | 0 | zero | 2 | 2 + | | 0 | zero | 2 | 4 + | | 0 | zero | 3 | -3 + | | 0 | zero | 5 | -5 + | | 0 | zero | 5 | -5 + | | 0 | zero | | 0 | | 0 | zero | | - | 1 | 4 | one | | 0 - | 2 | 3 | two | | 0 - | 3 | 2 | three | | 0 - | 4 | 1 | four | | 0 - | 5 | 0 | five | | 0 - | 6 | 6 | six | | 0 - | 7 | 7 | seven | | 0 - | 8 | 8 | eight | | 0 - | 0 | | zero | | 0 + | | | null | 0 | + | | | null | 1 | -1 + | | | null | 2 | 2 + | | | null | 2 | 4 + | | | null | 3 | -3 + | | | null | 5 | -5 + | | | null | 5 | -5 | | | null | | 0 - | | 0 | zero | | 0 + | | | null | | (99 rows) -- ambiguous column @@ -341,1217 +348,1221 @@ LINE 1: SELECT '' AS "xxx", i, k, t ^ -- resolve previous ambiguity by specifying the table name SELECT '' AS "xxx", t1.i, k, t - FROM J1_TBL t1 CROSS JOIN J2_TBL t2; + FROM J1_TBL t1 CROSS JOIN J2_TBL t2 + ORDER BY i, k, t; xxx | i | k | t -----+---+----+------- - | 1 | -1 | one - | 2 | -1 | two - | 3 | -1 | three - | 4 | -1 | four - | 5 | -1 | five - | 6 | -1 | six - | 7 | -1 | seven - | 8 | -1 | eight + | 0 | -5 | zero + | 0 | -5 | zero + | 0 | -3 | zero | 0 | -1 | zero - | | -1 | null - | | -1 | zero - | 1 | 2 | one - | 2 | 2 | two - | 3 | 2 | three - | 4 | 2 | four - | 5 | 2 | five - | 6 | 2 | six - | 7 | 2 | seven - | 8 | 2 | eight + | 0 | 0 | zero | 0 | 2 | zero - | | 2 | null - | | 2 | zero - | 1 | -3 | one - | 2 | -3 | two - | 3 | -3 | three - | 4 | -3 | four - | 5 | -3 | five - | 6 | -3 | six - | 7 | -3 | seven - | 8 | -3 | eight - | 0 | -3 | zero - | | -3 | null - | | -3 | zero - | 1 | 4 | one - | 2 | 4 | two - | 3 | 4 | three - | 4 | 4 | four - | 5 | 4 | five - | 6 | 4 | six - | 7 | 4 | seven - | 8 | 4 | eight | 0 | 4 | zero - | | 4 | null - | | 4 | zero + | 0 | | zero + | 0 | | zero | 1 | -5 | one - | 2 | -5 | two - | 3 | -5 | three - | 4 | -5 | four - | 5 | -5 | five - | 6 | -5 | six - | 7 | -5 | seven - | 8 | -5 | eight - | 0 | -5 | zero - | | -5 | null - | | -5 | zero | 1 | -5 | one + | 1 | -3 | one + | 1 | -1 | one + | 1 | 0 | one + | 1 | 2 | one + | 1 | 4 | one + | 1 | | one + | 1 | | one | 2 | -5 | two + | 2 | -5 | two + | 2 | -3 | two + | 2 | -1 | two + | 2 | 0 | two + | 2 | 2 | two + | 2 | 4 | two + | 2 | | two + | 2 | | two | 3 | -5 | three + | 3 | -5 | three + | 3 | -3 | three + | 3 | -1 | three + | 3 | 0 | three + | 3 | 2 | three + | 3 | 4 | three + | 3 | | three + | 3 | | three + | 4 | -5 | four | 4 | -5 | four + | 4 | -3 | four + | 4 | -1 | four + | 4 | 0 | four + | 4 | 2 | four + | 4 | 4 | four + | 4 | | four + | 4 | | four + | 5 | -5 | five | 5 | -5 | five + | 5 | -3 | five + | 5 | -1 | five + | 5 | 0 | five + | 5 | 2 | five + | 5 | 4 | five + | 5 | | five + | 5 | | five + | 6 | -5 | six | 6 | -5 | six + | 6 | -3 | six + | 6 | -1 | six + | 6 | 0 | six + | 6 | 2 | six + | 6 | 4 | six + | 6 | | six + | 6 | | six | 7 | -5 | seven + | 7 | -5 | seven + | 7 | -3 | seven + | 7 | -1 | seven + | 7 | 0 | seven + | 7 | 2 | seven + | 7 | 4 | seven + | 7 | | seven + | 7 | | seven | 8 | -5 | eight - | 0 | -5 | zero + | 8 | -5 | eight + | 8 | -3 | eight + | 8 | -1 | eight + | 8 | 0 | eight + | 8 | 2 | eight + | 8 | 4 | eight + | 8 | | eight + | 8 | | eight + | | -5 | null | | -5 | null | | -5 | zero - | 1 | | one - | 2 | | two - | 3 | | three - | 4 | | four - | 5 | | five - | 6 | | six - | 7 | | seven - | 8 | | eight - | 0 | | zero + | | -5 | zero + | | -3 | null + | | -3 | zero + | | -1 | null + | | -1 | zero + | | 0 | null + | | 0 | zero + | | 2 | null + | | 2 | zero + | | 4 | null + | | 4 | zero | | | null - | | | zero - | 1 | | one - | 2 | | two - | 3 | | three - | 4 | | four - | 5 | | five - | 6 | | six - | 7 | | seven - | 8 | | eight - | 0 | | zero | | | null | | | zero - | 1 | 0 | one - | 2 | 0 | two - | 3 | 0 | three - | 4 | 0 | four - | 5 | 0 | five - | 6 | 0 | six - | 7 | 0 | seven - | 8 | 0 | eight - | 0 | 0 | zero - | | 0 | null - | | 0 | zero + | | | zero (99 rows) SELECT '' AS "xxx", ii, tt, kk FROM (J1_TBL CROSS JOIN J2_TBL) - AS tx (ii, jj, tt, ii2, kk); + AS tx (ii, jj, tt, ii2, kk) + ORDER BY ii, tt, kk; xxx | ii | tt | kk -----+----+-------+---- - | 1 | one | -1 - | 2 | two | -1 - | 3 | three | -1 - | 4 | four | -1 - | 5 | five | -1 - | 6 | six | -1 - | 7 | seven | -1 - | 8 | eight | -1 + | 0 | zero | -5 + | 0 | zero | -5 + | 0 | zero | -3 | 0 | zero | -1 - | | null | -1 - | | zero | -1 - | 1 | one | 2 - | 2 | two | 2 - | 3 | three | 2 - | 4 | four | 2 - | 5 | five | 2 - | 6 | six | 2 - | 7 | seven | 2 - | 8 | eight | 2 + | 0 | zero | 0 | 0 | zero | 2 - | | null | 2 - | | zero | 2 - | 1 | one | -3 - | 2 | two | -3 - | 3 | three | -3 - | 4 | four | -3 - | 5 | five | -3 - | 6 | six | -3 - | 7 | seven | -3 - | 8 | eight | -3 - | 0 | zero | -3 - | | null | -3 - | | zero | -3 - | 1 | one | 4 - | 2 | two | 4 - | 3 | three | 4 - | 4 | four | 4 - | 5 | five | 4 - | 6 | six | 4 - | 7 | seven | 4 - | 8 | eight | 4 | 0 | zero | 4 - | | null | 4 - | | zero | 4 + | 0 | zero | + | 0 | zero | | 1 | one | -5 - | 2 | two | -5 - | 3 | three | -5 - | 4 | four | -5 - | 5 | five | -5 - | 6 | six | -5 - | 7 | seven | -5 - | 8 | eight | -5 - | 0 | zero | -5 - | | null | -5 - | | zero | -5 | 1 | one | -5 - | 2 | two | -5 - | 3 | three | -5 - | 4 | four | -5 - | 5 | five | -5 - | 6 | six | -5 - | 7 | seven | -5 - | 8 | eight | -5 - | 0 | zero | -5 - | | null | -5 - | | zero | -5 + | 1 | one | -3 + | 1 | one | -1 + | 1 | one | 0 + | 1 | one | 2 + | 1 | one | 4 | 1 | one | - | 2 | two | - | 3 | three | - | 4 | four | - | 5 | five | - | 6 | six | - | 7 | seven | - | 8 | eight | - | 0 | zero | - | | null | - | | zero | | 1 | one | - | 2 | two | - | 3 | three | - | 4 | four | - | 5 | five | - | 6 | six | - | 7 | seven | - | 8 | eight | - | 0 | zero | - | | null | - | | zero | - | 1 | one | 0 + | 2 | two | -5 + | 2 | two | -5 + | 2 | two | -3 + | 2 | two | -1 | 2 | two | 0 + | 2 | two | 2 + | 2 | two | 4 + | 2 | two | + | 2 | two | + | 3 | three | -5 + | 3 | three | -5 + | 3 | three | -3 + | 3 | three | -1 | 3 | three | 0 + | 3 | three | 2 + | 3 | three | 4 + | 3 | three | + | 3 | three | + | 4 | four | -5 + | 4 | four | -5 + | 4 | four | -3 + | 4 | four | -1 | 4 | four | 0 + | 4 | four | 2 + | 4 | four | 4 + | 4 | four | + | 4 | four | + | 5 | five | -5 + | 5 | five | -5 + | 5 | five | -3 + | 5 | five | -1 | 5 | five | 0 + | 5 | five | 2 + | 5 | five | 4 + | 5 | five | + | 5 | five | + | 6 | six | -5 + | 6 | six | -5 + | 6 | six | -3 + | 6 | six | -1 | 6 | six | 0 + | 6 | six | 2 + | 6 | six | 4 + | 6 | six | + | 6 | six | + | 7 | seven | -5 + | 7 | seven | -5 + | 7 | seven | -3 + | 7 | seven | -1 | 7 | seven | 0 + | 7 | seven | 2 + | 7 | seven | 4 + | 7 | seven | + | 7 | seven | + | 8 | eight | -5 + | 8 | eight | -5 + | 8 | eight | -3 + | 8 | eight | -1 | 8 | eight | 0 - | 0 | zero | 0 + | 8 | eight | 2 + | 8 | eight | 4 + | 8 | eight | + | 8 | eight | + | | null | -5 + | | null | -5 + | | null | -3 + | | null | -1 | | null | 0 + | | null | 2 + | | null | 4 + | | null | + | | null | + | | zero | -5 + | | zero | -5 + | | zero | -3 + | | zero | -1 | | zero | 0 + | | zero | 2 + | | zero | 4 + | | zero | + | | zero | (99 rows) SELECT '' AS "xxx", tx.ii, tx.jj, tx.kk FROM (J1_TBL t1 (a, b, c) CROSS JOIN J2_TBL t2 (d, e)) - AS tx (ii, jj, tt, ii2, kk); + AS tx (ii, jj, tt, ii2, kk) + ORDER BY ii, jj, kk; xxx | ii | jj | kk -----+----+----+---- - | 1 | 4 | -1 - | 2 | 3 | -1 - | 3 | 2 | -1 - | 4 | 1 | -1 - | 5 | 0 | -1 - | 6 | 6 | -1 - | 7 | 7 | -1 - | 8 | 8 | -1 + | 0 | | -5 + | 0 | | -5 + | 0 | | -3 | 0 | | -1 - | | | -1 - | | 0 | -1 - | 1 | 4 | 2 - | 2 | 3 | 2 - | 3 | 2 | 2 - | 4 | 1 | 2 - | 5 | 0 | 2 - | 6 | 6 | 2 - | 7 | 7 | 2 - | 8 | 8 | 2 + | 0 | | 0 | 0 | | 2 - | | | 2 - | | 0 | 2 - | 1 | 4 | -3 - | 2 | 3 | -3 - | 3 | 2 | -3 - | 4 | 1 | -3 - | 5 | 0 | -3 - | 6 | 6 | -3 - | 7 | 7 | -3 - | 8 | 8 | -3 - | 0 | | -3 - | | | -3 - | | 0 | -3 - | 1 | 4 | 4 - | 2 | 3 | 4 - | 3 | 2 | 4 - | 4 | 1 | 4 - | 5 | 0 | 4 - | 6 | 6 | 4 - | 7 | 7 | 4 - | 8 | 8 | 4 | 0 | | 4 - | | | 4 - | | 0 | 4 + | 0 | | + | 0 | | | 1 | 4 | -5 - | 2 | 3 | -5 - | 3 | 2 | -5 - | 4 | 1 | -5 - | 5 | 0 | -5 - | 6 | 6 | -5 - | 7 | 7 | -5 - | 8 | 8 | -5 - | 0 | | -5 - | | | -5 - | | 0 | -5 | 1 | 4 | -5 - | 2 | 3 | -5 - | 3 | 2 | -5 - | 4 | 1 | -5 - | 5 | 0 | -5 - | 6 | 6 | -5 - | 7 | 7 | -5 - | 8 | 8 | -5 - | 0 | | -5 - | | | -5 - | | 0 | -5 + | 1 | 4 | -3 + | 1 | 4 | -1 + | 1 | 4 | 0 + | 1 | 4 | 2 + | 1 | 4 | 4 | 1 | 4 | - | 2 | 3 | - | 3 | 2 | - | 4 | 1 | - | 5 | 0 | - | 6 | 6 | - | 7 | 7 | - | 8 | 8 | - | 0 | | - | | | - | | 0 | | 1 | 4 | + | 2 | 3 | -5 + | 2 | 3 | -5 + | 2 | 3 | -3 + | 2 | 3 | -1 + | 2 | 3 | 0 + | 2 | 3 | 2 + | 2 | 3 | 4 | 2 | 3 | + | 2 | 3 | + | 3 | 2 | -5 + | 3 | 2 | -5 + | 3 | 2 | -3 + | 3 | 2 | -1 + | 3 | 2 | 0 + | 3 | 2 | 2 + | 3 | 2 | 4 | 3 | 2 | + | 3 | 2 | + | 4 | 1 | -5 + | 4 | 1 | -5 + | 4 | 1 | -3 + | 4 | 1 | -1 + | 4 | 1 | 0 + | 4 | 1 | 2 + | 4 | 1 | 4 + | 4 | 1 | | 4 | 1 | + | 5 | 0 | -5 + | 5 | 0 | -5 + | 5 | 0 | -3 + | 5 | 0 | -1 + | 5 | 0 | 0 + | 5 | 0 | 2 + | 5 | 0 | 4 | 5 | 0 | + | 5 | 0 | + | 6 | 6 | -5 + | 6 | 6 | -5 + | 6 | 6 | -3 + | 6 | 6 | -1 + | 6 | 6 | 0 + | 6 | 6 | 2 + | 6 | 6 | 4 | 6 | 6 | + | 6 | 6 | + | 7 | 7 | -5 + | 7 | 7 | -5 + | 7 | 7 | -3 + | 7 | 7 | -1 + | 7 | 7 | 0 + | 7 | 7 | 2 + | 7 | 7 | 4 + | 7 | 7 | | 7 | 7 | + | 8 | 8 | -5 + | 8 | 8 | -5 + | 8 | 8 | -3 + | 8 | 8 | -1 + | 8 | 8 | 0 + | 8 | 8 | 2 + | 8 | 8 | 4 | 8 | 8 | - | 0 | | - | | | + | 8 | 8 | + | | 0 | -5 + | | 0 | -5 + | | 0 | -3 + | | 0 | -1 + | | 0 | 0 + | | 0 | 2 + | | 0 | 4 | | 0 | - | 1 | 4 | 0 - | 2 | 3 | 0 - | 3 | 2 | 0 - | 4 | 1 | 0 - | 5 | 0 | 0 - | 6 | 6 | 0 - | 7 | 7 | 0 - | 8 | 8 | 0 - | 0 | | 0 + | | 0 | + | | | -5 + | | | -5 + | | | -3 + | | | -1 | | | 0 - | | 0 | 0 + | | | 2 + | | | 4 + | | | + | | | (99 rows) SELECT '' AS "xxx", * - FROM J1_TBL CROSS JOIN J2_TBL a CROSS JOIN J2_TBL b; + FROM J1_TBL CROSS JOIN J2_TBL a CROSS JOIN J2_TBL b + ORDER BY J1_TBL.i,J1_TBL.j,J1_TBL.t,a.i,a.k,b.i,b.k; xxx | i | j | t | i | k | i | k -----+---+---+-------+---+----+---+---- - | 1 | 4 | one | 1 | -1 | 1 | -1 - | 2 | 3 | two | 1 | -1 | 1 | -1 - | 3 | 2 | three | 1 | -1 | 1 | -1 - | 4 | 1 | four | 1 | -1 | 1 | -1 - | 5 | 0 | five | 1 | -1 | 1 | -1 - | 6 | 6 | six | 1 | -1 | 1 | -1 - | 7 | 7 | seven | 1 | -1 | 1 | -1 - | 8 | 8 | eight | 1 | -1 | 1 | -1 + | 0 | | zero | 0 | | 0 | + | 0 | | zero | 0 | | 1 | -1 + | 0 | | zero | 0 | | 2 | 2 + | 0 | | zero | 0 | | 2 | 4 + | 0 | | zero | 0 | | 3 | -3 + | 0 | | zero | 0 | | 5 | -5 + | 0 | | zero | 0 | | 5 | -5 + | 0 | | zero | 0 | | | 0 + | 0 | | zero | 0 | | | + | 0 | | zero | 1 | -1 | 0 | | 0 | | zero | 1 | -1 | 1 | -1 - | | | null | 1 | -1 | 1 | -1 - | | 0 | zero | 1 | -1 | 1 | -1 - | 1 | 4 | one | 1 | -1 | 2 | 2 - | 2 | 3 | two | 1 | -1 | 2 | 2 - | 3 | 2 | three | 1 | -1 | 2 | 2 - | 4 | 1 | four | 1 | -1 | 2 | 2 - | 5 | 0 | five | 1 | -1 | 2 | 2 - | 6 | 6 | six | 1 | -1 | 2 | 2 - | 7 | 7 | seven | 1 | -1 | 2 | 2 - | 8 | 8 | eight | 1 | -1 | 2 | 2 | 0 | | zero | 1 | -1 | 2 | 2 - | | | null | 1 | -1 | 2 | 2 - | | 0 | zero | 1 | -1 | 2 | 2 - | 1 | 4 | one | 1 | -1 | 3 | -3 - | 2 | 3 | two | 1 | -1 | 3 | -3 - | 3 | 2 | three | 1 | -1 | 3 | -3 - | 4 | 1 | four | 1 | -1 | 3 | -3 - | 5 | 0 | five | 1 | -1 | 3 | -3 - | 6 | 6 | six | 1 | -1 | 3 | -3 - | 7 | 7 | seven | 1 | -1 | 3 | -3 - | 8 | 8 | eight | 1 | -1 | 3 | -3 - | 0 | | zero | 1 | -1 | 3 | -3 - | | | null | 1 | -1 | 3 | -3 - | | 0 | zero | 1 | -1 | 3 | -3 - | 1 | 4 | one | 1 | -1 | 2 | 4 - | 2 | 3 | two | 1 | -1 | 2 | 4 - | 3 | 2 | three | 1 | -1 | 2 | 4 - | 4 | 1 | four | 1 | -1 | 2 | 4 - | 5 | 0 | five | 1 | -1 | 2 | 4 - | 6 | 6 | six | 1 | -1 | 2 | 4 - | 7 | 7 | seven | 1 | -1 | 2 | 4 - | 8 | 8 | eight | 1 | -1 | 2 | 4 | 0 | | zero | 1 | -1 | 2 | 4 - | | | null | 1 | -1 | 2 | 4 - | | 0 | zero | 1 | -1 | 2 | 4 - | 1 | 4 | one | 1 | -1 | 5 | -5 - | 2 | 3 | two | 1 | -1 | 5 | -5 - | 3 | 2 | three | 1 | -1 | 5 | -5 - | 4 | 1 | four | 1 | -1 | 5 | -5 - | 5 | 0 | five | 1 | -1 | 5 | -5 - | 6 | 6 | six | 1 | -1 | 5 | -5 - | 7 | 7 | seven | 1 | -1 | 5 | -5 - | 8 | 8 | eight | 1 | -1 | 5 | -5 + | 0 | | zero | 1 | -1 | 3 | -3 | 0 | | zero | 1 | -1 | 5 | -5 - | | | null | 1 | -1 | 5 | -5 - | | 0 | zero | 1 | -1 | 5 | -5 - | 1 | 4 | one | 1 | -1 | 5 | -5 - | 2 | 3 | two | 1 | -1 | 5 | -5 - | 3 | 2 | three | 1 | -1 | 5 | -5 - | 4 | 1 | four | 1 | -1 | 5 | -5 - | 5 | 0 | five | 1 | -1 | 5 | -5 - | 6 | 6 | six | 1 | -1 | 5 | -5 - | 7 | 7 | seven | 1 | -1 | 5 | -5 - | 8 | 8 | eight | 1 | -1 | 5 | -5 | 0 | | zero | 1 | -1 | 5 | -5 - | | | null | 1 | -1 | 5 | -5 - | | 0 | zero | 1 | -1 | 5 | -5 - | 1 | 4 | one | 1 | -1 | 0 | - | 2 | 3 | two | 1 | -1 | 0 | - | 3 | 2 | three | 1 | -1 | 0 | - | 4 | 1 | four | 1 | -1 | 0 | - | 5 | 0 | five | 1 | -1 | 0 | - | 6 | 6 | six | 1 | -1 | 0 | - | 7 | 7 | seven | 1 | -1 | 0 | - | 8 | 8 | eight | 1 | -1 | 0 | - | 0 | | zero | 1 | -1 | 0 | - | | | null | 1 | -1 | 0 | - | | 0 | zero | 1 | -1 | 0 | - | 1 | 4 | one | 1 | -1 | | - | 2 | 3 | two | 1 | -1 | | - | 3 | 2 | three | 1 | -1 | | - | 4 | 1 | four | 1 | -1 | | - | 5 | 0 | five | 1 | -1 | | - | 6 | 6 | six | 1 | -1 | | - | 7 | 7 | seven | 1 | -1 | | - | 8 | 8 | eight | 1 | -1 | | - | 0 | | zero | 1 | -1 | | - | | | null | 1 | -1 | | - | | 0 | zero | 1 | -1 | | - | 1 | 4 | one | 1 | -1 | | 0 - | 2 | 3 | two | 1 | -1 | | 0 - | 3 | 2 | three | 1 | -1 | | 0 - | 4 | 1 | four | 1 | -1 | | 0 - | 5 | 0 | five | 1 | -1 | | 0 - | 6 | 6 | six | 1 | -1 | | 0 - | 7 | 7 | seven | 1 | -1 | | 0 - | 8 | 8 | eight | 1 | -1 | | 0 | 0 | | zero | 1 | -1 | | 0 - | | | null | 1 | -1 | | 0 - | | 0 | zero | 1 | -1 | | 0 - | 1 | 4 | one | 2 | 2 | 1 | -1 - | 2 | 3 | two | 2 | 2 | 1 | -1 - | 3 | 2 | three | 2 | 2 | 1 | -1 - | 4 | 1 | four | 2 | 2 | 1 | -1 - | 5 | 0 | five | 2 | 2 | 1 | -1 - | 6 | 6 | six | 2 | 2 | 1 | -1 - | 7 | 7 | seven | 2 | 2 | 1 | -1 - | 8 | 8 | eight | 2 | 2 | 1 | -1 + | 0 | | zero | 1 | -1 | | + | 0 | | zero | 2 | 2 | 0 | | 0 | | zero | 2 | 2 | 1 | -1 - | | | null | 2 | 2 | 1 | -1 - | | 0 | zero | 2 | 2 | 1 | -1 - | 1 | 4 | one | 2 | 2 | 2 | 2 - | 2 | 3 | two | 2 | 2 | 2 | 2 - | 3 | 2 | three | 2 | 2 | 2 | 2 - | 4 | 1 | four | 2 | 2 | 2 | 2 - | 5 | 0 | five | 2 | 2 | 2 | 2 - | 6 | 6 | six | 2 | 2 | 2 | 2 - | 7 | 7 | seven | 2 | 2 | 2 | 2 - | 8 | 8 | eight | 2 | 2 | 2 | 2 | 0 | | zero | 2 | 2 | 2 | 2 - | | | null | 2 | 2 | 2 | 2 - | | 0 | zero | 2 | 2 | 2 | 2 - | 1 | 4 | one | 2 | 2 | 3 | -3 - | 2 | 3 | two | 2 | 2 | 3 | -3 - | 3 | 2 | three | 2 | 2 | 3 | -3 - | 4 | 1 | four | 2 | 2 | 3 | -3 - | 5 | 0 | five | 2 | 2 | 3 | -3 - | 6 | 6 | six | 2 | 2 | 3 | -3 - | 7 | 7 | seven | 2 | 2 | 3 | -3 - | 8 | 8 | eight | 2 | 2 | 3 | -3 - | 0 | | zero | 2 | 2 | 3 | -3 - | | | null | 2 | 2 | 3 | -3 - | | 0 | zero | 2 | 2 | 3 | -3 - | 1 | 4 | one | 2 | 2 | 2 | 4 - | 2 | 3 | two | 2 | 2 | 2 | 4 - | 3 | 2 | three | 2 | 2 | 2 | 4 - | 4 | 1 | four | 2 | 2 | 2 | 4 - | 5 | 0 | five | 2 | 2 | 2 | 4 - | 6 | 6 | six | 2 | 2 | 2 | 4 - | 7 | 7 | seven | 2 | 2 | 2 | 4 - | 8 | 8 | eight | 2 | 2 | 2 | 4 | 0 | | zero | 2 | 2 | 2 | 4 - | | | null | 2 | 2 | 2 | 4 - | | 0 | zero | 2 | 2 | 2 | 4 - | 1 | 4 | one | 2 | 2 | 5 | -5 - | 2 | 3 | two | 2 | 2 | 5 | -5 - | 3 | 2 | three | 2 | 2 | 5 | -5 - | 4 | 1 | four | 2 | 2 | 5 | -5 - | 5 | 0 | five | 2 | 2 | 5 | -5 - | 6 | 6 | six | 2 | 2 | 5 | -5 - | 7 | 7 | seven | 2 | 2 | 5 | -5 - | 8 | 8 | eight | 2 | 2 | 5 | -5 + | 0 | | zero | 2 | 2 | 3 | -3 | 0 | | zero | 2 | 2 | 5 | -5 - | | | null | 2 | 2 | 5 | -5 - | | 0 | zero | 2 | 2 | 5 | -5 - | 1 | 4 | one | 2 | 2 | 5 | -5 - | 2 | 3 | two | 2 | 2 | 5 | -5 - | 3 | 2 | three | 2 | 2 | 5 | -5 - | 4 | 1 | four | 2 | 2 | 5 | -5 - | 5 | 0 | five | 2 | 2 | 5 | -5 - | 6 | 6 | six | 2 | 2 | 5 | -5 - | 7 | 7 | seven | 2 | 2 | 5 | -5 - | 8 | 8 | eight | 2 | 2 | 5 | -5 | 0 | | zero | 2 | 2 | 5 | -5 - | | | null | 2 | 2 | 5 | -5 - | | 0 | zero | 2 | 2 | 5 | -5 - | 1 | 4 | one | 2 | 2 | 0 | - | 2 | 3 | two | 2 | 2 | 0 | - | 3 | 2 | three | 2 | 2 | 0 | - | 4 | 1 | four | 2 | 2 | 0 | - | 5 | 0 | five | 2 | 2 | 0 | - | 6 | 6 | six | 2 | 2 | 0 | - | 7 | 7 | seven | 2 | 2 | 0 | - | 8 | 8 | eight | 2 | 2 | 0 | - | 0 | | zero | 2 | 2 | 0 | - | | | null | 2 | 2 | 0 | - | | 0 | zero | 2 | 2 | 0 | - | 1 | 4 | one | 2 | 2 | | - | 2 | 3 | two | 2 | 2 | | - | 3 | 2 | three | 2 | 2 | | - | 4 | 1 | four | 2 | 2 | | - | 5 | 0 | five | 2 | 2 | | - | 6 | 6 | six | 2 | 2 | | - | 7 | 7 | seven | 2 | 2 | | - | 8 | 8 | eight | 2 | 2 | | - | 0 | | zero | 2 | 2 | | - | | | null | 2 | 2 | | - | | 0 | zero | 2 | 2 | | - | 1 | 4 | one | 2 | 2 | | 0 - | 2 | 3 | two | 2 | 2 | | 0 - | 3 | 2 | three | 2 | 2 | | 0 - | 4 | 1 | four | 2 | 2 | | 0 - | 5 | 0 | five | 2 | 2 | | 0 - | 6 | 6 | six | 2 | 2 | | 0 - | 7 | 7 | seven | 2 | 2 | | 0 - | 8 | 8 | eight | 2 | 2 | | 0 | 0 | | zero | 2 | 2 | | 0 - | | | null | 2 | 2 | | 0 - | | 0 | zero | 2 | 2 | | 0 - | 1 | 4 | one | 3 | -3 | 1 | -1 - | 2 | 3 | two | 3 | -3 | 1 | -1 - | 3 | 2 | three | 3 | -3 | 1 | -1 - | 4 | 1 | four | 3 | -3 | 1 | -1 - | 5 | 0 | five | 3 | -3 | 1 | -1 - | 6 | 6 | six | 3 | -3 | 1 | -1 - | 7 | 7 | seven | 3 | -3 | 1 | -1 - | 8 | 8 | eight | 3 | -3 | 1 | -1 + | 0 | | zero | 2 | 2 | | + | 0 | | zero | 2 | 4 | 0 | + | 0 | | zero | 2 | 4 | 1 | -1 + | 0 | | zero | 2 | 4 | 2 | 2 + | 0 | | zero | 2 | 4 | 2 | 4 + | 0 | | zero | 2 | 4 | 3 | -3 + | 0 | | zero | 2 | 4 | 5 | -5 + | 0 | | zero | 2 | 4 | 5 | -5 + | 0 | | zero | 2 | 4 | | 0 + | 0 | | zero | 2 | 4 | | + | 0 | | zero | 3 | -3 | 0 | | 0 | | zero | 3 | -3 | 1 | -1 - | | | null | 3 | -3 | 1 | -1 - | | 0 | zero | 3 | -3 | 1 | -1 - | 1 | 4 | one | 3 | -3 | 2 | 2 - | 2 | 3 | two | 3 | -3 | 2 | 2 - | 3 | 2 | three | 3 | -3 | 2 | 2 - | 4 | 1 | four | 3 | -3 | 2 | 2 - | 5 | 0 | five | 3 | -3 | 2 | 2 - | 6 | 6 | six | 3 | -3 | 2 | 2 - | 7 | 7 | seven | 3 | -3 | 2 | 2 - | 8 | 8 | eight | 3 | -3 | 2 | 2 | 0 | | zero | 3 | -3 | 2 | 2 - | | | null | 3 | -3 | 2 | 2 - | | 0 | zero | 3 | -3 | 2 | 2 - | 1 | 4 | one | 3 | -3 | 3 | -3 - | 2 | 3 | two | 3 | -3 | 3 | -3 - | 3 | 2 | three | 3 | -3 | 3 | -3 - | 4 | 1 | four | 3 | -3 | 3 | -3 - | 5 | 0 | five | 3 | -3 | 3 | -3 - | 6 | 6 | six | 3 | -3 | 3 | -3 - | 7 | 7 | seven | 3 | -3 | 3 | -3 - | 8 | 8 | eight | 3 | -3 | 3 | -3 - | 0 | | zero | 3 | -3 | 3 | -3 - | | | null | 3 | -3 | 3 | -3 - | | 0 | zero | 3 | -3 | 3 | -3 - | 1 | 4 | one | 3 | -3 | 2 | 4 - | 2 | 3 | two | 3 | -3 | 2 | 4 - | 3 | 2 | three | 3 | -3 | 2 | 4 - | 4 | 1 | four | 3 | -3 | 2 | 4 - | 5 | 0 | five | 3 | -3 | 2 | 4 - | 6 | 6 | six | 3 | -3 | 2 | 4 - | 7 | 7 | seven | 3 | -3 | 2 | 4 - | 8 | 8 | eight | 3 | -3 | 2 | 4 | 0 | | zero | 3 | -3 | 2 | 4 - | | | null | 3 | -3 | 2 | 4 - | | 0 | zero | 3 | -3 | 2 | 4 - | 1 | 4 | one | 3 | -3 | 5 | -5 - | 2 | 3 | two | 3 | -3 | 5 | -5 - | 3 | 2 | three | 3 | -3 | 5 | -5 - | 4 | 1 | four | 3 | -3 | 5 | -5 - | 5 | 0 | five | 3 | -3 | 5 | -5 - | 6 | 6 | six | 3 | -3 | 5 | -5 - | 7 | 7 | seven | 3 | -3 | 5 | -5 - | 8 | 8 | eight | 3 | -3 | 5 | -5 + | 0 | | zero | 3 | -3 | 3 | -3 | 0 | | zero | 3 | -3 | 5 | -5 - | | | null | 3 | -3 | 5 | -5 - | | 0 | zero | 3 | -3 | 5 | -5 - | 1 | 4 | one | 3 | -3 | 5 | -5 - | 2 | 3 | two | 3 | -3 | 5 | -5 - | 3 | 2 | three | 3 | -3 | 5 | -5 - | 4 | 1 | four | 3 | -3 | 5 | -5 - | 5 | 0 | five | 3 | -3 | 5 | -5 - | 6 | 6 | six | 3 | -3 | 5 | -5 - | 7 | 7 | seven | 3 | -3 | 5 | -5 - | 8 | 8 | eight | 3 | -3 | 5 | -5 | 0 | | zero | 3 | -3 | 5 | -5 - | | | null | 3 | -3 | 5 | -5 - | | 0 | zero | 3 | -3 | 5 | -5 - | 1 | 4 | one | 3 | -3 | 0 | - | 2 | 3 | two | 3 | -3 | 0 | - | 3 | 2 | three | 3 | -3 | 0 | - | 4 | 1 | four | 3 | -3 | 0 | - | 5 | 0 | five | 3 | -3 | 0 | - | 6 | 6 | six | 3 | -3 | 0 | - | 7 | 7 | seven | 3 | -3 | 0 | - | 8 | 8 | eight | 3 | -3 | 0 | - | 0 | | zero | 3 | -3 | 0 | - | | | null | 3 | -3 | 0 | - | | 0 | zero | 3 | -3 | 0 | - | 1 | 4 | one | 3 | -3 | | - | 2 | 3 | two | 3 | -3 | | - | 3 | 2 | three | 3 | -3 | | - | 4 | 1 | four | 3 | -3 | | - | 5 | 0 | five | 3 | -3 | | - | 6 | 6 | six | 3 | -3 | | - | 7 | 7 | seven | 3 | -3 | | - | 8 | 8 | eight | 3 | -3 | | - | 0 | | zero | 3 | -3 | | - | | | null | 3 | -3 | | - | | 0 | zero | 3 | -3 | | - | 1 | 4 | one | 3 | -3 | | 0 - | 2 | 3 | two | 3 | -3 | | 0 - | 3 | 2 | three | 3 | -3 | | 0 - | 4 | 1 | four | 3 | -3 | | 0 - | 5 | 0 | five | 3 | -3 | | 0 - | 6 | 6 | six | 3 | -3 | | 0 - | 7 | 7 | seven | 3 | -3 | | 0 - | 8 | 8 | eight | 3 | -3 | | 0 | 0 | | zero | 3 | -3 | | 0 - | | | null | 3 | -3 | | 0 - | | 0 | zero | 3 | -3 | | 0 + | 0 | | zero | 3 | -3 | | + | 0 | | zero | 5 | -5 | 0 | + | 0 | | zero | 5 | -5 | 0 | + | 0 | | zero | 5 | -5 | 1 | -1 + | 0 | | zero | 5 | -5 | 1 | -1 + | 0 | | zero | 5 | -5 | 2 | 2 + | 0 | | zero | 5 | -5 | 2 | 2 + | 0 | | zero | 5 | -5 | 2 | 4 + | 0 | | zero | 5 | -5 | 2 | 4 + | 0 | | zero | 5 | -5 | 3 | -3 + | 0 | | zero | 5 | -5 | 3 | -3 + | 0 | | zero | 5 | -5 | 5 | -5 + | 0 | | zero | 5 | -5 | 5 | -5 + | 0 | | zero | 5 | -5 | 5 | -5 + | 0 | | zero | 5 | -5 | 5 | -5 + | 0 | | zero | 5 | -5 | | 0 + | 0 | | zero | 5 | -5 | | 0 + | 0 | | zero | 5 | -5 | | + | 0 | | zero | 5 | -5 | | + | 0 | | zero | | 0 | 0 | + | 0 | | zero | | 0 | 1 | -1 + | 0 | | zero | | 0 | 2 | 2 + | 0 | | zero | | 0 | 2 | 4 + | 0 | | zero | | 0 | 3 | -3 + | 0 | | zero | | 0 | 5 | -5 + | 0 | | zero | | 0 | 5 | -5 + | 0 | | zero | | 0 | | 0 + | 0 | | zero | | 0 | | + | 0 | | zero | | | 0 | + | 0 | | zero | | | 1 | -1 + | 0 | | zero | | | 2 | 2 + | 0 | | zero | | | 2 | 4 + | 0 | | zero | | | 3 | -3 + | 0 | | zero | | | 5 | -5 + | 0 | | zero | | | 5 | -5 + | 0 | | zero | | | | 0 + | 0 | | zero | | | | + | 1 | 4 | one | 0 | | 0 | + | 1 | 4 | one | 0 | | 1 | -1 + | 1 | 4 | one | 0 | | 2 | 2 + | 1 | 4 | one | 0 | | 2 | 4 + | 1 | 4 | one | 0 | | 3 | -3 + | 1 | 4 | one | 0 | | 5 | -5 + | 1 | 4 | one | 0 | | 5 | -5 + | 1 | 4 | one | 0 | | | 0 + | 1 | 4 | one | 0 | | | + | 1 | 4 | one | 1 | -1 | 0 | + | 1 | 4 | one | 1 | -1 | 1 | -1 + | 1 | 4 | one | 1 | -1 | 2 | 2 + | 1 | 4 | one | 1 | -1 | 2 | 4 + | 1 | 4 | one | 1 | -1 | 3 | -3 + | 1 | 4 | one | 1 | -1 | 5 | -5 + | 1 | 4 | one | 1 | -1 | 5 | -5 + | 1 | 4 | one | 1 | -1 | | 0 + | 1 | 4 | one | 1 | -1 | | + | 1 | 4 | one | 2 | 2 | 0 | + | 1 | 4 | one | 2 | 2 | 1 | -1 + | 1 | 4 | one | 2 | 2 | 2 | 2 + | 1 | 4 | one | 2 | 2 | 2 | 4 + | 1 | 4 | one | 2 | 2 | 3 | -3 + | 1 | 4 | one | 2 | 2 | 5 | -5 + | 1 | 4 | one | 2 | 2 | 5 | -5 + | 1 | 4 | one | 2 | 2 | | 0 + | 1 | 4 | one | 2 | 2 | | + | 1 | 4 | one | 2 | 4 | 0 | | 1 | 4 | one | 2 | 4 | 1 | -1 - | 2 | 3 | two | 2 | 4 | 1 | -1 - | 3 | 2 | three | 2 | 4 | 1 | -1 - | 4 | 1 | four | 2 | 4 | 1 | -1 - | 5 | 0 | five | 2 | 4 | 1 | -1 - | 6 | 6 | six | 2 | 4 | 1 | -1 - | 7 | 7 | seven | 2 | 4 | 1 | -1 - | 8 | 8 | eight | 2 | 4 | 1 | -1 - | 0 | | zero | 2 | 4 | 1 | -1 - | | | null | 2 | 4 | 1 | -1 - | | 0 | zero | 2 | 4 | 1 | -1 | 1 | 4 | one | 2 | 4 | 2 | 2 - | 2 | 3 | two | 2 | 4 | 2 | 2 - | 3 | 2 | three | 2 | 4 | 2 | 2 - | 4 | 1 | four | 2 | 4 | 2 | 2 - | 5 | 0 | five | 2 | 4 | 2 | 2 - | 6 | 6 | six | 2 | 4 | 2 | 2 - | 7 | 7 | seven | 2 | 4 | 2 | 2 - | 8 | 8 | eight | 2 | 4 | 2 | 2 - | 0 | | zero | 2 | 4 | 2 | 2 - | | | null | 2 | 4 | 2 | 2 - | | 0 | zero | 2 | 4 | 2 | 2 - | 1 | 4 | one | 2 | 4 | 3 | -3 - | 2 | 3 | two | 2 | 4 | 3 | -3 - | 3 | 2 | three | 2 | 4 | 3 | -3 - | 4 | 1 | four | 2 | 4 | 3 | -3 - | 5 | 0 | five | 2 | 4 | 3 | -3 - | 6 | 6 | six | 2 | 4 | 3 | -3 - | 7 | 7 | seven | 2 | 4 | 3 | -3 - | 8 | 8 | eight | 2 | 4 | 3 | -3 - | 0 | | zero | 2 | 4 | 3 | -3 - | | | null | 2 | 4 | 3 | -3 - | | 0 | zero | 2 | 4 | 3 | -3 | 1 | 4 | one | 2 | 4 | 2 | 4 - | 2 | 3 | two | 2 | 4 | 2 | 4 - | 3 | 2 | three | 2 | 4 | 2 | 4 - | 4 | 1 | four | 2 | 4 | 2 | 4 - | 5 | 0 | five | 2 | 4 | 2 | 4 - | 6 | 6 | six | 2 | 4 | 2 | 4 - | 7 | 7 | seven | 2 | 4 | 2 | 4 - | 8 | 8 | eight | 2 | 4 | 2 | 4 - | 0 | | zero | 2 | 4 | 2 | 4 - | | | null | 2 | 4 | 2 | 4 - | | 0 | zero | 2 | 4 | 2 | 4 + | 1 | 4 | one | 2 | 4 | 3 | -3 | 1 | 4 | one | 2 | 4 | 5 | -5 - | 2 | 3 | two | 2 | 4 | 5 | -5 - | 3 | 2 | three | 2 | 4 | 5 | -5 - | 4 | 1 | four | 2 | 4 | 5 | -5 - | 5 | 0 | five | 2 | 4 | 5 | -5 - | 6 | 6 | six | 2 | 4 | 5 | -5 - | 7 | 7 | seven | 2 | 4 | 5 | -5 - | 8 | 8 | eight | 2 | 4 | 5 | -5 - | 0 | | zero | 2 | 4 | 5 | -5 - | | | null | 2 | 4 | 5 | -5 - | | 0 | zero | 2 | 4 | 5 | -5 | 1 | 4 | one | 2 | 4 | 5 | -5 - | 2 | 3 | two | 2 | 4 | 5 | -5 - | 3 | 2 | three | 2 | 4 | 5 | -5 - | 4 | 1 | four | 2 | 4 | 5 | -5 - | 5 | 0 | five | 2 | 4 | 5 | -5 - | 6 | 6 | six | 2 | 4 | 5 | -5 - | 7 | 7 | seven | 2 | 4 | 5 | -5 - | 8 | 8 | eight | 2 | 4 | 5 | -5 - | 0 | | zero | 2 | 4 | 5 | -5 - | | | null | 2 | 4 | 5 | -5 - | | 0 | zero | 2 | 4 | 5 | -5 - | 1 | 4 | one | 2 | 4 | 0 | - | 2 | 3 | two | 2 | 4 | 0 | - | 3 | 2 | three | 2 | 4 | 0 | - | 4 | 1 | four | 2 | 4 | 0 | - | 5 | 0 | five | 2 | 4 | 0 | - | 6 | 6 | six | 2 | 4 | 0 | - | 7 | 7 | seven | 2 | 4 | 0 | - | 8 | 8 | eight | 2 | 4 | 0 | - | 0 | | zero | 2 | 4 | 0 | - | | | null | 2 | 4 | 0 | - | | 0 | zero | 2 | 4 | 0 | - | 1 | 4 | one | 2 | 4 | | - | 2 | 3 | two | 2 | 4 | | - | 3 | 2 | three | 2 | 4 | | - | 4 | 1 | four | 2 | 4 | | - | 5 | 0 | five | 2 | 4 | | - | 6 | 6 | six | 2 | 4 | | - | 7 | 7 | seven | 2 | 4 | | - | 8 | 8 | eight | 2 | 4 | | - | 0 | | zero | 2 | 4 | | - | | | null | 2 | 4 | | - | | 0 | zero | 2 | 4 | | | 1 | 4 | one | 2 | 4 | | 0 - | 2 | 3 | two | 2 | 4 | | 0 - | 3 | 2 | three | 2 | 4 | | 0 - | 4 | 1 | four | 2 | 4 | | 0 - | 5 | 0 | five | 2 | 4 | | 0 - | 6 | 6 | six | 2 | 4 | | 0 - | 7 | 7 | seven | 2 | 4 | | 0 - | 8 | 8 | eight | 2 | 4 | | 0 - | 0 | | zero | 2 | 4 | | 0 - | | | null | 2 | 4 | | 0 - | | 0 | zero | 2 | 4 | | 0 + | 1 | 4 | one | 2 | 4 | | + | 1 | 4 | one | 3 | -3 | 0 | + | 1 | 4 | one | 3 | -3 | 1 | -1 + | 1 | 4 | one | 3 | -3 | 2 | 2 + | 1 | 4 | one | 3 | -3 | 2 | 4 + | 1 | 4 | one | 3 | -3 | 3 | -3 + | 1 | 4 | one | 3 | -3 | 5 | -5 + | 1 | 4 | one | 3 | -3 | 5 | -5 + | 1 | 4 | one | 3 | -3 | | 0 + | 1 | 4 | one | 3 | -3 | | + | 1 | 4 | one | 5 | -5 | 0 | + | 1 | 4 | one | 5 | -5 | 0 | + | 1 | 4 | one | 5 | -5 | 1 | -1 | 1 | 4 | one | 5 | -5 | 1 | -1 - | 2 | 3 | two | 5 | -5 | 1 | -1 - | 3 | 2 | three | 5 | -5 | 1 | -1 - | 4 | 1 | four | 5 | -5 | 1 | -1 - | 5 | 0 | five | 5 | -5 | 1 | -1 - | 6 | 6 | six | 5 | -5 | 1 | -1 - | 7 | 7 | seven | 5 | -5 | 1 | -1 - | 8 | 8 | eight | 5 | -5 | 1 | -1 - | 0 | | zero | 5 | -5 | 1 | -1 - | | | null | 5 | -5 | 1 | -1 - | | 0 | zero | 5 | -5 | 1 | -1 | 1 | 4 | one | 5 | -5 | 2 | 2 - | 2 | 3 | two | 5 | -5 | 2 | 2 - | 3 | 2 | three | 5 | -5 | 2 | 2 - | 4 | 1 | four | 5 | -5 | 2 | 2 - | 5 | 0 | five | 5 | -5 | 2 | 2 - | 6 | 6 | six | 5 | -5 | 2 | 2 - | 7 | 7 | seven | 5 | -5 | 2 | 2 - | 8 | 8 | eight | 5 | -5 | 2 | 2 - | 0 | | zero | 5 | -5 | 2 | 2 - | | | null | 5 | -5 | 2 | 2 - | | 0 | zero | 5 | -5 | 2 | 2 - | 1 | 4 | one | 5 | -5 | 3 | -3 - | 2 | 3 | two | 5 | -5 | 3 | -3 - | 3 | 2 | three | 5 | -5 | 3 | -3 - | 4 | 1 | four | 5 | -5 | 3 | -3 - | 5 | 0 | five | 5 | -5 | 3 | -3 - | 6 | 6 | six | 5 | -5 | 3 | -3 - | 7 | 7 | seven | 5 | -5 | 3 | -3 - | 8 | 8 | eight | 5 | -5 | 3 | -3 - | 0 | | zero | 5 | -5 | 3 | -3 - | | | null | 5 | -5 | 3 | -3 - | | 0 | zero | 5 | -5 | 3 | -3 + | 1 | 4 | one | 5 | -5 | 2 | 2 | 1 | 4 | one | 5 | -5 | 2 | 4 - | 2 | 3 | two | 5 | -5 | 2 | 4 - | 3 | 2 | three | 5 | -5 | 2 | 4 - | 4 | 1 | four | 5 | -5 | 2 | 4 - | 5 | 0 | five | 5 | -5 | 2 | 4 - | 6 | 6 | six | 5 | -5 | 2 | 4 - | 7 | 7 | seven | 5 | -5 | 2 | 4 - | 8 | 8 | eight | 5 | -5 | 2 | 4 - | 0 | | zero | 5 | -5 | 2 | 4 - | | | null | 5 | -5 | 2 | 4 - | | 0 | zero | 5 | -5 | 2 | 4 + | 1 | 4 | one | 5 | -5 | 2 | 4 + | 1 | 4 | one | 5 | -5 | 3 | -3 + | 1 | 4 | one | 5 | -5 | 3 | -3 + | 1 | 4 | one | 5 | -5 | 5 | -5 + | 1 | 4 | one | 5 | -5 | 5 | -5 | 1 | 4 | one | 5 | -5 | 5 | -5 - | 2 | 3 | two | 5 | -5 | 5 | -5 - | 3 | 2 | three | 5 | -5 | 5 | -5 - | 4 | 1 | four | 5 | -5 | 5 | -5 - | 5 | 0 | five | 5 | -5 | 5 | -5 - | 6 | 6 | six | 5 | -5 | 5 | -5 - | 7 | 7 | seven | 5 | -5 | 5 | -5 - | 8 | 8 | eight | 5 | -5 | 5 | -5 - | 0 | | zero | 5 | -5 | 5 | -5 - | | | null | 5 | -5 | 5 | -5 - | | 0 | zero | 5 | -5 | 5 | -5 | 1 | 4 | one | 5 | -5 | 5 | -5 - | 2 | 3 | two | 5 | -5 | 5 | -5 - | 3 | 2 | three | 5 | -5 | 5 | -5 - | 4 | 1 | four | 5 | -5 | 5 | -5 - | 5 | 0 | five | 5 | -5 | 5 | -5 - | 6 | 6 | six | 5 | -5 | 5 | -5 - | 7 | 7 | seven | 5 | -5 | 5 | -5 - | 8 | 8 | eight | 5 | -5 | 5 | -5 - | 0 | | zero | 5 | -5 | 5 | -5 - | | | null | 5 | -5 | 5 | -5 - | | 0 | zero | 5 | -5 | 5 | -5 - | 1 | 4 | one | 5 | -5 | 0 | - | 2 | 3 | two | 5 | -5 | 0 | - | 3 | 2 | three | 5 | -5 | 0 | - | 4 | 1 | four | 5 | -5 | 0 | - | 5 | 0 | five | 5 | -5 | 0 | - | 6 | 6 | six | 5 | -5 | 0 | - | 7 | 7 | seven | 5 | -5 | 0 | - | 8 | 8 | eight | 5 | -5 | 0 | - | 0 | | zero | 5 | -5 | 0 | - | | | null | 5 | -5 | 0 | - | | 0 | zero | 5 | -5 | 0 | - | 1 | 4 | one | 5 | -5 | | - | 2 | 3 | two | 5 | -5 | | - | 3 | 2 | three | 5 | -5 | | - | 4 | 1 | four | 5 | -5 | | - | 5 | 0 | five | 5 | -5 | | - | 6 | 6 | six | 5 | -5 | | - | 7 | 7 | seven | 5 | -5 | | - | 8 | 8 | eight | 5 | -5 | | - | 0 | | zero | 5 | -5 | | - | | | null | 5 | -5 | | - | | 0 | zero | 5 | -5 | | | 1 | 4 | one | 5 | -5 | | 0 - | 2 | 3 | two | 5 | -5 | | 0 - | 3 | 2 | three | 5 | -5 | | 0 - | 4 | 1 | four | 5 | -5 | | 0 - | 5 | 0 | five | 5 | -5 | | 0 - | 6 | 6 | six | 5 | -5 | | 0 - | 7 | 7 | seven | 5 | -5 | | 0 - | 8 | 8 | eight | 5 | -5 | | 0 - | 0 | | zero | 5 | -5 | | 0 - | | | null | 5 | -5 | | 0 - | | 0 | zero | 5 | -5 | | 0 - | 1 | 4 | one | 5 | -5 | 1 | -1 + | 1 | 4 | one | 5 | -5 | | 0 + | 1 | 4 | one | 5 | -5 | | + | 1 | 4 | one | 5 | -5 | | + | 1 | 4 | one | | 0 | 0 | + | 1 | 4 | one | | 0 | 1 | -1 + | 1 | 4 | one | | 0 | 2 | 2 + | 1 | 4 | one | | 0 | 2 | 4 + | 1 | 4 | one | | 0 | 3 | -3 + | 1 | 4 | one | | 0 | 5 | -5 + | 1 | 4 | one | | 0 | 5 | -5 + | 1 | 4 | one | | 0 | | 0 + | 1 | 4 | one | | 0 | | + | 1 | 4 | one | | | 0 | + | 1 | 4 | one | | | 1 | -1 + | 1 | 4 | one | | | 2 | 2 + | 1 | 4 | one | | | 2 | 4 + | 1 | 4 | one | | | 3 | -3 + | 1 | 4 | one | | | 5 | -5 + | 1 | 4 | one | | | 5 | -5 + | 1 | 4 | one | | | | 0 + | 1 | 4 | one | | | | + | 2 | 3 | two | 0 | | 0 | + | 2 | 3 | two | 0 | | 1 | -1 + | 2 | 3 | two | 0 | | 2 | 2 + | 2 | 3 | two | 0 | | 2 | 4 + | 2 | 3 | two | 0 | | 3 | -3 + | 2 | 3 | two | 0 | | 5 | -5 + | 2 | 3 | two | 0 | | 5 | -5 + | 2 | 3 | two | 0 | | | 0 + | 2 | 3 | two | 0 | | | + | 2 | 3 | two | 1 | -1 | 0 | + | 2 | 3 | two | 1 | -1 | 1 | -1 + | 2 | 3 | two | 1 | -1 | 2 | 2 + | 2 | 3 | two | 1 | -1 | 2 | 4 + | 2 | 3 | two | 1 | -1 | 3 | -3 + | 2 | 3 | two | 1 | -1 | 5 | -5 + | 2 | 3 | two | 1 | -1 | 5 | -5 + | 2 | 3 | two | 1 | -1 | | 0 + | 2 | 3 | two | 1 | -1 | | + | 2 | 3 | two | 2 | 2 | 0 | + | 2 | 3 | two | 2 | 2 | 1 | -1 + | 2 | 3 | two | 2 | 2 | 2 | 2 + | 2 | 3 | two | 2 | 2 | 2 | 4 + | 2 | 3 | two | 2 | 2 | 3 | -3 + | 2 | 3 | two | 2 | 2 | 5 | -5 + | 2 | 3 | two | 2 | 2 | 5 | -5 + | 2 | 3 | two | 2 | 2 | | 0 + | 2 | 3 | two | 2 | 2 | | + | 2 | 3 | two | 2 | 4 | 0 | + | 2 | 3 | two | 2 | 4 | 1 | -1 + | 2 | 3 | two | 2 | 4 | 2 | 2 + | 2 | 3 | two | 2 | 4 | 2 | 4 + | 2 | 3 | two | 2 | 4 | 3 | -3 + | 2 | 3 | two | 2 | 4 | 5 | -5 + | 2 | 3 | two | 2 | 4 | 5 | -5 + | 2 | 3 | two | 2 | 4 | | 0 + | 2 | 3 | two | 2 | 4 | | + | 2 | 3 | two | 3 | -3 | 0 | + | 2 | 3 | two | 3 | -3 | 1 | -1 + | 2 | 3 | two | 3 | -3 | 2 | 2 + | 2 | 3 | two | 3 | -3 | 2 | 4 + | 2 | 3 | two | 3 | -3 | 3 | -3 + | 2 | 3 | two | 3 | -3 | 5 | -5 + | 2 | 3 | two | 3 | -3 | 5 | -5 + | 2 | 3 | two | 3 | -3 | | 0 + | 2 | 3 | two | 3 | -3 | | + | 2 | 3 | two | 5 | -5 | 0 | + | 2 | 3 | two | 5 | -5 | 0 | + | 2 | 3 | two | 5 | -5 | 1 | -1 | 2 | 3 | two | 5 | -5 | 1 | -1 - | 3 | 2 | three | 5 | -5 | 1 | -1 - | 4 | 1 | four | 5 | -5 | 1 | -1 - | 5 | 0 | five | 5 | -5 | 1 | -1 - | 6 | 6 | six | 5 | -5 | 1 | -1 - | 7 | 7 | seven | 5 | -5 | 1 | -1 - | 8 | 8 | eight | 5 | -5 | 1 | -1 - | 0 | | zero | 5 | -5 | 1 | -1 - | | | null | 5 | -5 | 1 | -1 - | | 0 | zero | 5 | -5 | 1 | -1 - | 1 | 4 | one | 5 | -5 | 2 | 2 | 2 | 3 | two | 5 | -5 | 2 | 2 - | 3 | 2 | three | 5 | -5 | 2 | 2 - | 4 | 1 | four | 5 | -5 | 2 | 2 - | 5 | 0 | five | 5 | -5 | 2 | 2 - | 6 | 6 | six | 5 | -5 | 2 | 2 - | 7 | 7 | seven | 5 | -5 | 2 | 2 - | 8 | 8 | eight | 5 | -5 | 2 | 2 - | 0 | | zero | 5 | -5 | 2 | 2 - | | | null | 5 | -5 | 2 | 2 - | | 0 | zero | 5 | -5 | 2 | 2 - | 1 | 4 | one | 5 | -5 | 3 | -3 - | 2 | 3 | two | 5 | -5 | 3 | -3 - | 3 | 2 | three | 5 | -5 | 3 | -3 - | 4 | 1 | four | 5 | -5 | 3 | -3 - | 5 | 0 | five | 5 | -5 | 3 | -3 - | 6 | 6 | six | 5 | -5 | 3 | -3 - | 7 | 7 | seven | 5 | -5 | 3 | -3 - | 8 | 8 | eight | 5 | -5 | 3 | -3 - | 0 | | zero | 5 | -5 | 3 | -3 - | | | null | 5 | -5 | 3 | -3 - | | 0 | zero | 5 | -5 | 3 | -3 - | 1 | 4 | one | 5 | -5 | 2 | 4 + | 2 | 3 | two | 5 | -5 | 2 | 2 | 2 | 3 | two | 5 | -5 | 2 | 4 - | 3 | 2 | three | 5 | -5 | 2 | 4 - | 4 | 1 | four | 5 | -5 | 2 | 4 - | 5 | 0 | five | 5 | -5 | 2 | 4 - | 6 | 6 | six | 5 | -5 | 2 | 4 - | 7 | 7 | seven | 5 | -5 | 2 | 4 - | 8 | 8 | eight | 5 | -5 | 2 | 4 - | 0 | | zero | 5 | -5 | 2 | 4 - | | | null | 5 | -5 | 2 | 4 - | | 0 | zero | 5 | -5 | 2 | 4 - | 1 | 4 | one | 5 | -5 | 5 | -5 + | 2 | 3 | two | 5 | -5 | 2 | 4 + | 2 | 3 | two | 5 | -5 | 3 | -3 + | 2 | 3 | two | 5 | -5 | 3 | -3 + | 2 | 3 | two | 5 | -5 | 5 | -5 + | 2 | 3 | two | 5 | -5 | 5 | -5 | 2 | 3 | two | 5 | -5 | 5 | -5 - | 3 | 2 | three | 5 | -5 | 5 | -5 - | 4 | 1 | four | 5 | -5 | 5 | -5 - | 5 | 0 | five | 5 | -5 | 5 | -5 - | 6 | 6 | six | 5 | -5 | 5 | -5 - | 7 | 7 | seven | 5 | -5 | 5 | -5 - | 8 | 8 | eight | 5 | -5 | 5 | -5 - | 0 | | zero | 5 | -5 | 5 | -5 - | | | null | 5 | -5 | 5 | -5 - | | 0 | zero | 5 | -5 | 5 | -5 - | 1 | 4 | one | 5 | -5 | 5 | -5 | 2 | 3 | two | 5 | -5 | 5 | -5 - | 3 | 2 | three | 5 | -5 | 5 | -5 - | 4 | 1 | four | 5 | -5 | 5 | -5 - | 5 | 0 | five | 5 | -5 | 5 | -5 - | 6 | 6 | six | 5 | -5 | 5 | -5 - | 7 | 7 | seven | 5 | -5 | 5 | -5 - | 8 | 8 | eight | 5 | -5 | 5 | -5 - | 0 | | zero | 5 | -5 | 5 | -5 - | | | null | 5 | -5 | 5 | -5 - | | 0 | zero | 5 | -5 | 5 | -5 - | 1 | 4 | one | 5 | -5 | 0 | - | 2 | 3 | two | 5 | -5 | 0 | - | 3 | 2 | three | 5 | -5 | 0 | - | 4 | 1 | four | 5 | -5 | 0 | - | 5 | 0 | five | 5 | -5 | 0 | - | 6 | 6 | six | 5 | -5 | 0 | - | 7 | 7 | seven | 5 | -5 | 0 | - | 8 | 8 | eight | 5 | -5 | 0 | - | 0 | | zero | 5 | -5 | 0 | - | | | null | 5 | -5 | 0 | - | | 0 | zero | 5 | -5 | 0 | - | 1 | 4 | one | 5 | -5 | | - | 2 | 3 | two | 5 | -5 | | - | 3 | 2 | three | 5 | -5 | | - | 4 | 1 | four | 5 | -5 | | - | 5 | 0 | five | 5 | -5 | | - | 6 | 6 | six | 5 | -5 | | - | 7 | 7 | seven | 5 | -5 | | - | 8 | 8 | eight | 5 | -5 | | - | 0 | | zero | 5 | -5 | | - | | | null | 5 | -5 | | - | | 0 | zero | 5 | -5 | | - | 1 | 4 | one | 5 | -5 | | 0 | 2 | 3 | two | 5 | -5 | | 0 - | 3 | 2 | three | 5 | -5 | | 0 - | 4 | 1 | four | 5 | -5 | | 0 - | 5 | 0 | five | 5 | -5 | | 0 - | 6 | 6 | six | 5 | -5 | | 0 - | 7 | 7 | seven | 5 | -5 | | 0 - | 8 | 8 | eight | 5 | -5 | | 0 - | 0 | | zero | 5 | -5 | | 0 - | | | null | 5 | -5 | | 0 - | | 0 | zero | 5 | -5 | | 0 - | 1 | 4 | one | 0 | | 1 | -1 - | 2 | 3 | two | 0 | | 1 | -1 + | 2 | 3 | two | 5 | -5 | | 0 + | 2 | 3 | two | 5 | -5 | | + | 2 | 3 | two | 5 | -5 | | + | 2 | 3 | two | | 0 | 0 | + | 2 | 3 | two | | 0 | 1 | -1 + | 2 | 3 | two | | 0 | 2 | 2 + | 2 | 3 | two | | 0 | 2 | 4 + | 2 | 3 | two | | 0 | 3 | -3 + | 2 | 3 | two | | 0 | 5 | -5 + | 2 | 3 | two | | 0 | 5 | -5 + | 2 | 3 | two | | 0 | | 0 + | 2 | 3 | two | | 0 | | + | 2 | 3 | two | | | 0 | + | 2 | 3 | two | | | 1 | -1 + | 2 | 3 | two | | | 2 | 2 + | 2 | 3 | two | | | 2 | 4 + | 2 | 3 | two | | | 3 | -3 + | 2 | 3 | two | | | 5 | -5 + | 2 | 3 | two | | | 5 | -5 + | 2 | 3 | two | | | | 0 + | 2 | 3 | two | | | | + | 3 | 2 | three | 0 | | 0 | | 3 | 2 | three | 0 | | 1 | -1 - | 4 | 1 | four | 0 | | 1 | -1 - | 5 | 0 | five | 0 | | 1 | -1 - | 6 | 6 | six | 0 | | 1 | -1 - | 7 | 7 | seven | 0 | | 1 | -1 - | 8 | 8 | eight | 0 | | 1 | -1 - | 0 | | zero | 0 | | 1 | -1 - | | | null | 0 | | 1 | -1 - | | 0 | zero | 0 | | 1 | -1 - | 1 | 4 | one | 0 | | 2 | 2 - | 2 | 3 | two | 0 | | 2 | 2 | 3 | 2 | three | 0 | | 2 | 2 - | 4 | 1 | four | 0 | | 2 | 2 - | 5 | 0 | five | 0 | | 2 | 2 - | 6 | 6 | six | 0 | | 2 | 2 - | 7 | 7 | seven | 0 | | 2 | 2 - | 8 | 8 | eight | 0 | | 2 | 2 - | 0 | | zero | 0 | | 2 | 2 - | | | null | 0 | | 2 | 2 - | | 0 | zero | 0 | | 2 | 2 - | 1 | 4 | one | 0 | | 3 | -3 - | 2 | 3 | two | 0 | | 3 | -3 - | 3 | 2 | three | 0 | | 3 | -3 - | 4 | 1 | four | 0 | | 3 | -3 - | 5 | 0 | five | 0 | | 3 | -3 - | 6 | 6 | six | 0 | | 3 | -3 - | 7 | 7 | seven | 0 | | 3 | -3 - | 8 | 8 | eight | 0 | | 3 | -3 - | 0 | | zero | 0 | | 3 | -3 - | | | null | 0 | | 3 | -3 - | | 0 | zero | 0 | | 3 | -3 - | 1 | 4 | one | 0 | | 2 | 4 - | 2 | 3 | two | 0 | | 2 | 4 | 3 | 2 | three | 0 | | 2 | 4 - | 4 | 1 | four | 0 | | 2 | 4 - | 5 | 0 | five | 0 | | 2 | 4 - | 6 | 6 | six | 0 | | 2 | 4 - | 7 | 7 | seven | 0 | | 2 | 4 - | 8 | 8 | eight | 0 | | 2 | 4 - | 0 | | zero | 0 | | 2 | 4 - | | | null | 0 | | 2 | 4 - | | 0 | zero | 0 | | 2 | 4 - | 1 | 4 | one | 0 | | 5 | -5 - | 2 | 3 | two | 0 | | 5 | -5 + | 3 | 2 | three | 0 | | 3 | -3 | 3 | 2 | three | 0 | | 5 | -5 - | 4 | 1 | four | 0 | | 5 | -5 - | 5 | 0 | five | 0 | | 5 | -5 - | 6 | 6 | six | 0 | | 5 | -5 - | 7 | 7 | seven | 0 | | 5 | -5 - | 8 | 8 | eight | 0 | | 5 | -5 - | 0 | | zero | 0 | | 5 | -5 - | | | null | 0 | | 5 | -5 - | | 0 | zero | 0 | | 5 | -5 - | 1 | 4 | one | 0 | | 5 | -5 - | 2 | 3 | two | 0 | | 5 | -5 | 3 | 2 | three | 0 | | 5 | -5 - | 4 | 1 | four | 0 | | 5 | -5 - | 5 | 0 | five | 0 | | 5 | -5 - | 6 | 6 | six | 0 | | 5 | -5 - | 7 | 7 | seven | 0 | | 5 | -5 - | 8 | 8 | eight | 0 | | 5 | -5 - | 0 | | zero | 0 | | 5 | -5 - | | | null | 0 | | 5 | -5 - | | 0 | zero | 0 | | 5 | -5 - | 1 | 4 | one | 0 | | 0 | - | 2 | 3 | two | 0 | | 0 | - | 3 | 2 | three | 0 | | 0 | - | 4 | 1 | four | 0 | | 0 | - | 5 | 0 | five | 0 | | 0 | - | 6 | 6 | six | 0 | | 0 | - | 7 | 7 | seven | 0 | | 0 | - | 8 | 8 | eight | 0 | | 0 | - | 0 | | zero | 0 | | 0 | - | | | null | 0 | | 0 | - | | 0 | zero | 0 | | 0 | - | 1 | 4 | one | 0 | | | - | 2 | 3 | two | 0 | | | - | 3 | 2 | three | 0 | | | - | 4 | 1 | four | 0 | | | - | 5 | 0 | five | 0 | | | - | 6 | 6 | six | 0 | | | - | 7 | 7 | seven | 0 | | | - | 8 | 8 | eight | 0 | | | - | 0 | | zero | 0 | | | - | | | null | 0 | | | - | | 0 | zero | 0 | | | - | 1 | 4 | one | 0 | | | 0 - | 2 | 3 | two | 0 | | | 0 | 3 | 2 | three | 0 | | | 0 - | 4 | 1 | four | 0 | | | 0 - | 5 | 0 | five | 0 | | | 0 - | 6 | 6 | six | 0 | | | 0 - | 7 | 7 | seven | 0 | | | 0 - | 8 | 8 | eight | 0 | | | 0 - | 0 | | zero | 0 | | | 0 - | | | null | 0 | | | 0 - | | 0 | zero | 0 | | | 0 - | 1 | 4 | one | | | 1 | -1 - | 2 | 3 | two | | | 1 | -1 + | 3 | 2 | three | 0 | | | + | 3 | 2 | three | 1 | -1 | 0 | + | 3 | 2 | three | 1 | -1 | 1 | -1 + | 3 | 2 | three | 1 | -1 | 2 | 2 + | 3 | 2 | three | 1 | -1 | 2 | 4 + | 3 | 2 | three | 1 | -1 | 3 | -3 + | 3 | 2 | three | 1 | -1 | 5 | -5 + | 3 | 2 | three | 1 | -1 | 5 | -5 + | 3 | 2 | three | 1 | -1 | | 0 + | 3 | 2 | three | 1 | -1 | | + | 3 | 2 | three | 2 | 2 | 0 | + | 3 | 2 | three | 2 | 2 | 1 | -1 + | 3 | 2 | three | 2 | 2 | 2 | 2 + | 3 | 2 | three | 2 | 2 | 2 | 4 + | 3 | 2 | three | 2 | 2 | 3 | -3 + | 3 | 2 | three | 2 | 2 | 5 | -5 + | 3 | 2 | three | 2 | 2 | 5 | -5 + | 3 | 2 | three | 2 | 2 | | 0 + | 3 | 2 | three | 2 | 2 | | + | 3 | 2 | three | 2 | 4 | 0 | + | 3 | 2 | three | 2 | 4 | 1 | -1 + | 3 | 2 | three | 2 | 4 | 2 | 2 + | 3 | 2 | three | 2 | 4 | 2 | 4 + | 3 | 2 | three | 2 | 4 | 3 | -3 + | 3 | 2 | three | 2 | 4 | 5 | -5 + | 3 | 2 | three | 2 | 4 | 5 | -5 + | 3 | 2 | three | 2 | 4 | | 0 + | 3 | 2 | three | 2 | 4 | | + | 3 | 2 | three | 3 | -3 | 0 | + | 3 | 2 | three | 3 | -3 | 1 | -1 + | 3 | 2 | three | 3 | -3 | 2 | 2 + | 3 | 2 | three | 3 | -3 | 2 | 4 + | 3 | 2 | three | 3 | -3 | 3 | -3 + | 3 | 2 | three | 3 | -3 | 5 | -5 + | 3 | 2 | three | 3 | -3 | 5 | -5 + | 3 | 2 | three | 3 | -3 | | 0 + | 3 | 2 | three | 3 | -3 | | + | 3 | 2 | three | 5 | -5 | 0 | + | 3 | 2 | three | 5 | -5 | 0 | + | 3 | 2 | three | 5 | -5 | 1 | -1 + | 3 | 2 | three | 5 | -5 | 1 | -1 + | 3 | 2 | three | 5 | -5 | 2 | 2 + | 3 | 2 | three | 5 | -5 | 2 | 2 + | 3 | 2 | three | 5 | -5 | 2 | 4 + | 3 | 2 | three | 5 | -5 | 2 | 4 + | 3 | 2 | three | 5 | -5 | 3 | -3 + | 3 | 2 | three | 5 | -5 | 3 | -3 + | 3 | 2 | three | 5 | -5 | 5 | -5 + | 3 | 2 | three | 5 | -5 | 5 | -5 + | 3 | 2 | three | 5 | -5 | 5 | -5 + | 3 | 2 | three | 5 | -5 | 5 | -5 + | 3 | 2 | three | 5 | -5 | | 0 + | 3 | 2 | three | 5 | -5 | | 0 + | 3 | 2 | three | 5 | -5 | | + | 3 | 2 | three | 5 | -5 | | + | 3 | 2 | three | | 0 | 0 | + | 3 | 2 | three | | 0 | 1 | -1 + | 3 | 2 | three | | 0 | 2 | 2 + | 3 | 2 | three | | 0 | 2 | 4 + | 3 | 2 | three | | 0 | 3 | -3 + | 3 | 2 | three | | 0 | 5 | -5 + | 3 | 2 | three | | 0 | 5 | -5 + | 3 | 2 | three | | 0 | | 0 + | 3 | 2 | three | | 0 | | + | 3 | 2 | three | | | 0 | | 3 | 2 | three | | | 1 | -1 - | 4 | 1 | four | | | 1 | -1 - | 5 | 0 | five | | | 1 | -1 - | 6 | 6 | six | | | 1 | -1 - | 7 | 7 | seven | | | 1 | -1 - | 8 | 8 | eight | | | 1 | -1 - | 0 | | zero | | | 1 | -1 - | | | null | | | 1 | -1 - | | 0 | zero | | | 1 | -1 - | 1 | 4 | one | | | 2 | 2 - | 2 | 3 | two | | | 2 | 2 | 3 | 2 | three | | | 2 | 2 - | 4 | 1 | four | | | 2 | 2 - | 5 | 0 | five | | | 2 | 2 - | 6 | 6 | six | | | 2 | 2 - | 7 | 7 | seven | | | 2 | 2 - | 8 | 8 | eight | | | 2 | 2 - | 0 | | zero | | | 2 | 2 - | | | null | | | 2 | 2 - | | 0 | zero | | | 2 | 2 - | 1 | 4 | one | | | 3 | -3 - | 2 | 3 | two | | | 3 | -3 - | 3 | 2 | three | | | 3 | -3 - | 4 | 1 | four | | | 3 | -3 - | 5 | 0 | five | | | 3 | -3 - | 6 | 6 | six | | | 3 | -3 - | 7 | 7 | seven | | | 3 | -3 - | 8 | 8 | eight | | | 3 | -3 - | 0 | | zero | | | 3 | -3 - | | | null | | | 3 | -3 - | | 0 | zero | | | 3 | -3 - | 1 | 4 | one | | | 2 | 4 - | 2 | 3 | two | | | 2 | 4 | 3 | 2 | three | | | 2 | 4 - | 4 | 1 | four | | | 2 | 4 - | 5 | 0 | five | | | 2 | 4 - | 6 | 6 | six | | | 2 | 4 - | 7 | 7 | seven | | | 2 | 4 - | 8 | 8 | eight | | | 2 | 4 - | 0 | | zero | | | 2 | 4 - | | | null | | | 2 | 4 - | | 0 | zero | | | 2 | 4 - | 1 | 4 | one | | | 5 | -5 - | 2 | 3 | two | | | 5 | -5 + | 3 | 2 | three | | | 3 | -3 | 3 | 2 | three | | | 5 | -5 - | 4 | 1 | four | | | 5 | -5 - | 5 | 0 | five | | | 5 | -5 - | 6 | 6 | six | | | 5 | -5 - | 7 | 7 | seven | | | 5 | -5 - | 8 | 8 | eight | | | 5 | -5 - | 0 | | zero | | | 5 | -5 - | | | null | | | 5 | -5 - | | 0 | zero | | | 5 | -5 - | 1 | 4 | one | | | 5 | -5 - | 2 | 3 | two | | | 5 | -5 | 3 | 2 | three | | | 5 | -5 - | 4 | 1 | four | | | 5 | -5 - | 5 | 0 | five | | | 5 | -5 - | 6 | 6 | six | | | 5 | -5 - | 7 | 7 | seven | | | 5 | -5 - | 8 | 8 | eight | | | 5 | -5 - | 0 | | zero | | | 5 | -5 - | | | null | | | 5 | -5 - | | 0 | zero | | | 5 | -5 - | 1 | 4 | one | | | 0 | - | 2 | 3 | two | | | 0 | - | 3 | 2 | three | | | 0 | - | 4 | 1 | four | | | 0 | - | 5 | 0 | five | | | 0 | - | 6 | 6 | six | | | 0 | - | 7 | 7 | seven | | | 0 | - | 8 | 8 | eight | | | 0 | - | 0 | | zero | | | 0 | - | | | null | | | 0 | - | | 0 | zero | | | 0 | - | 1 | 4 | one | | | | - | 2 | 3 | two | | | | - | 3 | 2 | three | | | | - | 4 | 1 | four | | | | - | 5 | 0 | five | | | | - | 6 | 6 | six | | | | - | 7 | 7 | seven | | | | - | 8 | 8 | eight | | | | - | 0 | | zero | | | | - | | | null | | | | - | | 0 | zero | | | | - | 1 | 4 | one | | | | 0 - | 2 | 3 | two | | | | 0 | 3 | 2 | three | | | | 0 - | 4 | 1 | four | | | | 0 - | 5 | 0 | five | | | | 0 - | 6 | 6 | six | | | | 0 - | 7 | 7 | seven | | | | 0 - | 8 | 8 | eight | | | | 0 - | 0 | | zero | | | | 0 - | | | null | | | | 0 - | | 0 | zero | | | | 0 - | 1 | 4 | one | | 0 | 1 | -1 - | 2 | 3 | two | | 0 | 1 | -1 - | 3 | 2 | three | | 0 | 1 | -1 + | 3 | 2 | three | | | | + | 4 | 1 | four | 0 | | 0 | + | 4 | 1 | four | 0 | | 1 | -1 + | 4 | 1 | four | 0 | | 2 | 2 + | 4 | 1 | four | 0 | | 2 | 4 + | 4 | 1 | four | 0 | | 3 | -3 + | 4 | 1 | four | 0 | | 5 | -5 + | 4 | 1 | four | 0 | | 5 | -5 + | 4 | 1 | four | 0 | | | 0 + | 4 | 1 | four | 0 | | | + | 4 | 1 | four | 1 | -1 | 0 | + | 4 | 1 | four | 1 | -1 | 1 | -1 + | 4 | 1 | four | 1 | -1 | 2 | 2 + | 4 | 1 | four | 1 | -1 | 2 | 4 + | 4 | 1 | four | 1 | -1 | 3 | -3 + | 4 | 1 | four | 1 | -1 | 5 | -5 + | 4 | 1 | four | 1 | -1 | 5 | -5 + | 4 | 1 | four | 1 | -1 | | 0 + | 4 | 1 | four | 1 | -1 | | + | 4 | 1 | four | 2 | 2 | 0 | + | 4 | 1 | four | 2 | 2 | 1 | -1 + | 4 | 1 | four | 2 | 2 | 2 | 2 + | 4 | 1 | four | 2 | 2 | 2 | 4 + | 4 | 1 | four | 2 | 2 | 3 | -3 + | 4 | 1 | four | 2 | 2 | 5 | -5 + | 4 | 1 | four | 2 | 2 | 5 | -5 + | 4 | 1 | four | 2 | 2 | | 0 + | 4 | 1 | four | 2 | 2 | | + | 4 | 1 | four | 2 | 4 | 0 | + | 4 | 1 | four | 2 | 4 | 1 | -1 + | 4 | 1 | four | 2 | 4 | 2 | 2 + | 4 | 1 | four | 2 | 4 | 2 | 4 + | 4 | 1 | four | 2 | 4 | 3 | -3 + | 4 | 1 | four | 2 | 4 | 5 | -5 + | 4 | 1 | four | 2 | 4 | 5 | -5 + | 4 | 1 | four | 2 | 4 | | 0 + | 4 | 1 | four | 2 | 4 | | + | 4 | 1 | four | 3 | -3 | 0 | + | 4 | 1 | four | 3 | -3 | 1 | -1 + | 4 | 1 | four | 3 | -3 | 2 | 2 + | 4 | 1 | four | 3 | -3 | 2 | 4 + | 4 | 1 | four | 3 | -3 | 3 | -3 + | 4 | 1 | four | 3 | -3 | 5 | -5 + | 4 | 1 | four | 3 | -3 | 5 | -5 + | 4 | 1 | four | 3 | -3 | | 0 + | 4 | 1 | four | 3 | -3 | | + | 4 | 1 | four | 5 | -5 | 0 | + | 4 | 1 | four | 5 | -5 | 0 | + | 4 | 1 | four | 5 | -5 | 1 | -1 + | 4 | 1 | four | 5 | -5 | 1 | -1 + | 4 | 1 | four | 5 | -5 | 2 | 2 + | 4 | 1 | four | 5 | -5 | 2 | 2 + | 4 | 1 | four | 5 | -5 | 2 | 4 + | 4 | 1 | four | 5 | -5 | 2 | 4 + | 4 | 1 | four | 5 | -5 | 3 | -3 + | 4 | 1 | four | 5 | -5 | 3 | -3 + | 4 | 1 | four | 5 | -5 | 5 | -5 + | 4 | 1 | four | 5 | -5 | 5 | -5 + | 4 | 1 | four | 5 | -5 | 5 | -5 + | 4 | 1 | four | 5 | -5 | 5 | -5 + | 4 | 1 | four | 5 | -5 | | 0 + | 4 | 1 | four | 5 | -5 | | 0 + | 4 | 1 | four | 5 | -5 | | + | 4 | 1 | four | 5 | -5 | | + | 4 | 1 | four | | 0 | 0 | | 4 | 1 | four | | 0 | 1 | -1 - | 5 | 0 | five | | 0 | 1 | -1 - | 6 | 6 | six | | 0 | 1 | -1 - | 7 | 7 | seven | | 0 | 1 | -1 - | 8 | 8 | eight | | 0 | 1 | -1 - | 0 | | zero | | 0 | 1 | -1 - | | | null | | 0 | 1 | -1 - | | 0 | zero | | 0 | 1 | -1 - | 1 | 4 | one | | 0 | 2 | 2 - | 2 | 3 | two | | 0 | 2 | 2 - | 3 | 2 | three | | 0 | 2 | 2 | 4 | 1 | four | | 0 | 2 | 2 - | 5 | 0 | five | | 0 | 2 | 2 - | 6 | 6 | six | | 0 | 2 | 2 - | 7 | 7 | seven | | 0 | 2 | 2 - | 8 | 8 | eight | | 0 | 2 | 2 - | 0 | | zero | | 0 | 2 | 2 - | | | null | | 0 | 2 | 2 - | | 0 | zero | | 0 | 2 | 2 - | 1 | 4 | one | | 0 | 3 | -3 - | 2 | 3 | two | | 0 | 3 | -3 - | 3 | 2 | three | | 0 | 3 | -3 - | 4 | 1 | four | | 0 | 3 | -3 - | 5 | 0 | five | | 0 | 3 | -3 - | 6 | 6 | six | | 0 | 3 | -3 - | 7 | 7 | seven | | 0 | 3 | -3 - | 8 | 8 | eight | | 0 | 3 | -3 - | 0 | | zero | | 0 | 3 | -3 - | | | null | | 0 | 3 | -3 - | | 0 | zero | | 0 | 3 | -3 - | 1 | 4 | one | | 0 | 2 | 4 - | 2 | 3 | two | | 0 | 2 | 4 - | 3 | 2 | three | | 0 | 2 | 4 | 4 | 1 | four | | 0 | 2 | 4 - | 5 | 0 | five | | 0 | 2 | 4 - | 6 | 6 | six | | 0 | 2 | 4 - | 7 | 7 | seven | | 0 | 2 | 4 - | 8 | 8 | eight | | 0 | 2 | 4 - | 0 | | zero | | 0 | 2 | 4 - | | | null | | 0 | 2 | 4 - | | 0 | zero | | 0 | 2 | 4 - | 1 | 4 | one | | 0 | 5 | -5 - | 2 | 3 | two | | 0 | 5 | -5 - | 3 | 2 | three | | 0 | 5 | -5 + | 4 | 1 | four | | 0 | 3 | -3 | 4 | 1 | four | | 0 | 5 | -5 - | 5 | 0 | five | | 0 | 5 | -5 - | 6 | 6 | six | | 0 | 5 | -5 - | 7 | 7 | seven | | 0 | 5 | -5 - | 8 | 8 | eight | | 0 | 5 | -5 - | 0 | | zero | | 0 | 5 | -5 - | | | null | | 0 | 5 | -5 - | | 0 | zero | | 0 | 5 | -5 - | 1 | 4 | one | | 0 | 5 | -5 - | 2 | 3 | two | | 0 | 5 | -5 - | 3 | 2 | three | | 0 | 5 | -5 | 4 | 1 | four | | 0 | 5 | -5 - | 5 | 0 | five | | 0 | 5 | -5 - | 6 | 6 | six | | 0 | 5 | -5 - | 7 | 7 | seven | | 0 | 5 | -5 - | 8 | 8 | eight | | 0 | 5 | -5 - | 0 | | zero | | 0 | 5 | -5 - | | | null | | 0 | 5 | -5 - | | 0 | zero | | 0 | 5 | -5 - | 1 | 4 | one | | 0 | 0 | - | 2 | 3 | two | | 0 | 0 | - | 3 | 2 | three | | 0 | 0 | - | 4 | 1 | four | | 0 | 0 | - | 5 | 0 | five | | 0 | 0 | - | 6 | 6 | six | | 0 | 0 | - | 7 | 7 | seven | | 0 | 0 | - | 8 | 8 | eight | | 0 | 0 | - | 0 | | zero | | 0 | 0 | - | | | null | | 0 | 0 | - | | 0 | zero | | 0 | 0 | - | 1 | 4 | one | | 0 | | - | 2 | 3 | two | | 0 | | - | 3 | 2 | three | | 0 | | + | 4 | 1 | four | | 0 | | 0 | 4 | 1 | four | | 0 | | + | 4 | 1 | four | | | 0 | + | 4 | 1 | four | | | 1 | -1 + | 4 | 1 | four | | | 2 | 2 + | 4 | 1 | four | | | 2 | 4 + | 4 | 1 | four | | | 3 | -3 + | 4 | 1 | four | | | 5 | -5 + | 4 | 1 | four | | | 5 | -5 + | 4 | 1 | four | | | | 0 + | 4 | 1 | four | | | | + | 5 | 0 | five | 0 | | 0 | + | 5 | 0 | five | 0 | | 1 | -1 + | 5 | 0 | five | 0 | | 2 | 2 + | 5 | 0 | five | 0 | | 2 | 4 + | 5 | 0 | five | 0 | | 3 | -3 + | 5 | 0 | five | 0 | | 5 | -5 + | 5 | 0 | five | 0 | | 5 | -5 + | 5 | 0 | five | 0 | | | 0 + | 5 | 0 | five | 0 | | | + | 5 | 0 | five | 1 | -1 | 0 | + | 5 | 0 | five | 1 | -1 | 1 | -1 + | 5 | 0 | five | 1 | -1 | 2 | 2 + | 5 | 0 | five | 1 | -1 | 2 | 4 + | 5 | 0 | five | 1 | -1 | 3 | -3 + | 5 | 0 | five | 1 | -1 | 5 | -5 + | 5 | 0 | five | 1 | -1 | 5 | -5 + | 5 | 0 | five | 1 | -1 | | 0 + | 5 | 0 | five | 1 | -1 | | + | 5 | 0 | five | 2 | 2 | 0 | + | 5 | 0 | five | 2 | 2 | 1 | -1 + | 5 | 0 | five | 2 | 2 | 2 | 2 + | 5 | 0 | five | 2 | 2 | 2 | 4 + | 5 | 0 | five | 2 | 2 | 3 | -3 + | 5 | 0 | five | 2 | 2 | 5 | -5 + | 5 | 0 | five | 2 | 2 | 5 | -5 + | 5 | 0 | five | 2 | 2 | | 0 + | 5 | 0 | five | 2 | 2 | | + | 5 | 0 | five | 2 | 4 | 0 | + | 5 | 0 | five | 2 | 4 | 1 | -1 + | 5 | 0 | five | 2 | 4 | 2 | 2 + | 5 | 0 | five | 2 | 4 | 2 | 4 + | 5 | 0 | five | 2 | 4 | 3 | -3 + | 5 | 0 | five | 2 | 4 | 5 | -5 + | 5 | 0 | five | 2 | 4 | 5 | -5 + | 5 | 0 | five | 2 | 4 | | 0 + | 5 | 0 | five | 2 | 4 | | + | 5 | 0 | five | 3 | -3 | 0 | + | 5 | 0 | five | 3 | -3 | 1 | -1 + | 5 | 0 | five | 3 | -3 | 2 | 2 + | 5 | 0 | five | 3 | -3 | 2 | 4 + | 5 | 0 | five | 3 | -3 | 3 | -3 + | 5 | 0 | five | 3 | -3 | 5 | -5 + | 5 | 0 | five | 3 | -3 | 5 | -5 + | 5 | 0 | five | 3 | -3 | | 0 + | 5 | 0 | five | 3 | -3 | | + | 5 | 0 | five | 5 | -5 | 0 | + | 5 | 0 | five | 5 | -5 | 0 | + | 5 | 0 | five | 5 | -5 | 1 | -1 + | 5 | 0 | five | 5 | -5 | 1 | -1 + | 5 | 0 | five | 5 | -5 | 2 | 2 + | 5 | 0 | five | 5 | -5 | 2 | 2 + | 5 | 0 | five | 5 | -5 | 2 | 4 + | 5 | 0 | five | 5 | -5 | 2 | 4 + | 5 | 0 | five | 5 | -5 | 3 | -3 + | 5 | 0 | five | 5 | -5 | 3 | -3 + | 5 | 0 | five | 5 | -5 | 5 | -5 + | 5 | 0 | five | 5 | -5 | 5 | -5 + | 5 | 0 | five | 5 | -5 | 5 | -5 + | 5 | 0 | five | 5 | -5 | 5 | -5 + | 5 | 0 | five | 5 | -5 | | 0 + | 5 | 0 | five | 5 | -5 | | 0 + | 5 | 0 | five | 5 | -5 | | + | 5 | 0 | five | 5 | -5 | | + | 5 | 0 | five | | 0 | 0 | + | 5 | 0 | five | | 0 | 1 | -1 + | 5 | 0 | five | | 0 | 2 | 2 + | 5 | 0 | five | | 0 | 2 | 4 + | 5 | 0 | five | | 0 | 3 | -3 + | 5 | 0 | five | | 0 | 5 | -5 + | 5 | 0 | five | | 0 | 5 | -5 + | 5 | 0 | five | | 0 | | 0 | 5 | 0 | five | | 0 | | + | 5 | 0 | five | | | 0 | + | 5 | 0 | five | | | 1 | -1 + | 5 | 0 | five | | | 2 | 2 + | 5 | 0 | five | | | 2 | 4 + | 5 | 0 | five | | | 3 | -3 + | 5 | 0 | five | | | 5 | -5 + | 5 | 0 | five | | | 5 | -5 + | 5 | 0 | five | | | | 0 + | 5 | 0 | five | | | | + | 6 | 6 | six | 0 | | 0 | + | 6 | 6 | six | 0 | | 1 | -1 + | 6 | 6 | six | 0 | | 2 | 2 + | 6 | 6 | six | 0 | | 2 | 4 + | 6 | 6 | six | 0 | | 3 | -3 + | 6 | 6 | six | 0 | | 5 | -5 + | 6 | 6 | six | 0 | | 5 | -5 + | 6 | 6 | six | 0 | | | 0 + | 6 | 6 | six | 0 | | | + | 6 | 6 | six | 1 | -1 | 0 | + | 6 | 6 | six | 1 | -1 | 1 | -1 + | 6 | 6 | six | 1 | -1 | 2 | 2 + | 6 | 6 | six | 1 | -1 | 2 | 4 + | 6 | 6 | six | 1 | -1 | 3 | -3 + | 6 | 6 | six | 1 | -1 | 5 | -5 + | 6 | 6 | six | 1 | -1 | 5 | -5 + | 6 | 6 | six | 1 | -1 | | 0 + | 6 | 6 | six | 1 | -1 | | + | 6 | 6 | six | 2 | 2 | 0 | + | 6 | 6 | six | 2 | 2 | 1 | -1 + | 6 | 6 | six | 2 | 2 | 2 | 2 + | 6 | 6 | six | 2 | 2 | 2 | 4 + | 6 | 6 | six | 2 | 2 | 3 | -3 + | 6 | 6 | six | 2 | 2 | 5 | -5 + | 6 | 6 | six | 2 | 2 | 5 | -5 + | 6 | 6 | six | 2 | 2 | | 0 + | 6 | 6 | six | 2 | 2 | | + | 6 | 6 | six | 2 | 4 | 0 | + | 6 | 6 | six | 2 | 4 | 1 | -1 + | 6 | 6 | six | 2 | 4 | 2 | 2 + | 6 | 6 | six | 2 | 4 | 2 | 4 + | 6 | 6 | six | 2 | 4 | 3 | -3 + | 6 | 6 | six | 2 | 4 | 5 | -5 + | 6 | 6 | six | 2 | 4 | 5 | -5 + | 6 | 6 | six | 2 | 4 | | 0 + | 6 | 6 | six | 2 | 4 | | + | 6 | 6 | six | 3 | -3 | 0 | + | 6 | 6 | six | 3 | -3 | 1 | -1 + | 6 | 6 | six | 3 | -3 | 2 | 2 + | 6 | 6 | six | 3 | -3 | 2 | 4 + | 6 | 6 | six | 3 | -3 | 3 | -3 + | 6 | 6 | six | 3 | -3 | 5 | -5 + | 6 | 6 | six | 3 | -3 | 5 | -5 + | 6 | 6 | six | 3 | -3 | | 0 + | 6 | 6 | six | 3 | -3 | | + | 6 | 6 | six | 5 | -5 | 0 | + | 6 | 6 | six | 5 | -5 | 0 | + | 6 | 6 | six | 5 | -5 | 1 | -1 + | 6 | 6 | six | 5 | -5 | 1 | -1 + | 6 | 6 | six | 5 | -5 | 2 | 2 + | 6 | 6 | six | 5 | -5 | 2 | 2 + | 6 | 6 | six | 5 | -5 | 2 | 4 + | 6 | 6 | six | 5 | -5 | 2 | 4 + | 6 | 6 | six | 5 | -5 | 3 | -3 + | 6 | 6 | six | 5 | -5 | 3 | -3 + | 6 | 6 | six | 5 | -5 | 5 | -5 + | 6 | 6 | six | 5 | -5 | 5 | -5 + | 6 | 6 | six | 5 | -5 | 5 | -5 + | 6 | 6 | six | 5 | -5 | 5 | -5 + | 6 | 6 | six | 5 | -5 | | 0 + | 6 | 6 | six | 5 | -5 | | 0 + | 6 | 6 | six | 5 | -5 | | + | 6 | 6 | six | 5 | -5 | | + | 6 | 6 | six | | 0 | 0 | + | 6 | 6 | six | | 0 | 1 | -1 + | 6 | 6 | six | | 0 | 2 | 2 + | 6 | 6 | six | | 0 | 2 | 4 + | 6 | 6 | six | | 0 | 3 | -3 + | 6 | 6 | six | | 0 | 5 | -5 + | 6 | 6 | six | | 0 | 5 | -5 + | 6 | 6 | six | | 0 | | 0 | 6 | 6 | six | | 0 | | + | 6 | 6 | six | | | 0 | + | 6 | 6 | six | | | 1 | -1 + | 6 | 6 | six | | | 2 | 2 + | 6 | 6 | six | | | 2 | 4 + | 6 | 6 | six | | | 3 | -3 + | 6 | 6 | six | | | 5 | -5 + | 6 | 6 | six | | | 5 | -5 + | 6 | 6 | six | | | | 0 + | 6 | 6 | six | | | | + | 7 | 7 | seven | 0 | | 0 | + | 7 | 7 | seven | 0 | | 1 | -1 + | 7 | 7 | seven | 0 | | 2 | 2 + | 7 | 7 | seven | 0 | | 2 | 4 + | 7 | 7 | seven | 0 | | 3 | -3 + | 7 | 7 | seven | 0 | | 5 | -5 + | 7 | 7 | seven | 0 | | 5 | -5 + | 7 | 7 | seven | 0 | | | 0 + | 7 | 7 | seven | 0 | | | + | 7 | 7 | seven | 1 | -1 | 0 | + | 7 | 7 | seven | 1 | -1 | 1 | -1 + | 7 | 7 | seven | 1 | -1 | 2 | 2 + | 7 | 7 | seven | 1 | -1 | 2 | 4 + | 7 | 7 | seven | 1 | -1 | 3 | -3 + | 7 | 7 | seven | 1 | -1 | 5 | -5 + | 7 | 7 | seven | 1 | -1 | 5 | -5 + | 7 | 7 | seven | 1 | -1 | | 0 + | 7 | 7 | seven | 1 | -1 | | + | 7 | 7 | seven | 2 | 2 | 0 | + | 7 | 7 | seven | 2 | 2 | 1 | -1 + | 7 | 7 | seven | 2 | 2 | 2 | 2 + | 7 | 7 | seven | 2 | 2 | 2 | 4 + | 7 | 7 | seven | 2 | 2 | 3 | -3 + | 7 | 7 | seven | 2 | 2 | 5 | -5 + | 7 | 7 | seven | 2 | 2 | 5 | -5 + | 7 | 7 | seven | 2 | 2 | | 0 + | 7 | 7 | seven | 2 | 2 | | + | 7 | 7 | seven | 2 | 4 | 0 | + | 7 | 7 | seven | 2 | 4 | 1 | -1 + | 7 | 7 | seven | 2 | 4 | 2 | 2 + | 7 | 7 | seven | 2 | 4 | 2 | 4 + | 7 | 7 | seven | 2 | 4 | 3 | -3 + | 7 | 7 | seven | 2 | 4 | 5 | -5 + | 7 | 7 | seven | 2 | 4 | 5 | -5 + | 7 | 7 | seven | 2 | 4 | | 0 + | 7 | 7 | seven | 2 | 4 | | + | 7 | 7 | seven | 3 | -3 | 0 | + | 7 | 7 | seven | 3 | -3 | 1 | -1 + | 7 | 7 | seven | 3 | -3 | 2 | 2 + | 7 | 7 | seven | 3 | -3 | 2 | 4 + | 7 | 7 | seven | 3 | -3 | 3 | -3 + | 7 | 7 | seven | 3 | -3 | 5 | -5 + | 7 | 7 | seven | 3 | -3 | 5 | -5 + | 7 | 7 | seven | 3 | -3 | | 0 + | 7 | 7 | seven | 3 | -3 | | + | 7 | 7 | seven | 5 | -5 | 0 | + | 7 | 7 | seven | 5 | -5 | 0 | + | 7 | 7 | seven | 5 | -5 | 1 | -1 + | 7 | 7 | seven | 5 | -5 | 1 | -1 + | 7 | 7 | seven | 5 | -5 | 2 | 2 + | 7 | 7 | seven | 5 | -5 | 2 | 2 + | 7 | 7 | seven | 5 | -5 | 2 | 4 + | 7 | 7 | seven | 5 | -5 | 2 | 4 + | 7 | 7 | seven | 5 | -5 | 3 | -3 + | 7 | 7 | seven | 5 | -5 | 3 | -3 + | 7 | 7 | seven | 5 | -5 | 5 | -5 + | 7 | 7 | seven | 5 | -5 | 5 | -5 + | 7 | 7 | seven | 5 | -5 | 5 | -5 + | 7 | 7 | seven | 5 | -5 | 5 | -5 + | 7 | 7 | seven | 5 | -5 | | 0 + | 7 | 7 | seven | 5 | -5 | | 0 + | 7 | 7 | seven | 5 | -5 | | + | 7 | 7 | seven | 5 | -5 | | + | 7 | 7 | seven | | 0 | 0 | + | 7 | 7 | seven | | 0 | 1 | -1 + | 7 | 7 | seven | | 0 | 2 | 2 + | 7 | 7 | seven | | 0 | 2 | 4 + | 7 | 7 | seven | | 0 | 3 | -3 + | 7 | 7 | seven | | 0 | 5 | -5 + | 7 | 7 | seven | | 0 | 5 | -5 + | 7 | 7 | seven | | 0 | | 0 | 7 | 7 | seven | | 0 | | + | 7 | 7 | seven | | | 0 | + | 7 | 7 | seven | | | 1 | -1 + | 7 | 7 | seven | | | 2 | 2 + | 7 | 7 | seven | | | 2 | 4 + | 7 | 7 | seven | | | 3 | -3 + | 7 | 7 | seven | | | 5 | -5 + | 7 | 7 | seven | | | 5 | -5 + | 7 | 7 | seven | | | | 0 + | 7 | 7 | seven | | | | + | 8 | 8 | eight | 0 | | 0 | + | 8 | 8 | eight | 0 | | 1 | -1 + | 8 | 8 | eight | 0 | | 2 | 2 + | 8 | 8 | eight | 0 | | 2 | 4 + | 8 | 8 | eight | 0 | | 3 | -3 + | 8 | 8 | eight | 0 | | 5 | -5 + | 8 | 8 | eight | 0 | | 5 | -5 + | 8 | 8 | eight | 0 | | | 0 + | 8 | 8 | eight | 0 | | | + | 8 | 8 | eight | 1 | -1 | 0 | + | 8 | 8 | eight | 1 | -1 | 1 | -1 + | 8 | 8 | eight | 1 | -1 | 2 | 2 + | 8 | 8 | eight | 1 | -1 | 2 | 4 + | 8 | 8 | eight | 1 | -1 | 3 | -3 + | 8 | 8 | eight | 1 | -1 | 5 | -5 + | 8 | 8 | eight | 1 | -1 | 5 | -5 + | 8 | 8 | eight | 1 | -1 | | 0 + | 8 | 8 | eight | 1 | -1 | | + | 8 | 8 | eight | 2 | 2 | 0 | + | 8 | 8 | eight | 2 | 2 | 1 | -1 + | 8 | 8 | eight | 2 | 2 | 2 | 2 + | 8 | 8 | eight | 2 | 2 | 2 | 4 + | 8 | 8 | eight | 2 | 2 | 3 | -3 + | 8 | 8 | eight | 2 | 2 | 5 | -5 + | 8 | 8 | eight | 2 | 2 | 5 | -5 + | 8 | 8 | eight | 2 | 2 | | 0 + | 8 | 8 | eight | 2 | 2 | | + | 8 | 8 | eight | 2 | 4 | 0 | + | 8 | 8 | eight | 2 | 4 | 1 | -1 + | 8 | 8 | eight | 2 | 4 | 2 | 2 + | 8 | 8 | eight | 2 | 4 | 2 | 4 + | 8 | 8 | eight | 2 | 4 | 3 | -3 + | 8 | 8 | eight | 2 | 4 | 5 | -5 + | 8 | 8 | eight | 2 | 4 | 5 | -5 + | 8 | 8 | eight | 2 | 4 | | 0 + | 8 | 8 | eight | 2 | 4 | | + | 8 | 8 | eight | 3 | -3 | 0 | + | 8 | 8 | eight | 3 | -3 | 1 | -1 + | 8 | 8 | eight | 3 | -3 | 2 | 2 + | 8 | 8 | eight | 3 | -3 | 2 | 4 + | 8 | 8 | eight | 3 | -3 | 3 | -3 + | 8 | 8 | eight | 3 | -3 | 5 | -5 + | 8 | 8 | eight | 3 | -3 | 5 | -5 + | 8 | 8 | eight | 3 | -3 | | 0 + | 8 | 8 | eight | 3 | -3 | | + | 8 | 8 | eight | 5 | -5 | 0 | + | 8 | 8 | eight | 5 | -5 | 0 | + | 8 | 8 | eight | 5 | -5 | 1 | -1 + | 8 | 8 | eight | 5 | -5 | 1 | -1 + | 8 | 8 | eight | 5 | -5 | 2 | 2 + | 8 | 8 | eight | 5 | -5 | 2 | 2 + | 8 | 8 | eight | 5 | -5 | 2 | 4 + | 8 | 8 | eight | 5 | -5 | 2 | 4 + | 8 | 8 | eight | 5 | -5 | 3 | -3 + | 8 | 8 | eight | 5 | -5 | 3 | -3 + | 8 | 8 | eight | 5 | -5 | 5 | -5 + | 8 | 8 | eight | 5 | -5 | 5 | -5 + | 8 | 8 | eight | 5 | -5 | 5 | -5 + | 8 | 8 | eight | 5 | -5 | 5 | -5 + | 8 | 8 | eight | 5 | -5 | | 0 + | 8 | 8 | eight | 5 | -5 | | 0 + | 8 | 8 | eight | 5 | -5 | | + | 8 | 8 | eight | 5 | -5 | | + | 8 | 8 | eight | | 0 | 0 | + | 8 | 8 | eight | | 0 | 1 | -1 + | 8 | 8 | eight | | 0 | 2 | 2 + | 8 | 8 | eight | | 0 | 2 | 4 + | 8 | 8 | eight | | 0 | 3 | -3 + | 8 | 8 | eight | | 0 | 5 | -5 + | 8 | 8 | eight | | 0 | 5 | -5 + | 8 | 8 | eight | | 0 | | 0 | 8 | 8 | eight | | 0 | | - | 0 | | zero | | 0 | | - | | | null | | 0 | | + | 8 | 8 | eight | | | 0 | + | 8 | 8 | eight | | | 1 | -1 + | 8 | 8 | eight | | | 2 | 2 + | 8 | 8 | eight | | | 2 | 4 + | 8 | 8 | eight | | | 3 | -3 + | 8 | 8 | eight | | | 5 | -5 + | 8 | 8 | eight | | | 5 | -5 + | 8 | 8 | eight | | | | 0 + | 8 | 8 | eight | | | | + | | 0 | zero | 0 | | 0 | + | | 0 | zero | 0 | | 1 | -1 + | | 0 | zero | 0 | | 2 | 2 + | | 0 | zero | 0 | | 2 | 4 + | | 0 | zero | 0 | | 3 | -3 + | | 0 | zero | 0 | | 5 | -5 + | | 0 | zero | 0 | | 5 | -5 + | | 0 | zero | 0 | | | 0 + | | 0 | zero | 0 | | | + | | 0 | zero | 1 | -1 | 0 | + | | 0 | zero | 1 | -1 | 1 | -1 + | | 0 | zero | 1 | -1 | 2 | 2 + | | 0 | zero | 1 | -1 | 2 | 4 + | | 0 | zero | 1 | -1 | 3 | -3 + | | 0 | zero | 1 | -1 | 5 | -5 + | | 0 | zero | 1 | -1 | 5 | -5 + | | 0 | zero | 1 | -1 | | 0 + | | 0 | zero | 1 | -1 | | + | | 0 | zero | 2 | 2 | 0 | + | | 0 | zero | 2 | 2 | 1 | -1 + | | 0 | zero | 2 | 2 | 2 | 2 + | | 0 | zero | 2 | 2 | 2 | 4 + | | 0 | zero | 2 | 2 | 3 | -3 + | | 0 | zero | 2 | 2 | 5 | -5 + | | 0 | zero | 2 | 2 | 5 | -5 + | | 0 | zero | 2 | 2 | | 0 + | | 0 | zero | 2 | 2 | | + | | 0 | zero | 2 | 4 | 0 | + | | 0 | zero | 2 | 4 | 1 | -1 + | | 0 | zero | 2 | 4 | 2 | 2 + | | 0 | zero | 2 | 4 | 2 | 4 + | | 0 | zero | 2 | 4 | 3 | -3 + | | 0 | zero | 2 | 4 | 5 | -5 + | | 0 | zero | 2 | 4 | 5 | -5 + | | 0 | zero | 2 | 4 | | 0 + | | 0 | zero | 2 | 4 | | + | | 0 | zero | 3 | -3 | 0 | + | | 0 | zero | 3 | -3 | 1 | -1 + | | 0 | zero | 3 | -3 | 2 | 2 + | | 0 | zero | 3 | -3 | 2 | 4 + | | 0 | zero | 3 | -3 | 3 | -3 + | | 0 | zero | 3 | -3 | 5 | -5 + | | 0 | zero | 3 | -3 | 5 | -5 + | | 0 | zero | 3 | -3 | | 0 + | | 0 | zero | 3 | -3 | | + | | 0 | zero | 5 | -5 | 0 | + | | 0 | zero | 5 | -5 | 0 | + | | 0 | zero | 5 | -5 | 1 | -1 + | | 0 | zero | 5 | -5 | 1 | -1 + | | 0 | zero | 5 | -5 | 2 | 2 + | | 0 | zero | 5 | -5 | 2 | 2 + | | 0 | zero | 5 | -5 | 2 | 4 + | | 0 | zero | 5 | -5 | 2 | 4 + | | 0 | zero | 5 | -5 | 3 | -3 + | | 0 | zero | 5 | -5 | 3 | -3 + | | 0 | zero | 5 | -5 | 5 | -5 + | | 0 | zero | 5 | -5 | 5 | -5 + | | 0 | zero | 5 | -5 | 5 | -5 + | | 0 | zero | 5 | -5 | 5 | -5 + | | 0 | zero | 5 | -5 | | 0 + | | 0 | zero | 5 | -5 | | 0 + | | 0 | zero | 5 | -5 | | + | | 0 | zero | 5 | -5 | | + | | 0 | zero | | 0 | 0 | + | | 0 | zero | | 0 | 1 | -1 + | | 0 | zero | | 0 | 2 | 2 + | | 0 | zero | | 0 | 2 | 4 + | | 0 | zero | | 0 | 3 | -3 + | | 0 | zero | | 0 | 5 | -5 + | | 0 | zero | | 0 | 5 | -5 + | | 0 | zero | | 0 | | 0 | | 0 | zero | | 0 | | - | 1 | 4 | one | | 0 | | 0 - | 2 | 3 | two | | 0 | | 0 - | 3 | 2 | three | | 0 | | 0 - | 4 | 1 | four | | 0 | | 0 - | 5 | 0 | five | | 0 | | 0 - | 6 | 6 | six | | 0 | | 0 - | 7 | 7 | seven | | 0 | | 0 - | 8 | 8 | eight | | 0 | | 0 - | 0 | | zero | | 0 | | 0 + | | 0 | zero | | | 0 | + | | 0 | zero | | | 1 | -1 + | | 0 | zero | | | 2 | 2 + | | 0 | zero | | | 2 | 4 + | | 0 | zero | | | 3 | -3 + | | 0 | zero | | | 5 | -5 + | | 0 | zero | | | 5 | -5 + | | 0 | zero | | | | 0 + | | 0 | zero | | | | + | | | null | 0 | | 0 | + | | | null | 0 | | 1 | -1 + | | | null | 0 | | 2 | 2 + | | | null | 0 | | 2 | 4 + | | | null | 0 | | 3 | -3 + | | | null | 0 | | 5 | -5 + | | | null | 0 | | 5 | -5 + | | | null | 0 | | | 0 + | | | null | 0 | | | + | | | null | 1 | -1 | 0 | + | | | null | 1 | -1 | 1 | -1 + | | | null | 1 | -1 | 2 | 2 + | | | null | 1 | -1 | 2 | 4 + | | | null | 1 | -1 | 3 | -3 + | | | null | 1 | -1 | 5 | -5 + | | | null | 1 | -1 | 5 | -5 + | | | null | 1 | -1 | | 0 + | | | null | 1 | -1 | | + | | | null | 2 | 2 | 0 | + | | | null | 2 | 2 | 1 | -1 + | | | null | 2 | 2 | 2 | 2 + | | | null | 2 | 2 | 2 | 4 + | | | null | 2 | 2 | 3 | -3 + | | | null | 2 | 2 | 5 | -5 + | | | null | 2 | 2 | 5 | -5 + | | | null | 2 | 2 | | 0 + | | | null | 2 | 2 | | + | | | null | 2 | 4 | 0 | + | | | null | 2 | 4 | 1 | -1 + | | | null | 2 | 4 | 2 | 2 + | | | null | 2 | 4 | 2 | 4 + | | | null | 2 | 4 | 3 | -3 + | | | null | 2 | 4 | 5 | -5 + | | | null | 2 | 4 | 5 | -5 + | | | null | 2 | 4 | | 0 + | | | null | 2 | 4 | | + | | | null | 3 | -3 | 0 | + | | | null | 3 | -3 | 1 | -1 + | | | null | 3 | -3 | 2 | 2 + | | | null | 3 | -3 | 2 | 4 + | | | null | 3 | -3 | 3 | -3 + | | | null | 3 | -3 | 5 | -5 + | | | null | 3 | -3 | 5 | -5 + | | | null | 3 | -3 | | 0 + | | | null | 3 | -3 | | + | | | null | 5 | -5 | 0 | + | | | null | 5 | -5 | 0 | + | | | null | 5 | -5 | 1 | -1 + | | | null | 5 | -5 | 1 | -1 + | | | null | 5 | -5 | 2 | 2 + | | | null | 5 | -5 | 2 | 2 + | | | null | 5 | -5 | 2 | 4 + | | | null | 5 | -5 | 2 | 4 + | | | null | 5 | -5 | 3 | -3 + | | | null | 5 | -5 | 3 | -3 + | | | null | 5 | -5 | 5 | -5 + | | | null | 5 | -5 | 5 | -5 + | | | null | 5 | -5 | 5 | -5 + | | | null | 5 | -5 | 5 | -5 + | | | null | 5 | -5 | | 0 + | | | null | 5 | -5 | | 0 + | | | null | 5 | -5 | | + | | | null | 5 | -5 | | + | | | null | | 0 | 0 | + | | | null | | 0 | 1 | -1 + | | | null | | 0 | 2 | 2 + | | | null | | 0 | 2 | 4 + | | | null | | 0 | 3 | -3 + | | | null | | 0 | 5 | -5 + | | | null | | 0 | 5 | -5 | | | null | | 0 | | 0 - | | 0 | zero | | 0 | | 0 + | | | null | | 0 | | + | | | null | | | 0 | + | | | null | | | 1 | -1 + | | | null | | | 2 | 2 + | | | null | | | 2 | 4 + | | | null | | | 3 | -3 + | | | null | | | 5 | -5 + | | | null | | | 5 | -5 + | | | null | | | | 0 + | | | null | | | | (891 rows) -- @@ -1566,7 +1577,8 @@ SELECT '' AS "xxx", * -- -- Inner equi-join on specified column SELECT '' AS "xxx", * - FROM J1_TBL INNER JOIN J2_TBL USING (i); + FROM J1_TBL INNER JOIN J2_TBL USING (i) + ORDER BY i, j, k, t; xxx | i | j | t | k -----+---+---+-------+---- | 0 | | zero | @@ -1580,7 +1592,8 @@ SELECT '' AS "xxx", * -- Same as above, slightly different syntax SELECT '' AS "xxx", * - FROM J1_TBL JOIN J2_TBL USING (i); + FROM J1_TBL JOIN J2_TBL USING (i) + ORDER BY i, j, k, t; xxx | i | j | t | k -----+---+---+-------+---- | 0 | | zero | @@ -1622,7 +1635,8 @@ SELECT '' AS "xxx", * -- Inner equi-join on all columns with the same name -- SELECT '' AS "xxx", * - FROM J1_TBL NATURAL JOIN J2_TBL; + FROM J1_TBL NATURAL JOIN J2_TBL + ORDER BY i, j, k, t; xxx | i | j | t | k -----+---+---+-------+---- | 0 | | zero | @@ -1635,7 +1649,8 @@ SELECT '' AS "xxx", * (7 rows) SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (a, d); + FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (a, d) + ORDER BY a, b, c, d; xxx | a | b | c | d -----+---+---+-------+---- | 0 | | zero | @@ -1648,7 +1663,8 @@ SELECT '' AS "xxx", * (7 rows) SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (d, a); + FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (d, a) + ORDER BY a, b, c, d; xxx | a | b | c | d -----+---+---+------+--- | 0 | | zero | @@ -1659,7 +1675,8 @@ SELECT '' AS "xxx", * -- mismatch number of columns -- currently, Postgres will fill in with underlying names SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b) NATURAL JOIN J2_TBL t2 (a); + FROM J1_TBL t1 (a, b) NATURAL JOIN J2_TBL t2 (a) + ORDER BY a, b, t, k; xxx | a | b | t | k -----+---+---+-------+---- | 0 | | zero | @@ -1675,7 +1692,8 @@ SELECT '' AS "xxx", * -- Inner joins (equi-joins) -- SELECT '' AS "xxx", * - FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.i); + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.i) + ORDER BY J1_TBL.i, J1_TBL.j, J1_TBL.t, J2_TBL.i, J2_TBL.k; xxx | i | j | t | i | k -----+---+---+-------+---+---- | 0 | | zero | 0 | @@ -1688,7 +1706,8 @@ SELECT '' AS "xxx", * (7 rows) SELECT '' AS "xxx", * - FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.k); + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.k) + ORDER BY J1_TBL.i, J1_TBL.j, J1_TBL.t, J2_TBL.i, J2_TBL.k; xxx | i | j | t | i | k -----+---+---+------+---+--- | 0 | | zero | | 0 @@ -1700,18 +1719,19 @@ SELECT '' AS "xxx", * -- Non-equi-joins -- SELECT '' AS "xxx", * - FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i <= J2_TBL.k); + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i <= J2_TBL.k) + ORDER BY J1_TBL.i, J1_TBL.j, J1_TBL.t, J2_TBL.i, J2_TBL.k; xxx | i | j | t | i | k -----+---+---+-------+---+--- - | 1 | 4 | one | 2 | 2 - | 2 | 3 | two | 2 | 2 | 0 | | zero | 2 | 2 + | 0 | | zero | 2 | 4 + | 0 | | zero | | 0 + | 1 | 4 | one | 2 | 2 | 1 | 4 | one | 2 | 4 + | 2 | 3 | two | 2 | 2 | 2 | 3 | two | 2 | 4 | 3 | 2 | three | 2 | 4 | 4 | 1 | four | 2 | 4 - | 0 | | zero | 2 | 4 - | 0 | | zero | | 0 (9 rows) -- @@ -1759,7 +1779,8 @@ SELECT '' AS "xxx", * (13 rows) SELECT '' AS "xxx", * - FROM J1_TBL RIGHT OUTER JOIN J2_TBL USING (i); + FROM J1_TBL RIGHT OUTER JOIN J2_TBL USING (i) + ORDER BY i, j, k, t; xxx | i | j | t | k -----+---+---+-------+---- | 0 | | zero | @@ -1769,12 +1790,13 @@ SELECT '' AS "xxx", * | 3 | 2 | three | -3 | 5 | 0 | five | -5 | 5 | 0 | five | -5 - | | | | | | | | 0 + | | | | (9 rows) SELECT '' AS "xxx", * - FROM J1_TBL RIGHT JOIN J2_TBL USING (i); + FROM J1_TBL RIGHT JOIN J2_TBL USING (i) + ORDER BY i, j, k, t; xxx | i | j | t | k -----+---+---+-------+---- | 0 | | zero | @@ -1784,8 +1806,8 @@ SELECT '' AS "xxx", * | 3 | 2 | three | -3 | 5 | 0 | five | -5 | 5 | 0 | five | -5 - | | | | | | | | 0 + | | | | (9 rows) SELECT '' AS "xxx", * @@ -1861,7 +1883,8 @@ INSERT INTO t2 VALUES ( 'ee', 42 ); INSERT INTO t3 VALUES ( 'bb', 13 ); INSERT INTO t3 VALUES ( 'cc', 23 ); INSERT INTO t3 VALUES ( 'dd', 33 ); -SELECT * FROM t1 FULL JOIN t2 USING (name) FULL JOIN t3 USING (name); +SELECT * FROM t1 FULL JOIN t2 USING (name) FULL JOIN t3 USING (name) +ORDER BY name,t1.n, t2.n, t3.n; name | n | n | n ------+----+----+---- bb | 11 | 12 | 13 @@ -1878,7 +1901,8 @@ SELECT * FROM (SELECT * FROM t2) as s2 INNER JOIN (SELECT * FROM t3) s3 -USING (name); +USING (name) +ORDER BY name, s2.n, s3.n; name | n | n ------+----+---- bb | 12 | 13 @@ -1889,7 +1913,8 @@ SELECT * FROM (SELECT * FROM t2) as s2 LEFT JOIN (SELECT * FROM t3) s3 -USING (name); +USING (name) +ORDER BY name, s2.n, s3.n; name | n | n ------+----+---- bb | 12 | 13 @@ -1901,7 +1926,8 @@ SELECT * FROM (SELECT * FROM t2) as s2 FULL JOIN (SELECT * FROM t3) s3 -USING (name); +USING (name) +ORDER BY name, s2.n, s3.n; name | n | n ------+----+---- bb | 12 | 13 @@ -1915,7 +1941,8 @@ USING (name); SELECT * FROM (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL INNER JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s2_n, s3_n; name | s2_n | s2_2 | s3_n | s3_2 ------+------+------+------+------ bb | 12 | 2 | 13 | 3 @@ -1925,7 +1952,8 @@ NATURAL INNER JOIN SELECT * FROM (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL LEFT JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s2_n, s3_n; name | s2_n | s2_2 | s3_n | s3_2 ------+------+------+------+------ bb | 12 | 2 | 13 | 3 @@ -1936,7 +1964,8 @@ NATURAL LEFT JOIN SELECT * FROM (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL FULL JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s2_n, s3_n; name | s2_n | s2_2 | s3_n | s3_2 ------+------+------+------+------ bb | 12 | 2 | 13 | 3 @@ -1950,7 +1979,8 @@ SELECT * FROM NATURAL INNER JOIN (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL INNER JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s1_n, s2_n, s3_n; name | s1_n | s1_1 | s2_n | s2_2 | s3_n | s3_2 ------+------+------+------+------+------+------ bb | 11 | 1 | 12 | 2 | 13 | 3 @@ -1961,7 +1991,8 @@ SELECT * FROM NATURAL FULL JOIN (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL FULL JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s1_n, s2_n, s3_n; name | s1_n | s1_1 | s2_n | s2_2 | s3_n | s3_2 ------+------+------+------+------+------+------ bb | 11 | 1 | 12 | 2 | 13 | 3 @@ -1977,7 +2008,8 @@ NATURAL FULL JOIN (SELECT name, n as s2_n FROM t2) as s2 NATURAL FULL JOIN (SELECT name, n as s3_n FROM t3) as s3 - ) ss2; + ) ss2 + ORDER BY name, s1_n, s2_n, s3_n; name | s1_n | s2_n | s3_n ------+------+------+------ bb | 11 | 12 | 13 @@ -1993,7 +2025,8 @@ NATURAL FULL JOIN (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL FULL JOIN (SELECT name, n as s3_n FROM t3) as s3 - ) ss2; + ) ss2 + ORDER BY name, s1_n, s2_n, s3_n; name | s1_n | s2_n | s2_2 | s3_n ------+------+------+------+------ bb | 11 | 12 | 2 | 13 @@ -2014,7 +2047,7 @@ insert into y values (1,111); insert into y values (2,222); insert into y values (3,333); insert into y values (4,null); -select * from x; +select * from x ORDER BY x1; x1 | x2 ----+---- 1 | 11 @@ -2024,7 +2057,7 @@ select * from x; 5 | (5 rows) -select * from y; +select * from y ORDER BY y1; y1 | y2 ----+----- 1 | 111 @@ -2033,7 +2066,7 @@ select * from y; 4 | (4 rows) -select * from x left join y on (x1 = y1 and x2 is not null); +select * from x left join y on (x1 = y1 and x2 is not null) ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 ----+----+----+----- 1 | 11 | 1 | 111 @@ -2043,7 +2076,7 @@ select * from x left join y on (x1 = y1 and x2 is not null); 5 | | | (5 rows) -select * from x left join y on (x1 = y1 and y2 is not null); +select * from x left join y on (x1 = y1 and y2 is not null) ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 ----+----+----+----- 1 | 11 | 1 | 111 @@ -2054,7 +2087,7 @@ select * from x left join y on (x1 = y1 and y2 is not null); (5 rows) select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1); +on (x1 = xx1) ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 | xx1 | xx2 ----+----+----+-----+-----+----- 1 | 11 | 1 | 111 | 1 | 11 @@ -2065,7 +2098,7 @@ on (x1 = xx1); (5 rows) select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1 and x2 is not null); +on (x1 = xx1 and x2 is not null) ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 | xx1 | xx2 ----+----+----+-----+-----+----- 1 | 11 | 1 | 111 | 1 | 11 @@ -2076,7 +2109,7 @@ on (x1 = xx1 and x2 is not null); (5 rows) select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1 and y2 is not null); +on (x1 = xx1 and y2 is not null) ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 | xx1 | xx2 ----+----+----+-----+-----+----- 1 | 11 | 1 | 111 | 1 | 11 @@ -2087,7 +2120,7 @@ on (x1 = xx1 and y2 is not null); (5 rows) select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1 and xx2 is not null); +on (x1 = xx1 and xx2 is not null) ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 | xx1 | xx2 ----+----+----+-----+-----+----- 1 | 11 | 1 | 111 | 1 | 11 @@ -2099,7 +2132,8 @@ on (x1 = xx1 and xx2 is not null); -- these should NOT give the same answers as above select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1) where (x2 is not null); +on (x1 = xx1) where (x2 is not null) +ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 | xx1 | xx2 ----+----+----+-----+-----+----- 1 | 11 | 1 | 111 | 1 | 11 @@ -2108,7 +2142,8 @@ on (x1 = xx1) where (x2 is not null); (3 rows) select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1) where (y2 is not null); +on (x1 = xx1) where (y2 is not null) +ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 | xx1 | xx2 ----+----+----+-----+-----+----- 1 | 11 | 1 | 111 | 1 | 11 @@ -2117,7 +2152,8 @@ on (x1 = xx1) where (y2 is not null); (3 rows) select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1) where (xx2 is not null); +on (x1 = xx1) where (xx2 is not null) +ORDER BY x1, x2, y1, y2; x1 | x2 | y1 | y2 | xx1 | xx2 ----+----+----+-----+-----+----- 1 | 11 | 1 | 111 | 1 | 11 @@ -2173,7 +2209,7 @@ INSERT INTO t3 VALUES (6, 7); INSERT INTO t3 VALUES (7, 8); INSERT INTO t3 VALUES (500, 100); DELETE FROM t3 USING t1 table1 WHERE t3.x = table1.a; -SELECT * FROM t3; +SELECT * FROM t3 ORDER By x, y; x | y -----+----- 6 | 7 @@ -2182,7 +2218,7 @@ SELECT * FROM t3; (3 rows) DELETE FROM t3 USING t1 JOIN t2 USING (a) WHERE t3.x > t1.a; -SELECT * FROM t3; +SELECT * FROM t3 ORDER By x, y; x | y ---+--- 6 | 7 @@ -2190,7 +2226,7 @@ SELECT * FROM t3; (2 rows) DELETE FROM t3 USING t3 t3_other WHERE t3.x = t3_other.x AND t3.y = t3_other.y; -SELECT * FROM t3; +SELECT * FROM t3 ORDER By x, y; x | y ---+--- (0 rows) @@ -2207,7 +2243,8 @@ INSERT INTO tt2 VALUES (22, 11); set enable_hashjoin to off; set enable_nestloop to off; -- these should give the same results -select tt1.*, tt2.* from tt1 left join tt2 on tt1.joincol = tt2.joincol; +select tt1.*, tt2.* from tt1 left join tt2 on tt1.joincol = tt2.joincol + ORDER BY tt1_id, tt2_id; tt1_id | joincol | tt2_id | joincol --------+---------+--------+--------- 1 | 11 | 21 | 11 @@ -2215,7 +2252,8 @@ select tt1.*, tt2.* from tt1 left join tt2 on tt1.joincol = tt2.joincol; 2 | | | (3 rows) -select tt1.*, tt2.* from tt2 right join tt1 on tt1.joincol = tt2.joincol; +select tt1.*, tt2.* from tt2 right join tt1 on tt1.joincol = tt2.joincol + ORDER BY tt1_id, tt2_id; tt1_id | joincol | tt2_id | joincol --------+---------+--------+--------- 1 | 11 | 21 | 11 @@ -2242,7 +2280,7 @@ LEFT JOIN ( FROM tt3 b LEFT JOIN tt3 c ON (b.f1 = c.f1) WHERE c.f1 IS NULL ) AS d ON (a.f1 = d.f1) -WHERE d.f1 IS NULL; +WHERE d.f1 IS NULL ORDER BY f1; f1 ------ 0 @@ -2260,7 +2298,8 @@ insert into tt5 values(1, 11); insert into tt6 values(1, 9); insert into tt6 values(1, 2); insert into tt6 values(2, 9); -select * from tt5,tt6 where tt5.f1 = tt6.f1 and tt5.f1 = tt5.f2 - tt6.f2; +select * from tt5,tt6 where tt5.f1 = tt6.f1 and tt5.f1 = tt5.f2 - tt6.f2 + ORDER BY tt5.f1, tt5.f2, tt6.f1, tt6.f2; f1 | f2 | f1 | f2 ----+----+----+---- 1 | 10 | 1 | 9 @@ -2282,7 +2321,8 @@ select yy.pkyy as yy_pkyy, yy.pkxx as yy_pkxx, yya.pkyy as yya_pkyy, from yy left join (SELECT * FROM yy where pkyy = 101) as yya ON yy.pkyy = yya.pkyy left join xx xxa on yya.pkxx = xxa.pkxx - left join xx xxb on coalesce (xxa.pkxx, 1) = xxb.pkxx; + left join xx xxb on coalesce (xxa.pkxx, 1) = xxb.pkxx + ORDER BY yy_pkyy, yy_pkxx, yya_pkyy, xxa_pkxx, xxb_pkxx; yy_pkyy | yy_pkxx | yya_pkyy | xxa_pkxx | xxb_pkxx ---------+---------+----------+----------+---------- 101 | 1 | 101 | 1 | 1 @@ -2305,7 +2345,8 @@ insert into zt2 values(53); select * from zt2 left join zt3 on (f2 = f3) left join zt1 on (f3 = f1) -where f2 = 53; +where f2 = 53 +ORDER BY f1, f2, f3; f2 | f3 | f1 ----+----+---- 53 | | @@ -2315,7 +2356,8 @@ create temp view zv1 as select *,'dummy'::text AS junk from zt1; select * from zt2 left join zt3 on (f2 = f3) left join zv1 on (f3 = f1) -where f2 = 53; +where f2 = 53 +ORDER BY f1, f2, f3; f2 | f3 | f1 | junk ----+----+----+------ 53 | | | diff --git a/src/test/regress/expected/largeobject.out b/src/test/regress/expected/largeobject.out new file mode 100644 index 0000000000..e71b608545 --- /dev/null +++ b/src/test/regress/expected/largeobject.out @@ -0,0 +1,284 @@ +-- +-- Test large object support +-- +-- Load a file +CREATE TABLE lotest_stash_values (loid oid, fd integer); +-- lo_creat(mode integer) returns oid +-- The mode arg to lo_creat is unused, some vestigal holdover from ancient times +-- returns the large object id +INSERT INTO lotest_stash_values (loid) SELECT lo_creat(42); +-- NOTE: large objects require transactions +BEGIN; +-- lo_open(lobjId oid, mode integer) returns integer +-- The mode parameter to lo_open uses two constants: +-- INV_READ = 0x20000 +-- INV_WRITE = 0x40000 +-- The return value is a file descriptor-like value which remains valid for the +-- transaction. +UPDATE lotest_stash_values SET fd = lo_open(loid, CAST(x'20000' | x'40000' AS integer)); +-- loread/lowrite names are wonky, different from other functions which are lo_* +-- lowrite(fd integer, data bytea) returns integer +-- the integer is the number of bytes written +SELECT lowrite(fd, ' +Whose woods these are I think I know, +His house is in the village though. +He will not see me stopping here, +To watch his woods fill up with snow. + +My little horse must think it queer, +To stop without a farmhouse near, +Between the woods and frozen lake, +The darkest evening of the year. + +He gives his harness bells a shake, +To ask if there is some mistake. +The only other sound''s the sweep, +Of easy wind and downy flake. + +The woods are lovely, dark and deep, +But I have promises to keep, +And miles to go before I sleep, +And miles to go before I sleep. + + -- Robert Frost +') FROM lotest_stash_values; + lowrite +--------- + 578 +(1 row) + +-- lo_close(fd integer) returns integer +-- return value is 0 for success, or <0 for error (actually only -1, but...) +SELECT lo_close(fd) FROM lotest_stash_values; + lo_close +---------- + 0 +(1 row) + +END; +-- Read out a portion +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); +-- lo_lseek(fd integer, offset integer, whence integer) returns integer +-- offset is in bytes, whence is one of three values: +-- SEEK_SET (= 0) meaning relative to beginning +-- SEEK_CUR (= 1) meaning relative to current position +-- SEEK_END (= 2) meaning relative to end (offset better be negative) +-- returns current position in file +SELECT lo_lseek(fd, 422, 0) FROM lotest_stash_values; + lo_lseek +---------- + 422 +(1 row) + +-- loread/lowrite names are wonky, different from other functions which are lo_* +-- loread(fd integer, len integer) returns bytea +SELECT loread(fd, 35) FROM lotest_stash_values; + loread +------------------------------------- + The woods are lovely, dark and deep +(1 row) + +SELECT lo_lseek(fd, -19, 1) FROM lotest_stash_values; + lo_lseek +---------- + 438 +(1 row) + +SELECT lowrite(fd, 'n') FROM lotest_stash_values; + lowrite +--------- + 1 +(1 row) + +SELECT lo_tell(fd) FROM lotest_stash_values; + lo_tell +--------- + 439 +(1 row) + +SELECT lo_lseek(fd, -156, 2) FROM lotest_stash_values; + lo_lseek +---------- + 422 +(1 row) + +SELECT loread(fd, 35) FROM lotest_stash_values; + loread +------------------------------------- + The woods are lonely, dark and deep +(1 row) + +SELECT lo_close(fd) FROM lotest_stash_values; + lo_close +---------- + 0 +(1 row) + +END; +-- Test resource management +BEGIN; +SELECT lo_open(loid, x'40000'::int) from lotest_stash_values; + lo_open +--------- + 0 +(1 row) + +ABORT; +-- Test truncation. +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); +SELECT lo_truncate(fd, 10) FROM lotest_stash_values; + lo_truncate +------------- + 0 +(1 row) + +SELECT loread(fd, 15) FROM lotest_stash_values; + loread +--------------- + \012Whose woo +(1 row) + +SELECT lo_truncate(fd, 10000) FROM lotest_stash_values; + lo_truncate +------------- + 0 +(1 row) + +SELECT loread(fd, 10) FROM lotest_stash_values; + loread +------------------------------------------ + \000\000\000\000\000\000\000\000\000\000 +(1 row) + +SELECT lo_lseek(fd, 0, 2) FROM lotest_stash_values; + lo_lseek +---------- + 10000 +(1 row) + +SELECT lo_tell(fd) FROM lotest_stash_values; + lo_tell +--------- + 10000 +(1 row) + +SELECT lo_truncate(fd, 5000) FROM lotest_stash_values; + lo_truncate +------------- + 0 +(1 row) + +SELECT lo_lseek(fd, 0, 2) FROM lotest_stash_values; + lo_lseek +---------- + 5000 +(1 row) + +SELECT lo_tell(fd) FROM lotest_stash_values; + lo_tell +--------- + 5000 +(1 row) + +SELECT lo_close(fd) FROM lotest_stash_values; + lo_close +---------- + 0 +(1 row) + +END; +-- lo_unlink(lobjId oid) returns integer +-- return value appears to always be 1 +SELECT lo_unlink(loid) from lotest_stash_values; + lo_unlink +----------- + 1 +(1 row) + +TRUNCATE lotest_stash_values; +INSERT INTO lotest_stash_values (loid) SELECT lo_import('/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/tenk.data'); +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); +-- with the default BLKSZ, LOBLKSZ = 2048, so this positions us for a block +-- edge case +SELECT lo_lseek(fd, 2030, 0) FROM lotest_stash_values; + lo_lseek +---------- + 2030 +(1 row) + +-- this should get half of the value from page 0 and half from page 1 of the +-- large object +SELECT loread(fd, 36) FROM lotest_stash_values; + loread +----------------------------------------------------------------- + AAA\011FBAAAA\011VVVVxx\0122513\01132\0111\0111\0113\01113\0111 +(1 row) + +SELECT lo_tell(fd) FROM lotest_stash_values; + lo_tell +--------- + 2066 +(1 row) + +SELECT lo_lseek(fd, -26, 1) FROM lotest_stash_values; + lo_lseek +---------- + 2040 +(1 row) + +SELECT lowrite(fd, 'abcdefghijklmnop') FROM lotest_stash_values; + lowrite +--------- + 16 +(1 row) + +SELECT lo_lseek(fd, 2030, 0) FROM lotest_stash_values; + lo_lseek +---------- + 2030 +(1 row) + +SELECT loread(fd, 36) FROM lotest_stash_values; + loread +----------------------------------------------------- + AAA\011FBAAAAabcdefghijklmnop1\0111\0113\01113\0111 +(1 row) + +SELECT lo_close(fd) FROM lotest_stash_values; + lo_close +---------- + 0 +(1 row) + +END; +SELECT lo_export(loid, '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/lotest.txt') FROM lotest_stash_values; + lo_export +----------- + 1 +(1 row) + +\lo_import 'results/lotest.txt' +\set newloid :LASTOID +-- just make sure \lo_export does not barf +\lo_export :newloid 'results/lotest2.txt' +-- This is a hack to test that export/import are reversible +-- This uses knowledge about the inner workings of large object mechanism +-- which should not be used outside it. This makes it a HACK +SELECT pageno, data FROM pg_largeobject WHERE loid = (SELECT loid from lotest_stash_values) +EXCEPT +SELECT pageno, data FROM pg_largeobject WHERE loid = :newloid; + pageno | data +--------+------ +(0 rows) + +SELECT lo_unlink(loid) FROM lotest_stash_values; + lo_unlink +----------- + 1 +(1 row) + +\lo_unlink :newloid +TRUNCATE lotest_stash_values; diff --git a/src/test/regress/expected/largeobject_1.out b/src/test/regress/expected/largeobject_1.out new file mode 100644 index 0000000000..5fe7cae80e --- /dev/null +++ b/src/test/regress/expected/largeobject_1.out @@ -0,0 +1,284 @@ +-- +-- Test large object support +-- +-- Load a file +CREATE TABLE lotest_stash_values (loid oid, fd integer); +-- lo_creat(mode integer) returns oid +-- The mode arg to lo_creat is unused, some vestigal holdover from ancient times +-- returns the large object id +INSERT INTO lotest_stash_values (loid) SELECT lo_creat(42); +-- NOTE: large objects require transactions +BEGIN; +-- lo_open(lobjId oid, mode integer) returns integer +-- The mode parameter to lo_open uses two constants: +-- INV_READ = 0x20000 +-- INV_WRITE = 0x40000 +-- The return value is a file descriptor-like value which remains valid for the +-- transaction. +UPDATE lotest_stash_values SET fd = lo_open(loid, CAST(x'20000' | x'40000' AS integer)); +-- loread/lowrite names are wonky, different from other functions which are lo_* +-- lowrite(fd integer, data bytea) returns integer +-- the integer is the number of bytes written +SELECT lowrite(fd, ' +Whose woods these are I think I know, +His house is in the village though. +He will not see me stopping here, +To watch his woods fill up with snow. + +My little horse must think it queer, +To stop without a farmhouse near, +Between the woods and frozen lake, +The darkest evening of the year. + +He gives his harness bells a shake, +To ask if there is some mistake. +The only other sound''s the sweep, +Of easy wind and downy flake. + +The woods are lovely, dark and deep, +But I have promises to keep, +And miles to go before I sleep, +And miles to go before I sleep. + + -- Robert Frost +') FROM lotest_stash_values; + lowrite +--------- + 578 +(1 row) + +-- lo_close(fd integer) returns integer +-- return value is 0 for success, or <0 for error (actually only -1, but...) +SELECT lo_close(fd) FROM lotest_stash_values; + lo_close +---------- + 0 +(1 row) + +END; +-- Read out a portion +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); +-- lo_lseek(fd integer, offset integer, whence integer) returns integer +-- offset is in bytes, whence is one of three values: +-- SEEK_SET (= 0) meaning relative to beginning +-- SEEK_CUR (= 1) meaning relative to current position +-- SEEK_END (= 2) meaning relative to end (offset better be negative) +-- returns current position in file +SELECT lo_lseek(fd, 422, 0) FROM lotest_stash_values; + lo_lseek +---------- + 422 +(1 row) + +-- loread/lowrite names are wonky, different from other functions which are lo_* +-- loread(fd integer, len integer) returns bytea +SELECT loread(fd, 35) FROM lotest_stash_values; + loread +------------------------------------- + The woods are lovely, dark and deep +(1 row) + +SELECT lo_lseek(fd, -19, 1) FROM lotest_stash_values; + lo_lseek +---------- + 438 +(1 row) + +SELECT lowrite(fd, 'n') FROM lotest_stash_values; + lowrite +--------- + 1 +(1 row) + +SELECT lo_tell(fd) FROM lotest_stash_values; + lo_tell +--------- + 439 +(1 row) + +SELECT lo_lseek(fd, -156, 2) FROM lotest_stash_values; + lo_lseek +---------- + 422 +(1 row) + +SELECT loread(fd, 35) FROM lotest_stash_values; + loread +------------------------------------- + The woods are lonely, dark and deep +(1 row) + +SELECT lo_close(fd) FROM lotest_stash_values; + lo_close +---------- + 0 +(1 row) + +END; +-- Test resource management +BEGIN; +SELECT lo_open(loid, x'40000'::int) from lotest_stash_values; + lo_open +--------- + 0 +(1 row) + +ABORT; +-- Test truncation. +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); +SELECT lo_truncate(fd, 10) FROM lotest_stash_values; + lo_truncate +------------- + 0 +(1 row) + +SELECT loread(fd, 15) FROM lotest_stash_values; + loread +--------------- + \012Whose woo +(1 row) + +SELECT lo_truncate(fd, 10000) FROM lotest_stash_values; + lo_truncate +------------- + 0 +(1 row) + +SELECT loread(fd, 10) FROM lotest_stash_values; + loread +------------------------------------------ + \000\000\000\000\000\000\000\000\000\000 +(1 row) + +SELECT lo_lseek(fd, 0, 2) FROM lotest_stash_values; + lo_lseek +---------- + 10000 +(1 row) + +SELECT lo_tell(fd) FROM lotest_stash_values; + lo_tell +--------- + 10000 +(1 row) + +SELECT lo_truncate(fd, 5000) FROM lotest_stash_values; + lo_truncate +------------- + 0 +(1 row) + +SELECT lo_lseek(fd, 0, 2) FROM lotest_stash_values; + lo_lseek +---------- + 5000 +(1 row) + +SELECT lo_tell(fd) FROM lotest_stash_values; + lo_tell +--------- + 5000 +(1 row) + +SELECT lo_close(fd) FROM lotest_stash_values; + lo_close +---------- + 0 +(1 row) + +END; +-- lo_unlink(lobjId oid) returns integer +-- return value appears to always be 1 +SELECT lo_unlink(loid) from lotest_stash_values; + lo_unlink +----------- + 1 +(1 row) + +TRUNCATE lotest_stash_values; +INSERT INTO lotest_stash_values (loid) SELECT lo_import('/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/tenk.data'); +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); +-- with the default BLKSZ, LOBLKSZ = 2048, so this positions us for a block +-- edge case +SELECT lo_lseek(fd, 2030, 0) FROM lotest_stash_values; + lo_lseek +---------- + 2030 +(1 row) + +-- this should get half of the value from page 0 and half from page 1 of the +-- large object +SELECT loread(fd, 36) FROM lotest_stash_values; + loread +-------------------------------------------------------------- + 44\011144\0111144\0114144\0119144\01188\01189\011SNAAAA\011F +(1 row) + +SELECT lo_tell(fd) FROM lotest_stash_values; + lo_tell +--------- + 2066 +(1 row) + +SELECT lo_lseek(fd, -26, 1) FROM lotest_stash_values; + lo_lseek +---------- + 2040 +(1 row) + +SELECT lowrite(fd, 'abcdefghijklmnop') FROM lotest_stash_values; + lowrite +--------- + 16 +(1 row) + +SELECT lo_lseek(fd, 2030, 0) FROM lotest_stash_values; + lo_lseek +---------- + 2030 +(1 row) + +SELECT loread(fd, 36) FROM lotest_stash_values; + loread +-------------------------------------------------- + 44\011144\011114abcdefghijklmnop9\011SNAAAA\011F +(1 row) + +SELECT lo_close(fd) FROM lotest_stash_values; + lo_close +---------- + 0 +(1 row) + +END; +SELECT lo_export(loid, '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/lotest.txt') FROM lotest_stash_values; + lo_export +----------- + 1 +(1 row) + +\lo_import 'results/lotest.txt' +\set newloid :LASTOID +-- just make sure \lo_export does not barf +\lo_export :newloid 'results/lotest2.txt' +-- This is a hack to test that export/import are reversible +-- This uses knowledge about the inner workings of large object mechanism +-- which should not be used outside it. This makes it a HACK +SELECT pageno, data FROM pg_largeobject WHERE loid = (SELECT loid from lotest_stash_values) +EXCEPT +SELECT pageno, data FROM pg_largeobject WHERE loid = :newloid; + pageno | data +--------+------ +(0 rows) + +SELECT lo_unlink(loid) FROM lotest_stash_values; + lo_unlink +----------- + 1 +(1 row) + +\lo_unlink :newloid +TRUNCATE lotest_stash_values; diff --git a/src/test/regress/expected/lseg.out b/src/test/regress/expected/lseg.out index bba1f3ee80..f2f4367e8c 100644 --- a/src/test/regress/expected/lseg.out +++ b/src/test/regress/expected/lseg.out @@ -26,27 +26,27 @@ INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)'); ERROR: invalid input syntax for type lseg: "[(1,2),(3,4)" LINE 1: INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)'); ^ -select * from LSEG_TBL; +select * from LSEG_TBL ORDER BY (s[0])[0], (s[0])[1]; s ------------------------------- - [(1,2),(3,4)] + [(-1000000,200),(300000,-40)] [(0,0),(6,6)] + [(1,2),(3,4)] [(10,-10),(-3,-4)] - [(-1000000,200),(300000,-40)] [(11,22),(33,44)] (5 rows) -SELECT * FROM LSEG_TBL WHERE s <= lseg '[(1,2),(3,4)]'; +SELECT * FROM LSEG_TBL WHERE s <= lseg '[(1,2),(3,4)]' ORDER BY (s[0])[0], (s[0])[1]; s --------------- [(1,2),(3,4)] (1 row) -SELECT * FROM LSEG_TBL WHERE (s <-> lseg '[(1,2),(3,4)]') < 10; +SELECT * FROM LSEG_TBL WHERE (s <-> lseg '[(1,2),(3,4)]') < 10 ORDER BY (s[0])[0], (s[0])[1]; s -------------------- - [(1,2),(3,4)] [(0,0),(6,6)] + [(1,2),(3,4)] [(10,-10),(-3,-4)] (3 rows) diff --git a/src/test/regress/expected/macaddr.out b/src/test/regress/expected/macaddr.out index 0b2a96d2f7..eeaaeed24b 100644 --- a/src/test/regress/expected/macaddr.out +++ b/src/test/regress/expected/macaddr.out @@ -21,7 +21,7 @@ INSERT INTO macaddr_data VALUES (11, '08:00:2b:01:02:02'); INSERT INTO macaddr_data VALUES (12, '08:00:2a:01:02:03'); INSERT INTO macaddr_data VALUES (13, '08:00:2c:01:02:03'); INSERT INTO macaddr_data VALUES (14, '08:00:2a:01:02:04'); -SELECT * FROM macaddr_data; +SELECT * FROM macaddr_data ORDER BY a; a | b ----+------------------- 1 | 08:00:2b:01:02:03 diff --git a/src/test/regress/expected/misc.out b/src/test/regress/expected/misc.out new file mode 100644 index 0000000000..5a532608c2 --- /dev/null +++ b/src/test/regress/expected/misc.out @@ -0,0 +1,761 @@ +-- +-- MISC +-- +-- +-- BTREE +-- +UPDATE onek + SET unique1 = onek.unique1 + 1; +UPDATE onek + SET unique1 = onek.unique1 - 1; +-- +-- BTREE partial +-- +-- UPDATE onek2 +-- SET unique1 = onek2.unique1 + 1; +--UPDATE onek2 +-- SET unique1 = onek2.unique1 - 1; +-- +-- BTREE shutting out non-functional updates +-- +-- the following two tests seem to take a long time on some +-- systems. This non-func update stuff needs to be examined +-- more closely. - jolly (2/22/96) +-- +UPDATE tmp + SET stringu1 = reverse_name(onek.stringu1) + FROM onek + WHERE onek.stringu1 = 'JBAAAA' and + onek.stringu1 = tmp.stringu1; +UPDATE tmp + SET stringu1 = reverse_name(onek2.stringu1) + FROM onek2 + WHERE onek2.stringu1 = 'JCAAAA' and + onek2.stringu1 = tmp.stringu1; +DROP TABLE tmp; +--UPDATE person* +-- SET age = age + 1; +--UPDATE person* +-- SET age = age + 3 +-- WHERE name = 'linda'; +-- +-- copy +-- +COPY onek TO '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; +DELETE FROM onek; +COPY onek FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; +SELECT unique1 FROM onek WHERE unique1 < 2 ORDER BY unique1; + unique1 +--------- + 0 + 1 +(2 rows) + +DELETE FROM onek2; +COPY onek2 FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; +SELECT unique1 FROM onek2 WHERE unique1 < 2 ORDER BY unique1; + unique1 +--------- + 0 + 1 +(2 rows) + +COPY BINARY stud_emp TO '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/stud_emp.data'; +DELETE FROM stud_emp; +COPY BINARY stud_emp FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/stud_emp.data'; +SELECT * FROM stud_emp ORDER BY 1, 2; + name | age | location | salary | manager | gpa | percent +-------+-----+------------+--------+---------+-----+--------- + cim | 30 | (10.5,4.7) | 400 | | 3.4 | + jeff | 23 | (8,7.7) | 600 | sharon | 3.5 | + linda | 19 | (0.9,6.1) | 100 | | 2.9 | +(3 rows) + +-- COPY aggtest FROM stdin; +-- 56 7.8 +-- 100 99.097 +-- 0 0.09561 +-- 42 324.78 +-- . +-- COPY aggtest TO stdout; +-- +-- inheritance stress test +-- +SELECT * FROM a_star* ORDER BY 1,2; + class | a +-------+---- + a | 1 + a | 2 + a | + b | 3 + b | 4 + b | + b | + c | 5 + c | 6 + c | + c | + d | 7 + d | 8 + d | 9 + d | 10 + d | 11 + d | 12 + d | 13 + d | 14 + d | + d | + d | + d | + d | + d | + d | + d | + e | 15 + e | 16 + e | 17 + e | 18 + e | + e | + e | + f | 19 + f | 20 + f | 21 + f | 22 + f | 24 + f | 25 + f | 26 + f | 27 + f | + f | + f | + f | + f | + f | + f | + f | +(50 rows) + +SELECT * + FROM b_star* x + WHERE x.b = text 'bumble' or x.a < 3; + class | a | b +-------+---+-------- + b | | bumble +(1 row) + +SELECT class, a + FROM c_star* x + WHERE x.c ~ text 'hi' ORDER BY 1,2; + class | a +-------+---- + c | 5 + c | + d | 7 + d | 8 + d | 10 + d | 12 + d | + d | + d | + d | + e | 15 + e | 16 + e | + e | + f | 19 + f | 20 + f | 21 + f | 24 + f | + f | + f | + f | +(22 rows) + +SELECT class, b, c + FROM d_star* x + WHERE x.a < 100 ORDER BY 1,2,3; + class | b | c +-------+---------+------------ + d | fumble | + d | grumble | hi sunita + d | rumble | + d | stumble | hi koko + d | | hi avi + d | | hi kristin + d | | + d | | +(8 rows) + +SELECT class, c FROM e_star* x WHERE x.c NOTNULL ORDER BY 1,2; + class | c +-------+------------- + e | hi bob + e | hi carol + e | hi elisa + e | hi michelle + f | hi allison + f | hi carl + f | hi claire + f | hi jeff + f | hi keith + f | hi marc + f | hi marcel + f | hi mike +(12 rows) + +SELECT * FROM f_star* x WHERE x.c ISNULL ORDER BY 1,2; + class | a | c | e | f +-------+----+---+-----+------------------------------------------- + f | 22 | | -7 | ((111,555),(222,666),(333,777),(444,888)) + f | 25 | | -9 | + f | 26 | | | ((11111,33333),(22222,44444)) + f | 27 | | | + f | | | -11 | ((1111111,3333333),(2222222,4444444)) + f | | | -12 | + f | | | | ((11111111,33333333),(22222222,44444444)) + f | | | | +(8 rows) + +-- grouping and aggregation on inherited sets have been busted in the past... +SELECT sum(a) FROM a_star*; + sum +----- + 355 +(1 row) + +SELECT class, sum(a) FROM a_star* GROUP BY class ORDER BY class; + class | sum +-------+----- + a | 3 + b | 7 + c | 11 + d | 84 + e | 66 + f | 184 +(6 rows) + +ALTER TABLE f_star RENAME COLUMN f TO ff; +ALTER TABLE e_star* RENAME COLUMN e TO ee; +ALTER TABLE d_star* RENAME COLUMN d TO dd; +ALTER TABLE c_star* RENAME COLUMN c TO cc; +ALTER TABLE b_star* RENAME COLUMN b TO bb; +ALTER TABLE a_star* RENAME COLUMN a TO aa; +SELECT class, aa + FROM a_star* x + WHERE aa ISNULL ORDER BY 1,2; + class | aa +-------+---- + a | + b | + b | + c | + c | + d | + d | + d | + d | + d | + d | + d | + d | + e | + e | + e | + f | + f | + f | + f | + f | + f | + f | + f | +(24 rows) + +-- As of Postgres 7.1, ALTER implicitly recurses, +-- so this should be same as ALTER a_star* +ALTER TABLE a_star RENAME COLUMN aa TO foo; +SELECT class, foo + FROM a_star* x + WHERE x.foo >= 2 ORDER BY 1,2; + class | foo +-------+----- + a | 2 + b | 3 + b | 4 + c | 5 + c | 6 + d | 7 + d | 8 + d | 9 + d | 10 + d | 11 + d | 12 + d | 13 + d | 14 + e | 15 + e | 16 + e | 17 + e | 18 + f | 19 + f | 20 + f | 21 + f | 22 + f | 24 + f | 25 + f | 26 + f | 27 +(25 rows) + +ALTER TABLE a_star RENAME COLUMN foo TO aa; +SELECT * + from a_star* + WHERE aa < 1000 ORDER BY 1,2; + class | aa +-------+---- + a | 1 + a | 2 + b | 3 + b | 4 + c | 5 + c | 6 + d | 7 + d | 8 + d | 9 + d | 10 + d | 11 + d | 12 + d | 13 + d | 14 + e | 15 + e | 16 + e | 17 + e | 18 + f | 19 + f | 20 + f | 21 + f | 22 + f | 24 + f | 25 + f | 26 + f | 27 +(26 rows) + +ALTER TABLE f_star ADD COLUMN f int4; +UPDATE f_star SET f = 10; +ALTER TABLE e_star* ADD COLUMN e int4; +--UPDATE e_star* SET e = 42; +SELECT * FROM e_star* ORDER BY 1,2; + class | aa | cc | ee | e +-------+----+-------------+-----+--- + e | 15 | hi carol | -1 | + e | 16 | hi bob | | + e | 17 | | -2 | + e | 18 | | | + e | | hi elisa | | + e | | | -4 | + e | | hi michelle | -3 | + f | 19 | hi claire | -5 | + f | 20 | hi mike | -6 | + f | 21 | hi marcel | | + f | 22 | | -7 | + f | 24 | hi marc | | + f | 25 | | -9 | + f | 26 | | | + f | 27 | | | + f | | | | + f | | hi keith | -8 | + f | | hi allison | -10 | + f | | hi jeff | | + f | | | -11 | + f | | hi carl | | + f | | | -12 | + f | | | | +(23 rows) + +ALTER TABLE a_star* ADD COLUMN a text; +NOTICE: merging definition of column "a" for child "d_star" +--UPDATE b_star* +-- SET a = text 'gazpacho' +-- WHERE aa > 4; +SELECT class, aa, a FROM a_star* ORDER BY 1,2; + class | aa | a +-------+----+--- + a | 1 | + a | 2 | + a | | + b | 3 | + b | 4 | + b | | + b | | + c | 5 | + c | 6 | + c | | + c | | + d | 7 | + d | 8 | + d | 9 | + d | 10 | + d | 11 | + d | 12 | + d | 13 | + d | 14 | + d | | + d | | + d | | + d | | + d | | + d | | + d | | + d | | + e | 15 | + e | 16 | + e | 17 | + e | 18 | + e | | + e | | + e | | + f | 19 | + f | 20 | + f | 21 | + f | 22 | + f | 24 | + f | 25 | + f | 26 | + f | 27 | + f | | + f | | + f | | + f | | + f | | + f | | + f | | + f | | +(50 rows) + +-- +-- versions +-- +-- +-- postquel functions +-- +-- +-- mike does post_hacking, +-- joe and sally play basketball, and +-- everyone else does nothing. +-- +SELECT p.name, name(p.hobbies) FROM ONLY person p ORDER BY 1,2; + name | name +-------+------------- + joe | basketball + mike | posthacking + sally | basketball +(3 rows) + +-- +-- as above, but jeff also does post_hacking. +-- +SELECT p.name, name(p.hobbies) FROM person* p ORDER BY 1,2; + name | name +-------+------------- + jeff | posthacking + joe | basketball + mike | posthacking + sally | basketball +(4 rows) + +-- +-- the next two queries demonstrate how functions generate bogus duplicates. +-- this is a "feature" .. +-- +SELECT DISTINCT hobbies_r.name, name(hobbies_r.equipment) FROM hobbies_r + ORDER BY 1,2; + name | name +-------------+--------------- + basketball | hightops + posthacking | advil + posthacking | peet's coffee + skywalking | guts +(4 rows) + +SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r ORDER BY 1,2; + name | name +-------------+--------------- + basketball | hightops + basketball | hightops + posthacking | advil + posthacking | advil + posthacking | peet's coffee + posthacking | peet's coffee + skywalking | guts +(7 rows) + +-- +-- mike needs advil and peet's coffee, +-- joe and sally need hightops, and +-- everyone else is fine. +-- +SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p ORDER BY 1,2,3; + name | name | name +-------+-------------+--------------- + joe | basketball | hightops + mike | posthacking | advil + mike | posthacking | peet's coffee + sally | basketball | hightops +(4 rows) + +-- +-- as above, but jeff needs advil and peet's coffee as well. +-- +SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p ORDER BY 1,2,3; + name | name | name +-------+-------------+--------------- + jeff | posthacking | advil + jeff | posthacking | peet's coffee + joe | basketball | hightops + mike | posthacking | advil + mike | posthacking | peet's coffee + sally | basketball | hightops +(6 rows) + +-- +-- just like the last two, but make sure that the target list fixup and +-- unflattening is being done correctly. +-- +SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p ORDER BY 1,2,3; + name | name | name +---------------+-------+------------- + advil | mike | posthacking + hightops | joe | basketball + hightops | sally | basketball + peet's coffee | mike | posthacking +(4 rows) + +SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p ORDER BY 1,2,3; + name | name | name +---------------+-------+------------- + advil | jeff | posthacking + advil | mike | posthacking + hightops | joe | basketball + hightops | sally | basketball + peet's coffee | jeff | posthacking + peet's coffee | mike | posthacking +(6 rows) + +SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p ORDER BY 1,2,3; + name | name | name +---------------+-------------+------- + advil | posthacking | mike + hightops | basketball | joe + hightops | basketball | sally + peet's coffee | posthacking | mike +(4 rows) + +SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p ORDER BY 1,2,3; + name | name | name +---------------+-------------+------- + advil | posthacking | jeff + advil | posthacking | mike + hightops | basketball | joe + hightops | basketball | sally + peet's coffee | posthacking | jeff + peet's coffee | posthacking | mike +(6 rows) + +SELECT user_relns() AS user_relns + ORDER BY user_relns; + user_relns +--------------------- + a + a_star + abstime_tbl + aggtest + array_index_op_test + array_op_test + arrtest + b + b_star + box_tbl + bprime + bt_f8_heap + bt_i4_heap + bt_name_heap + bt_txt_heap + c + c_star + char_tbl + check2_tbl + check_seq + check_tbl + circle_tbl + city + copy_tbl + d + d_star + date_tbl + default_seq + default_tbl + defaultexpr_tbl + dept + e_star + emp + equipment_r + f_star + fast_emp4000 + float4_tbl + float8_tbl + func_index_heap + hash_f8_heap + hash_i4_heap + hash_name_heap + hash_txt_heap + hobbies_r + iexit + ihighway + inet_tbl + inhe + inhf + inhx + insert_seq + insert_tbl + int2_tbl + int4_tbl + int8_tbl + interval_tbl + iportaltest + log_table + lseg_tbl + main_table + money_data + num_data + num_exp_add + num_exp_div + num_exp_ln + num_exp_log10 + num_exp_mul + num_exp_power_10_ln + num_exp_sqrt + num_exp_sub + num_input_test + num_result + onek + onek2 + path_tbl + person + point_tbl + polygon_tbl + ramp + random_tbl + real_city + reltime_tbl + road + shighway + slow_emp4000 + street + stud_emp + student + subselect_tbl + tenk1 + tenk2 + test_tsvector + text_tbl + time_tbl + timestamp_tbl + timestamptz_tbl + timetz_tbl + tinterval_tbl + toyemp + varchar_tbl + xacttest +(101 rows) + +SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))); + name +------ + guts +(1 row) + +SELECT hobbies_by_name('basketball'); + hobbies_by_name +----------------- + joe +(1 row) + +SELECT name, overpaid(emp.*) FROM emp ORDER BY 1,2; + name | overpaid +--------+---------- + bill | t + cim | f + jeff | f + linda | f + sam | t + sharon | t +(6 rows) + +-- +-- Try a few cases with SQL-spec row constructor expressions +-- +SELECT * FROM equipment(ROW('skywalking', 'mer')); + name | hobby +------+------------ + guts | skywalking +(1 row) + +SELECT name(equipment(ROW('skywalking', 'mer'))); + name +------ + guts +(1 row) + +SELECT *, name(equipment(h.*)) FROM hobbies_r h ORDER BY 1,2,3; + name | person | name +-------------+--------+--------------- + basketball | joe | hightops + basketball | sally | hightops + posthacking | jeff | advil + posthacking | jeff | peet's coffee + posthacking | mike | advil + posthacking | mike | peet's coffee + skywalking | | guts +(7 rows) + +SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h ORDER BY 1,2,3; + name | person | name +-------------+--------+--------------- + basketball | joe | hightops + basketball | sally | hightops + posthacking | jeff | advil + posthacking | jeff | peet's coffee + posthacking | mike | advil + posthacking | mike | peet's coffee + skywalking | | guts +(7 rows) + +-- +-- check that old-style C functions work properly with TOASTed values +-- +create table oldstyle_test(i int4, t text); +insert into oldstyle_test values(null,null); +insert into oldstyle_test values(0,'12'); +insert into oldstyle_test values(1000,'12'); +insert into oldstyle_test values(0, repeat('x', 50000)); +select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test ORDER BY 1,2,3; + i | length | octet_length | oldstyle_length +------+--------+--------------+----------------- + 0 | 2 | 2 | 2 + 0 | 50000 | 50000 | 50000 + 1000 | 2 | 2 | 1002 + | | | +(4 rows) + +drop table oldstyle_test; +-- +-- functional joins +-- +-- +-- instance rules +-- +-- +-- rewrite rules +-- diff --git a/src/test/regress/expected/name.out b/src/test/regress/expected/name.out index b359d52822..a6c636bdac 100644 --- a/src/test/regress/expected/name.out +++ b/src/test/regress/expected/name.out @@ -26,26 +26,26 @@ INSERT INTO NAME_TBL(f1) VALUES ('343f%2a'); INSERT INTO NAME_TBL(f1) VALUES ('d34aaasdf'); INSERT INTO NAME_TBL(f1) VALUES (''); INSERT INTO NAME_TBL(f1) VALUES ('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'); -SELECT '' AS seven, * FROM NAME_TBL; +SELECT '' AS seven, * FROM NAME_TBL ORDER BY f1; seven | f1 -------+----------------------------------------------------------------- + | + | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ | 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq - | asdfghjkl; | 343f%2a + | asdfghjkl; | d34aaasdf - | - | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ (7 rows) -SELECT '' AS six, c.f1 FROM NAME_TBL c WHERE c.f1 <> '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS six, c.f1 FROM NAME_TBL c WHERE c.f1 <> '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; six | f1 -----+----------------------------------------------------------------- + | | 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq - | asdfghjkl; | 343f%2a + | asdfghjkl; | d34aaasdf - | (5 rows) SELECT '' AS one, c.f1 FROM NAME_TBL c WHERE c.f1 = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; @@ -55,68 +55,68 @@ SELECT '' AS one, c.f1 FROM NAME_TBL c WHERE c.f1 = '1234567890ABCDEFGHIJKLMNOPQ | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ (2 rows) -SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 < '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 < '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; three | f1 -------+---- | (1 row) -SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 <= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 <= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; four | f1 ------+----------------------------------------------------------------- - | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ | | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ + | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ (3 rows) -SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 > '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 > '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; three | f1 -------+----------------------------------------------------------------- | 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq - | asdfghjkl; | 343f%2a + | asdfghjkl; | d34aaasdf (4 rows) -SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 >= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 >= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; four | f1 ------+----------------------------------------------------------------- | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ + | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ | 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq - | asdfghjkl; | 343f%2a + | asdfghjkl; | d34aaasdf - | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ (6 rows) -SELECT '' AS seven, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*'; +SELECT '' AS seven, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*' ORDER BY f1; seven | f1 -------+----------------------------------------------------------------- + | + | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ | 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq - | asdfghjkl; | 343f%2a + | asdfghjkl; | d34aaasdf - | - | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ (7 rows) -SELECT '' AS zero, c.f1 FROM NAME_TBL c WHERE c.f1 !~ '.*'; +SELECT '' AS zero, c.f1 FROM NAME_TBL c WHERE c.f1 !~ '.*' ORDER BY f1; zero | f1 ------+---- (0 rows) -SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '[0-9]'; +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '[0-9]' ORDER BY f1; three | f1 -------+----------------------------------------------------------------- | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ + | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ | 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq | 343f%2a | d34aaasdf - | 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQ (5 rows) -SELECT '' AS two, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*asdf.*'; +SELECT '' AS two, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*asdf.*' ORDER BY f1; two | f1 -----+------------ | asdfghjkl; diff --git a/src/test/regress/expected/namespace.out b/src/test/regress/expected/namespace.out index 58a0c4dc81..504752f889 100644 --- a/src/test/regress/expected/namespace.out +++ b/src/test/regress/expected/namespace.out @@ -22,7 +22,7 @@ SELECT COUNT(*) FROM pg_class WHERE relnamespace = INSERT INTO test_schema_1.abc DEFAULT VALUES; INSERT INTO test_schema_1.abc DEFAULT VALUES; INSERT INTO test_schema_1.abc DEFAULT VALUES; -SELECT * FROM test_schema_1.abc; +SELECT * FROM test_schema_1.abc ORDER BY a; a | b ---+--- 1 | @@ -30,7 +30,7 @@ SELECT * FROM test_schema_1.abc; 3 | (3 rows) -SELECT * FROM test_schema_1.abc_view; +SELECT * FROM test_schema_1.abc_view ORDER BY a; a | b ---+--- 2 | diff --git a/src/test/regress/expected/numeric.out b/src/test/regress/expected/numeric.out index a3b631aabe..b316d33e5b 100644 --- a/src/test/regress/expected/numeric.out +++ b/src/test/regress/expected/numeric.out @@ -508,7 +508,7 @@ INSERT INTO num_result SELECT t1.id, t2.id, t1.val + t2.val SELECT t1.id1, t1.id2, t1.result, t2.expected FROM num_result t1, num_exp_add t2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 - AND t1.result != t2.expected; + AND t1.result != t2.expected ORDER BY t1.id1, t1.id2, t2.expected; id1 | id2 | result | expected -----+-----+--------+---------- (0 rows) @@ -519,7 +519,7 @@ INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val + t2.val, 10) SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 10) as expected FROM num_result t1, num_exp_add t2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 - AND t1.result != round(t2.expected, 10); + AND t1.result != round(t2.expected, 10) ORDER BY t1.id1, t1.id2; id1 | id2 | result | expected -----+-----+--------+---------- (0 rows) @@ -533,7 +533,7 @@ INSERT INTO num_result SELECT t1.id, t2.id, t1.val - t2.val SELECT t1.id1, t1.id2, t1.result, t2.expected FROM num_result t1, num_exp_sub t2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 - AND t1.result != t2.expected; + AND t1.result != t2.expected ORDER BY t1.id1, t1.id2, t2.expected; id1 | id2 | result | expected -----+-----+--------+---------- (0 rows) @@ -696,7 +696,7 @@ ERROR: numeric field overflow DETAIL: A field with precision 4, scale 4 must round to an absolute value less than 1. INSERT INTO fract_only VALUES (7, '0.00001'); INSERT INTO fract_only VALUES (8, '0.00017'); -SELECT * FROM fract_only; +SELECT * FROM fract_only ORDER BY id; id | val ----+--------- 1 | 0.0000 @@ -717,16 +717,16 @@ INSERT INTO ceil_floor_round VALUES ('9.4999999'); INSERT INTO ceil_floor_round VALUES ('0.0'); INSERT INTO ceil_floor_round VALUES ('0.0000001'); INSERT INTO ceil_floor_round VALUES ('-0.000001'); -SELECT a, ceil(a), ceiling(a), floor(a), round(a) FROM ceil_floor_round; +SELECT a, ceil(a), ceiling(a), floor(a), round(a) FROM ceil_floor_round ORDER BY a; a | ceil | ceiling | floor | round -----------+------+---------+-------+------- -5.5 | -5 | -5 | -6 | -6 -5.499999 | -5 | -5 | -6 | -5 - 9.5 | 10 | 10 | 9 | 10 - 9.4999999 | 10 | 10 | 9 | 9 + -0.000001 | 0 | 0 | -1 | 0 0.0 | 0 | 0 | 0 | 0 0.0000001 | 1 | 1 | 0 | 0 - -0.000001 | 0 | 0 | -1 | 0 + 9.4999999 | 10 | 10 | 9 | 9 + 9.5 | 10 | 10 | 9 | 10 (7 rows) DROP TABLE ceil_floor_round; @@ -765,7 +765,7 @@ SELECT width_bucket(operand_f8, 5.0, 5.5, 20) AS wb_4f, width_bucket(operand_num, -25, 25, 10) AS wb_5, width_bucket(operand_f8, -25, 25, 10) AS wb_5f - FROM width_bucket_test; + FROM width_bucket_test ORDER BY operand_num; operand_num | wb_1 | wb_1f | wb_2 | wb_2f | wb_3 | wb_3f | wb_4 | wb_4f | wb_5 | wb_5f ------------------+------+-------+------+-------+------+-------+------+-------+------+------- -5.2 | 0 | 0 | 6 | 6 | 0 | 0 | 0 | 0 | 4 | 4 @@ -806,337 +806,337 @@ DROP TABLE width_bucket_test; -- TO_CHAR() -- SELECT '' AS to_char_1, to_char(val, '9G999G999G999G999G999') - FROM num_data; + FROM num_data ORDER BY val; to_char_1 | to_char -----------+------------------------ + | -83,028,485 + | -34,338,492 + | -24,926,804 | 0 | 0 - | -34,338,492 | 4 - | 7,799,461 | 16,397 - | 93,902 - | -83,028,485 | 74,881 - | -24,926,804 + | 93,902 + | 7,799,461 (10 rows) SELECT '' AS to_char_2, to_char(val, '9G999G999G999G999G999D999G999G999G999G999') - FROM num_data; + FROM num_data ORDER BY val; to_char_2 | to_char -----------+-------------------------------------------- + | -83,028,485.000,000,000,000,000 + | -34,338,492.215,397,047,000,000 + | -24,926,804.045,047,420,000,000 | .000,000,000,000,000 | .000,000,000,000,000 - | -34,338,492.215,397,047,000,000 | 4.310,000,000,000,000 - | 7,799,461.411,900,000,000,000 | 16,397.038,491,000,000,000 - | 93,901.577,630,260,000,000 - | -83,028,485.000,000,000,000,000 | 74,881.000,000,000,000,000 - | -24,926,804.045,047,420,000,000 + | 93,901.577,630,260,000,000 + | 7,799,461.411,900,000,000,000 (10 rows) SELECT '' AS to_char_3, to_char(val, '9999999999999999.999999999999999PR') - FROM num_data; + FROM num_data ORDER BY val; to_char_3 | to_char -----------+------------------------------------ + | <83028485.000000000000000> + | <34338492.215397047000000> + | <24926804.045047420000000> | .000000000000000 | .000000000000000 - | <34338492.215397047000000> | 4.310000000000000 - | 7799461.411900000000000 | 16397.038491000000000 - | 93901.577630260000000 - | <83028485.000000000000000> | 74881.000000000000000 - | <24926804.045047420000000> + | 93901.577630260000000 + | 7799461.411900000000000 (10 rows) SELECT '' AS to_char_4, to_char(val, '9999999999999999.999999999999999S') - FROM num_data; + FROM num_data ORDER BY val; to_char_4 | to_char -----------+----------------------------------- + | 83028485.000000000000000- + | 34338492.215397047000000- + | 24926804.045047420000000- | .000000000000000+ | .000000000000000+ - | 34338492.215397047000000- | 4.310000000000000+ - | 7799461.411900000000000+ | 16397.038491000000000+ - | 93901.577630260000000+ - | 83028485.000000000000000- | 74881.000000000000000+ - | 24926804.045047420000000- + | 93901.577630260000000+ + | 7799461.411900000000000+ (10 rows) -SELECT '' AS to_char_5, to_char(val, 'MI9999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_5, to_char(val, 'MI9999999999999999.999999999999999') FROM num_data ORDER BY val; to_char_5 | to_char -----------+----------------------------------- + | - 83028485.000000000000000 + | - 34338492.215397047000000 + | - 24926804.045047420000000 | .000000000000000 | .000000000000000 - | - 34338492.215397047000000 | 4.310000000000000 - | 7799461.411900000000000 | 16397.038491000000000 - | 93901.577630260000000 - | - 83028485.000000000000000 | 74881.000000000000000 - | - 24926804.045047420000000 + | 93901.577630260000000 + | 7799461.411900000000000 (10 rows) -SELECT '' AS to_char_6, to_char(val, 'FMS9999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_6, to_char(val, 'FMS9999999999999999.999999999999999') FROM num_data ORDER BY val; to_char_6 | to_char -----------+--------------------- + | -83028485. + | -34338492.215397047 + | -24926804.04504742 | +0. | +0. - | -34338492.215397047 | +4.31 - | +7799461.4119 | +16397.038491 - | +93901.57763026 - | -83028485. | +74881. - | -24926804.04504742 + | +93901.57763026 + | +7799461.4119 (10 rows) -SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data; +SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data ORDER BY val; to_char_7 | to_char -----------+---------------------- + | <83028485.> + | <34338492.215397047> + | <24926804.04504742> | 0. | 0. - | <34338492.215397047> | 4.31 - | 7799461.4119 | 16397.038491 - | 93901.57763026 - | <83028485.> | 74881. - | <24926804.04504742> + | 93901.57763026 + | 7799461.4119 (10 rows) -SELECT '' AS to_char_8, to_char(val, 'SG9999999999999999.999999999999999th') FROM num_data; +SELECT '' AS to_char_8, to_char(val, 'SG9999999999999999.999999999999999th') FROM num_data ORDER BY val; to_char_8 | to_char -----------+----------------------------------- + | - 83028485.000000000000000 + | - 34338492.215397047000000 + | - 24926804.045047420000000 | + .000000000000000 | + .000000000000000 - | - 34338492.215397047000000 | + 4.310000000000000 - | + 7799461.411900000000000 | + 16397.038491000000000 - | + 93901.577630260000000 - | - 83028485.000000000000000 | + 74881.000000000000000 - | - 24926804.045047420000000 + | + 93901.577630260000000 + | + 7799461.411900000000000 (10 rows) -SELECT '' AS to_char_9, to_char(val, '0999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_9, to_char(val, '0999999999999999.999999999999999') FROM num_data ORDER BY val; to_char_9 | to_char -----------+----------------------------------- + | -0000000083028485.000000000000000 + | -0000000034338492.215397047000000 + | -0000000024926804.045047420000000 | 0000000000000000.000000000000000 | 0000000000000000.000000000000000 - | -0000000034338492.215397047000000 | 0000000000000004.310000000000000 - | 0000000007799461.411900000000000 | 0000000000016397.038491000000000 - | 0000000000093901.577630260000000 - | -0000000083028485.000000000000000 | 0000000000074881.000000000000000 - | -0000000024926804.045047420000000 + | 0000000000093901.577630260000000 + | 0000000007799461.411900000000000 (10 rows) -SELECT '' AS to_char_10, to_char(val, 'S0999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_10, to_char(val, 'S0999999999999999.999999999999999') FROM num_data ORDER BY val; to_char_10 | to_char ------------+----------------------------------- + | -0000000083028485.000000000000000 + | -0000000034338492.215397047000000 + | -0000000024926804.045047420000000 | +0000000000000000.000000000000000 | +0000000000000000.000000000000000 - | -0000000034338492.215397047000000 | +0000000000000004.310000000000000 - | +0000000007799461.411900000000000 | +0000000000016397.038491000000000 - | +0000000000093901.577630260000000 - | -0000000083028485.000000000000000 | +0000000000074881.000000000000000 - | -0000000024926804.045047420000000 + | +0000000000093901.577630260000000 + | +0000000007799461.411900000000000 (10 rows) -SELECT '' AS to_char_11, to_char(val, 'FM0999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_11, to_char(val, 'FM0999999999999999.999999999999999') FROM num_data ORDER BY val; to_char_11 | to_char ------------+----------------------------- + | -0000000083028485. + | -0000000034338492.215397047 + | -0000000024926804.04504742 | 0000000000000000. | 0000000000000000. - | -0000000034338492.215397047 | 0000000000000004.31 - | 0000000007799461.4119 | 0000000000016397.038491 - | 0000000000093901.57763026 - | -0000000083028485. | 0000000000074881. - | -0000000024926804.04504742 + | 0000000000093901.57763026 + | 0000000007799461.4119 (10 rows) -SELECT '' AS to_char_12, to_char(val, 'FM9999999999999999.099999999999999') FROM num_data; +SELECT '' AS to_char_12, to_char(val, 'FM9999999999999999.099999999999999') FROM num_data ORDER BY val; to_char_12 | to_char ------------+--------------------- + | -83028485.0 + | -34338492.215397047 + | -24926804.04504742 | .0 | .0 - | -34338492.215397047 | 4.31 - | 7799461.4119 | 16397.038491 - | 93901.57763026 - | -83028485.0 | 74881.0 - | -24926804.04504742 + | 93901.57763026 + | 7799461.4119 (10 rows) -SELECT '' AS to_char_13, to_char(val, 'FM9999999999990999.990999999999999') FROM num_data; +SELECT '' AS to_char_13, to_char(val, 'FM9999999999990999.990999999999999') FROM num_data ORDER BY val; to_char_13 | to_char ------------+--------------------- + | -83028485.000 + | -34338492.215397047 + | -24926804.04504742 | 0000.000 | 0000.000 - | -34338492.215397047 | 0004.310 - | 7799461.4119 | 16397.038491 - | 93901.57763026 - | -83028485.000 | 74881.000 - | -24926804.04504742 + | 93901.57763026 + | 7799461.4119 (10 rows) -SELECT '' AS to_char_14, to_char(val, 'FM0999999999999999.999909999999999') FROM num_data; +SELECT '' AS to_char_14, to_char(val, 'FM0999999999999999.999909999999999') FROM num_data ORDER BY val; to_char_14 | to_char ------------+----------------------------- + | -0000000083028485.00000 + | -0000000034338492.215397047 + | -0000000024926804.04504742 | 0000000000000000.00000 | 0000000000000000.00000 - | -0000000034338492.215397047 | 0000000000000004.31000 - | 0000000007799461.41190 | 0000000000016397.038491 - | 0000000000093901.57763026 - | -0000000083028485.00000 | 0000000000074881.00000 - | -0000000024926804.04504742 + | 0000000000093901.57763026 + | 0000000007799461.41190 (10 rows) -SELECT '' AS to_char_15, to_char(val, 'FM9999999990999999.099999999999999') FROM num_data; +SELECT '' AS to_char_15, to_char(val, 'FM9999999990999999.099999999999999') FROM num_data ORDER BY val; to_char_15 | to_char ------------+--------------------- + | -83028485.0 + | -34338492.215397047 + | -24926804.04504742 | 0000000.0 | 0000000.0 - | -34338492.215397047 | 0000004.31 - | 7799461.4119 | 0016397.038491 - | 0093901.57763026 - | -83028485.0 | 0074881.0 - | -24926804.04504742 + | 0093901.57763026 + | 7799461.4119 (10 rows) -SELECT '' AS to_char_16, to_char(val, 'L9999999999999999.099999999999999') FROM num_data; +SELECT '' AS to_char_16, to_char(val, 'L9999999999999999.099999999999999') FROM num_data ORDER BY val; to_char_16 | to_char ------------+------------------------------------ + | -83028485.000000000000000 + | -34338492.215397047000000 + | -24926804.045047420000000 | .000000000000000 | .000000000000000 - | -34338492.215397047000000 | 4.310000000000000 - | 7799461.411900000000000 | 16397.038491000000000 - | 93901.577630260000000 - | -83028485.000000000000000 | 74881.000000000000000 - | -24926804.045047420000000 + | 93901.577630260000000 + | 7799461.411900000000000 (10 rows) -SELECT '' AS to_char_17, to_char(val, 'FM9999999999999999.99999999999999') FROM num_data; +SELECT '' AS to_char_17, to_char(val, 'FM9999999999999999.99999999999999') FROM num_data ORDER BY val; to_char_17 | to_char ------------+--------------------- + | -83028485. + | -34338492.215397047 + | -24926804.04504742 | 0. | 0. - | -34338492.215397047 | 4.31 - | 7799461.4119 | 16397.038491 - | 93901.57763026 - | -83028485. | 74881. - | -24926804.04504742 + | 93901.57763026 + | 7799461.4119 (10 rows) -SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data; +SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data ORDER BY val; to_char_18 | to_char ------------+----------------------------------------------------------------------- + | -8 3 0 2 8 4 8 5 . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + | -3 4 3 3 8 4 9 2 . 2 1 5 3 9 7 0 4 7 0 0 0 0 0 0 0 0 + | -2 4 9 2 6 8 0 4 . 0 4 5 0 4 7 4 2 0 0 0 0 0 0 0 0 0 | +. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | +. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - | -3 4 3 3 8 4 9 2 . 2 1 5 3 9 7 0 4 7 0 0 0 0 0 0 0 0 | +4 . 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - | +7 7 9 9 4 6 1 . 4 1 1 9 0 0 0 0 0 0 0 0 0 0 0 0 0 | +1 6 3 9 7 . 0 3 8 4 9 1 0 0 0 0 0 0 0 0 0 0 0 - | +9 3 9 0 1 . 5 7 7 6 3 0 2 6 0 0 0 0 0 0 0 0 0 - | -8 3 0 2 8 4 8 5 . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | +7 4 8 8 1 . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - | -2 4 9 2 6 8 0 4 . 0 4 5 0 4 7 4 2 0 0 0 0 0 0 0 0 0 + | +9 3 9 0 1 . 5 7 7 6 3 0 2 6 0 0 0 0 0 0 0 0 0 + | +7 7 9 9 4 6 1 . 4 1 1 9 0 0 0 0 0 0 0 0 0 0 0 0 0 (10 rows) -SELECT '' AS to_char_19, to_char(val, 'FMS 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data; +SELECT '' AS to_char_19, to_char(val, 'FMS 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data ORDER BY val; to_char_19 | to_char ------------+------------------------------------------------------- + | -8 3 0 2 8 4 8 5 . + | -3 4 3 3 8 4 9 2 . 2 1 5 3 9 7 0 4 7 + | -2 4 9 2 6 8 0 4 . 0 4 5 0 4 7 4 2 | +0 . | +0 . - | -3 4 3 3 8 4 9 2 . 2 1 5 3 9 7 0 4 7 | +4 . 3 1 - | +7 7 9 9 4 6 1 . 4 1 1 9 | +1 6 3 9 7 . 0 3 8 4 9 1 - | +9 3 9 0 1 . 5 7 7 6 3 0 2 6 - | -8 3 0 2 8 4 8 5 . | +7 4 8 8 1 . - | -2 4 9 2 6 8 0 4 . 0 4 5 0 4 7 4 2 + | +9 3 9 0 1 . 5 7 7 6 3 0 2 6 + | +7 7 9 9 4 6 1 . 4 1 1 9 (10 rows) -SELECT '' AS to_char_20, to_char(val, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM num_data; +SELECT '' AS to_char_20, to_char(val, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM num_data ORDER BY val; to_char_20 | to_char ------------+----------------------------------------------------------- + | text -8 9999 302 "text between quote marks" 8485 + | text -3 9999 433 "text between quote marks" 8492 + | text -2 9999 492 "text between quote marks" 6804 | text 9999 "text between quote marks" 0 | text 9999 "text between quote marks" 0 - | text -3 9999 433 "text between quote marks" 8492 | text 9999 "text between quote marks" 4 - | text 9999 779 "text between quote marks" 9461 | text 9999 1 "text between quote marks" 6397 - | text 9999 9 "text between quote marks" 3902 - | text -8 9999 302 "text between quote marks" 8485 | text 9999 7 "text between quote marks" 4881 - | text -2 9999 492 "text between quote marks" 6804 + | text 9999 9 "text between quote marks" 3902 + | text 9999 779 "text between quote marks" 9461 (10 rows) -SELECT '' AS to_char_21, to_char(val, '999999SG9999999999') FROM num_data; +SELECT '' AS to_char_21, to_char(val, '999999SG9999999999') FROM num_data ORDER BY val; to_char_21 | to_char ------------+------------------- + | - 83028485 + | - 34338492 + | - 24926804 | + 0 | + 0 - | - 34338492 | + 4 - | + 7799461 | + 16397 - | + 93902 - | - 83028485 | + 74881 - | - 24926804 + | + 93902 + | + 7799461 (10 rows) -SELECT '' AS to_char_22, to_char(val, 'FM9999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_22, to_char(val, 'FM9999999999999999.999999999999999') FROM num_data ORDER BY val; to_char_22 | to_char ------------+--------------------- + | -83028485. + | -34338492.215397047 + | -24926804.04504742 | 0. | 0. - | -34338492.215397047 | 4.31 - | 7799461.4119 | 16397.038491 - | 93901.57763026 - | -83028485. | 74881. - | -24926804.04504742 + | 93901.57763026 + | 7799461.4119 (10 rows) -- TO_NUMBER() @@ -1264,14 +1264,14 @@ INSERT INTO num_input_test(n1) VALUES (' N aN '); ERROR: invalid input syntax for type numeric: " N aN " LINE 1: INSERT INTO num_input_test(n1) VALUES (' N aN '); ^ -SELECT * FROM num_input_test; +SELECT * FROM num_input_test ORDER BY n1; n1 --------- - 123 - 3245874 -93853 - 555.50 -555.50 + 123 + 555.50 + 3245874 NaN NaN (7 rows) diff --git a/src/test/regress/expected/oid.out b/src/test/regress/expected/oid.out index 008b5a246b..b8f0b17e0d 100644 --- a/src/test/regress/expected/oid.out +++ b/src/test/regress/expected/oid.out @@ -52,71 +52,71 @@ INSERT INTO OID_TBL(f1) VALUES ('-23582358720398502385'); ERROR: value "-23582358720398502385" is out of range for type oid LINE 1: INSERT INTO OID_TBL(f1) VALUES ('-23582358720398502385'); ^ -SELECT '' AS six, * FROM OID_TBL; +SELECT '' AS six, * FROM OID_TBL ORDER BY f1; six | f1 -----+------------ - | 1234 - | 1235 - | 987 - | 4294966256 - | 99999999 | 5 | 10 | 15 + | 987 + | 1234 + | 1235 + | 99999999 + | 4294966256 (8 rows) -SELECT '' AS one, o.* FROM OID_TBL o WHERE o.f1 = 1234; +SELECT '' AS one, o.* FROM OID_TBL o WHERE o.f1 = 1234 ORDER BY f1; one | f1 -----+------ | 1234 (1 row) -SELECT '' AS five, o.* FROM OID_TBL o WHERE o.f1 <> '1234'; +SELECT '' AS five, o.* FROM OID_TBL o WHERE o.f1 <> '1234' ORDER BY f1; five | f1 ------+------------ - | 1235 - | 987 - | 4294966256 - | 99999999 | 5 | 10 | 15 + | 987 + | 1235 + | 99999999 + | 4294966256 (7 rows) -SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 <= '1234'; +SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 <= '1234' ORDER BY f1; three | f1 -------+------ - | 1234 - | 987 | 5 | 10 | 15 + | 987 + | 1234 (5 rows) -SELECT '' AS two, o.* FROM OID_TBL o WHERE o.f1 < '1234'; +SELECT '' AS two, o.* FROM OID_TBL o WHERE o.f1 < '1234' ORDER BY f1; two | f1 -----+----- - | 987 | 5 | 10 | 15 + | 987 (4 rows) -SELECT '' AS four, o.* FROM OID_TBL o WHERE o.f1 >= '1234'; +SELECT '' AS four, o.* FROM OID_TBL o WHERE o.f1 >= '1234' ORDER BY f1; four | f1 ------+------------ | 1234 | 1235 - | 4294966256 | 99999999 + | 4294966256 (4 rows) -SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 > '1234'; +SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 > '1234' ORDER BY f1; three | f1 -------+------------ | 1235 - | 4294966256 | 99999999 + | 4294966256 (3 rows) DROP TABLE OID_TBL; diff --git a/src/test/regress/expected/path.out b/src/test/regress/expected/path.out index 08d6d61dda..e38377981a 100644 --- a/src/test/regress/expected/path.out +++ b/src/test/regress/expected/path.out @@ -2,25 +2,25 @@ -- PATH -- --DROP TABLE PATH_TBL; -CREATE TABLE PATH_TBL (f1 path); -INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]'); -INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))'); -INSERT INTO PATH_TBL VALUES ('[(0,0),(3,0),(4,5),(1,6)]'); -INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))'); -INSERT INTO PATH_TBL VALUES ('1,2 ,3,4'); -INSERT INTO PATH_TBL VALUES ('[1,2,3, 4]'); -INSERT INTO PATH_TBL VALUES ('[11,12,13,14]'); -INSERT INTO PATH_TBL VALUES ('(11,12,13,14)'); +CREATE TABLE PATH_TBL (ID int, f1 path); +INSERT INTO PATH_TBL VALUES (1,'[(1,2),(3,4)]'); +INSERT INTO PATH_TBL VALUES (2,'((1,2),(3,4))'); +INSERT INTO PATH_TBL VALUES (3,'[(0,0),(3,0),(4,5),(1,6)]'); +INSERT INTO PATH_TBL VALUES (4, '((1,2),(3,4))'); +INSERT INTO PATH_TBL VALUES (5, '1,2 ,3,4'); +INSERT INTO PATH_TBL VALUES (6, '[1,2,3, 4]'); +INSERT INTO PATH_TBL VALUES (7, '[11,12,13,14]'); +INSERT INTO PATH_TBL VALUES (8, '(11,12,13,14)'); -- bad values for parser testing -INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]'); +INSERT INTO PATH_TBL VALUES (9, '[(,2),(3,4)]'); ERROR: invalid input syntax for type path: "[(,2),(3,4)]" -LINE 1: INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]'); - ^ -INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)'); +LINE 1: INSERT INTO PATH_TBL VALUES (9, '[(,2),(3,4)]'); + ^ +INSERT INTO PATH_TBL VALUES (10, '[(1,2),(3,4)'); ERROR: invalid input syntax for type path: "[(1,2),(3,4)" -LINE 1: INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)'); - ^ -SELECT f1 FROM PATH_TBL; +LINE 1: INSERT INTO PATH_TBL VALUES (10, '[(1,2),(3,4)'); + ^ +SELECT f1 FROM PATH_TBL ORDER BY ID; f1 --------------------------- [(1,2),(3,4)] @@ -33,7 +33,7 @@ SELECT f1 FROM PATH_TBL; ((11,12),(13,14)) (8 rows) -SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1); +SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1) ORDER BY ID; count | open_path -------+--------------------------- | [(1,2),(3,4)] @@ -42,7 +42,7 @@ SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1); | [(11,12),(13,14)] (4 rows) -SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1); +SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1) ORDER BY ID; count | closed_path -------+------------------- | ((1,2),(3,4)) @@ -51,7 +51,7 @@ SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1); | ((11,12),(13,14)) (4 rows) -SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL; +SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL ORDER BY ID; count | closed_path -------+--------------------------- | ((1,2),(3,4)) @@ -64,7 +64,7 @@ SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL; | ((11,12),(13,14)) (8 rows) -SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL; +SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL ORDER BY ID; count | open_path -------+--------------------------- | [(1,2),(3,4)] diff --git a/src/test/regress/expected/plancache.out b/src/test/regress/expected/plancache.out index c0681d26e3..f83c20b92e 100644 --- a/src/test/regress/expected/plancache.out +++ b/src/test/regress/expected/plancache.out @@ -3,19 +3,19 @@ -- CREATE TEMP TABLE pcachetest AS SELECT * FROM int8_tbl; -- create and use a cached plan -PREPARE prepstmt AS SELECT * FROM pcachetest; +PREPARE prepstmt AS SELECT * FROM pcachetest ORDER BY q1, q2; EXECUTE prepstmt; q1 | q2 ------------------+------------------- 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (5 rows) -- and one with parameters -PREPARE prepstmt2(bigint) AS SELECT * FROM pcachetest WHERE q1 = $1; +PREPARE prepstmt2(bigint) AS SELECT * FROM pcachetest WHERE q1 = $1 ORDER BY q1, q2; EXECUTE prepstmt2(123); q1 | q2 -----+------------------ @@ -31,14 +31,14 @@ EXECUTE prepstmt2(123); ERROR: relation "pcachetest" does not exist -- recreate the temp table (this demonstrates that the raw plan is -- purely textual and doesn't depend on OIDs, for instance) -CREATE TEMP TABLE pcachetest AS SELECT * FROM int8_tbl ORDER BY 2; +CREATE TEMP TABLE pcachetest AS SELECT * FROM int8_tbl ORDER BY q1, q2; EXECUTE prepstmt; q1 | q2 ------------------+------------------- - 4567890123456789 | -4567890123456789 - 4567890123456789 | 123 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 4567890123456789 | 4567890123456789 (5 rows) @@ -61,10 +61,10 @@ ALTER TABLE pcachetest DROP COLUMN q3; EXECUTE prepstmt; q1 | q2 ------------------+------------------- - 4567890123456789 | -4567890123456789 - 4567890123456789 | 123 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 4567890123456789 | 4567890123456789 (5 rows) @@ -79,26 +79,26 @@ EXECUTE prepstmt2(123); -- but should trigger invalidation anyway CREATE TEMP VIEW pcacheview AS SELECT * FROM pcachetest; -PREPARE vprep AS SELECT * FROM pcacheview; +PREPARE vprep AS SELECT * FROM pcacheview ORDER BY q1, q2; EXECUTE vprep; q1 | q2 ------------------+------------------- - 4567890123456789 | -4567890123456789 - 4567890123456789 | 123 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 + 4567890123456789 | 123 4567890123456789 | 4567890123456789 (5 rows) CREATE OR REPLACE TEMP VIEW pcacheview AS - SELECT q1, q2/2 AS q2 FROM pcachetest; + SELECT q1, q2/2 AS q2 FROM pcachetest ORDER BY q1, q2; EXECUTE vprep; q1 | q2 ------------------+------------------- - 4567890123456789 | -2283945061728394 - 4567890123456789 | 61 123 | 228 123 | 2283945061728394 + 4567890123456789 | -2283945061728394 + 4567890123456789 | 61 4567890123456789 | 2283945061728394 (5 rows) diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out index 0446f5193c..da978b845c 100644 --- a/src/test/regress/expected/plpgsql.out +++ b/src/test/regress/expected/plpgsql.out @@ -1607,15 +1607,15 @@ select test_found(); t (1 row) -select * from found_test_tbl; +select * from found_test_tbl order by 1; a ----- 2 - 100 3 4 5 6 + 100 (6 rows) -- @@ -1630,15 +1630,15 @@ BEGIN END LOOP; RETURN; END;' language plpgsql; -select * from test_table_func_rec(); +select * from test_table_func_rec() order by 1; a ----- 2 - 100 3 4 5 6 + 100 (6 rows) create function test_table_func_row() returns setof found_test_tbl as ' @@ -1650,15 +1650,15 @@ BEGIN END LOOP; RETURN; END;' language plpgsql; -select * from test_table_func_row(); +select * from test_table_func_row() order by 1; a ----- 2 - 100 3 4 5 6 + 100 (6 rows) create function test_ret_set_scalar(int,int) returns setof int as ' @@ -1670,7 +1670,7 @@ BEGIN END LOOP; RETURN; END;' language plpgsql; -select * from test_ret_set_scalar(1,10); +select * from test_ret_set_scalar(1,10) order by 1; test_ret_set_scalar --------------------- 2 @@ -1700,14 +1700,14 @@ BEGIN END IF; RETURN; END;' language plpgsql; -SELECT * FROM test_ret_set_rec_dyn(1500) AS (a int, b int, c int); +SELECT * FROM test_ret_set_rec_dyn(1500) AS (a int, b int, c int) order by a, b, c; a | b | c ---+----+---- 5 | 10 | 15 5 | 10 | 15 (2 rows) -SELECT * FROM test_ret_set_rec_dyn(5) AS (a int, b numeric, c text); +SELECT * FROM test_ret_set_rec_dyn(5) AS (a int, b numeric, c text) order by a, b, c; a | b | c ----+---+----- 50 | 5 | xxx @@ -1726,13 +1726,13 @@ BEGIN RETURN retval; END IF; END;' language plpgsql; -SELECT * FROM test_ret_rec_dyn(1500) AS (a int, b int, c int); +SELECT * FROM test_ret_rec_dyn(1500) AS (a int, b int, c int) order by a, b, c; a | b | c ---+----+---- 5 | 10 | 15 (1 row) -SELECT * FROM test_ret_rec_dyn(5) AS (a int, b numeric, c text); +SELECT * FROM test_ret_rec_dyn(5) AS (a int, b numeric, c text) order by a, b, c; a | b | c ----+---+----- 50 | 5 | xxx @@ -1792,7 +1792,7 @@ begin return next; return; end$$ language plpgsql; -select * from f1(42); +select * from f1(42) order by 1; j ---- 43 @@ -1828,7 +1828,7 @@ begin k := 'foot'; return next; end$$ language plpgsql; -select * from f1(42); +select * from f1(42) order by j, k;; j | k ----+------ 43 | foo @@ -1897,7 +1897,7 @@ SELECT perform_test_func(); (1 row) -SELECT * FROM perform_test; +SELECT * FROM perform_test order by a, b; a | b -----+----- 5 | 15 @@ -2041,7 +2041,7 @@ NOTICE: nyeah nyeah, can't stop me (1 row) reset statement_timeout; -select * from foo; +select * from foo order by 1; f1 ---- 1 @@ -2854,7 +2854,7 @@ NOTICE: x.f1 = 7, x.f2 = 8 (1 row) -select * from foo; +select * from foo order by 1, 2; f1 | f2 ----+---- 1 | 2 @@ -2949,14 +2949,14 @@ begin close c; end; $$ language plpgsql; -select * from sc_test(); +select * from sc_test() order by 1; sc_test ------------- -2147483647 - 2147483647 -123456 - 123456 0 + 123456 + 2147483647 (5 rows) create or replace function sc_test() returns setof integer as $$ @@ -2973,7 +2973,7 @@ begin close c; end; $$ language plpgsql; -select * from sc_test(); -- fails because of NO SCROLL specification +select * from sc_test() order by 1; -- fails because of NO SCROLL specification ERROR: cursor can only scan forward HINT: Declare it with SCROLL option to enable backward scan. CONTEXT: PL/pgSQL function "sc_test" line 6 at FETCH @@ -2991,14 +2991,14 @@ begin close c; end; $$ language plpgsql; -select * from sc_test(); +select * from sc_test() order by 1; sc_test ------------- -2147483647 - 2147483647 -123456 - 123456 0 + 123456 + 2147483647 (5 rows) create or replace function sc_test() returns setof integer as $$ @@ -3015,7 +3015,7 @@ begin close c; end; $$ language plpgsql; -select * from sc_test(); +select * from sc_test() order by 1; sc_test ------------- -2147483647 @@ -3042,7 +3042,7 @@ begin close c; end; $$ language plpgsql; -select * from sc_test(); +select * from sc_test() order by 1; sc_test --------- 3 @@ -3089,10 +3089,11 @@ begin return next; end; $$ language plpgsql; -select * from ret_query1(); +select * from ret_query1() order by 1, 2; column1 | column2 ---------+--------- -1 | -2 + -1 | -2 1 | 0 2 | 10 3 | 20 @@ -3104,7 +3105,6 @@ select * from ret_query1(); 9 | 80 10 | 90 11 | 100 - -1 | -2 (13 rows) create type record_type as (x text, y int, z boolean); @@ -3114,18 +3114,18 @@ begin from generate_series(-8, lim) s (x) where s.x % 2 = 0; end; $$ language plpgsql; -select * from ret_query2(8); +select * from ret_query2(8) order by 1; x | y | z ----------------------------------+----+--- - a8d2ec85eaf98407310b72eb73dda247 | -8 | f - 596a3d04481816330f07e4f97510c28f | -6 | f 0267aaf632e87a63288a08331f22c7c3 | -4 | f + 1679091c5a880faf6fb5e6087eb1b2dc | 6 | t + 596a3d04481816330f07e4f97510c28f | -6 | f 5d7b9adcbe1c629ec722529dd12e5129 | -2 | f - cfcd208495d565ef66e7dff9f98764da | 0 | f - c81e728d9d4c2f636f067f89cc14862c | 2 | t a87ff679a2f3e71d9181a67b7542122c | 4 | t - 1679091c5a880faf6fb5e6087eb1b2dc | 6 | t + a8d2ec85eaf98407310b72eb73dda247 | -8 | f + c81e728d9d4c2f636f067f89cc14862c | 2 | t c9f0f895fb98ab9159f51fd0297e236d | 8 | t + cfcd208495d565ef66e7dff9f98764da | 0 | f (9 rows) -- test EXECUTE USING @@ -3239,7 +3239,7 @@ NOTICE: 10, 10 (1 row) -select * from forc_test; +select * from forc_test order by 1, 2; i | j ------+---- 100 | 2 @@ -3275,7 +3275,7 @@ begin return query execute 'select * from (values($1),($2)) f' using 40,50; end; $$ language plpgsql; -select * from return_dquery(); +select * from return_dquery() order by 1; return_dquery --------------- 10 @@ -3640,7 +3640,7 @@ begin return query select $1, $1+i from generate_series(1,5) g(i); end; $$ language plpgsql immutable strict; -select * from tftest(10); +select * from tftest(10) order by 1, 2; a | b ----+---- 10 | 11 @@ -3658,7 +3658,7 @@ begin return next; end; $$ language plpgsql immutable strict; -select * from tftest(10); +select * from tftest(10) order by 1, 2; a | b -----+----- 10 | 11 @@ -3684,7 +3684,7 @@ begin raise notice '% %', found, rc; end; $$ language plpgsql; -select * from rttest(); +select * from rttest() order by 1; NOTICE: t 2 NOTICE: f 0 NOTICE: t 2 @@ -3692,9 +3692,9 @@ NOTICE: f 0 rttest -------- 10 - 20 10 20 + 20 (4 rows) drop function rttest(); diff --git a/src/test/regress/expected/point.out b/src/test/regress/expected/point.out index 9d1bd434e9..7612d74dbe 100644 --- a/src/test/regress/expected/point.out +++ b/src/test/regress/expected/point.out @@ -33,39 +33,39 @@ SELECT '' AS six, * FROM POINT_TBL; (6 rows) -- left of -SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)'; +SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)' ORDER BY p.f1[0], p.f1[1]; three | f1 -------+---------- | (-10,0) - | (-3,4) | (-5,-12) + | (-3,4) (3 rows) -- right of -SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1; +SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1 ORDER BY p.f1[0], p.f1[1]; three | f1 -------+---------- | (-10,0) - | (-3,4) | (-5,-12) + | (-3,4) (3 rows) -- above -SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1 ORDER BY p.f1[0], p.f1[1]; one | f1 -----+---------- | (-5,-12) (1 row) -- below -SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)' ORDER BY p.f1[0], p.f1[1]; one | f1 -----+---------- | (-5,-12) (1 row) -- equal -SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)'; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)' ORDER BY p.f1[0], p.f1[1]; one | f1 -----+------------ | (5.1,34.5) @@ -73,7 +73,7 @@ SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)'; -- point in box SELECT '' AS three, p.* FROM POINT_TBL p - WHERE p.f1 <@ box '(0,0,100,100)'; + WHERE p.f1 <@ box '(0,0,100,100)' ORDER BY p.f1[0], p.f1[1]; three | f1 -------+------------ | (0,0) @@ -82,25 +82,25 @@ SELECT '' AS three, p.* FROM POINT_TBL p (3 rows) SELECT '' AS three, p.* FROM POINT_TBL p - WHERE not p.f1 <@ box '(0,0,100,100)'; + WHERE not p.f1 <@ box '(0,0,100,100)' ORDER BY p.f1[0], p.f1[1]; three | f1 -------+---------- | (-10,0) - | (-3,4) | (-5,-12) + | (-3,4) (3 rows) SELECT '' AS two, p.* FROM POINT_TBL p - WHERE p.f1 <@ path '[(0,0),(-10,0),(-10,10)]'; + WHERE p.f1 <@ path '[(0,0),(-10,0),(-10,10)]' ORDER BY p.f1[0], p.f1[1]; two | f1 -----+--------- - | (0,0) | (-10,0) + | (0,0) (2 rows) SELECT '' AS six, p.f1, p.f1 <-> point '(0,0)' AS dist FROM POINT_TBL p - ORDER BY dist; + ORDER BY dist, p.f1[0], p.f1[1]; six | f1 | dist -----+------------+------------------ | (0,0) | 0 @@ -156,39 +156,39 @@ SELECT '' AS thirtysix, p1.f1 AS point1, p2.f1 AS point2, p1.f1 <-> p2.f1 AS dis SELECT '' AS thirty, p1.f1 AS point1, p2.f1 AS point2 FROM POINT_TBL p1, POINT_TBL p2 - WHERE (p1.f1 <-> p2.f1) > 3; + WHERE (p1.f1 <-> p2.f1) > 3 ORDER BY p1.f1[0], p1.f1[1], p2.f1[0], p2.f1[1]; thirty | point1 | point2 --------+------------+------------ - | (0,0) | (-10,0) - | (0,0) | (-3,4) - | (0,0) | (5.1,34.5) - | (0,0) | (-5,-12) - | (0,0) | (10,10) - | (-10,0) | (0,0) + | (-10,0) | (-5,-12) | (-10,0) | (-3,4) + | (-10,0) | (0,0) | (-10,0) | (5.1,34.5) - | (-10,0) | (-5,-12) | (-10,0) | (10,10) - | (-3,4) | (0,0) + | (-5,-12) | (-10,0) + | (-5,-12) | (-3,4) + | (-5,-12) | (0,0) + | (-5,-12) | (5.1,34.5) + | (-5,-12) | (10,10) | (-3,4) | (-10,0) - | (-3,4) | (5.1,34.5) | (-3,4) | (-5,-12) + | (-3,4) | (0,0) + | (-3,4) | (5.1,34.5) | (-3,4) | (10,10) - | (5.1,34.5) | (0,0) + | (0,0) | (-10,0) + | (0,0) | (-5,-12) + | (0,0) | (-3,4) + | (0,0) | (5.1,34.5) + | (0,0) | (10,10) | (5.1,34.5) | (-10,0) - | (5.1,34.5) | (-3,4) | (5.1,34.5) | (-5,-12) + | (5.1,34.5) | (-3,4) + | (5.1,34.5) | (0,0) | (5.1,34.5) | (10,10) - | (-5,-12) | (0,0) - | (-5,-12) | (-10,0) - | (-5,-12) | (-3,4) - | (-5,-12) | (5.1,34.5) - | (-5,-12) | (10,10) - | (10,10) | (0,0) | (10,10) | (-10,0) + | (10,10) | (-5,-12) | (10,10) | (-3,4) + | (10,10) | (0,0) | (10,10) | (5.1,34.5) - | (10,10) | (-5,-12) (30 rows) -- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10 @@ -219,7 +219,7 @@ SELECT '' AS fifteen, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS dis SELECT '' AS three, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance FROM POINT_TBL p1, POINT_TBL p2 WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 >^ p2.f1 - ORDER BY distance; + ORDER BY distance, p1.f1[0], p1.f1[1], p2.f1[0], p2.f1[1]; three | point1 | point2 | distance -------+------------+----------+------------------ | (-3,4) | (0,0) | 5 diff --git a/src/test/regress/expected/polygon.out b/src/test/regress/expected/polygon.out index 56b72aaa8e..da49ff00f6 100644 --- a/src/test/regress/expected/polygon.out +++ b/src/test/regress/expected/polygon.out @@ -13,116 +13,116 @@ -- -- 0 1 2 3 4 -- -CREATE TABLE POLYGON_TBL(f1 polygon); -INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,0.0),(2.0,4.0),(0.0,0.0)'); -INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)'); +CREATE TABLE POLYGON_TBL(ID int, f1 polygon); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (1, '(2.0,0.0),(2.0,4.0),(0.0,0.0)'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (2, '(3.0,1.0),(3.0,3.0),(1.0,0.0)'); -- degenerate polygons -INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)'); -INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (3, '(0.0,0.0)'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (4, '(0.0,1.0),(0.0,1.0)'); -- bad polygon input strings -INSERT INTO POLYGON_TBL(f1) VALUES ('0.0'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (5, '0.0'); ERROR: invalid input syntax for type polygon: "0.0" -LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('0.0'); - ^ -INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0'); +LINE 1: INSERT INTO POLYGON_TBL(ID,f1) VALUES (5, '0.0'); + ^ +INSERT INTO POLYGON_TBL(ID,f1) VALUES (6, '(0.0 0.0'); ERROR: invalid input syntax for type polygon: "(0.0 0.0" -LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0'); - ^ -INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)'); +LINE 1: INSERT INTO POLYGON_TBL(ID,f1) VALUES (6, '(0.0 0.0'); + ^ +INSERT INTO POLYGON_TBL(ID,f1) VALUES (7, '(0,1,2)'); ERROR: invalid input syntax for type polygon: "(0,1,2)" -LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)'); - ^ -INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3'); +LINE 1: INSERT INTO POLYGON_TBL(ID,f1) VALUES (7, '(0,1,2)'); + ^ +INSERT INTO POLYGON_TBL(ID,f1) VALUES (8, '(0,1,2,3'); ERROR: invalid input syntax for type polygon: "(0,1,2,3" -LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3'); - ^ -INSERT INTO POLYGON_TBL(f1) VALUES ('asdf'); +LINE 1: INSERT INTO POLYGON_TBL(ID,f1) VALUES (8, '(0,1,2,3'); + ^ +INSERT INTO POLYGON_TBL(ID,f1) VALUES (9, 'asdf'); ERROR: invalid input syntax for type polygon: "asdf" -LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('asdf'); - ^ -SELECT '' AS four, * FROM POLYGON_TBL; - four | f1 -------+--------------------- - | ((2,0),(2,4),(0,0)) - | ((3,1),(3,3),(1,0)) - | ((0,0)) - | ((0,1),(0,1)) +LINE 1: INSERT INTO POLYGON_TBL(ID,f1) VALUES (9, 'asdf'); + ^ +SELECT '' AS four, * FROM POLYGON_TBL ORDER BY ID; + four | id | f1 +------+----+--------------------- + | 1 | ((2,0),(2,4),(0,0)) + | 2 | ((3,1),(3,3),(1,0)) + | 3 | ((0,0)) + | 4 | ((0,1),(0,1)) (4 rows) -- overlap SELECT '' AS three, p.* FROM POLYGON_TBL p - WHERE p.f1 && '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; - three | f1 --------+--------------------- - | ((2,0),(2,4),(0,0)) - | ((3,1),(3,3),(1,0)) + WHERE p.f1 && '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; + three | id | f1 +-------+----+--------------------- + | 1 | ((2,0),(2,4),(0,0)) + | 2 | ((3,1),(3,3),(1,0)) (2 rows) -- left overlap SELECT '' AS four, p.* FROM POLYGON_TBL p - WHERE p.f1 &< '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; - four | f1 -------+--------------------- - | ((2,0),(2,4),(0,0)) - | ((3,1),(3,3),(1,0)) - | ((0,0)) - | ((0,1),(0,1)) + WHERE p.f1 &< '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; + four | id | f1 +------+----+--------------------- + | 1 | ((2,0),(2,4),(0,0)) + | 2 | ((3,1),(3,3),(1,0)) + | 3 | ((0,0)) + | 4 | ((0,1),(0,1)) (4 rows) -- right overlap SELECT '' AS two, p.* FROM POLYGON_TBL p - WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; - two | f1 ------+--------------------- - | ((3,1),(3,3),(1,0)) + WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; + two | id | f1 +-----+----+--------------------- + | 2 | ((3,1),(3,3),(1,0)) (1 row) -- left of SELECT '' AS one, p.* FROM POLYGON_TBL p - WHERE p.f1 << '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; - one | f1 ------+--------------- - | ((0,0)) - | ((0,1),(0,1)) + WHERE p.f1 << '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; + one | id | f1 +-----+----+--------------- + | 3 | ((0,0)) + | 4 | ((0,1),(0,1)) (2 rows) -- right of SELECT '' AS zero, p.* FROM POLYGON_TBL p - WHERE p.f1 >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; - zero | f1 -------+---- + WHERE p.f1 >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; + zero | id | f1 +------+----+---- (0 rows) -- contained SELECT '' AS one, p.* FROM POLYGON_TBL p - WHERE p.f1 <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; - one | f1 ------+--------------------- - | ((3,1),(3,3),(1,0)) + WHERE p.f1 <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; + one | id | f1 +-----+----+--------------------- + | 2 | ((3,1),(3,3),(1,0)) (1 row) -- same SELECT '' AS one, p.* FROM POLYGON_TBL p - WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; - one | f1 ------+--------------------- - | ((3,1),(3,3),(1,0)) + WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; + one | id | f1 +-----+----+--------------------- + | 2 | ((3,1),(3,3),(1,0)) (1 row) -- contains SELECT '' AS one, p.* FROM POLYGON_TBL p - WHERE p.f1 @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; - one | f1 ------+--------------------- - | ((3,1),(3,3),(1,0)) + WHERE p.f1 @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; + one | id | f1 +-----+----+--------------------- + | 2 | ((3,1),(3,3),(1,0)) (1 row) -- diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out index 77f693c2b1..fde69ad051 100644 --- a/src/test/regress/expected/polymorphism.out +++ b/src/test/regress/expected/polymorphism.out @@ -552,7 +552,7 @@ create function sql_if(bool, anyelement, anyelement) returns anyelement as $$ select case when $1 then $2 else $3 end $$ language sql; -- Note this would fail with integer overflow, never mind wrong bleat() output, -- if the CASE expression were not successfully inlined -select f1, sql_if(f1 > 0, bleat(f1), bleat(f1 + 1)) from int4_tbl; +select f1, sql_if(f1 > 0, bleat(f1), bleat(f1 + 1)) from int4_tbl order by 1, 2; NOTICE: bleat 1 NOTICE: bleat 123456 NOTICE: bleat -123455 @@ -560,21 +560,21 @@ NOTICE: bleat 2147483647 NOTICE: bleat -2147483646 f1 | sql_if -------------+------------- + -2147483647 | -2147483646 + -123456 | -123455 0 | 1 123456 | 123456 - -123456 | -123455 2147483647 | 2147483647 - -2147483647 | -2147483646 (5 rows) -select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl; +select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl order by 1, 2; q2 | sql_if -------------------+------------------- + -4567890123456789 | -4567890123456788 + 123 | 123 456 | 456 4567890123456789 | 4567890123456789 - 123 | 123 4567890123456789 | 4567890123456789 - -4567890123456789 | -4567890123456788 (5 rows) -- another kind of polymorphic aggregate @@ -837,7 +837,7 @@ select dfunc(); -- verify it lists properly \df dfunc - List of functions + List of functions Schema | Name | Result data type | Argument data types | Type --------+-------+------------------+-----------------------------------------------------------+-------- public | dfunc | integer | a integer DEFAULT 1, OUT sum integer, b integer DEFAULT 2 | normal @@ -1005,7 +1005,7 @@ $$ select array_upper($1, 1) $$ language sql; ERROR: cannot remove parameter defaults from existing function HINT: Use DROP FUNCTION first. \df dfunc - List of functions + List of functions Schema | Name | Result data type | Argument data types | Type --------+-------+------------------+-------------------------------------------------+-------- public | dfunc | integer | VARIADIC a integer[] DEFAULT ARRAY[]::integer[] | normal diff --git a/src/test/regress/expected/portals.out b/src/test/regress/expected/portals.out index 95dcea5a1d..94de1b92d5 100644 --- a/src/test/regress/expected/portals.out +++ b/src/test/regress/expected/portals.out @@ -778,7 +778,7 @@ ERROR: cursor "foo26" does not exist BEGIN; CREATE FUNCTION declares_cursor(text) RETURNS void - AS 'DECLARE c CURSOR FOR SELECT stringu1 FROM tenk1 WHERE stringu1 LIKE $1;' + AS 'DECLARE c CURSOR FOR SELECT stringu1 FROM tenk1 WHERE stringu1 LIKE $1 ORDER BY stringu1;' LANGUAGE SQL; SELECT declares_cursor('AB%'); declares_cursor @@ -904,7 +904,7 @@ COMMIT; -- CREATE TEMP TABLE uctest(f1 int, f2 text); INSERT INTO uctest VALUES (1, 'one'), (2, 'two'), (3, 'three'); -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- 1 | one @@ -914,7 +914,7 @@ SELECT * FROM uctest; -- Check DELETE WHERE CURRENT BEGIN; -DECLARE c1 CURSOR FOR SELECT * FROM uctest; +DECLARE c1 CURSOR FOR SELECT * FROM uctest ORDER BY f1; FETCH 2 FROM c1; f1 | f2 ----+----- @@ -923,39 +923,27 @@ FETCH 2 FROM c1; (2 rows) DELETE FROM uctest WHERE CURRENT OF c1; +ERROR: cursor "c1" is not a simply updatable scan of table "uctest" -- should show deletion -SELECT * FROM uctest; - f1 | f2 -----+------- - 1 | one - 3 | three -(2 rows) - +SELECT * FROM uctest ORDER BY f1; +ERROR: current transaction is aborted, commands ignored until end of transaction block -- cursor did not move FETCH ALL FROM c1; - f1 | f2 -----+------- - 3 | three -(1 row) - +ERROR: current transaction is aborted, commands ignored until end of transaction block -- cursor is insensitive MOVE BACKWARD ALL IN c1; +ERROR: current transaction is aborted, commands ignored until end of transaction block FETCH ALL FROM c1; - f1 | f2 -----+------- - 1 | one - 2 | two - 3 | three -(3 rows) - +ERROR: current transaction is aborted, commands ignored until end of transaction block COMMIT; -- should still see deletion -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- 1 | one + 2 | two 3 | three -(2 rows) +(3 rows) -- Check UPDATE WHERE CURRENT; this time use FOR UPDATE BEGIN; @@ -967,159 +955,181 @@ FETCH c1; (1 row) UPDATE uctest SET f1 = 8 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- + 2 | two 3 | three 8 | one -(2 rows) +(3 rows) COMMIT; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- + 2 | two 3 | three 8 | one -(2 rows) +(3 rows) -- Check repeated-update and update-then-delete cases BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest; FETCH c1; - f1 | f2 -----+------- - 3 | three + f1 | f2 +----+----- + 2 | two (1 row) UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; SELECT * FROM uctest; f1 | f2 ----+------- + 3 | three 8 | one - 13 | three -(2 rows) + 12 | two +(3 rows) UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY 1; f1 | f2 ----+------- + 3 | three 8 | one - 23 | three -(2 rows) + 22 | two +(3 rows) -- insensitive cursor should not show effects of updates or deletes FETCH RELATIVE 0 FROM c1; - f1 | f2 -----+------- - 3 | three + f1 | f2 +----+----- + 2 | two (1 row) DELETE FROM uctest WHERE CURRENT OF c1; -SELECT * FROM uctest; - f1 | f2 -----+----- +SELECT * FROM uctest ORDER BY f1; + f1 | f2 +----+------- + 3 | three 8 | one -(1 row) +(2 rows) DELETE FROM uctest WHERE CURRENT OF c1; -- no-op -SELECT * FROM uctest; - f1 | f2 -----+----- +SELECT * FROM uctest ORDER BY f1; + f1 | f2 +----+------- + 3 | three 8 | one -(1 row) +(2 rows) UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- no-op -SELECT * FROM uctest; - f1 | f2 -----+----- - 8 | one -(1 row) - -FETCH RELATIVE 0 FROM c1; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- 3 | three + 8 | one +(2 rows) + +FETCH RELATIVE 0 FROM c1; + f1 | f2 +----+----- + 2 | two (1 row) ROLLBACK; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- + 2 | two 3 | three 8 | one -(2 rows) +(3 rows) BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; FETCH c1; - f1 | f2 -----+------- - 3 | three + f1 | f2 +----+----- + 2 | two (1 row) UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- + 3 | three 8 | one - 13 | three -(2 rows) + 12 | two +(3 rows) UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- + 3 | three 8 | one - 23 | three -(2 rows) + 22 | two +(3 rows) DELETE FROM uctest WHERE CURRENT OF c1; -SELECT * FROM uctest; - f1 | f2 -----+----- +SELECT * FROM uctest ORDER BY f1; + f1 | f2 +----+------- + 3 | three 8 | one -(1 row) +(2 rows) DELETE FROM uctest WHERE CURRENT OF c1; -- no-op -SELECT * FROM uctest; - f1 | f2 -----+----- +SELECT * FROM uctest ORDER BY f1; + f1 | f2 +----+------- + 3 | three 8 | one -(1 row) +(2 rows) UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- no-op -SELECT * FROM uctest; - f1 | f2 -----+----- +SELECT * FROM uctest ORDER BY f1; + f1 | f2 +----+------- + 3 | three 8 | one -(1 row) +(2 rows) --- sensitive cursors can't currently scroll back, so this is an error: FETCH RELATIVE 0 FROM c1; ERROR: cursor can only scan forward HINT: Declare it with SCROLL option to enable backward scan. ROLLBACK; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 ----+------- + 2 | two 3 | three 8 | one -(2 rows) +(3 rows) -- Check inheritance cases CREATE TEMP TABLE ucchild () inherits (uctest); INSERT INTO ucchild values(100, 'hundred'); -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 -----+--------- + 2 | two 3 | three 8 | one 100 | hundred -(3 rows) +(4 rows) BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; FETCH 1 FROM c1; + f1 | f2 +----+----- + 2 | two +(1 row) + +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +FETCH 1 FROM c1; f1 | f2 ----+------- 3 | three @@ -1139,20 +1149,15 @@ FETCH 1 FROM c1; 100 | hundred (1 row) -UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -FETCH 1 FROM c1; - f1 | f2 -----+---- -(0 rows) - COMMIT; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 -----+--------- + 12 | two 13 | three 18 | one - 110 | hundred -(3 rows) + 100 | hundred +(4 rows) -- Can update from a self-join, but only if FOR UPDATE says which to use BEGIN; @@ -1186,13 +1191,14 @@ FETCH 1 FROM c1; (1 row) UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; f1 | f2 -----+--------- + 12 | two 13 | three 28 | one - 110 | hundred -(3 rows) + 100 | hundred +(4 rows) ROLLBACK; -- Check various error cases @@ -1234,9 +1240,9 @@ CREATE RULE ucrule AS ON DELETE TO ucview DO INSTEAD BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM ucview; FETCH FROM c1; - f1 | f2 -----+------- - 13 | three + f1 | f2 +----+----- + 12 | two (1 row) DELETE FROM ucview WHERE CURRENT OF c1; -- fail, views not supported diff --git a/src/test/regress/expected/prepare.out b/src/test/regress/expected/prepare.out index 610f259123..5350c1be78 100644 --- a/src/test/regress/expected/prepare.out +++ b/src/test/regress/expected/prepare.out @@ -32,7 +32,7 @@ EXECUTE q1; (1 row) PREPARE q2 AS SELECT 2 AS b; -SELECT name, statement, parameter_types FROM pg_prepared_statements; +SELECT name, statement, parameter_types FROM pg_prepared_statements ORDER BY name; name | statement | parameter_types ------+------------------------------+----------------- q1 | PREPARE q1 AS SELECT 2; | {} diff --git a/src/test/regress/expected/prepared_xacts.out b/src/test/regress/expected/prepared_xacts.out index 292962ab7b..630780baca 100644 --- a/src/test/regress/expected/prepared_xacts.out +++ b/src/test/regress/expected/prepared_xacts.out @@ -11,21 +11,21 @@ INSERT INTO pxtest1 VALUES ('aaa'); -- Test PREPARE TRANSACTION BEGIN; UPDATE pxtest1 SET foobar = 'bbb' WHERE foobar = 'aaa'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- bbb (1 row) PREPARE TRANSACTION 'foo1'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa (1 row) -- Test pg_prepared_xacts system view -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; gid ------ foo1 @@ -33,13 +33,13 @@ SELECT gid FROM pg_prepared_xacts; -- Test ROLLBACK PREPARED ROLLBACK PREPARED 'foo1'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa (1 row) -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; gid ----- (0 rows) @@ -47,7 +47,7 @@ SELECT gid FROM pg_prepared_xacts; -- Test COMMIT PREPARED BEGIN; INSERT INTO pxtest1 VALUES ('ddd'); -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa @@ -55,14 +55,14 @@ SELECT * FROM pxtest1; (2 rows) PREPARE TRANSACTION 'foo2'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa (1 row) COMMIT PREPARED 'foo2'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa @@ -72,7 +72,7 @@ SELECT * FROM pxtest1; -- Test duplicate gids BEGIN; UPDATE pxtest1 SET foobar = 'eee' WHERE foobar = 'ddd'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa @@ -80,7 +80,7 @@ SELECT * FROM pxtest1; (2 rows) PREPARE TRANSACTION 'foo3'; -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; gid ------ foo3 @@ -88,7 +88,7 @@ SELECT gid FROM pg_prepared_xacts; BEGIN; INSERT INTO pxtest1 VALUES ('fff'); -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa @@ -99,7 +99,7 @@ SELECT * FROM pxtest1; -- This should fail, because the gid foo3 is already in use PREPARE TRANSACTION 'foo3'; ERROR: transaction identifier "foo3" is already in use -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa @@ -107,7 +107,7 @@ SELECT * FROM pxtest1; (2 rows) ROLLBACK PREPARED 'foo3'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; foobar -------- aaa @@ -151,7 +151,7 @@ ERROR: relation "pxtest2" does not exist LINE 1: SELECT * FROM pxtest2; ^ -- There should be two prepared transactions -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; gid ------------- regress-one @@ -166,7 +166,7 @@ reset statement_timeout; -- Disconnect, we will continue testing in a different backend \c - -- There should still be two prepared transactions -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; gid ------------- regress-one @@ -207,7 +207,7 @@ ERROR: relation "pxtest3" does not exist LINE 1: SELECT * FROM pxtest3; ^ -- There should be no prepared transactions -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; gid ----- (0 rows) diff --git a/src/test/regress/expected/rangefuncs.out b/src/test/regress/expected/rangefuncs.out index 486dd3f3fe..330ed6f872 100644 --- a/src/test/regress/expected/rangefuncs.out +++ b/src/test/regress/expected/rangefuncs.out @@ -1,4 +1,4 @@ -SELECT name, setting FROM pg_settings WHERE name LIKE 'enable%'; +SELECT name, setting FROM pg_settings WHERE name LIKE 'enable%' ORDER BY name; name | setting -------------------+--------- enable_bitmapscan | on @@ -98,19 +98,19 @@ SELECT * FROM vw_getfoo; DROP VIEW vw_getfoo; DROP FUNCTION getfoo(int); CREATE FUNCTION getfoo(int) RETURNS setof text AS 'SELECT fooname FROM foo WHERE fooid = $1;' LANGUAGE SQL; -SELECT * FROM getfoo(1) AS t1; +SELECT * FROM getfoo(1) AS t1 ORDER BY 1; t1 ----- - Joe Ed + Joe (2 rows) CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1); -SELECT * FROM vw_getfoo; +SELECT * FROM vw_getfoo ORDER BY 1; getfoo -------- - Joe Ed + Joe (2 rows) -- sql, proretset = f, prorettype = c @@ -134,7 +134,7 @@ SELECT * FROM vw_getfoo; DROP VIEW vw_getfoo; DROP FUNCTION getfoo(int); CREATE FUNCTION getfoo(int) RETURNS setof foo AS 'SELECT * FROM foo WHERE fooid = $1;' LANGUAGE SQL; -SELECT * FROM getfoo(1) AS t1; +SELECT * FROM getfoo(1) AS t1 ORDER BY foosubid; fooid | foosubid | fooname -------+----------+--------- 1 | 1 | Joe @@ -142,7 +142,7 @@ SELECT * FROM getfoo(1) AS t1; (2 rows) CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1); -SELECT * FROM vw_getfoo; +SELECT * FROM vw_getfoo ORDER BY foosubid; fooid | foosubid | fooname -------+----------+--------- 1 | 1 | Joe @@ -171,7 +171,7 @@ SELECT * FROM vw_getfoo; DROP VIEW vw_getfoo; DROP FUNCTION getfoo(int); CREATE FUNCTION getfoo(int) RETURNS setof record AS 'SELECT * FROM foo WHERE fooid = $1;' LANGUAGE SQL; -SELECT * FROM getfoo(1) AS t1(fooid int, foosubid int, fooname text); +SELECT * FROM getfoo(1) AS t1(fooid int, foosubid int, fooname text) ORDER BY foosubid; fooid | foosubid | fooname -------+----------+--------- 1 | 1 | Joe @@ -180,7 +180,7 @@ SELECT * FROM getfoo(1) AS t1(fooid int, foosubid int, fooname text); CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1) AS (fooid int, foosubid int, fooname text); -SELECT * FROM vw_getfoo; +SELECT * FROM vw_getfoo ORDER BY foosubid; fooid | foosubid | fooname -------+----------+--------- 1 | 1 | Joe @@ -440,14 +440,14 @@ ERROR: cannot change return type of existing function HINT: Use DROP FUNCTION first. CREATE OR REPLACE FUNCTION foor(in f1 int, out f2 int, out text) AS $$select $1-1, $1::text || 'z'$$ LANGUAGE sql; -SELECT f1, foor(f1) FROM int4_tbl; +SELECT f1, foor(f1) FROM int4_tbl ORDER BY 1, 2; f1 | foor -------------+---------------------------- + -2147483647 | (-2147483648,-2147483647z) + -123456 | (-123457,-123456z) 0 | (-1,0z) 123456 | (123455,123456z) - -123456 | (-123457,-123456z) 2147483647 | (2147483646,2147483647z) - -2147483647 | (-2147483648,-2147483647z) (5 rows) SELECT * FROM foor(42); @@ -464,14 +464,14 @@ SELECT * FROM foor(42) AS p(a,b); CREATE OR REPLACE FUNCTION foob(in f1 int, inout f2 int, out text) AS $$select $2-1, $1::text || 'z'$$ LANGUAGE sql; -SELECT f1, foob(f1, f1/2) FROM int4_tbl; +SELECT f1, foob(f1, f1/2) FROM int4_tbl ORDER BY 1, 2; f1 | foob -------------+---------------------------- + -2147483647 | (-1073741824,-2147483647z) + -123456 | (-61729,-123456z) 0 | (-1,0z) 123456 | (61727,123456z) - -123456 | (-61729,-123456z) 2147483647 | (1073741822,2147483647z) - -2147483647 | (-1073741824,-2147483647z) (5 rows) SELECT * FROM foob(42, 99); @@ -536,7 +536,7 @@ DETAIL: A function returning a polymorphic type must have at least one polymorp CREATE OR REPLACE FUNCTION foo() RETURNS TABLE(a int) AS $$ SELECT a FROM generate_series(1,5) a(a) $$ LANGUAGE sql; -SELECT * FROM foo(); +SELECT * FROM foo() ORDER BY 1; a --- 1 @@ -552,7 +552,7 @@ RETURNS TABLE(a int, b int) AS $$ SELECT a, b FROM generate_series(1,$1) a(a), generate_series(1,$1) b(b) $$ LANGUAGE sql; -SELECT * FROM foo(3); +SELECT * FROM foo(3) ORDER BY 1, 2; a | b ---+--- 1 | 1 @@ -587,7 +587,7 @@ select insert_tt('bar'); 2 (1 row) -select * from tt; +select * from tt order by 1, 2; f1 | data ----+------ 1 | foo @@ -604,7 +604,7 @@ select insert_tt('fool'); 3 (1 row) -select * from tt; +select * from tt order by 1, 2; f1 | data ----+---------- 1 | foo @@ -624,14 +624,14 @@ select insert_tt2('foolish','barrish'); 6 (2 rows) -select * from insert_tt2('baz','quux'); +select * from insert_tt2('baz','quux') order by 1; insert_tt2 ------------ 7 8 (2 rows) -select * from tt; +select * from tt order by 1, 2; f1 | data ----+---------- 1 | foo @@ -651,7 +651,7 @@ select insert_tt2('foolish','barrish') limit 1; 9 (1 row) -select * from tt; +select * from tt order by 1, 2; f1 | data ----+---------- 1 | foo @@ -684,7 +684,7 @@ CONTEXT: SQL function "insert_tt2" statement 1 11 (1 row) -select * from tt; +select * from tt order by 1, 2; f1 | data ----+---------- 1 | foo @@ -715,7 +715,7 @@ CONTEXT: SQL function "insert_tt2" statement 1 13 (1 row) -select * from tt; +select * from tt order by 1, 2; f1 | data ----+---------- 1 | foo @@ -736,7 +736,7 @@ select * from tt; -- note that nextval() gets executed a second time in the rule expansion, -- which is expected. -select * from tt_log; +select * from tt_log order by 1, 2; f1 | data ----+--------- 15 | foollog @@ -776,7 +776,7 @@ select array_to_set(array['one', 'two']); (2,two) (2 rows) -select * from array_to_set(array['one', 'two']) as t(f1 int,f2 text); +select * from array_to_set(array['one', 'two']) as t(f1 int,f2 text) order by 1, 2; f1 | f2 ----+----- 1 | one @@ -818,7 +818,7 @@ select testfoo(); (3,4) (2 rows) -select * from testfoo() as t(f1 int8,f2 int8); +select * from testfoo() as t(f1 int8,f2 int8) order by 1, 2; f1 | f2 ----+---- 1 | 2 diff --git a/src/test/regress/expected/reltime.out b/src/test/regress/expected/reltime.out index 14fdc6aeec..bdc4ef1f4b 100644 --- a/src/test/regress/expected/reltime.out +++ b/src/test/regress/expected/reltime.out @@ -18,70 +18,70 @@ ERROR: invalid input syntax for type reltime: "@ 30 eons ago" LINE 1: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago'); ^ -- test reltime operators -SELECT '' AS six, * FROM RELTIME_TBL; +SELECT '' AS six, * FROM RELTIME_TBL ORDER BY f1; six | f1 -----+--------------- + | @ 14 secs ago | @ 1 min | @ 5 hours | @ 10 days - | @ 34 years | @ 3 mons - | @ 14 secs ago + | @ 34 years (6 rows) SELECT '' AS five, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 <> reltime '@ 10 days'; + WHERE RELTIME_TBL.f1 <> reltime '@ 10 days' ORDER BY f1; five | f1 ------+--------------- + | @ 14 secs ago | @ 1 min | @ 5 hours - | @ 34 years | @ 3 mons - | @ 14 secs ago + | @ 34 years (5 rows) SELECT '' AS three, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours'; + WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours' ORDER BY f1; three | f1 -------+--------------- + | @ 14 secs ago | @ 1 min | @ 5 hours - | @ 14 secs ago (3 rows) SELECT '' AS three, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 < reltime '@ 1 day'; + WHERE RELTIME_TBL.f1 < reltime '@ 1 day' ORDER BY f1; three | f1 -------+--------------- + | @ 14 secs ago | @ 1 min | @ 5 hours - | @ 14 secs ago (3 rows) SELECT '' AS one, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 = reltime '@ 34 years'; + WHERE RELTIME_TBL.f1 = reltime '@ 34 years' ORDER BY f1; one | f1 -----+------------ | @ 34 years (1 row) SELECT '' AS two, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 >= reltime '@ 1 month'; + WHERE RELTIME_TBL.f1 >= reltime '@ 1 month' ORDER BY f1; two | f1 -----+------------ - | @ 34 years | @ 3 mons + | @ 34 years (2 rows) SELECT '' AS five, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago'; + WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago' ORDER BY f1; five | f1 ------+------------ | @ 1 min | @ 5 hours | @ 10 days - | @ 34 years | @ 3 mons + | @ 34 years (5 rows) SELECT '' AS fifteen, r1.*, r2.* diff --git a/src/test/regress/expected/returning.out b/src/test/regress/expected/returning.out index b04f6f1a0e..0ffcea3026 100644 --- a/src/test/regress/expected/returning.out +++ b/src/test/regress/expected/returning.out @@ -14,7 +14,7 @@ INSERT INTO foo (f2,f3) 3 | MORE | 16 | 19 (3 rows) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 ----+------+---- 1 | test | 42 @@ -30,7 +30,7 @@ UPDATE foo SET f2 = lower(f2), f3 = DEFAULT RETURNING foo.*, f1+f3 AS sum13; 3 | more | 42 | 45 (3 rows) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 ----+------+---- 1 | test | 42 @@ -44,7 +44,7 @@ DELETE FROM foo WHERE f1 > 2 RETURNING f3, f2, f1, least(f1,f3); 42 | more | 3 | 3 (1 row) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 ----+------+---- 1 | test | 42 @@ -91,11 +91,11 @@ UPDATE foo SET f3 = f3*2 1 | test | 84 | 123456 (1 row) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 ----+------+---- - 2 | more | 42 1 | test | 84 + 2 | more | 42 (2 rows) DELETE FROM foo @@ -107,7 +107,7 @@ DELETE FROM foo 1 | test | 84 | 123456 (1 row) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 ----+------+---- 2 | more | 42 @@ -117,14 +117,14 @@ SELECT * FROM foo; CREATE TEMP TABLE foochild (fc int) INHERITS (foo); INSERT INTO foochild VALUES(123,'child',999,-123); ALTER TABLE foo ADD COLUMN f4 int8 DEFAULT 99; -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 | f4 -----+-------+-----+---- 2 | more | 42 | 99 123 | child | 999 | 99 (2 rows) -SELECT * FROM foochild; +SELECT * FROM foochild ORDER BY f1; f1 | f2 | f3 | fc | f4 -----+-------+-----+------+---- 123 | child | 999 | -123 | 99 @@ -137,14 +137,14 @@ UPDATE foo SET f4 = f4 + f3 WHERE f4 = 99 RETURNING *; 123 | child | 999 | 1098 (2 rows) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 | f4 -----+-------+-----+------ 2 | more | 42 | 141 123 | child | 999 | 1098 (2 rows) -SELECT * FROM foochild; +SELECT * FROM foochild ORDER BY f1; f1 | f2 | f3 | fc | f4 -----+-------+-----+------+------ 123 | child | 999 | -123 | 1098 @@ -159,14 +159,14 @@ UPDATE foo SET f3 = f3*2 123 | child | 1998 | 1098 | 4567890123456789 | 123 (1 row) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 | f4 -----+-------+------+------ 2 | more | 42 | 141 123 | child | 1998 | 1098 (2 rows) -SELECT * FROM foochild; +SELECT * FROM foochild ORDER BY f1; f1 | f2 | f3 | fc | f4 -----+-------+------+------+------ 123 | child | 1998 | -123 | 1098 @@ -181,13 +181,13 @@ DELETE FROM foo 123 | child | 1998 | 1098 | 4567890123456789 | 123 (1 row) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 | f4 ----+------+----+----- 2 | more | 42 | 141 (1 row) -SELECT * FROM foochild; +SELECT * FROM foochild ORDER BY f1; f1 | f2 | f3 | fc | f4 ----+----+----+----+---- (0 rows) @@ -217,7 +217,7 @@ INSERT INTO voo VALUES(14,'zoo2') RETURNING *; 14 | zoo2 (1 row) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 | f4 ----+------+----+----- 2 | more | 42 | 141 @@ -226,7 +226,7 @@ SELECT * FROM foo; 14 | zoo2 | 57 | 99 (4 rows) -SELECT * FROM voo; +SELECT * FROM voo ORDER BY f1; f1 | f2 ----+------ 2 | more @@ -245,7 +245,7 @@ update voo set f1 = f1 + 1 where f2 = 'zoo2' RETURNING *, f1*2; 16 | zoo2 | 32 (1 row) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 | f4 ----+------+----+----- 2 | more | 42 | 141 @@ -254,7 +254,7 @@ SELECT * FROM foo; 16 | zoo2 | 57 | 99 (4 rows) -SELECT * FROM voo; +SELECT * FROM voo ORDER BY f1; f1 | f2 ----+------ 2 | more @@ -273,14 +273,14 @@ DELETE FROM foo WHERE f2 = 'zit' RETURNING *; 11 | zit | 57 | 99 (1 row) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 | f4 ----+------+----+----- 2 | more | 42 | 141 16 | zoo2 | 57 | 99 (2 rows) -SELECT * FROM voo; +SELECT * FROM voo ORDER BY f1; f1 | f2 ----+------ 2 | more @@ -294,7 +294,7 @@ INSERT INTO joinme VALUES('zoo2', 54321); INSERT INTO joinme VALUES('other', 0); CREATE TEMP VIEW joinview AS SELECT foo.*, other FROM foo JOIN joinme ON (f2 = f2j); -SELECT * FROM joinview; +SELECT * FROM joinview ORDER BY f1; f1 | f2 | f3 | f4 | other ----+------+----+-----+------- 2 | more | 42 | 141 | 12345 @@ -311,21 +311,21 @@ UPDATE joinview SET f1 = f1 + 1 WHERE f3 = 57 RETURNING *, other + 1; 17 | zoo2 | 57 | 99 | 54321 | 54322 (1 row) -SELECT * FROM joinview; +SELECT * FROM joinview ORDER BY f1; f1 | f2 | f3 | f4 | other ----+------+----+-----+------- 2 | more | 42 | 141 | 12345 17 | zoo2 | 57 | 99 | 54321 (2 rows) -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; f1 | f2 | f3 | f4 ----+------+----+----- 2 | more | 42 | 141 17 | zoo2 | 57 | 99 (2 rows) -SELECT * FROM voo; +SELECT * FROM voo ORDER BY f1; f1 | f2 ----+------ 2 | more diff --git a/src/test/regress/expected/rowtypes.out b/src/test/regress/expected/rowtypes.out index e1181a61b8..10fe5672ea 100644 --- a/src/test/regress/expected/rowtypes.out +++ b/src/test/regress/expected/rowtypes.out @@ -56,7 +56,7 @@ DETAIL: Too many columns. create temp table quadtable(f1 int, q quad); insert into quadtable values (1, ((3.3,4.4),(5.5,6.6))); insert into quadtable values (2, ((null,4.4),(5.5,6.6))); -select * from quadtable; +select * from quadtable order by f1, q; f1 | q ----+--------------------------- 1 | ("(3.3,4.4)","(5.5,6.6)") @@ -70,7 +70,7 @@ ERROR: missing FROM-clause entry for table "q" LINE 1: select f1, q.c1 from quadtable; ^ rollback; -select f1, (q).c1, (qq.q).c1.i from quadtable qq; +select f1, (q).c1, (qq.q).c1.i from quadtable qq order by 1; f1 | c1 | i ----+-----------+----- 1 | (3.3,4.4) | 4.4 @@ -105,7 +105,7 @@ select * from people; (1 row) insert into quadtable (f1, q.c1.r, q.c2.i) values(44,55,66); -select * from quadtable; +select * from quadtable order by f1, q; f1 | q ----+--------------------------- 1 | ("(3.3,4.4)","(5.5,6.6)") @@ -119,11 +119,11 @@ select * from quadtable; create temp table pp (f1 text); insert into pp values (repeat('abcdefghijkl', 100000)); insert into people select ('Jim', f1, null)::fullname, current_date from pp; -select (fn).first, substr((fn).last, 1, 20), length((fn).last) from people; +select (fn).first, substr((fn).last, 1, 20), length((fn).last) from people order by 1, 2; first | substr | length -------+----------------------+--------- - Joe | Blow | 4 Jim | abcdefghijklabcdefgh | 1200000 + Joe | Blow | 4 (2 rows) -- Test row comparison semantics. Prior to PG 8.2 we did this in a totally diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 2667a13e44..4322920430 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -142,7 +142,7 @@ insert into rtest_t3 values (5, 35); -- insert values insert into rtest_v1 values (1, 11); insert into rtest_v1 values (2, 12); -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 11 @@ -151,7 +151,7 @@ select * from rtest_v1; -- delete with constant expression delete from rtest_v1 where a = 1; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 2 | 12 @@ -159,7 +159,7 @@ select * from rtest_v1; insert into rtest_v1 values (1, 11); delete from rtest_v1 where b = 12; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 11 @@ -167,7 +167,7 @@ select * from rtest_v1; insert into rtest_v1 values (2, 12); insert into rtest_v1 values (2, 13); -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 11 @@ -184,7 +184,7 @@ select * from rtest_v1; ** So this time both rows with a = 2 must get deleted \r delete from rtest_v1 where b = 12; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 11 @@ -193,7 +193,7 @@ select * from rtest_v1; delete from rtest_v1; -- insert select insert into rtest_v1 select * from rtest_t2; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 21 @@ -204,7 +204,7 @@ select * from rtest_v1; delete from rtest_v1; -- same with swapped targetlist insert into rtest_v1 (b, a) select b, a from rtest_t2; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 21 @@ -214,20 +214,20 @@ select * from rtest_v1; -- now with only one target attribute insert into rtest_v1 (a) select a from rtest_t3; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 21 - 2 | 22 - 3 | 23 1 | + 2 | 22 2 | + 3 | 23 3 | 4 | 5 | (8 rows) -select * from rtest_v1 where b isnull; +select * from rtest_v1 where b isnull order by a, b; a | b ---+--- 1 | @@ -240,7 +240,7 @@ select * from rtest_v1 where b isnull; -- let attribute a differ (must be done on rtest_t1 - see above) update rtest_t1 set a = a + 10 where b isnull; delete from rtest_v1 where b isnull; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 21 @@ -250,29 +250,29 @@ select * from rtest_v1; -- now updates with constant expression update rtest_v1 set b = 42 where a = 2; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 21 - 3 | 23 2 | 42 + 3 | 23 (3 rows) update rtest_v1 set b = 99 where b = 42; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 21 - 3 | 23 2 | 99 + 3 | 23 (3 rows) update rtest_v1 set b = 88 where b < 50; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- - 2 | 99 1 | 88 + 2 | 99 3 | 88 (3 rows) @@ -280,7 +280,7 @@ delete from rtest_v1; insert into rtest_v1 select rtest_t2.a, rtest_t3.b from rtest_t2, rtest_t3 where rtest_t2.a = rtest_t3.a; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 31 @@ -290,7 +290,7 @@ select * from rtest_v1; -- updates in a mergejoin update rtest_v1 set b = rtest_t2.b from rtest_t2 where rtest_v1.a = rtest_t2.a; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 21 @@ -299,21 +299,21 @@ select * from rtest_v1; (3 rows) insert into rtest_v1 select * from rtest_t3; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ---+---- 1 | 21 - 2 | 22 - 3 | 23 1 | 31 + 2 | 22 2 | 32 + 3 | 23 3 | 33 4 | 34 5 | 35 (8 rows) update rtest_t1 set a = a + 10 where b > 30; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ----+---- 1 | 21 @@ -327,7 +327,7 @@ select * from rtest_v1; (8 rows) update rtest_v1 set a = rtest_t3.a + 20 from rtest_t3 where rtest_v1.b = rtest_t3.b; -select * from rtest_v1; +select * from rtest_v1 order by a, b; a | b ----+---- 1 | 21 @@ -356,21 +356,21 @@ insert into rtest_admin values ('jw', 'orion'); insert into rtest_admin values ('jw', 'notjw'); insert into rtest_admin values ('bm', 'neptun'); update rtest_system set sysname = 'pluto' where sysname = 'neptun'; -select * from rtest_interface; +select * from rtest_interface order by sysname, ifname; sysname | ifname ---------+-------- + notjw | eth0 orion | eth0 orion | eth1 - notjw | eth0 pluto | eth0 (4 rows) -select * from rtest_admin; +select * from rtest_admin order by pname, sysname; pname | sysname -------+--------- - jw | orion - jw | notjw bm | pluto + jw | notjw + jw | orion (3 rows) update rtest_person set pname = 'jwieck' where pdesc = 'Jan Wieck'; @@ -386,14 +386,14 @@ select * from rtest_admin order by pname, sysname; (3 rows) delete from rtest_system where sysname = 'orion'; -select * from rtest_interface; +select * from rtest_interface order by sysname, ifname; sysname | ifname ---------+-------- notjw | eth0 pluto | eth0 (2 rows) -select * from rtest_admin; +select * from rtest_admin order by pname, sysname; pname | sysname --------+--------- bm | pluto @@ -487,7 +487,7 @@ insert into rtest_t4 values (26, 'Record should go to rtest_t4 and t8'); insert into rtest_t4 values (28, 'Record should go to rtest_t4 and t8'); insert into rtest_t4 values (30, 'Record should go to rtest_t4'); insert into rtest_t4 values (40, 'Record should go to rtest_t4'); -select * from rtest_t4; +select * from rtest_t4 order by a, b; a | b ----+------------------------------------- 1 | Record should go to rtest_t4 @@ -499,7 +499,7 @@ select * from rtest_t4; 40 | Record should go to rtest_t4 (7 rows) -select * from rtest_t5; +select * from rtest_t5 order by a, b; a | b ----+------------------------------------- 10 | Record should go to rtest_t5 @@ -507,19 +507,19 @@ select * from rtest_t5; 19 | Record should go to rtest_t5 and t7 (3 rows) -select * from rtest_t6; +select * from rtest_t6 order by a, b; a | b ----+------------------------------------- 20 | Record should go to rtest_t4 and t6 (1 row) -select * from rtest_t7; +select * from rtest_t7 order by a, b; a | b ----+------------------------------------- 19 | Record should go to rtest_t5 and t7 (1 row) -select * from rtest_t8; +select * from rtest_t8 order by a, b; a | b ----+------------------------------------- 26 | Record should go to rtest_t4 and t8 @@ -542,14 +542,14 @@ insert into rtest_t9 values (28, 'Record should go to rtest_t4 and t8'); insert into rtest_t9 values (30, 'Record should go to rtest_t4'); insert into rtest_t9 values (40, 'Record should go to rtest_t4'); insert into rtest_t4 select * from rtest_t9 where a < 20; -select * from rtest_t4; +select * from rtest_t4 order by a, b; a | b ---+------------------------------ 1 | Record should go to rtest_t4 2 | Record should go to rtest_t4 (2 rows) -select * from rtest_t5; +select * from rtest_t5 order by a, b; a | b ----+------------------------------------- 10 | Record should go to rtest_t5 @@ -557,24 +557,24 @@ select * from rtest_t5; 19 | Record should go to rtest_t5 and t7 (3 rows) -select * from rtest_t6; +select * from rtest_t6 order by a, b; a | b ---+--- (0 rows) -select * from rtest_t7; +select * from rtest_t7 order by a, b; a | b ----+------------------------------------- 19 | Record should go to rtest_t5 and t7 (1 row) -select * from rtest_t8; +select * from rtest_t8 order by a, b; a | b ---+--- (0 rows) insert into rtest_t4 select * from rtest_t9 where b ~ 'and t8'; -select * from rtest_t4; +select * from rtest_t4 order by a, b; a | b ----+------------------------------------- 1 | Record should go to rtest_t4 @@ -583,7 +583,7 @@ select * from rtest_t4; 28 | Record should go to rtest_t4 and t8 (4 rows) -select * from rtest_t5; +select * from rtest_t5 order by a, b; a | b ----+------------------------------------- 10 | Record should go to rtest_t5 @@ -591,18 +591,18 @@ select * from rtest_t5; 19 | Record should go to rtest_t5 and t7 (3 rows) -select * from rtest_t6; +select * from rtest_t6 order by a, b; a | b ---+--- (0 rows) -select * from rtest_t7; +select * from rtest_t7 order by a, b; a | b ----+------------------------------------- 19 | Record should go to rtest_t5 and t7 (1 row) -select * from rtest_t8; +select * from rtest_t8 order by a, b; a | b ----+------------------------------------- 26 | Record should go to rtest_t4 and t8 @@ -610,19 +610,19 @@ select * from rtest_t8; (2 rows) insert into rtest_t4 select a + 1, b from rtest_t9 where a in (20, 30, 40); -select * from rtest_t4; +select * from rtest_t4 order by a, b; a | b ----+------------------------------------- 1 | Record should go to rtest_t4 2 | Record should go to rtest_t4 + 21 | Record should go to rtest_t4 and t6 26 | Record should go to rtest_t4 and t8 28 | Record should go to rtest_t4 and t8 - 21 | Record should go to rtest_t4 and t6 31 | Record should go to rtest_t4 41 | Record should go to rtest_t4 (7 rows) -select * from rtest_t5; +select * from rtest_t5 order by a, b; a | b ----+------------------------------------- 10 | Record should go to rtest_t5 @@ -630,19 +630,19 @@ select * from rtest_t5; 19 | Record should go to rtest_t5 and t7 (3 rows) -select * from rtest_t6; +select * from rtest_t6 order by a, b; a | b ----+------------------------------------- 21 | Record should go to rtest_t4 and t6 (1 row) -select * from rtest_t7; +select * from rtest_t7 order by a, b; a | b ----+------------------------------------- 19 | Record should go to rtest_t5 and t7 (1 row) -select * from rtest_t8; +select * from rtest_t8 order by a, b; a | b ----+------------------------------------- 26 | Record should go to rtest_t4 and t8 @@ -653,7 +653,7 @@ select * from rtest_t8; -- Check that the ordering of rules fired is correct -- insert into rtest_order1 values (1); -select * from rtest_order2; +select * from rtest_order2 order by a, b, c; a | b | c ---+---+------------------------------ 1 | 1 | rule 1 - this should run 1st @@ -676,7 +676,7 @@ insert into rtest_nothn1 values (39, 'don''t want this'); insert into rtest_nothn1 values (40, 'want this'); insert into rtest_nothn1 values (50, 'want this'); insert into rtest_nothn1 values (60, 'want this'); -select * from rtest_nothn1; +select * from rtest_nothn1 order by a, b; a | b ----+----------- 1 | want this @@ -692,12 +692,12 @@ insert into rtest_nothn2 values (10, 'too small'); insert into rtest_nothn2 values (50, 'too small'); insert into rtest_nothn2 values (100, 'OK'); insert into rtest_nothn2 values (200, 'OK'); -select * from rtest_nothn2; +select * from rtest_nothn2 order by a, b; a | b ---+--- (0 rows) -select * from rtest_nothn3; +select * from rtest_nothn3 order by a, b; a | b -----+---- 100 | OK @@ -719,7 +719,7 @@ insert into rtest_nothn4 values (40, 'want this'); insert into rtest_nothn4 values (50, 'want this'); insert into rtest_nothn4 values (60, 'want this'); insert into rtest_nothn1 select * from rtest_nothn4; -select * from rtest_nothn1; +select * from rtest_nothn1 order by a, b; a | b ----+----------- 1 | want this @@ -737,12 +737,12 @@ insert into rtest_nothn4 values (50, 'too small'); insert into rtest_nothn4 values (100, 'OK'); insert into rtest_nothn4 values (200, 'OK'); insert into rtest_nothn2 select * from rtest_nothn4; -select * from rtest_nothn2; +select * from rtest_nothn2 order by a, b; a | b ---+--- (0 rows) -select * from rtest_nothn3; +select * from rtest_nothn3 order by a, b; a | b -----+---- 100 | OK @@ -783,7 +783,7 @@ insert into rtest_view2 values (7); insert into rtest_view2 values (7); insert into rtest_view2 values (7); insert into rtest_view2 values (7); -select * from rtest_vview1; +select * from rtest_vview1 order by a, b; a | b ---+-------- 2 | item 2 @@ -792,7 +792,7 @@ select * from rtest_vview1; 7 | item 7 (4 rows) -select * from rtest_vview2; +select * from rtest_vview2 order by a, b; a | b ---+-------- 1 | item 1 @@ -803,7 +803,7 @@ select * from rtest_vview2; 8 | item 8 (6 rows) -select * from rtest_vview3; +select * from rtest_vview3 order by a, b; a | b ---+-------- 2 | item 2 @@ -820,7 +820,7 @@ select * from rtest_vview4 order by a, b; 7 | item 7 | 4 (4 rows) -select * from rtest_vview5; +select * from rtest_vview5 order by a, b; a | b | refcount ---+--------+---------- 1 | item 1 | 0 @@ -834,7 +834,7 @@ select * from rtest_vview5; (8 rows) insert into rtest_view3 select * from rtest_vview1 where a < 7; -select * from rtest_view3; +select * from rtest_view3 order by a, b; a | b ---+-------- 2 | item 2 @@ -844,7 +844,7 @@ select * from rtest_view3; delete from rtest_view3; insert into rtest_view3 select * from rtest_vview2 where a != 5 and b !~ '2'; -select * from rtest_view3; +select * from rtest_view3 order by a, b; a | b ---+-------- 1 | item 1 @@ -855,7 +855,7 @@ select * from rtest_view3; delete from rtest_view3; insert into rtest_view3 select * from rtest_vview3; -select * from rtest_view3; +select * from rtest_view3 order by a, b; a | b ---+-------- 2 | item 2 @@ -875,7 +875,7 @@ select * from rtest_view4 order by a, b; delete from rtest_view4; insert into rtest_view4 select * from rtest_vview5 where a > 2 and refcount = 0; -select * from rtest_view4; +select * from rtest_view4 order by a, b; a | b | c ---+--------+--- 3 | item 3 | 0 @@ -1177,7 +1177,7 @@ create rule foorule as on insert to foo where f1 < 100 do instead nothing; insert into foo values(1); insert into foo values(1001); -select * from foo; +select * from foo order by f1; f1 ------ 1001 @@ -1195,14 +1195,14 @@ create rule foorule as on insert to foo where f1 < 100 do instead insert into foo2 values (new.f1); insert into foo values(2); insert into foo values(100); -select * from foo; +select * from foo order by f1; f1 ------ - 1001 100 + 1001 (2 rows) -select * from foo2; +select * from foo2 order by f1; f1 ---- 2 @@ -1230,7 +1230,7 @@ create rule rrule as select old.pid, new.descrip where old.descrip isnull; update cchild set descrip = new.descrip where cchild.pid = old.pid; ); -select * from vview; +select * from vview order by pid; pid | txt | descrip -----+---------+---------- 1 | parent1 | descrip1 @@ -1238,7 +1238,7 @@ select * from vview; (2 rows) update vview set descrip='test1' where pid=1; -select * from vview; +select * from vview order by pid; pid | txt | descrip -----+---------+--------- 1 | parent1 | test1 @@ -1246,7 +1246,7 @@ select * from vview; (2 rows) update vview set descrip='test2' where pid=2; -select * from vview; +select * from vview order by pid; pid | txt | descrip -----+---------+--------- 1 | parent1 | test1 @@ -1254,14 +1254,14 @@ select * from vview; (2 rows) update vview set descrip='test3' where pid=3; -select * from vview; +select * from vview order by pid; pid | txt | descrip -----+---------+--------- 1 | parent1 | test1 2 | parent2 | test2 (2 rows) -select * from cchild; +select * from cchild order by pid; pid | descrip -----+--------- 1 | test1 @@ -1377,7 +1377,7 @@ INSERT INTO ruletest_tbl VALUES (99, 99); CREATE OR REPLACE RULE myrule AS ON INSERT TO ruletest_tbl DO INSTEAD INSERT INTO ruletest_tbl2 VALUES (1000, 1000); INSERT INTO ruletest_tbl VALUES (99, 99); -SELECT * FROM ruletest_tbl2; +SELECT * FROM ruletest_tbl2 ORDER BY a; a | b ------+------ 10 | 10 @@ -1468,7 +1468,7 @@ insert into test_3 (name) values ('Test 6'); create view id_ordered as select * from id order by id; create rule update_id_ordered as on update to id_ordered do instead update id set name = new.name where id = old.id; -select * from id_ordered; +select * from id_ordered order by id; id | name ----+-------- 1 | Test 1 @@ -1482,7 +1482,7 @@ select * from id_ordered; update id_ordered set name = 'update 2' where id = 2; update id_ordered set name = 'update 4' where id = 4; update id_ordered set name = 'update 5' where id = 5; -select * from id_ordered; +select * from id_ordered order by id; id | name ----+---------- 1 | Test 1 @@ -1523,22 +1523,22 @@ create rule t1_upd_2 as on update to t1 set constraint_exclusion = on; insert into t1 select * from generate_series(5,19,1) g; update t1 set a = 4 where a = 5; -select * from only t1; +select * from only t1 order by 1; a --- (0 rows) -select * from only t1_1; +select * from only t1_1 order by 1; a --- + 4 6 7 8 9 - 4 (5 rows) -select * from only t1_2; +select * from only t1_2 order by 1; a ---- 10 diff --git a/src/test/regress/expected/select.out b/src/test/regress/expected/select.out index 47c3e67b23..0b73a1ea86 100644 --- a/src/test/regress/expected/select.out +++ b/src/test/regress/expected/select.out @@ -219,7 +219,7 @@ SET enable_sort TO off; -- -- awk '{if($1<10){print $0;}else{next;}}' onek.data | sort +0n -1 -- -SELECT onek2.* FROM onek2 WHERE onek2.unique1 < 10; +SELECT onek2.* FROM onek2 WHERE onek2.unique1 < 10 ORDER BY unique1; unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4 ---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+--------- 0 | 998 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | AAAAAA | KMBAAA | OOOOxx @@ -268,7 +268,8 @@ SELECT onek2.unique1, onek2.stringu1 FROM onek2 -- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 -- SELECT onek2.unique1, onek2.stringu1 FROM onek2 - WHERE onek2.unique1 > 980; + WHERE onek2.unique1 > 980 + ORDER BY unique1 using <; unique1 | stringu1 ---------+---------- 981 | TLAAAA @@ -305,67 +306,68 @@ SELECT two, stringu1, ten, string4 -- awk 'BEGIN{FS=" ";}{if(NF!=2){print $4,$5;}else{print;}}' - stud_emp.data -- -- SELECT name, age FROM person*; ??? check if different -SELECT p.name, p.age FROM person* p; +SELECT p.name, p.age FROM person* p + ORDER BY p.name, p.age; name | age ---------+----- - mike | 40 - joe | 20 - sally | 34 - sandra | 19 alex | 30 - sue | 50 + belinda | 38 + bertha | 88 + bill | 20 + carina | 58 + carmen | 78 + chris | 78 + cim | 30 denise | 24 - sarah | 88 - teresa | 38 - nan | 28 - leah | 68 - wendy | 78 - melissa | 28 - joan | 18 - mary | 8 + diane | 18 + edna | 18 + esther | 98 + fanny | 8 + fred | 28 + gina | 18 jane | 58 - liza | 38 jean | 28 + jeff | 23 jenifer | 38 + joan | 18 + joe | 20 juanita | 58 - susan | 78 - zena | 98 - martie | 88 - chris | 78 - pat | 18 - zola | 58 - louise | 98 - edna | 18 - bertha | 88 - sumi | 38 - koko | 88 - gina | 18 - rean | 48 - sharon | 78 - paula | 68 julie | 68 - belinda | 38 karen | 48 - carina | 58 - diane | 18 - esther | 98 - trudy | 88 - fanny | 8 - carmen | 78 + koko | 88 + larry | 60 + leah | 68 + linda | 19 lita | 25 + liza | 38 + louise | 98 + martie | 88 + mary | 8 + melissa | 28 + mike | 40 + nan | 28 pamela | 48 + pat | 18 + paula | 68 + rean | 48 + sally | 34 + sam | 30 + sandra | 19 sandy | 38 + sarah | 88 + sharon | 25 + sharon | 78 + sue | 50 + sumi | 38 + susan | 78 + teresa | 38 trisha | 88 + trudy | 88 uma | 78 velma | 68 - sharon | 25 - sam | 30 - bill | 20 - fred | 28 - larry | 60 - jeff | 23 - cim | 30 - linda | 19 + wendy | 78 + zena | 98 + zola | 58 (58 rows) -- @@ -463,7 +465,8 @@ select foo from (select 'xyzzy',1,null) as foo; -- Test VALUES lists -- select * from onek, (values(147, 'RFAAAA'), (931, 'VJAAAA')) as v (i, j) - WHERE onek.unique1 = v.i and onek.stringu1 = v.j; + WHERE onek.unique1 = v.i and onek.stringu1 = v.j + ORDER BY unique1; unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4 | i | j ---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------+-----+-------- 147 | 0 | 1 | 3 | 7 | 7 | 7 | 47 | 147 | 147 | 147 | 14 | 15 | RFAAAA | AAAAAA | AAAAxx | 147 | RFAAAA @@ -476,7 +479,8 @@ select * from onek, (values ((select i from (values(10000), (2), (389), (1000), (2000), ((select 10029))) as foo(i) order by i asc limit 1))) bar (i) - where onek.unique1 = bar.i; + where onek.unique1 = bar.i + ORDER BY unique1; unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4 | i ---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------+--- 2 | 326 | 0 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 4 | 5 | CAAAAA | OMAAAA | OOOOxx | 2 @@ -506,18 +510,19 @@ VALUES (1,2), (3,4+4), (7,77.7) UNION ALL SELECT 2+2, 57 UNION ALL -TABLE int8_tbl; +TABLE int8_tbl +ORDER BY column1,column2; column1 | column2 ------------------+------------------- 1 | 2 3 | 8 - 7 | 77.7 4 | 57 + 7 | 77.7 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (9 rows) -- @@ -749,12 +754,12 @@ SELECT 1 AS x ORDER BY x; -- But ORDER BY on a set-valued expression does create function sillysrf(int) returns setof int as 'values (1),(10),(2),($1)' language sql immutable; -select sillysrf(42); +select sillysrf(42) order by 1; sillysrf ---------- 1 - 10 2 + 10 42 (4 rows) diff --git a/src/test/regress/expected/select_distinct.out b/src/test/regress/expected/select_distinct.out index 3b5200b17a..8a7014ec8b 100644 --- a/src/test/regress/expected/select_distinct.out +++ b/src/test/regress/expected/select_distinct.out @@ -134,7 +134,7 @@ INSERT INTO DISTTABLE VALUES(2); INSERT INTO DISTTABLE VALUES(3); INSERT INTO DISTTABLE VALUES(NULL); -- basic cases -SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable; +SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable ORDER BY f1; f1 | not 2 ----+------- 1 | t @@ -143,7 +143,7 @@ SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable; | t (4 rows) -SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable; +SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable ORDER BY f1; f1 | not null ----+---------- 1 | t @@ -152,7 +152,7 @@ SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable; | f (4 rows) -SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable; +SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable ORDER BY f1; f1 | false ----+------- 1 | f @@ -161,7 +161,7 @@ SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable; | f (4 rows) -SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable; +SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable ORDER BY f1; f1 | not null ----+---------- 1 | t diff --git a/src/test/regress/expected/select_implicit.out b/src/test/regress/expected/select_implicit.out index 14fcd1c2b5..63193f0036 100644 --- a/src/test/regress/expected/select_implicit.out +++ b/src/test/regress/expected/select_implicit.out @@ -69,19 +69,19 @@ SELECT test_missing_target.b, count(*) (4 rows) -- w/o existing GROUP BY target -SELECT c FROM test_missing_target ORDER BY a; +SELECT c FROM test_missing_target ORDER BY c; c ---------- - XXXX ABAB ABAB BBBB BBBB + CCCC + CCCC + XXXX bbbb cccc cccc - CCCC - CCCC (10 rows) -- w/o existing ORDER BY target @@ -206,7 +206,7 @@ SELECT count(*) INTO TABLE test_missing_target2 FROM test_missing_target x, test_missing_target y WHERE x.a = y.a GROUP BY x.b ORDER BY x.b; -SELECT * FROM test_missing_target2; +SELECT * FROM test_missing_target2 ORDER BY 1; count ------- 1 @@ -322,12 +322,12 @@ SELECT count(x.b) INTO TABLE test_missing_target3 FROM test_missing_target x, test_missing_target y WHERE x.a = y.a GROUP BY x.b/2 ORDER BY x.b/2; -SELECT * FROM test_missing_target3; +SELECT * FROM test_missing_target3 ORDER BY 1; count ------- 1 - 5 4 + 5 (3 rows) -- Cleanup diff --git a/src/test/regress/expected/select_views.out b/src/test/regress/expected/select_views.out index 6cd317c869..6df0b67c5b 100644 --- a/src/test/regress/expected/select_views.out +++ b/src/test/regress/expected/select_views.out @@ -2,9 +2,22 @@ -- SELECT_VIEWS -- test the views defined in CREATE_VIEWS -- -SELECT * FROM street; +SELECT * FROM street ORDER BY 1,3; name | thepath | cname ------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------- + 100th Ave | [(-122.1657,37.429),(-122.1647,37.432)] | Oakland + 107th Ave | [(-122.1555,37.403),(-122.1531,37.41)] | Oakland + 14th St | [(-122.299,37.147),(-122.3,37.148)] | Lafayette + 19th Ave | [(-122.2366,37.897),(-122.2359,37.905)] | Berkeley + 1st St | [(-121.75508,37.89294),(-121.753581,37.90031)] | Oakland + 5th St | [(-122.296,37.615),(-122.2953,37.598)] | Berkeley + 5th St | [(-122.278,37),(-122.2792,37.005),(-122.2803,37.009)] | Lafayette + 82nd Ave | [(-122.1695,37.596),(-122.1681,37.603)] | Berkeley + 85th Ave | [(-122.1877,37.466),(-122.186,37.476)] | Oakland + 89th Ave | [(-122.1822,37.459),(-122.1803,37.471)] | Oakland + 98th Ave | [(-122.2001,37.258),(-122.1974,37.27)] | Lafayette + 98th Ave | [(-122.1568,37.498),(-122.1558,37.502)] | Oakland + 98th Ave | [(-122.1693,37.438),(-122.1682,37.444)] | Oakland Access Rd 25 | [(-121.9283,37.894),(-121.9283,37.9)] | Oakland Ada St | [(-122.2487,37.398),(-122.2496,37.401)] | Lafayette Agua Fria Creek | [(-121.9254,37.922),(-121.9281,37.889)] | Oakland @@ -22,24 +35,24 @@ SELECT * FROM street; Arroyo Las Positas | [(-121.7973,37.997),(-121.7957,37.005)] | Oakland Arroyo Seco | [(-121.7073,37.766),(-121.6997,37.729)] | Oakland Ash St | [(-122.0408,37.31),(-122.04,37.292)] | Oakland - Avenue 134th | [(-122.1823,37.002),(-122.1851,37.992)] | Oakland Avenue 134th | [(-122.1823,37.002),(-122.1851,37.992)] | Berkeley - Avenue 140th | [(-122.1656,37.003),(-122.1691,37.988)] | Oakland + Avenue 134th | [(-122.1823,37.002),(-122.1851,37.992)] | Oakland Avenue 140th | [(-122.1656,37.003),(-122.1691,37.988)] | Berkeley + Avenue 140th | [(-122.1656,37.003),(-122.1691,37.988)] | Oakland Avenue D | [(-122.298,37.848),(-122.3024,37.849)] | Berkeley B St | [(-122.1749,37.451),(-122.1743,37.443)] | Oakland - Bancroft Ave | [(-122.15714,37.4242),(-122.156,37.409)] | Oakland Bancroft Ave | [(-122.1643,37.523),(-122.1631,37.508),(-122.1621,37.493)] | Oakland - Birch St | [(-122.1617,37.425),(-122.1614,37.417)] | Oakland + Bancroft Ave | [(-122.15714,37.4242),(-122.156,37.409)] | Oakland Birch St | [(-122.1673,37.509),(-122.1661,37.492)] | Oakland + Birch St | [(-122.1617,37.425),(-122.1614,37.417)] | Oakland Blacow Road | [(-122.0179,37.469),(-122.0167,37.465)] | Oakland Bridgepointe Dr | [(-122.0514,37.305),(-122.0509,37.299)] | Oakland Broadmore Ave | [(-122.095,37.522),(-122.0936,37.497)] | Oakland Broadway | [(-122.2409,37.586),(-122.2395,37.601)] | Berkeley Buckingham Blvd | [(-122.2231,37.59),(-122.2214,37.606)] | Berkeley + Butterfield Dr | [(-122.0838,37.002),(-122.0834,37.987)] | Berkeley Butterfield Dr | [(-122.0838,37.002),(-122.0834,37.987)] | Oakland Butterfield Dr | [(-122.0838,37.002),(-122.0834,37.987)] | Oakland - Butterfield Dr | [(-122.0838,37.002),(-122.0834,37.987)] | Berkeley C St | [(-122.1768,37.46),(-122.1749,37.435)] | Oakland Calaveras Creek | [(-121.8203,37.035),(-121.8207,37.931)] | Oakland Calaveras Creek | [(-121.8203,37.035),(-121.8207,37.931)] | Oakland @@ -60,11 +73,11 @@ SELECT * FROM street; Chapman Dr | [(-122.0421,37.504),(-122.0414,37.498)] | Oakland Charles St | [(-122.0255,37.505),(-122.0252,37.499)] | Oakland Cherry St | [(-122.0437,37.42),(-122.0434,37.413)] | Oakland + Claremont Pl | [(-122.0542,37.995),(-122.0542,37.008)] | Berkeley Claremont Pl | [(-122.0542,37.995),(-122.0542,37.008)] | Oakland Claremont Pl | [(-122.0542,37.995),(-122.0542,37.008)] | Oakland - Claremont Pl | [(-122.0542,37.995),(-122.0542,37.008)] | Berkeley - Coliseum Way | [(-122.2001,37.47),(-122.1978,37.516)] | Oakland Coliseum Way | [(-122.2113,37.626),(-122.2085,37.592),(-122.2063,37.568)] | Berkeley + Coliseum Way | [(-122.2001,37.47),(-122.1978,37.516)] | Oakland Coolidge Ave | [(-122.2007,37.058),(-122.1992,37.06)] | Lafayette Cornell Ave | [(-122.2956,37.925),(-122.2949,37.906),(-122.2939,37.875)] | Berkeley Corriea Way | [(-121.9501,37.402),(-121.9505,37.398)] | Oakland @@ -77,9 +90,9 @@ SELECT * FROM street; Cull Canyon Road | [(-122.0536,37.435),(-122.0499,37.315)] | Oakland Cull Creek | [(-122.0624,37.875),(-122.0582,37.527)] | Berkeley D St | [(-122.1811,37.505),(-122.1805,37.497)] | Oakland + Decoto Road | [(-122.0159,37.006),(-122.016,37.002),(-122.0164,37.993)] | Berkeley Decoto Road | [(-122.0159,37.006),(-122.016,37.002),(-122.0164,37.993)] | Oakland Decoto Road | [(-122.0159,37.006),(-122.016,37.002),(-122.0164,37.993)] | Oakland - Decoto Road | [(-122.0159,37.006),(-122.016,37.002),(-122.0164,37.993)] | Berkeley Deering St | [(-122.2146,37.904),(-122.2126,37.897)] | Berkeley Dimond Ave | [(-122.2167,37.994),(-122.2162,37.006)] | Berkeley Dimond Ave | [(-122.2167,37.994),(-122.2162,37.006)] | Lafayette @@ -89,9 +102,9 @@ SELECT * FROM street; Driscoll Road | [(-121.9482,37.403),(-121.948451,37.39995)] | Oakland E St | [(-122.1832,37.505),(-122.1826,37.498),(-122.182,37.49)] | Oakland Eden Ave | [(-122.1143,37.505),(-122.1142,37.491)] | Oakland + Eden Creek | [(-122.022037,37.00675),(-122.0221,37.998)] | Berkeley Eden Creek | [(-122.022037,37.00675),(-122.0221,37.998)] | Oakland Eden Creek | [(-122.022037,37.00675),(-122.0221,37.998)] | Oakland - Eden Creek | [(-122.022037,37.00675),(-122.0221,37.998)] | Berkeley Edgewater Dr | [(-122.201,37.379),(-122.2042,37.41)] | Lafayette Enos Way | [(-121.7677,37.896),(-121.7673,37.91)] | Oakland Euclid Ave | [(-122.2671,37.009),(-122.2666,37.987)] | Berkeley @@ -106,90 +119,90 @@ SELECT * FROM street; Harris Road | [(-122.0659,37.372),(-122.0675,37.363)] | Oakland Heartwood Dr | [(-122.2006,37.341),(-122.1992,37.338)] | Lafayette Hegenberger Exwy | [(-122.1946,37.52),(-122.1947,37.497)] | Oakland - Herrier St | [(-122.1943,37.006),(-122.1936,37.998)] | Oakland Herrier St | [(-122.1943,37.006),(-122.1936,37.998)] | Berkeley + Herrier St | [(-122.1943,37.006),(-122.1936,37.998)] | Oakland + Hesperian Blvd | [(-122.1132,37.6),(-122.1123,37.586)] | Berkeley Hesperian Blvd | [(-122.097,37.333),(-122.0956,37.31),(-122.0946,37.293)] | Oakland Hesperian Blvd | [(-122.097,37.333),(-122.0956,37.31),(-122.0946,37.293)] | Oakland - Hesperian Blvd | [(-122.1132,37.6),(-122.1123,37.586)] | Berkeley Hollis St | [(-122.2885,37.397),(-122.289,37.414)] | Lafayette - I- 580 | [(-121.727,37.074),(-121.7229,37.093),(-121.722301,37.09522),(-121.721001,37.10005),(-121.7194,37.106),(-121.7188,37.109),(-121.7168,37.12),(-121.7163,37.123),(-121.7145,37.127),(-121.7096,37.148),(-121.707731,37.1568),(-121.7058,37.166),(-121.7055,37.168),(-121.7044,37.174),(-121.7038,37.172),(-121.7037,37.172),(-121.7027,37.175),(-121.7001,37.181),(-121.6957,37.191),(-121.6948,37.192),(-121.6897,37.204),(-121.6697,37.185)] | Oakland - I- 580 | [(-121.9322,37.989),(-121.9243,37.006),(-121.9217,37.014)] | Oakland - I- 580 | [(-121.9322,37.989),(-121.9243,37.006),(-121.9217,37.014)] | Oakland - I- 580 | [(-122.018,37.019),(-122.0009,37.032),(-121.9787,37.983),(-121.958,37.984),(-121.9571,37.986)] | Oakland - I- 580 | [(-122.018,37.019),(-122.0009,37.032),(-121.9787,37.983),(-121.958,37.984),(-121.9571,37.986)] | Oakland - I- 580 | [(-122.1108,37.023),(-122.1101,37.02),(-122.108103,37.00764),(-122.108,37.007),(-122.1069,37.998),(-122.1064,37.994),(-122.1053,37.982),(-122.1048,37.977),(-122.1032,37.958),(-122.1026,37.953),(-122.1013,37.938),(-122.0989,37.911),(-122.0984,37.91),(-122.098,37.908)] | Oakland I- 580 | [(-122.1108,37.023),(-122.1101,37.02),(-122.108103,37.00764),(-122.108,37.007),(-122.1069,37.998),(-122.1064,37.994),(-122.1053,37.982),(-122.1048,37.977),(-122.1032,37.958),(-122.1026,37.953),(-122.1013,37.938),(-122.0989,37.911),(-122.0984,37.91),(-122.098,37.908)] | Berkeley - I- 580 | [(-122.1543,37.703),(-122.1535,37.694),(-122.1512,37.655),(-122.1475,37.603),(-122.1468,37.583),(-122.1472,37.569),(-122.149044,37.54874),(-122.1493,37.546),(-122.1501,37.532),(-122.1506,37.509),(-122.1495,37.482),(-122.1487,37.467),(-122.1477,37.447),(-122.1414,37.383),(-122.1404,37.376),(-122.1398,37.372),(-122.139,37.356),(-122.1388,37.353),(-122.1385,37.34),(-122.1382,37.33),(-122.1378,37.316)] | Oakland I- 580 | [(-122.1543,37.703),(-122.1535,37.694),(-122.1512,37.655),(-122.1475,37.603),(-122.1468,37.583),(-122.1472,37.569),(-122.149044,37.54874),(-122.1493,37.546),(-122.1501,37.532),(-122.1506,37.509),(-122.1495,37.482),(-122.1487,37.467),(-122.1477,37.447),(-122.1414,37.383),(-122.1404,37.376),(-122.1398,37.372),(-122.139,37.356),(-122.1388,37.353),(-122.1385,37.34),(-122.1382,37.33),(-122.1378,37.316)] | Berkeley I- 580 | [(-122.2197,37.99),(-122.22,37.99),(-122.222092,37.99523),(-122.2232,37.998),(-122.224146,37.99963),(-122.2261,37.003),(-122.2278,37.007),(-122.2302,37.026),(-122.2323,37.043),(-122.2344,37.059),(-122.235405,37.06427),(-122.2365,37.07)] | Berkeley I- 580 | [(-122.2197,37.99),(-122.22,37.99),(-122.222092,37.99523),(-122.2232,37.998),(-122.224146,37.99963),(-122.2261,37.003),(-122.2278,37.007),(-122.2302,37.026),(-122.2323,37.043),(-122.2344,37.059),(-122.235405,37.06427),(-122.2365,37.07)] | Lafayette - I- 580 Ramp | [(-121.8521,37.011),(-121.8479,37.999),(-121.8476,37.999),(-121.8456,37.01),(-121.8455,37.011)] | Oakland - I- 580 Ramp | [(-121.8521,37.011),(-121.8479,37.999),(-121.8476,37.999),(-121.8456,37.01),(-121.8455,37.011)] | Oakland - I- 580 Ramp | [(-121.8743,37.014),(-121.8722,37.999),(-121.8714,37.999)] | Oakland - I- 580 Ramp | [(-121.8743,37.014),(-121.8722,37.999),(-121.8714,37.999)] | Oakland - I- 580 Ramp | [(-121.9043,37.998),(-121.9036,37.013),(-121.902632,37.0174),(-121.9025,37.018)] | Oakland - I- 580 Ramp | [(-121.9043,37.998),(-121.9036,37.013),(-121.902632,37.0174),(-121.9025,37.018)] | Oakland - I- 580 Ramp | [(-121.9368,37.986),(-121.936483,37.98832),(-121.9353,37.997),(-121.93504,37.00035),(-121.9346,37.006),(-121.933764,37.00031),(-121.9333,37.997),(-121.9322,37.989)] | Oakland - I- 580 Ramp | [(-121.9368,37.986),(-121.936483,37.98832),(-121.9353,37.997),(-121.93504,37.00035),(-121.9346,37.006),(-121.933764,37.00031),(-121.9333,37.997),(-121.9322,37.989)] | Oakland + I- 580 | [(-122.018,37.019),(-122.0009,37.032),(-121.9787,37.983),(-121.958,37.984),(-121.9571,37.986)] | Oakland + I- 580 | [(-121.9322,37.989),(-121.9243,37.006),(-121.9217,37.014)] | Oakland + I- 580 | [(-121.9322,37.989),(-121.9243,37.006),(-121.9217,37.014)] | Oakland + I- 580 | [(-121.727,37.074),(-121.7229,37.093),(-121.722301,37.09522),(-121.721001,37.10005),(-121.7194,37.106),(-121.7188,37.109),(-121.7168,37.12),(-121.7163,37.123),(-121.7145,37.127),(-121.7096,37.148),(-121.707731,37.1568),(-121.7058,37.166),(-121.7055,37.168),(-121.7044,37.174),(-121.7038,37.172),(-121.7037,37.172),(-121.7027,37.175),(-121.7001,37.181),(-121.6957,37.191),(-121.6948,37.192),(-121.6897,37.204),(-121.6697,37.185)] | Oakland + I- 580 | [(-122.1108,37.023),(-122.1101,37.02),(-122.108103,37.00764),(-122.108,37.007),(-122.1069,37.998),(-122.1064,37.994),(-122.1053,37.982),(-122.1048,37.977),(-122.1032,37.958),(-122.1026,37.953),(-122.1013,37.938),(-122.0989,37.911),(-122.0984,37.91),(-122.098,37.908)] | Oakland + I- 580 | [(-122.1543,37.703),(-122.1535,37.694),(-122.1512,37.655),(-122.1475,37.603),(-122.1468,37.583),(-122.1472,37.569),(-122.149044,37.54874),(-122.1493,37.546),(-122.1501,37.532),(-122.1506,37.509),(-122.1495,37.482),(-122.1487,37.467),(-122.1477,37.447),(-122.1414,37.383),(-122.1404,37.376),(-122.1398,37.372),(-122.139,37.356),(-122.1388,37.353),(-122.1385,37.34),(-122.1382,37.33),(-122.1378,37.316)] | Oakland + I- 580 | [(-122.018,37.019),(-122.0009,37.032),(-121.9787,37.983),(-121.958,37.984),(-121.9571,37.986)] | Oakland I- 580 Ramp | [(-122.093241,37.90351),(-122.09364,37.89634),(-122.093788,37.89212)] | Berkeley + I- 580 Ramp | [(-122.1086,37.003),(-122.1068,37.993),(-122.1066,37.992),(-122.1053,37.982)] | Berkeley I- 580 Ramp | [(-122.0934,37.896),(-122.09257,37.89961),(-122.0911,37.906)] | Berkeley I- 580 Ramp | [(-122.0941,37.897),(-122.0943,37.902)] | Berkeley I- 580 Ramp | [(-122.096,37.888),(-122.0962,37.891),(-122.0964,37.9)] | Berkeley I- 580 Ramp | [(-122.101,37.898),(-122.1005,37.902),(-122.0989,37.911)] | Berkeley + I- 580 Ramp | [(-121.9368,37.986),(-121.936483,37.98832),(-121.9353,37.997),(-121.93504,37.00035),(-121.9346,37.006),(-121.933764,37.00031),(-121.9333,37.997),(-121.9322,37.989)] | Oakland + I- 580 Ramp | [(-121.9368,37.986),(-121.936483,37.98832),(-121.9353,37.997),(-121.93504,37.00035),(-121.9346,37.006),(-121.933764,37.00031),(-121.9333,37.997),(-121.9322,37.989)] | Oakland I- 580 Ramp | [(-122.1086,37.003),(-122.1068,37.993),(-122.1066,37.992),(-122.1053,37.982)] | Oakland - I- 580 Ramp | [(-122.1086,37.003),(-122.1068,37.993),(-122.1066,37.992),(-122.1053,37.982)] | Berkeley I- 580 Ramp | [(-122.1414,37.383),(-122.1407,37.376),(-122.1403,37.372),(-122.139,37.356)] | Oakland + I- 580 Ramp | [(-121.9043,37.998),(-121.9036,37.013),(-121.902632,37.0174),(-121.9025,37.018)] | Oakland + I- 580 Ramp | [(-121.9043,37.998),(-121.9036,37.013),(-121.902632,37.0174),(-121.9025,37.018)] | Oakland + I- 580 Ramp | [(-121.8743,37.014),(-121.8722,37.999),(-121.8714,37.999)] | Oakland + I- 580 Ramp | [(-121.8743,37.014),(-121.8722,37.999),(-121.8714,37.999)] | Oakland + I- 580 Ramp | [(-121.8521,37.011),(-121.8479,37.999),(-121.8476,37.999),(-121.8456,37.01),(-121.8455,37.011)] | Oakland + I- 580 Ramp | [(-121.8521,37.011),(-121.8479,37.999),(-121.8476,37.999),(-121.8456,37.01),(-121.8455,37.011)] | Oakland I- 580/I-680 Ramp | ((-121.9207,37.988),(-121.9192,37.016)) | Oakland I- 580/I-680 Ramp | ((-121.9207,37.988),(-121.9192,37.016)) | Oakland + I- 680 | [(-121.9184,37.934),(-121.917,37.913),(-121.9122,37.83),(-121.9052,37.702)] | Oakland + I- 680 | [(-121.9101,37.715),(-121.911269,37.74682),(-121.9119,37.764),(-121.9124,37.776),(-121.9174,37.905),(-121.9194,37.957),(-121.9207,37.988)] | Oakland I- 680 | ((-121.939,37.15),(-121.9387,37.145),(-121.9373,37.125),(-121.934242,37.07643),(-121.933886,37.0709),(-121.9337,37.068),(-121.933122,37.06139),(-121.932736,37.05698),(-121.93222,37.05108),(-121.931844,37.04678),(-121.930113,37.027),(-121.926829,37),(-121.9265,37.998),(-121.9217,37.96),(-121.9203,37.949),(-121.9184,37.934)) | Oakland I- 680 | ((-121.939,37.15),(-121.9387,37.145),(-121.9373,37.125),(-121.934242,37.07643),(-121.933886,37.0709),(-121.9337,37.068),(-121.933122,37.06139),(-121.932736,37.05698),(-121.93222,37.05108),(-121.931844,37.04678),(-121.930113,37.027),(-121.926829,37),(-121.9265,37.998),(-121.9217,37.96),(-121.9203,37.949),(-121.9184,37.934)) | Oakland - I- 680 | [(-121.9101,37.715),(-121.911269,37.74682),(-121.9119,37.764),(-121.9124,37.776),(-121.9174,37.905),(-121.9194,37.957),(-121.9207,37.988)] | Oakland - I- 680 | [(-121.9184,37.934),(-121.917,37.913),(-121.9122,37.83),(-121.9052,37.702)] | Oakland + I- 680 Ramp | [(-121.9238,37.402),(-121.9234,37.395),(-121.923,37.399)] | Oakland I- 680 Ramp | [(-121.8833,37.376),(-121.8833,37.392),(-121.883,37.4),(-121.8835,37.402),(-121.8852,37.422)] | Oakland I- 680 Ramp | [(-121.8833,37.376),(-121.8833,37.392),(-121.883,37.4),(-121.8835,37.402),(-121.8852,37.422)] | Oakland I- 680 Ramp | [(-121.92,37.438),(-121.9218,37.424),(-121.9238,37.408),(-121.9252,37.392)] | Oakland I- 680 Ramp | [(-121.92,37.438),(-121.9218,37.424),(-121.9238,37.408),(-121.9252,37.392)] | Oakland I- 680 Ramp | [(-121.9238,37.402),(-121.9234,37.395),(-121.923,37.399)] | Oakland - I- 680 Ramp | [(-121.9238,37.402),(-121.9234,37.395),(-121.923,37.399)] | Oakland - I- 80 | ((-122.2937,37.277),(-122.3016,37.262)) | Lafayette I- 80 | ((-122.2962,37.273),(-122.3004,37.264)) | Lafayette + I- 80 | ((-122.2937,37.277),(-122.3016,37.262)) | Lafayette I- 80 Ramp | [(-122.2962,37.413),(-122.2959,37.382),(-122.2951,37.372)] | Lafayette - I- 880 | ((-121.9669,37.075),(-121.9663,37.071),(-121.9656,37.065),(-121.9618,37.037),(-121.95689,37),(-121.948,37.933)) | Oakland - I- 880 | ((-121.9669,37.075),(-121.9663,37.071),(-121.9656,37.065),(-121.9618,37.037),(-121.95689,37),(-121.948,37.933)) | Oakland - I- 880 | [(-121.948,37.933),(-121.9471,37.925),(-121.9467,37.923),(-121.946,37.918),(-121.9452,37.912),(-121.937,37.852)] | Oakland - I- 880 | [(-122.0219,37.466),(-122.0205,37.447),(-122.020331,37.44447),(-122.020008,37.43962),(-122.0195,37.432),(-122.0193,37.429),(-122.0164,37.393),(-122.010219,37.34771),(-122.0041,37.313)] | Oakland - I- 880 | [(-122.0375,37.632),(-122.0359,37.619),(-122.0358,37.616),(-122.034514,37.60409),(-122.031876,37.57965),(-122.031193,37.57332),(-122.03016,37.56375),(-122.02943,37.55698),(-122.028689,37.54929),(-122.027833,37.53908),(-122.025979,37.51698),(-122.0238,37.491)] | Oakland + I- 880 | [(-122.2214,37.711),(-122.2202,37.699),(-122.2199,37.695),(-122.219,37.682),(-122.2184,37.672),(-122.2173,37.652),(-122.2159,37.638),(-122.2144,37.616),(-122.2138,37.612),(-122.2135,37.609),(-122.212,37.592),(-122.2116,37.586),(-122.2111,37.581)] | Berkeley I- 880 | [(-122.0375,37.632),(-122.0359,37.619),(-122.0358,37.616),(-122.034514,37.60409),(-122.031876,37.57965),(-122.031193,37.57332),(-122.03016,37.56375),(-122.02943,37.55698),(-122.028689,37.54929),(-122.027833,37.53908),(-122.025979,37.51698),(-122.0238,37.491)] | Berkeley - I- 880 | [(-122.0612,37.003),(-122.0604,37.991),(-122.0596,37.982),(-122.0585,37.967),(-122.0583,37.961),(-122.0553,37.918),(-122.053635,37.89475),(-122.050759,37.8546),(-122.05,37.844),(-122.0485,37.817),(-122.0483,37.813),(-122.0482,37.811)] | Oakland - I- 880 | [(-122.0612,37.003),(-122.0604,37.991),(-122.0596,37.982),(-122.0585,37.967),(-122.0583,37.961),(-122.0553,37.918),(-122.053635,37.89475),(-122.050759,37.8546),(-122.05,37.844),(-122.0485,37.817),(-122.0483,37.813),(-122.0482,37.811)] | Oakland I- 880 | [(-122.0612,37.003),(-122.0604,37.991),(-122.0596,37.982),(-122.0585,37.967),(-122.0583,37.961),(-122.0553,37.918),(-122.053635,37.89475),(-122.050759,37.8546),(-122.05,37.844),(-122.0485,37.817),(-122.0483,37.813),(-122.0482,37.811)] | Berkeley - I- 880 | [(-122.0831,37.312),(-122.0819,37.296),(-122.081,37.285),(-122.0786,37.248),(-122.078,37.24),(-122.077642,37.23496),(-122.076983,37.22567),(-122.076599,37.22026),(-122.076229,37.21505),(-122.0758,37.209)] | Oakland - I- 880 | [(-122.0978,37.528),(-122.096,37.496),(-122.0931,37.453),(-122.09277,37.4496),(-122.090189,37.41442),(-122.0896,37.405),(-122.085,37.34)] | Oakland I- 880 | [(-122.1365,37.902),(-122.1358,37.898),(-122.1333,37.881),(-122.1323,37.874),(-122.1311,37.866),(-122.1308,37.865),(-122.1307,37.864),(-122.1289,37.851),(-122.1277,37.843),(-122.1264,37.834),(-122.1231,37.812),(-122.1165,37.766),(-122.1104,37.72),(-122.109695,37.71094),(-122.109,37.702),(-122.108312,37.69168),(-122.1076,37.681)] | Berkeley - I- 880 | [(-122.1755,37.185),(-122.1747,37.178),(-122.1742,37.173),(-122.1692,37.126),(-122.167792,37.11594),(-122.16757,37.11435),(-122.1671,37.111),(-122.1655,37.1),(-122.165169,37.09811),(-122.1641,37.092),(-122.1596,37.061),(-122.158381,37.05275),(-122.155991,37.03657),(-122.1531,37.017),(-122.1478,37.98),(-122.1407,37.932),(-122.1394,37.924),(-122.1389,37.92),(-122.1376,37.91)] | Oakland - I- 880 | [(-122.1755,37.185),(-122.1747,37.178),(-122.1742,37.173),(-122.1692,37.126),(-122.167792,37.11594),(-122.16757,37.11435),(-122.1671,37.111),(-122.1655,37.1),(-122.165169,37.09811),(-122.1641,37.092),(-122.1596,37.061),(-122.158381,37.05275),(-122.155991,37.03657),(-122.1531,37.017),(-122.1478,37.98),(-122.1407,37.932),(-122.1394,37.924),(-122.1389,37.92),(-122.1376,37.91)] | Berkeley - I- 880 | [(-122.2214,37.711),(-122.2202,37.699),(-122.2199,37.695),(-122.219,37.682),(-122.2184,37.672),(-122.2173,37.652),(-122.2159,37.638),(-122.2144,37.616),(-122.2138,37.612),(-122.2135,37.609),(-122.212,37.592),(-122.2116,37.586),(-122.2111,37.581)] | Berkeley I- 880 | [(-122.2707,37.975),(-122.2693,37.972),(-122.2681,37.966),(-122.267,37.962),(-122.2659,37.957),(-122.2648,37.952),(-122.2636,37.946),(-122.2625,37.935),(-122.2617,37.927),(-122.2607,37.921),(-122.2593,37.916),(-122.258,37.911),(-122.2536,37.898),(-122.2432,37.858),(-122.2408,37.845),(-122.2386,37.827),(-122.2374,37.811)] | Berkeley - I- 880 Ramp | [(-122.0019,37.301),(-122.002,37.293)] | Oakland + I- 880 | [(-122.1755,37.185),(-122.1747,37.178),(-122.1742,37.173),(-122.1692,37.126),(-122.167792,37.11594),(-122.16757,37.11435),(-122.1671,37.111),(-122.1655,37.1),(-122.165169,37.09811),(-122.1641,37.092),(-122.1596,37.061),(-122.158381,37.05275),(-122.155991,37.03657),(-122.1531,37.017),(-122.1478,37.98),(-122.1407,37.932),(-122.1394,37.924),(-122.1389,37.92),(-122.1376,37.91)] | Berkeley + I- 880 | [(-122.0978,37.528),(-122.096,37.496),(-122.0931,37.453),(-122.09277,37.4496),(-122.090189,37.41442),(-122.0896,37.405),(-122.085,37.34)] | Oakland + I- 880 | [(-121.948,37.933),(-121.9471,37.925),(-121.9467,37.923),(-121.946,37.918),(-121.9452,37.912),(-121.937,37.852)] | Oakland + I- 880 | ((-121.9669,37.075),(-121.9663,37.071),(-121.9656,37.065),(-121.9618,37.037),(-121.95689,37),(-121.948,37.933)) | Oakland + I- 880 | ((-121.9669,37.075),(-121.9663,37.071),(-121.9656,37.065),(-121.9618,37.037),(-121.95689,37),(-121.948,37.933)) | Oakland + I- 880 | [(-122.1755,37.185),(-122.1747,37.178),(-122.1742,37.173),(-122.1692,37.126),(-122.167792,37.11594),(-122.16757,37.11435),(-122.1671,37.111),(-122.1655,37.1),(-122.165169,37.09811),(-122.1641,37.092),(-122.1596,37.061),(-122.158381,37.05275),(-122.155991,37.03657),(-122.1531,37.017),(-122.1478,37.98),(-122.1407,37.932),(-122.1394,37.924),(-122.1389,37.92),(-122.1376,37.91)] | Oakland + I- 880 | [(-122.0831,37.312),(-122.0819,37.296),(-122.081,37.285),(-122.0786,37.248),(-122.078,37.24),(-122.077642,37.23496),(-122.076983,37.22567),(-122.076599,37.22026),(-122.076229,37.21505),(-122.0758,37.209)] | Oakland + I- 880 | [(-122.0612,37.003),(-122.0604,37.991),(-122.0596,37.982),(-122.0585,37.967),(-122.0583,37.961),(-122.0553,37.918),(-122.053635,37.89475),(-122.050759,37.8546),(-122.05,37.844),(-122.0485,37.817),(-122.0483,37.813),(-122.0482,37.811)] | Oakland + I- 880 | [(-122.0612,37.003),(-122.0604,37.991),(-122.0596,37.982),(-122.0585,37.967),(-122.0583,37.961),(-122.0553,37.918),(-122.053635,37.89475),(-122.050759,37.8546),(-122.05,37.844),(-122.0485,37.817),(-122.0483,37.813),(-122.0482,37.811)] | Oakland + I- 880 | [(-122.0375,37.632),(-122.0359,37.619),(-122.0358,37.616),(-122.034514,37.60409),(-122.031876,37.57965),(-122.031193,37.57332),(-122.03016,37.56375),(-122.02943,37.55698),(-122.028689,37.54929),(-122.027833,37.53908),(-122.025979,37.51698),(-122.0238,37.491)] | Oakland + I- 880 | [(-122.0219,37.466),(-122.0205,37.447),(-122.020331,37.44447),(-122.020008,37.43962),(-122.0195,37.432),(-122.0193,37.429),(-122.0164,37.393),(-122.010219,37.34771),(-122.0041,37.313)] | Oakland + I- 880 Ramp | [(-122.059,37.982),(-122.0577,37.984),(-122.0612,37.003)] | Berkeley + I- 880 Ramp | [(-122.0618,37.011),(-122.0631,37.982),(-122.0585,37.967)] | Berkeley + I- 880 Ramp | [(-122.1029,37.61),(-122.1013,37.587),(-122.0999,37.569)] | Berkeley + I- 880 Ramp | [(-122.1379,37.891),(-122.1383,37.897),(-122.1377,37.902)] | Berkeley + I- 880 Ramp | [(-122.1379,37.931),(-122.137597,37.92736),(-122.1374,37.925),(-122.1373,37.924),(-122.1369,37.914),(-122.1358,37.905),(-122.1365,37.908),(-122.1358,37.898)] | Berkeley + I- 880 Ramp | [(-122.2536,37.898),(-122.254,37.902)] | Berkeley + I- 880 Ramp | [(-122.2771,37.002),(-122.278,37)] | Lafayette I- 880 Ramp | [(-122.0041,37.313),(-122.0018,37.315),(-122.0007,37.315),(-122.0005,37.313),(-122.0002,37.308),(-121.9995,37.289)] | Oakland + I- 880 Ramp | [(-122.0019,37.301),(-122.002,37.293)] | Oakland I- 880 Ramp | [(-122.0041,37.313),(-122.0038,37.308),(-122.0039,37.284),(-122.0013,37.287),(-121.9995,37.289)] | Oakland I- 880 Ramp | [(-122.0236,37.488),(-122.0231,37.458),(-122.0227,37.458),(-122.0223,37.452),(-122.0205,37.447)] | Oakland I- 880 Ramp | [(-122.0238,37.491),(-122.0215,37.483),(-122.0211,37.477),(-122.0205,37.447)] | Oakland I- 880 Ramp | [(-122.059,37.982),(-122.0577,37.984),(-122.0612,37.003)] | Oakland I- 880 Ramp | [(-122.059,37.982),(-122.0577,37.984),(-122.0612,37.003)] | Oakland - I- 880 Ramp | [(-122.059,37.982),(-122.0577,37.984),(-122.0612,37.003)] | Berkeley I- 880 Ramp | [(-122.0618,37.011),(-122.0631,37.982),(-122.0585,37.967)] | Oakland I- 880 Ramp | [(-122.0618,37.011),(-122.0631,37.982),(-122.0585,37.967)] | Oakland - I- 880 Ramp | [(-122.0618,37.011),(-122.0631,37.982),(-122.0585,37.967)] | Berkeley I- 880 Ramp | [(-122.085,37.34),(-122.0801,37.316),(-122.081,37.285)] | Oakland I- 880 Ramp | [(-122.085,37.34),(-122.0801,37.316),(-122.081,37.285)] | Oakland I- 880 Ramp | [(-122.085,37.34),(-122.0866,37.316),(-122.0819,37.296)] | Oakland I- 880 Ramp | [(-122.085,37.34),(-122.0866,37.316),(-122.0819,37.296)] | Oakland - I- 880 Ramp | [(-122.1029,37.61),(-122.1013,37.587),(-122.0999,37.569)] | Berkeley - I- 880 Ramp | [(-122.1379,37.891),(-122.1383,37.897),(-122.1377,37.902)] | Berkeley - I- 880 Ramp | [(-122.1379,37.931),(-122.137597,37.92736),(-122.1374,37.925),(-122.1373,37.924),(-122.1369,37.914),(-122.1358,37.905),(-122.1365,37.908),(-122.1358,37.898)] | Berkeley - I- 880 Ramp | [(-122.2536,37.898),(-122.254,37.902)] | Berkeley - I- 880 Ramp | [(-122.2771,37.002),(-122.278,37)] | Lafayette Indian Way | [(-122.2066,37.398),(-122.2045,37.411)] | Lafayette Jackson St | [(-122.0845,37.6),(-122.0842,37.606)] | Berkeley Johnson Dr | [(-121.9145,37.901),(-121.915,37.877)] | Oakland @@ -212,26 +225,26 @@ SELECT * FROM street; Livermore Ave | [(-121.7687,37.448),(-121.769,37.375)] | Oakland Livermore Ave | [(-121.772719,37.99085),(-121.7728,37.001)] | Oakland Livermore Ave | [(-121.772719,37.99085),(-121.7728,37.001)] | Oakland - Locust St | [(-122.1606,37.007),(-122.1593,37.987)] | Oakland Locust St | [(-122.1606,37.007),(-122.1593,37.987)] | Berkeley + Locust St | [(-122.1606,37.007),(-122.1593,37.987)] | Oakland Logan Ct | [(-122.0053,37.492),(-122.0061,37.484)] | Oakland Magnolia St | [(-122.0971,37.5),(-122.0962,37.484)] | Oakland Mandalay Road | [(-122.2322,37.397),(-122.2321,37.403)] | Lafayette Marin Ave | [(-122.2741,37.894),(-122.272,37.901)] | Berkeley Martin Luther King Jr Way | [(-122.2712,37.608),(-122.2711,37.599)] | Berkeley Mattos Dr | [(-122.0005,37.502),(-122.000898,37.49683)] | Oakland - Maubert Ave | [(-122.1114,37.009),(-122.1096,37.995)] | Oakland Maubert Ave | [(-122.1114,37.009),(-122.1096,37.995)] | Berkeley - McClure Ave | [(-122.1431,37.001),(-122.1436,37.998)] | Oakland + Maubert Ave | [(-122.1114,37.009),(-122.1096,37.995)] | Oakland McClure Ave | [(-122.1431,37.001),(-122.1436,37.998)] | Berkeley + McClure Ave | [(-122.1431,37.001),(-122.1436,37.998)] | Oakland Medlar Dr | [(-122.0627,37.378),(-122.0625,37.375)] | Oakland Mildred Ct | [(-122.0002,37.388),(-121.9998,37.386)] | Oakland Miller Road | [(-122.0902,37.645),(-122.0865,37.545)] | Berkeley Miramar Ave | [(-122.1009,37.025),(-122.099089,37.03209)] | Oakland + Mission Blvd | [(-122.0006,37.896),(-121.9989,37.88)] | Berkeley + Mission Blvd | [(-122.0006,37.896),(-121.9989,37.88)] | Oakland Mission Blvd | [(-121.918886,37),(-121.9194,37.976),(-121.9198,37.975)] | Oakland Mission Blvd | [(-121.918886,37),(-121.9194,37.976),(-121.9198,37.975)] | Oakland - Mission Blvd | [(-122.0006,37.896),(-121.9989,37.88)] | Oakland - Mission Blvd | [(-122.0006,37.896),(-121.9989,37.88)] | Berkeley Moores Ave | [(-122.0087,37.301),(-122.0094,37.292)] | Oakland National Ave | [(-122.1192,37.5),(-122.1281,37.489)] | Oakland Navajo Ct | [(-121.8779,37.901),(-121.8783,37.9)] | Oakland @@ -241,51 +254,51 @@ SELECT * FROM street; Oneil Ave | [(-122.076754,37.62476),(-122.0745,37.595)] | Berkeley Parkridge Dr | [(-122.1438,37.884),(-122.1428,37.9)] | Berkeley Parkside Dr | [(-122.0475,37.603),(-122.0443,37.596)] | Berkeley + Paseo Padre Pkwy | [(-122.0021,37.639),(-121.996,37.628)] | Berkeley Paseo Padre Pkwy | [(-121.9143,37.005),(-121.913522,37)] | Oakland Paseo Padre Pkwy | [(-122.0021,37.639),(-121.996,37.628)] | Oakland - Paseo Padre Pkwy | [(-122.0021,37.639),(-121.996,37.628)] | Berkeley Pearl St | [(-122.2383,37.594),(-122.2366,37.615)] | Berkeley Periwinkle Road | [(-122.0451,37.301),(-122.044758,37.29844)] | Oakland Pimlico Dr | [(-121.8616,37.998),(-121.8618,37.008)] | Oakland Pimlico Dr | [(-121.8616,37.998),(-121.8618,37.008)] | Oakland Portsmouth Ave | [(-122.1064,37.315),(-122.1064,37.308)] | Oakland Proctor Ave | [(-122.2267,37.406),(-122.2251,37.386)] | Lafayette + Railroad Ave | [(-122.0245,37.013),(-122.0234,37.003),(-122.0223,37.993)] | Berkeley Railroad Ave | [(-122.0245,37.013),(-122.0234,37.003),(-122.0223,37.993)] | Oakland Railroad Ave | [(-122.0245,37.013),(-122.0234,37.003),(-122.0223,37.993)] | Oakland - Railroad Ave | [(-122.0245,37.013),(-122.0234,37.003),(-122.0223,37.993)] | Berkeley + Ranspot Dr | [(-122.0972,37.999),(-122.0959,37)] | Berkeley Ranspot Dr | [(-122.0972,37.999),(-122.0959,37)] | Oakland Ranspot Dr | [(-122.0972,37.999),(-122.0959,37)] | Oakland - Ranspot Dr | [(-122.0972,37.999),(-122.0959,37)] | Berkeley Redding St | [(-122.1978,37.901),(-122.1975,37.895)] | Berkeley - Redwood Road | [(-122.1493,37.98),(-122.1437,37.001)] | Oakland Redwood Road | [(-122.1493,37.98),(-122.1437,37.001)] | Berkeley + Redwood Road | [(-122.1493,37.98),(-122.1437,37.001)] | Oakland Roca Dr | [(-122.0335,37.609),(-122.0314,37.599)] | Berkeley Rosedale Ct | [(-121.9232,37.9),(-121.924,37.897)] | Oakland Sacramento St | [(-122.2799,37.606),(-122.2797,37.597)] | Berkeley Saddle Brook Dr | [(-122.1478,37.909),(-122.1454,37.904),(-122.1451,37.888)] | Berkeley Saginaw Ct | [(-121.8803,37.898),(-121.8806,37.901)] | Oakland San Andreas Dr | [(-122.0609,37.9),(-122.0614,37.895)] | Berkeley + Santa Maria Ave | [(-122.0773,37),(-122.0773,37.98)] | Berkeley Santa Maria Ave | [(-122.0773,37),(-122.0773,37.98)] | Oakland Santa Maria Ave | [(-122.0773,37),(-122.0773,37.98)] | Oakland - Santa Maria Ave | [(-122.0773,37),(-122.0773,37.98)] | Berkeley Shattuck Ave | [(-122.2686,37.904),(-122.2686,37.897)] | Berkeley Sheridan Road | [(-122.2279,37.425),(-122.2253,37.411),(-122.2223,37.377)] | Lafayette Shoreline Dr | [(-122.2657,37.603),(-122.2648,37.6)] | Berkeley - Skyline Blvd | [(-122.1738,37.01),(-122.1714,37.996)] | Oakland Skyline Blvd | [(-122.1738,37.01),(-122.1714,37.996)] | Berkeley + Skyline Blvd | [(-122.1738,37.01),(-122.1714,37.996)] | Oakland Skyline Dr | [(-122.0277,37.5),(-122.0284,37.498)] | Oakland Skywest Dr | [(-122.1161,37.62),(-122.1123,37.586)] | Berkeley Southern Pacific Railroad | [(-122.3002,37.674),(-122.2999,37.661)] | Berkeley - Sp Railroad | [(-121.893564,37.99009),(-121.897,37.016)] | Oakland - Sp Railroad | [(-121.893564,37.99009),(-121.897,37.016)] | Oakland - Sp Railroad | [(-121.9565,37.898),(-121.9562,37.9)] | Oakland + Sp Railroad | [(-122.0914,37.601),(-122.087,37.56),(-122.086408,37.5551)] | Berkeley + Sp Railroad | [(-122.137792,37.003),(-122.1365,37.992),(-122.131257,37.94612)] | Berkeley + Sp Railroad | [(-122.0734,37.001),(-122.0734,37.997)] | Berkeley Sp Railroad | [(-122.0734,37.001),(-122.0734,37.997)] | Oakland Sp Railroad | [(-122.0734,37.001),(-122.0734,37.997)] | Oakland - Sp Railroad | [(-122.0734,37.001),(-122.0734,37.997)] | Berkeley - Sp Railroad | [(-122.0914,37.601),(-122.087,37.56),(-122.086408,37.5551)] | Berkeley Sp Railroad | [(-122.137792,37.003),(-122.1365,37.992),(-122.131257,37.94612)] | Oakland - Sp Railroad | [(-122.137792,37.003),(-122.1365,37.992),(-122.131257,37.94612)] | Berkeley Sp Railroad | [(-122.1947,37.497),(-122.193328,37.4848)] | Oakland + Sp Railroad | [(-121.893564,37.99009),(-121.897,37.016)] | Oakland + Sp Railroad | [(-121.893564,37.99009),(-121.897,37.016)] | Oakland + Sp Railroad | [(-121.9565,37.898),(-121.9562,37.9)] | Oakland Stanton Ave | [(-122.100392,37.0697),(-122.099513,37.06052)] | Oakland State Hwy 123 | [(-122.3004,37.986),(-122.2998,37.969),(-122.2995,37.962),(-122.2992,37.952),(-122.299,37.942),(-122.2987,37.935),(-122.2984,37.924),(-122.2982,37.92),(-122.2976,37.904),(-122.297,37.88),(-122.2966,37.869),(-122.2959,37.848),(-122.2961,37.843)] | Berkeley State Hwy 13 | [(-122.1797,37.943),(-122.179871,37.91849),(-122.18,37.9),(-122.179023,37.86615),(-122.1787,37.862),(-122.1781,37.851),(-122.1777,37.845),(-122.1773,37.839),(-122.177,37.833)] | Berkeley @@ -316,28 +329,15 @@ SELECT * FROM street; Welch Creek Road | [(-121.7695,37.386),(-121.7737,37.413)] | Oakland Welch Creek Road | [(-121.7695,37.386),(-121.7737,37.413)] | Oakland West Loop Road | [(-122.0576,37.604),(-122.0602,37.586)] | Berkeley + Western Pacific Railroad Spur | [(-122.0394,37.018),(-122.0394,37.961)] | Berkeley Western Pacific Railroad Spur | [(-122.0394,37.018),(-122.0394,37.961)] | Oakland Western Pacific Railroad Spur | [(-122.0394,37.018),(-122.0394,37.961)] | Oakland - Western Pacific Railroad Spur | [(-122.0394,37.018),(-122.0394,37.961)] | Berkeley Whitlock Creek | [(-121.74683,37.91276),(-121.733107,37)] | Oakland Whitlock Creek | [(-121.74683,37.91276),(-121.733107,37)] | Oakland Willimet Way | [(-122.0964,37.517),(-122.0949,37.493)] | Oakland - Wisconsin St | [(-122.1994,37.017),(-122.1975,37.998),(-122.1971,37.994)] | Oakland Wisconsin St | [(-122.1994,37.017),(-122.1975,37.998),(-122.1971,37.994)] | Berkeley + Wisconsin St | [(-122.1994,37.017),(-122.1975,37.998),(-122.1971,37.994)] | Oakland Wp Railroad | [(-122.254,37.902),(-122.2506,37.891)] | Berkeley - 100th Ave | [(-122.1657,37.429),(-122.1647,37.432)] | Oakland - 107th Ave | [(-122.1555,37.403),(-122.1531,37.41)] | Oakland - 14th St | [(-122.299,37.147),(-122.3,37.148)] | Lafayette - 19th Ave | [(-122.2366,37.897),(-122.2359,37.905)] | Berkeley - 1st St | [(-121.75508,37.89294),(-121.753581,37.90031)] | Oakland - 5th St | [(-122.278,37),(-122.2792,37.005),(-122.2803,37.009)] | Lafayette - 5th St | [(-122.296,37.615),(-122.2953,37.598)] | Berkeley - 82nd Ave | [(-122.1695,37.596),(-122.1681,37.603)] | Berkeley - 85th Ave | [(-122.1877,37.466),(-122.186,37.476)] | Oakland - 89th Ave | [(-122.1822,37.459),(-122.1803,37.471)] | Oakland - 98th Ave | [(-122.1568,37.498),(-122.1558,37.502)] | Oakland - 98th Ave | [(-122.1693,37.438),(-122.1682,37.444)] | Oakland - 98th Ave | [(-122.2001,37.258),(-122.1974,37.27)] | Lafayette (333 rows) SELECT name, #thepath FROM iexit ORDER BY 1, 2; diff --git a/src/test/regress/expected/sequence.out b/src/test/regress/expected/sequence.out index 823039ae95..4b39cfe38d 100644 --- a/src/test/regress/expected/sequence.out +++ b/src/test/regress/expected/sequence.out @@ -11,11 +11,11 @@ INSERT INTO serialTest VALUES ('force', 100); INSERT INTO serialTest VALUES ('wrong', NULL); ERROR: null value in column "f2" violates not-null constraint -SELECT * FROM serialTest; +SELECT * FROM serialTest ORDER BY f1, f2; f1 | f2 -------+----- - foo | 1 bar | 2 + foo | 1 force | 100 (3 rows) @@ -126,11 +126,11 @@ DROP SEQUENCE foo_seq_new; -- renaming serial sequences ALTER TABLE serialtest_f2_seq RENAME TO serialtest_f2_foo; INSERT INTO serialTest VALUES ('more'); -SELECT * FROM serialTest; +SELECT * FROM serialTest ORDER BY f1, f2; f1 | f2 -------+----- - foo | 1 bar | 2 + foo | 1 force | 100 more | 3 (4 rows) diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out index 1241a2ace6..ca6aed81e7 100644 --- a/src/test/regress/expected/strings.out +++ b/src/test/regress/expected/strings.out @@ -101,7 +101,7 @@ RESET standard_conforming_strings; -- test conversions between various string types -- E021-10 implicit casting among the character data types -- -SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL; +SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL ORDER BY f1; text(char) ------------ a @@ -110,7 +110,7 @@ SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL; abcd (4 rows) -SELECT CAST(f1 AS text) AS "text(varchar)" FROM VARCHAR_TBL; +SELECT CAST(f1 AS text) AS "text(varchar)" FROM VARCHAR_TBL ORDER BY f1; text(varchar) --------------- a @@ -126,7 +126,7 @@ SELECT CAST(name 'namefield' AS text) AS "text(name)"; (1 row) -- since this is an explicit cast, it should truncate w/o error: -SELECT CAST(f1 AS char(10)) AS "char(text)" FROM TEXT_TBL; +SELECT CAST(f1 AS char(10)) AS "char(text)" FROM TEXT_TBL ORDER BY f1; char(text) ------------ doh! @@ -134,14 +134,14 @@ SELECT CAST(f1 AS char(10)) AS "char(text)" FROM TEXT_TBL; (2 rows) -- note: implicit-cast case is tested in char.sql -SELECT CAST(f1 AS char(20)) AS "char(text)" FROM TEXT_TBL; +SELECT CAST(f1 AS char(20)) AS "char(text)" FROM TEXT_TBL ORDER BY f1; char(text) ---------------------- doh! hi de ho neighbor (2 rows) -SELECT CAST(f1 AS char(10)) AS "char(varchar)" FROM VARCHAR_TBL; +SELECT CAST(f1 AS char(10)) AS "char(varchar)" FROM VARCHAR_TBL ORDER BY f1; char(varchar) --------------- a @@ -156,14 +156,14 @@ SELECT CAST(name 'namefield' AS char(10)) AS "char(name)"; namefield (1 row) -SELECT CAST(f1 AS varchar) AS "varchar(text)" FROM TEXT_TBL; +SELECT CAST(f1 AS varchar) AS "varchar(text)" FROM TEXT_TBL ORDER BY f1; varchar(text) ------------------- doh! hi de ho neighbor (2 rows) -SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL; +SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL ORDER BY f1; varchar(char) --------------- a diff --git a/src/test/regress/expected/subselect.out b/src/test/regress/expected/subselect.out index 49ee53741b..c7420fd716 100644 --- a/src/test/regress/expected/subselect.out +++ b/src/test/regress/expected/subselect.out @@ -31,22 +31,22 @@ INSERT INTO SUBSELECT_TBL VALUES (2, 2, 2); INSERT INTO SUBSELECT_TBL VALUES (3, 3, 3); INSERT INTO SUBSELECT_TBL VALUES (6, 7, 8); INSERT INTO SUBSELECT_TBL VALUES (8, 9, NULL); -SELECT '' AS eight, * FROM SUBSELECT_TBL; +SELECT '' AS eight, * FROM SUBSELECT_TBL ORDER BY f1, f2, f3; eight | f1 | f2 | f3 -------+----+----+---- - | 1 | 2 | 3 - | 2 | 3 | 4 - | 3 | 4 | 5 | 1 | 1 | 1 + | 1 | 2 | 3 | 2 | 2 | 2 + | 2 | 3 | 4 | 3 | 3 | 3 + | 3 | 4 | 5 | 6 | 7 | 8 | 8 | 9 | (8 rows) -- Uncorrelated subselects SELECT '' AS two, f1 AS "Constant Select" FROM SUBSELECT_TBL - WHERE f1 IN (SELECT 1); + WHERE f1 IN (SELECT 1) ORDER BY 2; two | Constant Select -----+----------------- | 1 @@ -54,34 +54,37 @@ SELECT '' AS two, f1 AS "Constant Select" FROM SUBSELECT_TBL (2 rows) SELECT '' AS six, f1 AS "Uncorrelated Field" FROM SUBSELECT_TBL - WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL); + WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL) + ORDER BY 2; six | Uncorrelated Field -----+-------------------- | 1 - | 2 - | 3 | 1 | 2 + | 2 + | 3 | 3 (6 rows) SELECT '' AS six, f1 AS "Uncorrelated Field" FROM SUBSELECT_TBL WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL WHERE - f2 IN (SELECT f1 FROM SUBSELECT_TBL)); + f2 IN (SELECT f1 FROM SUBSELECT_TBL)) + ORDER BY 2; six | Uncorrelated Field -----+-------------------- | 1 - | 2 - | 3 | 1 | 2 + | 2 + | 3 | 3 (6 rows) SELECT '' AS three, f1, f2 FROM SUBSELECT_TBL WHERE (f1, f2) NOT IN (SELECT f2, CAST(f3 AS int4) FROM SUBSELECT_TBL - WHERE f3 IS NOT NULL); + WHERE f3 IS NOT NULL) + ORDER BY f1, f2; three | f1 | f2 -------+----+---- | 1 | 2 @@ -92,34 +95,37 @@ SELECT '' AS three, f1, f2 -- Correlated subselects SELECT '' AS six, f1 AS "Correlated Field", f2 AS "Second Field" FROM SUBSELECT_TBL upper - WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL WHERE f1 = upper.f1); + WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL WHERE f1 = upper.f1) + ORDER BY f1, f2; six | Correlated Field | Second Field -----+------------------+-------------- - | 1 | 2 - | 2 | 3 - | 3 | 4 | 1 | 1 + | 1 | 2 | 2 | 2 + | 2 | 3 | 3 | 3 + | 3 | 4 (6 rows) SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field" FROM SUBSELECT_TBL upper WHERE f1 IN - (SELECT f2 FROM SUBSELECT_TBL WHERE CAST(upper.f2 AS float) = f3); + (SELECT f2 FROM SUBSELECT_TBL WHERE CAST(upper.f2 AS float) = f3) + ORDER BY 2, 3; six | Correlated Field | Second Field -----+------------------+-------------- - | 2 | 4 - | 3 | 5 | 1 | 1 | 2 | 2 + | 2 | 4 | 3 | 3 + | 3 | 5 (5 rows) SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field" FROM SUBSELECT_TBL upper WHERE f3 IN (SELECT upper.f1 + f2 FROM SUBSELECT_TBL - WHERE f2 = CAST(f3 AS integer)); + WHERE f2 = CAST(f3 AS integer)) + ORDER BY 2, 3; six | Correlated Field | Second Field -----+------------------+-------------- | 1 | 3 @@ -131,13 +137,14 @@ SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field" SELECT '' AS five, f1 AS "Correlated Field" FROM SUBSELECT_TBL WHERE (f1, f2) IN (SELECT f2, CAST(f3 AS int4) FROM SUBSELECT_TBL - WHERE f3 IS NOT NULL); + WHERE f3 IS NOT NULL) + ORDER BY 2; five | Correlated Field ------+------------------ - | 2 - | 3 | 1 | 2 + | 2 + | 3 | 3 (5 rows) @@ -147,13 +154,14 @@ SELECT '' AS five, f1 AS "Correlated Field" SELECT '' AS eight, ss.f1 AS "Correlated Field", ss.f3 AS "Second Field" FROM SUBSELECT_TBL ss WHERE f1 NOT IN (SELECT f1+1 FROM INT4_TBL - WHERE f1 != ss.f1 AND f1 < 2147483647); + WHERE f1 != ss.f1 AND f1 < 2147483647) + ORDER BY 2, 3; eight | Correlated Field | Second Field -------+------------------+-------------- - | 2 | 4 - | 3 | 5 | 2 | 2 + | 2 | 4 | 3 | 3 + | 3 | 5 | 6 | 8 | 8 | (6 rows) @@ -315,20 +323,21 @@ END) AS "Status", END) END) AS "Status_OK" FROM orderstest ord; -SELECT * FROM orders_view; +SELECT * FROM orders_view +ORDER BY approver_ref, po_ref, ordercancelled; approver_ref | po_ref | ordercancelled | Approved | Status | Status_OK --------------+--------+----------------+----------+-----------+----------- 1 | 1 | f | --- | --- | --- + 1 | 1 | f | --- | --- | --- + 1 | 1 | f | --- | --- | --- + 66 | 1 | f | Approved | Approved | Approved + 66 | 1 | f | Approved | Approved | Approved + 66 | 1 | t | Approved | Cancelled | Cancelled 66 | 5 | f | Approved | PO | PO 66 | 6 | f | Approved | PO | PO 66 | 7 | f | Approved | PO | PO - 66 | 1 | t | Approved | Cancelled | Cancelled 66 | 8 | f | Approved | PO | PO - 66 | 1 | f | Approved | Approved | Approved 77 | 1 | f | Approved | Approved | Approved - 1 | 1 | f | --- | --- | --- - 66 | 1 | f | Approved | Approved | Approved - 1 | 1 | f | --- | --- | --- (11 rows) DROP TABLE orderstest cascade; @@ -375,14 +384,15 @@ select * from shipped_view; select f1, ss1 as relabel from (select *, (select sum(f1) from int4_tbl b where f1 >= a.f1) as ss1 - from int4_tbl a) ss; + from int4_tbl a) ss + ORDER BY f1, relabel; f1 | relabel -------------+------------ + -2147483647 | 0 + -123456 | 2147483647 0 | 2147607103 123456 | 2147607103 - -123456 | 2147483647 2147483647 | 2147483647 - -2147483647 | 0 (5 rows) -- @@ -420,7 +430,8 @@ insert into numeric_table values (1), (1.000000000000000000001), (2), (3); create temp table float_table (float_col float8); insert into float_table values (1), (2), (3); select * from float_table - where float_col in (select num_col from numeric_table); + where float_col in (select num_col from numeric_table) + ORDER BY float_col; float_col ----------- 1 @@ -429,7 +440,8 @@ select * from float_table (3 rows) select * from numeric_table - where num_col in (select float_col from float_table); + where num_col in (select float_col from float_table) + ORDER BY num_col; num_col ------------------------- 1 @@ -458,7 +470,8 @@ insert into tc values(2,2); select ( select min(tb.id) from tb where tb.aval = (select ta.val from ta where ta.id = tc.aid) ) as min_tb_id -from tc; +from tc +ORDER BY min_tb_id; min_tb_id ----------- 1 diff --git a/src/test/regress/expected/tablespace.out b/src/test/regress/expected/tablespace.out new file mode 100644 index 0000000000..4df5192b41 --- /dev/null +++ b/src/test/regress/expected/tablespace.out @@ -0,0 +1,74 @@ +-- create a tablespace we can use +CREATE TABLESPACE testspace LOCATION '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/testtablespace'; +-- create a schema we can use +CREATE SCHEMA testschema; +-- try a table +CREATE TABLE testschema.foo (i int) TABLESPACE testspace; +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'foo'; + relname | spcname +---------+----------- + foo | testspace +(1 row) + +INSERT INTO testschema.foo VALUES(1); +INSERT INTO testschema.foo VALUES(2); +-- tables from dynamic sources +CREATE TABLE testschema.asselect TABLESPACE testspace AS SELECT 1; +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'asselect'; + relname | spcname +----------+----------- + asselect | testspace +(1 row) + +PREPARE selectsource(int) AS SELECT $1; +CREATE TABLE testschema.asexecute TABLESPACE testspace + AS EXECUTE selectsource(2); +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'asexecute'; + relname | spcname +-----------+----------- + asexecute | testspace +(1 row) + +-- index +CREATE INDEX foo_idx on testschema.foo(i) TABLESPACE testspace; +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'foo_idx'; + relname | spcname +---------+----------- + foo_idx | testspace +(1 row) + +-- let's try moving a table from one place to another +CREATE TABLE testschema.atable AS VALUES (1), (2); +CREATE UNIQUE INDEX anindex ON testschema.atable(column1); +ALTER TABLE testschema.atable SET TABLESPACE testspace; +ALTER INDEX testschema.anindex SET TABLESPACE testspace; +INSERT INTO testschema.atable VALUES(3); -- ok +INSERT INTO testschema.atable VALUES(1); -- fail (checks index) +ERROR: duplicate key value violates unique constraint "anindex" +SELECT COUNT(*) FROM testschema.atable; -- checks heap + count +------- + 3 +(1 row) + +-- Will fail with bad path +CREATE TABLESPACE badspace LOCATION '/no/such/location'; +ERROR: could not set permissions on directory "/no/such/location": No such file or directory +-- No such tablespace +CREATE TABLE bar (i int) TABLESPACE nosuchspace; +ERROR: tablespace "nosuchspace" does not exist +-- Fail, not empty +DROP TABLESPACE testspace; +ERROR: tablespace "testspace" is not empty +DROP SCHEMA testschema CASCADE; +NOTICE: drop cascades to 4 other objects +DETAIL: drop cascades to table testschema.foo +drop cascades to table testschema.asselect +drop cascades to table testschema.asexecute +drop cascades to table testschema.atable +-- Should succeed +DROP TABLESPACE testspace; diff --git a/src/test/regress/expected/temp.out b/src/test/regress/expected/temp.out index c39a88ad51..c7af26822c 100644 --- a/src/test/regress/expected/temp.out +++ b/src/test/regress/expected/temp.out @@ -52,7 +52,7 @@ CREATE TEMP TABLE temptest(col int) ON COMMIT DELETE ROWS; BEGIN; INSERT INTO temptest VALUES (1); INSERT INTO temptest VALUES (2); -SELECT * FROM temptest; +SELECT * FROM temptest ORDER BY 1; col ----- 1 @@ -86,7 +86,7 @@ BEGIN; CREATE TEMP TABLE temptest(col int) ON COMMIT DROP; INSERT INTO temptest VALUES (1); INSERT INTO temptest VALUES (2); -SELECT * FROM temptest; +SELECT * FROM temptest ORDER BY 1; col ----- 1 diff --git a/src/test/regress/expected/text.out b/src/test/regress/expected/text.out index 08d002fe71..e361c0c78f 100644 --- a/src/test/regress/expected/text.out +++ b/src/test/regress/expected/text.out @@ -16,7 +16,7 @@ SELECT text 'this is a text string' = text 'this is a text strin' AS false; CREATE TABLE TEXT_TBL (f1 text); INSERT INTO TEXT_TBL VALUES ('doh!'); INSERT INTO TEXT_TBL VALUES ('hi de ho neighbor'); -SELECT '' AS two, * FROM TEXT_TBL; +SELECT '' AS two, * FROM TEXT_TBL ORDER BY f1; two | f1 -----+------------------- | doh! diff --git a/src/test/regress/expected/time.out b/src/test/regress/expected/time.out index 8e0afe69e0..ae928d4b21 100644 --- a/src/test/regress/expected/time.out +++ b/src/test/regress/expected/time.out @@ -18,7 +18,7 @@ INSERT INTO TIME_TBL VALUES ('15:36:39 America/New_York'); ERROR: invalid input syntax for type time: "15:36:39 America/New_York" LINE 1: INSERT INTO TIME_TBL VALUES ('15:36:39 America/New_York'); ^ -SELECT f1 AS "Time" FROM TIME_TBL; +SELECT f1 AS "Time" FROM TIME_TBL ORDER BY f1; Time ------------- 00:00:00 @@ -27,13 +27,13 @@ SELECT f1 AS "Time" FROM TIME_TBL; 11:59:00 12:00:00 12:01:00 - 23:59:00 - 23:59:59.99 15:36:39 15:36:39 + 23:59:00 + 23:59:59.99 (10 rows) -SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07'; +SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07' ORDER BY f1; Three ---------- 00:00:00 @@ -41,24 +41,24 @@ SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07'; 02:03:00 (3 rows) -SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07'; +SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07' ORDER BY f1; Five ------------- 11:59:00 12:00:00 12:01:00 - 23:59:00 - 23:59:59.99 15:36:39 15:36:39 + 23:59:00 + 23:59:59.99 (7 rows) -SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00'; +SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00' ORDER BY f1; None ------ (0 rows) -SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00'; +SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00' ORDER BY f1; Eight ------------- 00:00:00 @@ -67,10 +67,10 @@ SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00'; 11:59:00 12:00:00 12:01:00 - 23:59:00 - 23:59:59.99 15:36:39 15:36:39 + 23:59:00 + 23:59:59.99 (10 rows) -- @@ -81,8 +81,8 @@ SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00'; -- Leave in one query to show that it is rejected, -- and do the rest of the testing in horology.sql -- where we do mixed-type arithmetic. - thomas 2000-12-02 -SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL; +SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL ORDER BY f1; ERROR: operator is not unique: time without time zone + time without time zone -LINE 1: SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL; +LINE 1: SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL ORDER BY... ^ HINT: Could not choose a best candidate operator. You might need to add explicit type casts. diff --git a/src/test/regress/expected/timestamp.out b/src/test/regress/expected/timestamp.out index d99c110724..61d67aefe1 100644 --- a/src/test/regress/expected/timestamp.out +++ b/src/test/regress/expected/timestamp.out @@ -180,34 +180,35 @@ INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 5097 BC'); ERROR: timestamp out of range: "Feb 16 17:32:01 5097 BC" LINE 1: INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 5097 BC')... ^ -SELECT '' AS "64", d1 FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 FROM TIMESTAMP_TBL ORDER BY d1; 64 | d1 ----+----------------------------- | -infinity - | infinity + | Tue Feb 16 17:32:01 0097 BC + | Sat Feb 16 17:32:01 0097 + | Thu Feb 16 17:32:01 0597 + | Tue Feb 16 17:32:01 1097 + | Sat Feb 16 17:32:01 1697 + | Thu Feb 16 17:32:01 1797 + | Tue Feb 16 17:32:01 1897 | Thu Jan 01 00:00:00 1970 - | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:02 1997 - | Mon Feb 10 17:32:01.4 1997 - | Mon Feb 10 17:32:01.5 1997 - | Mon Feb 10 17:32:01.6 1997 + | Wed Feb 28 17:32:01 1996 + | Thu Feb 29 17:32:01 1996 + | Fri Mar 01 17:32:01 1996 + | Mon Dec 30 17:32:01 1996 + | Tue Dec 31 17:32:01 1996 + | Wed Jan 01 17:32:01 1997 | Thu Jan 02 00:00:00 1997 | Thu Jan 02 03:04:05 1997 + | Mon Feb 10 17:32:00 1997 + | Mon Feb 10 17:32:01 1997 + | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 17:32:01 1997 - | Sat Sep 22 18:19:20 2001 - | Wed Mar 15 08:14:01 2000 - | Wed Mar 15 13:14:02 2000 - | Wed Mar 15 12:14:03 2000 - | Wed Mar 15 03:14:04 2000 - | Wed Mar 15 02:14:05 2000 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:00 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 @@ -217,66 +218,53 @@ SELECT '' AS "64", d1 FROM TIMESTAMP_TBL; | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 18:32:01 1997 | Mon Feb 10 17:32:01 1997 + | Mon Feb 10 17:32:01.4 1997 + | Mon Feb 10 17:32:01.5 1997 + | Mon Feb 10 17:32:01.6 1997 + | Mon Feb 10 17:32:02 1997 | Tue Feb 11 17:32:01 1997 | Wed Feb 12 17:32:01 1997 | Thu Feb 13 17:32:01 1997 | Fri Feb 14 17:32:01 1997 | Sat Feb 15 17:32:01 1997 | Sun Feb 16 17:32:01 1997 - | Tue Feb 16 17:32:01 0097 BC - | Sat Feb 16 17:32:01 0097 - | Thu Feb 16 17:32:01 0597 - | Tue Feb 16 17:32:01 1097 - | Sat Feb 16 17:32:01 1697 - | Thu Feb 16 17:32:01 1797 - | Tue Feb 16 17:32:01 1897 | Sun Feb 16 17:32:01 1997 - | Sat Feb 16 17:32:01 2097 - | Wed Feb 28 17:32:01 1996 - | Thu Feb 29 17:32:01 1996 - | Fri Mar 01 17:32:01 1996 - | Mon Dec 30 17:32:01 1996 - | Tue Dec 31 17:32:01 1996 - | Wed Jan 01 17:32:01 1997 | Fri Feb 28 17:32:01 1997 | Sat Mar 01 17:32:01 1997 + | Tue Jun 10 17:32:01 1997 + | Tue Jun 10 18:32:01 1997 | Tue Dec 30 17:32:01 1997 | Wed Dec 31 17:32:01 1997 | Fri Dec 31 17:32:01 1999 | Sat Jan 01 17:32:01 2000 + | Wed Mar 15 02:14:05 2000 + | Wed Mar 15 03:14:04 2000 + | Wed Mar 15 08:14:01 2000 + | Wed Mar 15 12:14:03 2000 + | Wed Mar 15 13:14:02 2000 | Sun Dec 31 17:32:01 2000 | Mon Jan 01 17:32:01 2001 + | Sat Sep 22 18:19:20 2001 + | Sat Feb 16 17:32:01 2097 + | infinity (65 rows) -- Demonstrate functions and operators SELECT '' AS "48", d1 FROM TIMESTAMP_TBL - WHERE d1 > timestamp without time zone '1997-01-02'; + WHERE d1 > timestamp without time zone '1997-01-02' ORDER BY d1; 48 | d1 ----+---------------------------- - | infinity + | Thu Jan 02 03:04:05 1997 + | Mon Feb 10 17:32:00 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:02 1997 - | Mon Feb 10 17:32:01.4 1997 - | Mon Feb 10 17:32:01.5 1997 - | Mon Feb 10 17:32:01.6 1997 - | Thu Jan 02 03:04:05 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 17:32:01 1997 - | Sat Sep 22 18:19:20 2001 - | Wed Mar 15 08:14:01 2000 - | Wed Mar 15 13:14:02 2000 - | Wed Mar 15 12:14:03 2000 - | Wed Mar 15 03:14:04 2000 - | Wed Mar 15 02:14:05 2000 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:00 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 @@ -286,8 +274,11 @@ SELECT '' AS "48", d1 FROM TIMESTAMP_TBL | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 18:32:01 1997 | Mon Feb 10 17:32:01 1997 + | Mon Feb 10 17:32:01.4 1997 + | Mon Feb 10 17:32:01.5 1997 + | Mon Feb 10 17:32:01.6 1997 + | Mon Feb 10 17:32:02 1997 | Tue Feb 11 17:32:01 1997 | Wed Feb 12 17:32:01 1997 | Thu Feb 13 17:32:01 1997 @@ -295,15 +286,24 @@ SELECT '' AS "48", d1 FROM TIMESTAMP_TBL | Sat Feb 15 17:32:01 1997 | Sun Feb 16 17:32:01 1997 | Sun Feb 16 17:32:01 1997 - | Sat Feb 16 17:32:01 2097 | Fri Feb 28 17:32:01 1997 | Sat Mar 01 17:32:01 1997 + | Tue Jun 10 17:32:01 1997 + | Tue Jun 10 18:32:01 1997 | Tue Dec 30 17:32:01 1997 | Wed Dec 31 17:32:01 1997 | Fri Dec 31 17:32:01 1999 | Sat Jan 01 17:32:01 2000 + | Wed Mar 15 02:14:05 2000 + | Wed Mar 15 03:14:04 2000 + | Wed Mar 15 08:14:01 2000 + | Wed Mar 15 12:14:03 2000 + | Wed Mar 15 13:14:02 2000 | Sun Dec 31 17:32:01 2000 | Mon Jan 01 17:32:01 2001 + | Sat Sep 22 18:19:20 2001 + | Sat Feb 16 17:32:01 2097 + | infinity (49 rows) SELECT '' AS "15", d1 FROM TIMESTAMP_TBL @@ -328,40 +328,41 @@ SELECT '' AS "15", d1 FROM TIMESTAMP_TBL (15 rows) SELECT '' AS one, d1 FROM TIMESTAMP_TBL - WHERE d1 = timestamp without time zone '1997-01-02'; + WHERE d1 = timestamp without time zone '1997-01-02' ORDER BY d1; one | d1 -----+-------------------------- | Thu Jan 02 00:00:00 1997 (1 row) SELECT '' AS "63", d1 FROM TIMESTAMP_TBL - WHERE d1 != timestamp without time zone '1997-01-02'; + WHERE d1 != timestamp without time zone '1997-01-02' ORDER BY d1; 63 | d1 ----+----------------------------- | -infinity - | infinity + | Tue Feb 16 17:32:01 0097 BC + | Sat Feb 16 17:32:01 0097 + | Thu Feb 16 17:32:01 0597 + | Tue Feb 16 17:32:01 1097 + | Sat Feb 16 17:32:01 1697 + | Thu Feb 16 17:32:01 1797 + | Tue Feb 16 17:32:01 1897 | Thu Jan 01 00:00:00 1970 + | Wed Feb 28 17:32:01 1996 + | Thu Feb 29 17:32:01 1996 + | Fri Mar 01 17:32:01 1996 + | Mon Dec 30 17:32:01 1996 + | Tue Dec 31 17:32:01 1996 + | Wed Jan 01 17:32:01 1997 + | Thu Jan 02 03:04:05 1997 + | Mon Feb 10 17:32:00 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:02 1997 - | Mon Feb 10 17:32:01.4 1997 - | Mon Feb 10 17:32:01.5 1997 - | Mon Feb 10 17:32:01.6 1997 - | Thu Jan 02 03:04:05 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 17:32:01 1997 - | Sat Sep 22 18:19:20 2001 - | Wed Mar 15 08:14:01 2000 - | Wed Mar 15 13:14:02 2000 - | Wed Mar 15 12:14:03 2000 - | Wed Mar 15 03:14:04 2000 - | Wed Mar 15 02:14:05 2000 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:00 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 @@ -371,46 +372,43 @@ SELECT '' AS "63", d1 FROM TIMESTAMP_TBL | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 18:32:01 1997 | Mon Feb 10 17:32:01 1997 + | Mon Feb 10 17:32:01.4 1997 + | Mon Feb 10 17:32:01.5 1997 + | Mon Feb 10 17:32:01.6 1997 + | Mon Feb 10 17:32:02 1997 | Tue Feb 11 17:32:01 1997 | Wed Feb 12 17:32:01 1997 | Thu Feb 13 17:32:01 1997 | Fri Feb 14 17:32:01 1997 | Sat Feb 15 17:32:01 1997 | Sun Feb 16 17:32:01 1997 - | Tue Feb 16 17:32:01 0097 BC - | Sat Feb 16 17:32:01 0097 - | Thu Feb 16 17:32:01 0597 - | Tue Feb 16 17:32:01 1097 - | Sat Feb 16 17:32:01 1697 - | Thu Feb 16 17:32:01 1797 - | Tue Feb 16 17:32:01 1897 | Sun Feb 16 17:32:01 1997 - | Sat Feb 16 17:32:01 2097 - | Wed Feb 28 17:32:01 1996 - | Thu Feb 29 17:32:01 1996 - | Fri Mar 01 17:32:01 1996 - | Mon Dec 30 17:32:01 1996 - | Tue Dec 31 17:32:01 1996 - | Wed Jan 01 17:32:01 1997 | Fri Feb 28 17:32:01 1997 | Sat Mar 01 17:32:01 1997 + | Tue Jun 10 17:32:01 1997 + | Tue Jun 10 18:32:01 1997 | Tue Dec 30 17:32:01 1997 | Wed Dec 31 17:32:01 1997 | Fri Dec 31 17:32:01 1999 | Sat Jan 01 17:32:01 2000 + | Wed Mar 15 02:14:05 2000 + | Wed Mar 15 03:14:04 2000 + | Wed Mar 15 08:14:01 2000 + | Wed Mar 15 12:14:03 2000 + | Wed Mar 15 13:14:02 2000 | Sun Dec 31 17:32:01 2000 | Mon Jan 01 17:32:01 2001 + | Sat Sep 22 18:19:20 2001 + | Sat Feb 16 17:32:01 2097 + | infinity (64 rows) SELECT '' AS "16", d1 FROM TIMESTAMP_TBL - WHERE d1 <= timestamp without time zone '1997-01-02'; + WHERE d1 <= timestamp without time zone '1997-01-02' ORDER BY d1; 16 | d1 ----+----------------------------- | -infinity - | Thu Jan 01 00:00:00 1970 - | Thu Jan 02 00:00:00 1997 | Tue Feb 16 17:32:01 0097 BC | Sat Feb 16 17:32:01 0097 | Thu Feb 16 17:32:01 0597 @@ -418,41 +416,30 @@ SELECT '' AS "16", d1 FROM TIMESTAMP_TBL | Sat Feb 16 17:32:01 1697 | Thu Feb 16 17:32:01 1797 | Tue Feb 16 17:32:01 1897 + | Thu Jan 01 00:00:00 1970 | Wed Feb 28 17:32:01 1996 | Thu Feb 29 17:32:01 1996 | Fri Mar 01 17:32:01 1996 | Mon Dec 30 17:32:01 1996 | Tue Dec 31 17:32:01 1996 | Wed Jan 01 17:32:01 1997 + | Thu Jan 02 00:00:00 1997 (16 rows) SELECT '' AS "49", d1 FROM TIMESTAMP_TBL - WHERE d1 >= timestamp without time zone '1997-01-02'; + WHERE d1 >= timestamp without time zone '1997-01-02' ORDER BY d1; 49 | d1 ----+---------------------------- - | infinity - | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:02 1997 - | Mon Feb 10 17:32:01.4 1997 - | Mon Feb 10 17:32:01.5 1997 - | Mon Feb 10 17:32:01.6 1997 | Thu Jan 02 00:00:00 1997 | Thu Jan 02 03:04:05 1997 + | Mon Feb 10 17:32:00 1997 + | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 17:32:01 1997 - | Sat Sep 22 18:19:20 2001 - | Wed Mar 15 08:14:01 2000 - | Wed Mar 15 13:14:02 2000 - | Wed Mar 15 12:14:03 2000 - | Wed Mar 15 03:14:04 2000 - | Wed Mar 15 02:14:05 2000 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Mon Feb 10 17:32:00 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 @@ -462,8 +449,12 @@ SELECT '' AS "49", d1 FROM TIMESTAMP_TBL | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997 - | Tue Jun 10 18:32:01 1997 | Mon Feb 10 17:32:01 1997 + | Mon Feb 10 17:32:01 1997 + | Mon Feb 10 17:32:01.4 1997 + | Mon Feb 10 17:32:01.5 1997 + | Mon Feb 10 17:32:01.6 1997 + | Mon Feb 10 17:32:02 1997 | Tue Feb 11 17:32:01 1997 | Wed Feb 12 17:32:01 1997 | Thu Feb 13 17:32:01 1997 @@ -471,44 +462,46 @@ SELECT '' AS "49", d1 FROM TIMESTAMP_TBL | Sat Feb 15 17:32:01 1997 | Sun Feb 16 17:32:01 1997 | Sun Feb 16 17:32:01 1997 - | Sat Feb 16 17:32:01 2097 | Fri Feb 28 17:32:01 1997 | Sat Mar 01 17:32:01 1997 + | Tue Jun 10 17:32:01 1997 + | Tue Jun 10 18:32:01 1997 | Tue Dec 30 17:32:01 1997 | Wed Dec 31 17:32:01 1997 | Fri Dec 31 17:32:01 1999 | Sat Jan 01 17:32:01 2000 + | Wed Mar 15 02:14:05 2000 + | Wed Mar 15 03:14:04 2000 + | Wed Mar 15 08:14:01 2000 + | Wed Mar 15 12:14:03 2000 + | Wed Mar 15 13:14:02 2000 | Sun Dec 31 17:32:01 2000 | Mon Jan 01 17:32:01 2001 + | Sat Sep 22 18:19:20 2001 + | Sat Feb 16 17:32:01 2097 + | infinity (50 rows) SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff - FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; 54 | diff ----+---------------------------------------- | @ 9863 days ago - | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins 2 secs - | @ 39 days 17 hours 32 mins 1.4 secs - | @ 39 days 17 hours 32 mins 1.5 secs - | @ 39 days 17 hours 32 mins 1.6 secs + | @ 308 days 6 hours 27 mins 59 secs ago + | @ 307 days 6 hours 27 mins 59 secs ago + | @ 306 days 6 hours 27 mins 59 secs ago + | @ 2 days 6 hours 27 mins 59 secs ago + | @ 1 day 6 hours 27 mins 59 secs ago + | @ 6 hours 27 mins 59 secs ago | @ 0 | @ 3 hours 4 mins 5 secs + | @ 39 days 17 hours 32 mins | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 159 days 17 hours 32 mins 1 sec - | @ 1724 days 18 hours 19 mins 20 secs - | @ 1168 days 8 hours 14 mins 1 sec - | @ 1168 days 13 hours 14 mins 2 secs - | @ 1168 days 12 hours 14 mins 3 secs - | @ 1168 days 3 hours 14 mins 4 secs - | @ 1168 days 2 hours 14 mins 5 secs | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec @@ -518,8 +511,13 @@ SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 159 days 18 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1.4 secs + | @ 39 days 17 hours 32 mins 1.5 secs + | @ 39 days 17 hours 32 mins 1.6 secs + | @ 39 days 17 hours 32 mins 2 secs | @ 40 days 17 hours 32 mins 1 sec | @ 41 days 17 hours 32 mins 1 sec | @ 42 days 17 hours 32 mins 1 sec @@ -527,20 +525,22 @@ SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff | @ 44 days 17 hours 32 mins 1 sec | @ 45 days 17 hours 32 mins 1 sec | @ 45 days 17 hours 32 mins 1 sec - | @ 308 days 6 hours 27 mins 59 secs ago - | @ 307 days 6 hours 27 mins 59 secs ago - | @ 306 days 6 hours 27 mins 59 secs ago - | @ 2 days 6 hours 27 mins 59 secs ago - | @ 1 day 6 hours 27 mins 59 secs ago - | @ 6 hours 27 mins 59 secs ago | @ 57 days 17 hours 32 mins 1 sec | @ 58 days 17 hours 32 mins 1 sec + | @ 159 days 17 hours 32 mins 1 sec + | @ 159 days 18 hours 32 mins 1 sec | @ 362 days 17 hours 32 mins 1 sec | @ 363 days 17 hours 32 mins 1 sec | @ 1093 days 17 hours 32 mins 1 sec | @ 1094 days 17 hours 32 mins 1 sec + | @ 1168 days 2 hours 14 mins 5 secs + | @ 1168 days 3 hours 14 mins 4 secs + | @ 1168 days 8 hours 14 mins 1 sec + | @ 1168 days 12 hours 14 mins 3 secs + | @ 1168 days 13 hours 14 mins 2 secs | @ 1459 days 17 hours 32 mins 1 sec | @ 1460 days 17 hours 32 mins 1 sec + | @ 1724 days 18 hours 19 mins 20 secs (55 rows) SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp '2004-02-29 15:44:17.71393' ) AS week_trunc; @@ -553,32 +553,27 @@ SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp '2004-02-29 15:44:17 SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff FROM TIMESTAMP_TBL WHERE d1 BETWEEN timestamp without time zone '1902-01-01' - AND timestamp without time zone '2038-01-01'; + AND timestamp without time zone '2038-01-01' ORDER BY d1; 54 | diff ----+---------------------------------------- | @ 9863 days ago - | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins 2 secs - | @ 39 days 17 hours 32 mins 1.4 secs - | @ 39 days 17 hours 32 mins 1.5 secs - | @ 39 days 17 hours 32 mins 1.6 secs + | @ 308 days 6 hours 27 mins 59 secs ago + | @ 307 days 6 hours 27 mins 59 secs ago + | @ 306 days 6 hours 27 mins 59 secs ago + | @ 2 days 6 hours 27 mins 59 secs ago + | @ 1 day 6 hours 27 mins 59 secs ago + | @ 6 hours 27 mins 59 secs ago | @ 0 | @ 3 hours 4 mins 5 secs + | @ 39 days 17 hours 32 mins + | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 159 days 17 hours 32 mins 1 sec - | @ 1724 days 18 hours 19 mins 20 secs - | @ 1168 days 8 hours 14 mins 1 sec - | @ 1168 days 13 hours 14 mins 2 secs - | @ 1168 days 12 hours 14 mins 3 secs - | @ 1168 days 3 hours 14 mins 4 secs - | @ 1168 days 2 hours 14 mins 5 secs | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec @@ -588,8 +583,11 @@ SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 159 days 18 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1.4 secs + | @ 39 days 17 hours 32 mins 1.5 secs + | @ 39 days 17 hours 32 mins 1.6 secs + | @ 39 days 17 hours 32 mins 2 secs | @ 40 days 17 hours 32 mins 1 sec | @ 41 days 17 hours 32 mins 1 sec | @ 42 days 17 hours 32 mins 1 sec @@ -597,52 +595,48 @@ SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff | @ 44 days 17 hours 32 mins 1 sec | @ 45 days 17 hours 32 mins 1 sec | @ 45 days 17 hours 32 mins 1 sec - | @ 308 days 6 hours 27 mins 59 secs ago - | @ 307 days 6 hours 27 mins 59 secs ago - | @ 306 days 6 hours 27 mins 59 secs ago - | @ 2 days 6 hours 27 mins 59 secs ago - | @ 1 day 6 hours 27 mins 59 secs ago - | @ 6 hours 27 mins 59 secs ago | @ 57 days 17 hours 32 mins 1 sec | @ 58 days 17 hours 32 mins 1 sec + | @ 159 days 17 hours 32 mins 1 sec + | @ 159 days 18 hours 32 mins 1 sec | @ 362 days 17 hours 32 mins 1 sec | @ 363 days 17 hours 32 mins 1 sec | @ 1093 days 17 hours 32 mins 1 sec | @ 1094 days 17 hours 32 mins 1 sec + | @ 1168 days 2 hours 14 mins 5 secs + | @ 1168 days 3 hours 14 mins 4 secs + | @ 1168 days 8 hours 14 mins 1 sec + | @ 1168 days 12 hours 14 mins 3 secs + | @ 1168 days 13 hours 14 mins 2 secs | @ 1459 days 17 hours 32 mins 1 sec | @ 1460 days 17 hours 32 mins 1 sec + | @ 1724 days 18 hours 19 mins 20 secs (55 rows) SELECT '' AS "54", d1 as "timestamp", date_part( 'year', d1) AS year, date_part( 'month', d1) AS month, date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour, date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second - FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; 54 | timestamp | year | month | day | hour | minute | second ----+----------------------------+------+-------+-----+------+--------+-------- | Thu Jan 01 00:00:00 1970 | 1970 | 1 | 1 | 0 | 0 | 0 - | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 - | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 - | Mon Feb 10 17:32:02 1997 | 1997 | 2 | 10 | 17 | 32 | 2 - | Mon Feb 10 17:32:01.4 1997 | 1997 | 2 | 10 | 17 | 32 | 1.4 - | Mon Feb 10 17:32:01.5 1997 | 1997 | 2 | 10 | 17 | 32 | 1.5 - | Mon Feb 10 17:32:01.6 1997 | 1997 | 2 | 10 | 17 | 32 | 1.6 + | Wed Feb 28 17:32:01 1996 | 1996 | 2 | 28 | 17 | 32 | 1 + | Thu Feb 29 17:32:01 1996 | 1996 | 2 | 29 | 17 | 32 | 1 + | Fri Mar 01 17:32:01 1996 | 1996 | 3 | 1 | 17 | 32 | 1 + | Mon Dec 30 17:32:01 1996 | 1996 | 12 | 30 | 17 | 32 | 1 + | Tue Dec 31 17:32:01 1996 | 1996 | 12 | 31 | 17 | 32 | 1 + | Wed Jan 01 17:32:01 1997 | 1997 | 1 | 1 | 17 | 32 | 1 | Thu Jan 02 00:00:00 1997 | 1997 | 1 | 2 | 0 | 0 | 0 | Thu Jan 02 03:04:05 1997 | 1997 | 1 | 2 | 3 | 4 | 5 + | Mon Feb 10 17:32:00 1997 | 1997 | 2 | 10 | 17 | 32 | 0 + | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 - | Tue Jun 10 17:32:01 1997 | 1997 | 6 | 10 | 17 | 32 | 1 - | Sat Sep 22 18:19:20 2001 | 2001 | 9 | 22 | 18 | 19 | 20 - | Wed Mar 15 08:14:01 2000 | 2000 | 3 | 15 | 8 | 14 | 1 - | Wed Mar 15 13:14:02 2000 | 2000 | 3 | 15 | 13 | 14 | 2 - | Wed Mar 15 12:14:03 2000 | 2000 | 3 | 15 | 12 | 14 | 3 - | Wed Mar 15 03:14:04 2000 | 2000 | 3 | 15 | 3 | 14 | 4 - | Wed Mar 15 02:14:05 2000 | 2000 | 3 | 15 | 2 | 14 | 5 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 - | Mon Feb 10 17:32:00 1997 | 1997 | 2 | 10 | 17 | 32 | 0 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 @@ -652,8 +646,12 @@ SELECT '' AS "54", d1 as "timestamp", | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 - | Tue Jun 10 18:32:01 1997 | 1997 | 6 | 10 | 18 | 32 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 + | Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1 + | Mon Feb 10 17:32:01.4 1997 | 1997 | 2 | 10 | 17 | 32 | 1.4 + | Mon Feb 10 17:32:01.5 1997 | 1997 | 2 | 10 | 17 | 32 | 1.5 + | Mon Feb 10 17:32:01.6 1997 | 1997 | 2 | 10 | 17 | 32 | 1.6 + | Mon Feb 10 17:32:02 1997 | 1997 | 2 | 10 | 17 | 32 | 2 | Tue Feb 11 17:32:01 1997 | 1997 | 2 | 11 | 17 | 32 | 1 | Wed Feb 12 17:32:01 1997 | 1997 | 2 | 12 | 17 | 32 | 1 | Thu Feb 13 17:32:01 1997 | 1997 | 2 | 13 | 17 | 32 | 1 @@ -661,51 +659,46 @@ SELECT '' AS "54", d1 as "timestamp", | Sat Feb 15 17:32:01 1997 | 1997 | 2 | 15 | 17 | 32 | 1 | Sun Feb 16 17:32:01 1997 | 1997 | 2 | 16 | 17 | 32 | 1 | Sun Feb 16 17:32:01 1997 | 1997 | 2 | 16 | 17 | 32 | 1 - | Wed Feb 28 17:32:01 1996 | 1996 | 2 | 28 | 17 | 32 | 1 - | Thu Feb 29 17:32:01 1996 | 1996 | 2 | 29 | 17 | 32 | 1 - | Fri Mar 01 17:32:01 1996 | 1996 | 3 | 1 | 17 | 32 | 1 - | Mon Dec 30 17:32:01 1996 | 1996 | 12 | 30 | 17 | 32 | 1 - | Tue Dec 31 17:32:01 1996 | 1996 | 12 | 31 | 17 | 32 | 1 - | Wed Jan 01 17:32:01 1997 | 1997 | 1 | 1 | 17 | 32 | 1 | Fri Feb 28 17:32:01 1997 | 1997 | 2 | 28 | 17 | 32 | 1 | Sat Mar 01 17:32:01 1997 | 1997 | 3 | 1 | 17 | 32 | 1 + | Tue Jun 10 17:32:01 1997 | 1997 | 6 | 10 | 17 | 32 | 1 + | Tue Jun 10 18:32:01 1997 | 1997 | 6 | 10 | 18 | 32 | 1 | Tue Dec 30 17:32:01 1997 | 1997 | 12 | 30 | 17 | 32 | 1 | Wed Dec 31 17:32:01 1997 | 1997 | 12 | 31 | 17 | 32 | 1 | Fri Dec 31 17:32:01 1999 | 1999 | 12 | 31 | 17 | 32 | 1 | Sat Jan 01 17:32:01 2000 | 2000 | 1 | 1 | 17 | 32 | 1 + | Wed Mar 15 02:14:05 2000 | 2000 | 3 | 15 | 2 | 14 | 5 + | Wed Mar 15 03:14:04 2000 | 2000 | 3 | 15 | 3 | 14 | 4 + | Wed Mar 15 08:14:01 2000 | 2000 | 3 | 15 | 8 | 14 | 1 + | Wed Mar 15 12:14:03 2000 | 2000 | 3 | 15 | 12 | 14 | 3 + | Wed Mar 15 13:14:02 2000 | 2000 | 3 | 15 | 13 | 14 | 2 | Sun Dec 31 17:32:01 2000 | 2000 | 12 | 31 | 17 | 32 | 1 | Mon Jan 01 17:32:01 2001 | 2001 | 1 | 1 | 17 | 32 | 1 + | Sat Sep 22 18:19:20 2001 | 2001 | 9 | 22 | 18 | 19 | 20 (55 rows) SELECT '' AS "54", d1 as "timestamp", date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec, date_part( 'usec', d1) AS usec - FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; 54 | timestamp | quarter | msec | usec ----+----------------------------+---------+-------+---------- | Thu Jan 01 00:00:00 1970 | 1 | 0 | 0 - | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 - | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 - | Mon Feb 10 17:32:02 1997 | 1 | 2000 | 2000000 - | Mon Feb 10 17:32:01.4 1997 | 1 | 1400 | 1400000 - | Mon Feb 10 17:32:01.5 1997 | 1 | 1500 | 1500000 - | Mon Feb 10 17:32:01.6 1997 | 1 | 1600 | 1600000 + | Wed Feb 28 17:32:01 1996 | 1 | 1000 | 1000000 + | Thu Feb 29 17:32:01 1996 | 1 | 1000 | 1000000 + | Fri Mar 01 17:32:01 1996 | 1 | 1000 | 1000000 + | Mon Dec 30 17:32:01 1996 | 4 | 1000 | 1000000 + | Tue Dec 31 17:32:01 1996 | 4 | 1000 | 1000000 + | Wed Jan 01 17:32:01 1997 | 1 | 1000 | 1000000 | Thu Jan 02 00:00:00 1997 | 1 | 0 | 0 | Thu Jan 02 03:04:05 1997 | 1 | 5000 | 5000000 + | Mon Feb 10 17:32:00 1997 | 1 | 0 | 0 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 - | Tue Jun 10 17:32:01 1997 | 2 | 1000 | 1000000 - | Sat Sep 22 18:19:20 2001 | 3 | 20000 | 20000000 - | Wed Mar 15 08:14:01 2000 | 1 | 1000 | 1000000 - | Wed Mar 15 13:14:02 2000 | 1 | 2000 | 2000000 - | Wed Mar 15 12:14:03 2000 | 1 | 3000 | 3000000 - | Wed Mar 15 03:14:04 2000 | 1 | 4000 | 4000000 - | Wed Mar 15 02:14:05 2000 | 1 | 5000 | 5000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 - | Mon Feb 10 17:32:00 1997 | 1 | 0 | 0 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 @@ -715,8 +708,13 @@ SELECT '' AS "54", d1 as "timestamp", | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 - | Tue Jun 10 18:32:01 1997 | 2 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 + | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 + | Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000 + | Mon Feb 10 17:32:01.4 1997 | 1 | 1400 | 1400000 + | Mon Feb 10 17:32:01.5 1997 | 1 | 1500 | 1500000 + | Mon Feb 10 17:32:01.6 1997 | 1 | 1600 | 1600000 + | Mon Feb 10 17:32:02 1997 | 1 | 2000 | 2000000 | Tue Feb 11 17:32:01 1997 | 1 | 1000 | 1000000 | Wed Feb 12 17:32:01 1997 | 1 | 1000 | 1000000 | Thu Feb 13 17:32:01 1997 | 1 | 1000 | 1000000 @@ -724,51 +722,46 @@ SELECT '' AS "54", d1 as "timestamp", | Sat Feb 15 17:32:01 1997 | 1 | 1000 | 1000000 | Sun Feb 16 17:32:01 1997 | 1 | 1000 | 1000000 | Sun Feb 16 17:32:01 1997 | 1 | 1000 | 1000000 - | Wed Feb 28 17:32:01 1996 | 1 | 1000 | 1000000 - | Thu Feb 29 17:32:01 1996 | 1 | 1000 | 1000000 - | Fri Mar 01 17:32:01 1996 | 1 | 1000 | 1000000 - | Mon Dec 30 17:32:01 1996 | 4 | 1000 | 1000000 - | Tue Dec 31 17:32:01 1996 | 4 | 1000 | 1000000 - | Wed Jan 01 17:32:01 1997 | 1 | 1000 | 1000000 | Fri Feb 28 17:32:01 1997 | 1 | 1000 | 1000000 | Sat Mar 01 17:32:01 1997 | 1 | 1000 | 1000000 + | Tue Jun 10 17:32:01 1997 | 2 | 1000 | 1000000 + | Tue Jun 10 18:32:01 1997 | 2 | 1000 | 1000000 | Tue Dec 30 17:32:01 1997 | 4 | 1000 | 1000000 | Wed Dec 31 17:32:01 1997 | 4 | 1000 | 1000000 | Fri Dec 31 17:32:01 1999 | 4 | 1000 | 1000000 | Sat Jan 01 17:32:01 2000 | 1 | 1000 | 1000000 + | Wed Mar 15 02:14:05 2000 | 1 | 5000 | 5000000 + | Wed Mar 15 03:14:04 2000 | 1 | 4000 | 4000000 + | Wed Mar 15 08:14:01 2000 | 1 | 1000 | 1000000 + | Wed Mar 15 12:14:03 2000 | 1 | 3000 | 3000000 + | Wed Mar 15 13:14:02 2000 | 1 | 2000 | 2000000 | Sun Dec 31 17:32:01 2000 | 4 | 1000 | 1000000 | Mon Jan 01 17:32:01 2001 | 1 | 1000 | 1000000 + | Sat Sep 22 18:19:20 2001 | 3 | 20000 | 20000000 (55 rows) SELECT '' AS "54", d1 as "timestamp", date_part( 'isoyear', d1) AS isoyear, date_part( 'week', d1) AS week, date_part( 'dow', d1) AS dow - FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; 54 | timestamp | isoyear | week | dow ----+----------------------------+---------+------+----- | Thu Jan 01 00:00:00 1970 | 1970 | 1 | 4 - | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 - | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 - | Mon Feb 10 17:32:02 1997 | 1997 | 7 | 1 - | Mon Feb 10 17:32:01.4 1997 | 1997 | 7 | 1 - | Mon Feb 10 17:32:01.5 1997 | 1997 | 7 | 1 - | Mon Feb 10 17:32:01.6 1997 | 1997 | 7 | 1 + | Wed Feb 28 17:32:01 1996 | 1996 | 9 | 3 + | Thu Feb 29 17:32:01 1996 | 1996 | 9 | 4 + | Fri Mar 01 17:32:01 1996 | 1996 | 9 | 5 + | Mon Dec 30 17:32:01 1996 | 1997 | 1 | 1 + | Tue Dec 31 17:32:01 1996 | 1997 | 1 | 2 + | Wed Jan 01 17:32:01 1997 | 1997 | 1 | 3 | Thu Jan 02 00:00:00 1997 | 1997 | 1 | 4 | Thu Jan 02 03:04:05 1997 | 1997 | 1 | 4 + | Mon Feb 10 17:32:00 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 - | Tue Jun 10 17:32:01 1997 | 1997 | 24 | 2 - | Sat Sep 22 18:19:20 2001 | 2001 | 38 | 6 - | Wed Mar 15 08:14:01 2000 | 2000 | 11 | 3 - | Wed Mar 15 13:14:02 2000 | 2000 | 11 | 3 - | Wed Mar 15 12:14:03 2000 | 2000 | 11 | 3 - | Wed Mar 15 03:14:04 2000 | 2000 | 11 | 3 - | Wed Mar 15 02:14:05 2000 | 2000 | 11 | 3 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 - | Mon Feb 10 17:32:00 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 @@ -778,8 +771,13 @@ SELECT '' AS "54", d1 as "timestamp", | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 - | Tue Jun 10 18:32:01 1997 | 1997 | 24 | 2 | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 + | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 + | Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1 + | Mon Feb 10 17:32:01.4 1997 | 1997 | 7 | 1 + | Mon Feb 10 17:32:01.5 1997 | 1997 | 7 | 1 + | Mon Feb 10 17:32:01.6 1997 | 1997 | 7 | 1 + | Mon Feb 10 17:32:02 1997 | 1997 | 7 | 1 | Tue Feb 11 17:32:01 1997 | 1997 | 7 | 2 | Wed Feb 12 17:32:01 1997 | 1997 | 7 | 3 | Thu Feb 13 17:32:01 1997 | 1997 | 7 | 4 @@ -787,29 +785,45 @@ SELECT '' AS "54", d1 as "timestamp", | Sat Feb 15 17:32:01 1997 | 1997 | 7 | 6 | Sun Feb 16 17:32:01 1997 | 1997 | 7 | 0 | Sun Feb 16 17:32:01 1997 | 1997 | 7 | 0 - | Wed Feb 28 17:32:01 1996 | 1996 | 9 | 3 - | Thu Feb 29 17:32:01 1996 | 1996 | 9 | 4 - | Fri Mar 01 17:32:01 1996 | 1996 | 9 | 5 - | Mon Dec 30 17:32:01 1996 | 1997 | 1 | 1 - | Tue Dec 31 17:32:01 1996 | 1997 | 1 | 2 - | Wed Jan 01 17:32:01 1997 | 1997 | 1 | 3 | Fri Feb 28 17:32:01 1997 | 1997 | 9 | 5 | Sat Mar 01 17:32:01 1997 | 1997 | 9 | 6 + | Tue Jun 10 17:32:01 1997 | 1997 | 24 | 2 + | Tue Jun 10 18:32:01 1997 | 1997 | 24 | 2 | Tue Dec 30 17:32:01 1997 | 1998 | 1 | 2 | Wed Dec 31 17:32:01 1997 | 1998 | 1 | 3 | Fri Dec 31 17:32:01 1999 | 1999 | 52 | 5 | Sat Jan 01 17:32:01 2000 | 1999 | 52 | 6 + | Wed Mar 15 02:14:05 2000 | 2000 | 11 | 3 + | Wed Mar 15 03:14:04 2000 | 2000 | 11 | 3 + | Wed Mar 15 08:14:01 2000 | 2000 | 11 | 3 + | Wed Mar 15 12:14:03 2000 | 2000 | 11 | 3 + | Wed Mar 15 13:14:02 2000 | 2000 | 11 | 3 | Sun Dec 31 17:32:01 2000 | 2000 | 52 | 0 | Mon Jan 01 17:32:01 2001 | 2001 | 1 | 1 + | Sat Sep 22 18:19:20 2001 | 2001 | 38 | 6 (55 rows) -- TO_CHAR() SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_1 | to_char -----------+------------------------------------------------------------------------------------------ | - | + | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb + | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb + | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb + | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb + | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb + | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb + | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb + | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan + | WEDNESDAY Wednesday wednesday WED Wed wed FEBRUARY February february II FEB Feb feb + | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb + | FRIDAY Friday friday FRI Fri fri MARCH March march III MAR Mar mar + | MONDAY Monday monday MON Mon mon DECEMBER December december XII DEC Dec dec + | TUESDAY Tuesday tuesday TUE Tue tue DECEMBER December december XII DEC Dec dec + | WEDNESDAY Wednesday wednesday WED Wed wed JANUARY January january I JAN Jan jan + | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb @@ -817,19 +831,10 @@ SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM M | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan - | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue JUNE June june VI JUN Jun jun - | SATURDAY Saturday saturday SAT Sat sat SEPTEMBER September september IX SEP Sep sep - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb @@ -842,7 +847,6 @@ SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM M | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue JUNE June june VI JUN Jun jun | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb | WEDNESDAY Wednesday wednesday WED Wed wed FEBRUARY February february II FEB Feb feb @@ -850,37 +854,47 @@ SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM M | FRIDAY Friday friday FRI Fri fri FEBRUARY February february II FEB Feb feb | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb | SUNDAY Sunday sunday SUN Sun sun FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb - | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb - | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb | SUNDAY Sunday sunday SUN Sun sun FEBRUARY February february II FEB Feb feb - | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb - | WEDNESDAY Wednesday wednesday WED Wed wed FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb - | FRIDAY Friday friday FRI Fri fri MARCH March march III MAR Mar mar - | MONDAY Monday monday MON Mon mon DECEMBER December december XII DEC Dec dec - | TUESDAY Tuesday tuesday TUE Tue tue DECEMBER December december XII DEC Dec dec - | WEDNESDAY Wednesday wednesday WED Wed wed JANUARY January january I JAN Jan jan | FRIDAY Friday friday FRI Fri fri FEBRUARY February february II FEB Feb feb | SATURDAY Saturday saturday SAT Sat sat MARCH March march III MAR Mar mar + | TUESDAY Tuesday tuesday TUE Tue tue JUNE June june VI JUN Jun jun + | TUESDAY Tuesday tuesday TUE Tue tue JUNE June june VI JUN Jun jun | TUESDAY Tuesday tuesday TUE Tue tue DECEMBER December december XII DEC Dec dec | WEDNESDAY Wednesday wednesday WED Wed wed DECEMBER December december XII DEC Dec dec | FRIDAY Friday friday FRI Fri fri DECEMBER December december XII DEC Dec dec | SATURDAY Saturday saturday SAT Sat sat JANUARY January january I JAN Jan jan + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar | SUNDAY Sunday sunday SUN Sun sun DECEMBER December december XII DEC Dec dec | MONDAY Monday monday MON Mon mon JANUARY January january I JAN Jan jan + | SATURDAY Saturday saturday SAT Sat sat SEPTEMBER September september IX SEP Sep sep + | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb + | (65 rows) SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth FMRM') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_2 | to_char -----------+-------------------------------------------------------------- | - | + | TUESDAY Tuesday tuesday FEBRUARY February february II + | SATURDAY Saturday saturday FEBRUARY February february II + | THURSDAY Thursday thursday FEBRUARY February february II + | TUESDAY Tuesday tuesday FEBRUARY February february II + | SATURDAY Saturday saturday FEBRUARY February february II + | THURSDAY Thursday thursday FEBRUARY February february II + | TUESDAY Tuesday tuesday FEBRUARY February february II + | THURSDAY Thursday thursday JANUARY January january I + | WEDNESDAY Wednesday wednesday FEBRUARY February february II + | THURSDAY Thursday thursday FEBRUARY February february II + | FRIDAY Friday friday MARCH March march III + | MONDAY Monday monday DECEMBER December december XII + | TUESDAY Tuesday tuesday DECEMBER December december XII + | WEDNESDAY Wednesday wednesday JANUARY January january I + | THURSDAY Thursday thursday JANUARY January january I | THURSDAY Thursday thursday JANUARY January january I | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II @@ -888,19 +902,10 @@ SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth F | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II - | THURSDAY Thursday thursday JANUARY January january I - | THURSDAY Thursday thursday JANUARY January january I | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II - | TUESDAY Tuesday tuesday JUNE June june VI - | SATURDAY Saturday saturday SEPTEMBER September september IX - | WEDNESDAY Wednesday wednesday MARCH March march III - | WEDNESDAY Wednesday wednesday MARCH March march III - | WEDNESDAY Wednesday wednesday MARCH March march III - | WEDNESDAY Wednesday wednesday MARCH March march III - | WEDNESDAY Wednesday wednesday MARCH March march III | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II @@ -913,7 +918,6 @@ SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth F | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II - | TUESDAY Tuesday tuesday JUNE June june VI | MONDAY Monday monday FEBRUARY February february II | TUESDAY Tuesday tuesday FEBRUARY February february II | WEDNESDAY Wednesday wednesday FEBRUARY February february II @@ -921,57 +925,58 @@ SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth F | FRIDAY Friday friday FEBRUARY February february II | SATURDAY Saturday saturday FEBRUARY February february II | SUNDAY Sunday sunday FEBRUARY February february II - | TUESDAY Tuesday tuesday FEBRUARY February february II - | SATURDAY Saturday saturday FEBRUARY February february II - | THURSDAY Thursday thursday FEBRUARY February february II - | TUESDAY Tuesday tuesday FEBRUARY February february II - | SATURDAY Saturday saturday FEBRUARY February february II - | THURSDAY Thursday thursday FEBRUARY February february II - | TUESDAY Tuesday tuesday FEBRUARY February february II | SUNDAY Sunday sunday FEBRUARY February february II - | SATURDAY Saturday saturday FEBRUARY February february II - | WEDNESDAY Wednesday wednesday FEBRUARY February february II - | THURSDAY Thursday thursday FEBRUARY February february II - | FRIDAY Friday friday MARCH March march III - | MONDAY Monday monday DECEMBER December december XII - | TUESDAY Tuesday tuesday DECEMBER December december XII - | WEDNESDAY Wednesday wednesday JANUARY January january I | FRIDAY Friday friday FEBRUARY February february II | SATURDAY Saturday saturday MARCH March march III + | TUESDAY Tuesday tuesday JUNE June june VI + | TUESDAY Tuesday tuesday JUNE June june VI | TUESDAY Tuesday tuesday DECEMBER December december XII | WEDNESDAY Wednesday wednesday DECEMBER December december XII | FRIDAY Friday friday DECEMBER December december XII | SATURDAY Saturday saturday JANUARY January january I + | WEDNESDAY Wednesday wednesday MARCH March march III + | WEDNESDAY Wednesday wednesday MARCH March march III + | WEDNESDAY Wednesday wednesday MARCH March march III + | WEDNESDAY Wednesday wednesday MARCH March march III + | WEDNESDAY Wednesday wednesday MARCH March march III | SUNDAY Sunday sunday DECEMBER December december XII | MONDAY Monday monday JANUARY January january I + | SATURDAY Saturday saturday SEPTEMBER September september IX + | SATURDAY Saturday saturday FEBRUARY February february II + | (65 rows) SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_3 | to_char -----------+------------------------------------------------- | - | + | 0,097 0097 097 97 7 01 1 02 07 047 16 3 1686042 + | 0,097 0097 097 97 7 01 1 02 07 047 16 7 1756536 + | 0,597 0597 597 97 7 06 1 02 07 047 16 5 1939157 + | 1,097 1097 097 97 7 11 1 02 07 047 16 3 2121778 + | 1,697 1697 697 97 7 17 1 02 07 047 16 7 2340924 + | 1,797 1797 797 97 7 18 1 02 07 047 16 5 2377448 + | 1,897 1897 897 97 7 19 1 02 07 047 16 3 2413972 | 1,970 1970 970 70 0 20 1 01 01 001 01 5 2440588 + | 1,996 1996 996 96 6 20 1 02 09 059 28 4 2450142 + | 1,996 1996 996 96 6 20 1 02 09 060 29 5 2450143 + | 1,996 1996 996 96 6 20 1 03 09 061 01 6 2450144 + | 1,996 1996 996 96 6 20 4 12 53 365 30 2 2450448 + | 1,996 1996 996 96 6 20 4 12 53 366 31 3 2450449 + | 1,997 1997 997 97 7 20 1 01 01 001 01 4 2450450 + | 1,997 1997 997 97 7 20 1 01 01 002 02 5 2450451 + | 1,997 1997 997 97 7 20 1 01 01 002 02 5 2450451 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 - | 1,997 1997 997 97 7 20 1 01 01 002 02 5 2450451 - | 1,997 1997 997 97 7 20 1 01 01 002 02 5 2450451 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 - | 1,997 1997 997 97 7 20 2 06 23 161 10 3 2450610 - | 2,001 2001 001 01 1 21 3 09 38 265 22 7 2452175 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 @@ -984,7 +989,6 @@ SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 - | 1,997 1997 997 97 7 20 2 06 23 161 10 3 2450610 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 042 11 3 2450491 | 1,997 1997 997 97 7 20 1 02 07 043 12 4 2450492 @@ -992,57 +996,58 @@ SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') | 1,997 1997 997 97 7 20 1 02 07 045 14 6 2450494 | 1,997 1997 997 97 7 20 1 02 07 046 15 7 2450495 | 1,997 1997 997 97 7 20 1 02 07 047 16 1 2450496 - | 0,097 0097 097 97 7 01 1 02 07 047 16 3 1686042 - | 0,097 0097 097 97 7 01 1 02 07 047 16 7 1756536 - | 0,597 0597 597 97 7 06 1 02 07 047 16 5 1939157 - | 1,097 1097 097 97 7 11 1 02 07 047 16 3 2121778 - | 1,697 1697 697 97 7 17 1 02 07 047 16 7 2340924 - | 1,797 1797 797 97 7 18 1 02 07 047 16 5 2377448 - | 1,897 1897 897 97 7 19 1 02 07 047 16 3 2413972 | 1,997 1997 997 97 7 20 1 02 07 047 16 1 2450496 - | 2,097 2097 097 97 7 21 1 02 07 047 16 7 2487021 - | 1,996 1996 996 96 6 20 1 02 09 059 28 4 2450142 - | 1,996 1996 996 96 6 20 1 02 09 060 29 5 2450143 - | 1,996 1996 996 96 6 20 1 03 09 061 01 6 2450144 - | 1,996 1996 996 96 6 20 4 12 53 365 30 2 2450448 - | 1,996 1996 996 96 6 20 4 12 53 366 31 3 2450449 - | 1,997 1997 997 97 7 20 1 01 01 001 01 4 2450450 | 1,997 1997 997 97 7 20 1 02 09 059 28 6 2450508 | 1,997 1997 997 97 7 20 1 03 09 060 01 7 2450509 + | 1,997 1997 997 97 7 20 2 06 23 161 10 3 2450610 + | 1,997 1997 997 97 7 20 2 06 23 161 10 3 2450610 | 1,997 1997 997 97 7 20 4 12 52 364 30 3 2450813 | 1,997 1997 997 97 7 20 4 12 53 365 31 4 2450814 | 1,999 1999 999 99 9 20 4 12 53 365 31 6 2451544 | 2,000 2000 000 00 0 20 1 01 01 001 01 7 2451545 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 | 2,000 2000 000 00 0 20 4 12 53 366 31 1 2451910 | 2,001 2001 001 01 1 21 1 01 01 001 01 2 2451911 + | 2,001 2001 001 01 1 21 3 09 38 265 22 7 2452175 + | 2,097 2097 097 97 7 21 1 02 07 047 16 7 2487021 + | (65 rows) SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM FMWW FMDDD FMDD FMD FMJ') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_4 | to_char -----------+------------------------------------------------- | - | + | 0,097 97 097 97 7 1 1 2 7 47 16 3 1686042 + | 0,097 97 097 97 7 1 1 2 7 47 16 7 1756536 + | 0,597 597 597 97 7 6 1 2 7 47 16 5 1939157 + | 1,097 1097 097 97 7 11 1 2 7 47 16 3 2121778 + | 1,697 1697 697 97 7 17 1 2 7 47 16 7 2340924 + | 1,797 1797 797 97 7 18 1 2 7 47 16 5 2377448 + | 1,897 1897 897 97 7 19 1 2 7 47 16 3 2413972 | 1,970 1970 970 70 0 20 1 1 1 1 1 5 2440588 + | 1,996 1996 996 96 6 20 1 2 9 59 28 4 2450142 + | 1,996 1996 996 96 6 20 1 2 9 60 29 5 2450143 + | 1,996 1996 996 96 6 20 1 3 9 61 1 6 2450144 + | 1,996 1996 996 96 6 20 4 12 53 365 30 2 2450448 + | 1,996 1996 996 96 6 20 4 12 53 366 31 3 2450449 + | 1,997 1997 997 97 7 20 1 1 1 1 1 4 2450450 + | 1,997 1997 997 97 7 20 1 1 1 2 2 5 2450451 + | 1,997 1997 997 97 7 20 1 1 1 2 2 5 2450451 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 - | 1,997 1997 997 97 7 20 1 1 1 2 2 5 2450451 - | 1,997 1997 997 97 7 20 1 1 1 2 2 5 2450451 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 - | 1,997 1997 997 97 7 20 2 6 23 161 10 3 2450610 - | 2,001 2001 001 01 1 21 3 9 38 265 22 7 2452175 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 @@ -1055,7 +1060,6 @@ SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 - | 1,997 1997 997 97 7 20 2 6 23 161 10 3 2450610 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 42 11 3 2450491 | 1,997 1997 997 97 7 20 1 2 7 43 12 4 2450492 @@ -1063,59 +1067,48 @@ SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM | 1,997 1997 997 97 7 20 1 2 7 45 14 6 2450494 | 1,997 1997 997 97 7 20 1 2 7 46 15 7 2450495 | 1,997 1997 997 97 7 20 1 2 7 47 16 1 2450496 - | 0,097 97 097 97 7 1 1 2 7 47 16 3 1686042 - | 0,097 97 097 97 7 1 1 2 7 47 16 7 1756536 - | 0,597 597 597 97 7 6 1 2 7 47 16 5 1939157 - | 1,097 1097 097 97 7 11 1 2 7 47 16 3 2121778 - | 1,697 1697 697 97 7 17 1 2 7 47 16 7 2340924 - | 1,797 1797 797 97 7 18 1 2 7 47 16 5 2377448 - | 1,897 1897 897 97 7 19 1 2 7 47 16 3 2413972 | 1,997 1997 997 97 7 20 1 2 7 47 16 1 2450496 - | 2,097 2097 097 97 7 21 1 2 7 47 16 7 2487021 - | 1,996 1996 996 96 6 20 1 2 9 59 28 4 2450142 - | 1,996 1996 996 96 6 20 1 2 9 60 29 5 2450143 - | 1,996 1996 996 96 6 20 1 3 9 61 1 6 2450144 - | 1,996 1996 996 96 6 20 4 12 53 365 30 2 2450448 - | 1,996 1996 996 96 6 20 4 12 53 366 31 3 2450449 - | 1,997 1997 997 97 7 20 1 1 1 1 1 4 2450450 | 1,997 1997 997 97 7 20 1 2 9 59 28 6 2450508 | 1,997 1997 997 97 7 20 1 3 9 60 1 7 2450509 + | 1,997 1997 997 97 7 20 2 6 23 161 10 3 2450610 + | 1,997 1997 997 97 7 20 2 6 23 161 10 3 2450610 | 1,997 1997 997 97 7 20 4 12 52 364 30 3 2450813 | 1,997 1997 997 97 7 20 4 12 53 365 31 4 2450814 | 1,999 1999 999 99 9 20 4 12 53 365 31 6 2451544 | 2,000 2000 000 00 0 20 1 1 1 1 1 7 2451545 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 | 2,000 2000 000 00 0 20 4 12 53 366 31 1 2451910 | 2,001 2001 001 01 1 21 1 1 1 1 1 2 2451911 + | 2,001 2001 001 01 1 21 3 9 38 265 22 7 2452175 + | 2,097 2097 097 97 7 21 1 2 7 47 16 7 2487021 + | (65 rows) SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_5 | to_char -----------+---------------------- | - | - | 12 12 00 00 00 0 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 - | 05 05 17 32 02 63122 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 - | 12 12 00 00 00 0 - | 03 03 03 04 05 11045 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 12 12 00 00 00 0 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 - | 06 06 18 19 20 65960 - | 08 08 08 14 01 29641 - | 01 01 13 14 02 47642 - | 12 12 12 14 03 44043 - | 03 03 03 14 04 11644 - | 02 02 02 14 05 8045 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 05 05 17 32 01 63121 + | 12 12 00 00 00 0 + | 03 03 03 04 05 11045 | 05 05 17 32 00 63120 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 @@ -1126,8 +1119,6 @@ SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 - | 06 06 18 32 01 66721 - | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 @@ -1140,6 +1131,7 @@ SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 05 05 17 32 02 63122 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 @@ -1150,43 +1142,44 @@ SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 06 06 18 32 01 66721 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 02 02 02 14 05 8045 + | 03 03 03 14 04 11644 + | 08 08 08 14 01 29641 + | 12 12 12 14 03 44043 + | 01 01 13 14 02 47642 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 06 06 18 19 20 65960 | 05 05 17 32 01 63121 + | (65 rows) SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between quote marks\\""') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_6 | to_char -----------+------------------------------------------------- | - | - | HH:MI:SS is 12:00:00 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 05:32:02 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 12:00:00 "text between quote marks" - | HH:MI:SS is 03:04:05 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 12:00:00 "text between quote marks" + | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 06:19:20 "text between quote marks" - | HH:MI:SS is 08:14:01 "text between quote marks" - | HH:MI:SS is 01:14:02 "text between quote marks" - | HH:MI:SS is 12:14:03 "text between quote marks" - | HH:MI:SS is 03:14:04 "text between quote marks" - | HH:MI:SS is 02:14:05 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 12:00:00 "text between quote marks" + | HH:MI:SS is 03:04:05 "text between quote marks" | HH:MI:SS is 05:32:00 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" @@ -1197,8 +1190,6 @@ SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between qu | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 06:32:01 "text between quote marks" - | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" @@ -1211,6 +1202,7 @@ SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between qu | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 05:32:02 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" @@ -1221,45 +1213,45 @@ SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between qu | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 06:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 02:14:05 "text between quote marks" + | HH:MI:SS is 03:14:04 "text between quote marks" + | HH:MI:SS is 08:14:01 "text between quote marks" + | HH:MI:SS is 12:14:03 "text between quote marks" + | HH:MI:SS is 01:14:02 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 06:19:20 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | (65 rows) SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_7 | to_char -----------+------------------------ | - | - | 00--text--00--text--00 | 17--text--32--text--01 | 17--text--32--text--01 - | 17--text--32--text--02 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 - | 00--text--00--text--00 - | 03--text--04--text--05 | 17--text--32--text--01 | 17--text--32--text--01 + | 00--text--00--text--00 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 - | 18--text--19--text--20 - | 08--text--14--text--01 - | 13--text--14--text--02 - | 12--text--14--text--03 - | 03--text--14--text--04 - | 02--text--14--text--05 | 17--text--32--text--01 | 17--text--32--text--01 - | 17--text--32--text--00 | 17--text--32--text--01 + | 00--text--00--text--00 + | 03--text--04--text--05 + | 17--text--32--text--00 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 @@ -1268,7 +1260,6 @@ SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 - | 18--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 @@ -1282,6 +1273,7 @@ SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 + | 17--text--32--text--02 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 @@ -1292,41 +1284,54 @@ SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 + | 18--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 + | 02--text--14--text--05 + | 03--text--14--text--04 + | 08--text--14--text--01 + | 12--text--14--text--03 + | 13--text--14--text--02 | 17--text--32--text--01 | 17--text--32--text--01 + | 18--text--19--text--20 | 17--text--32--text--01 + | (65 rows) SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_8 | to_char -----------+------------------------- | - | + | 0097TH 0097th 1686042nd + | 0097TH 0097th 1756536th + | 0597TH 0597th 1939157th + | 1097TH 1097th 2121778th + | 1697TH 1697th 2340924th + | 1797TH 1797th 2377448th + | 1897TH 1897th 2413972nd | 1970TH 1970th 2440588th + | 1996TH 1996th 2450142nd + | 1996TH 1996th 2450143rd + | 1996TH 1996th 2450144th + | 1996TH 1996th 2450448th + | 1996TH 1996th 2450449th + | 1997TH 1997th 2450450th + | 1997TH 1997th 2450451st + | 1997TH 1997th 2450451st | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th - | 1997TH 1997th 2450451st - | 1997TH 1997th 2450451st | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th - | 1997TH 1997th 2450610th - | 2001ST 2001st 2452175th - | 2000TH 2000th 2451619th - | 2000TH 2000th 2451619th - | 2000TH 2000th 2451619th - | 2000TH 2000th 2451619th - | 2000TH 2000th 2451619th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th @@ -1339,7 +1344,6 @@ SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th - | 1997TH 1997th 2450610th | 1997TH 1997th 2450490th | 1997TH 1997th 2450491st | 1997TH 1997th 2450492nd @@ -1347,61 +1351,61 @@ SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') | 1997TH 1997th 2450494th | 1997TH 1997th 2450495th | 1997TH 1997th 2450496th - | 0097TH 0097th 1686042nd - | 0097TH 0097th 1756536th - | 0597TH 0597th 1939157th - | 1097TH 1097th 2121778th - | 1697TH 1697th 2340924th - | 1797TH 1797th 2377448th - | 1897TH 1897th 2413972nd | 1997TH 1997th 2450496th - | 2097TH 2097th 2487021st - | 1996TH 1996th 2450142nd - | 1996TH 1996th 2450143rd - | 1996TH 1996th 2450144th - | 1996TH 1996th 2450448th - | 1996TH 1996th 2450449th - | 1997TH 1997th 2450450th | 1997TH 1997th 2450508th | 1997TH 1997th 2450509th + | 1997TH 1997th 2450610th + | 1997TH 1997th 2450610th | 1997TH 1997th 2450813th | 1997TH 1997th 2450814th | 1999TH 1999th 2451544th | 2000TH 2000th 2451545th + | 2000TH 2000th 2451619th + | 2000TH 2000th 2451619th + | 2000TH 2000th 2451619th + | 2000TH 2000th 2451619th + | 2000TH 2000th 2451619th | 2000TH 2000th 2451910th | 2001ST 2001st 2451911th + | 2001ST 2001st 2452175th + | 2097TH 2097th 2487021st + | (65 rows) SELECT '' AS to_char_9, to_char(d1, 'YYYY A.D. YYYY a.d. YYYY bc HH:MI:SS P.M. HH:MI:SS p.m. HH:MI:SS pm') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_9 | to_char -----------+--------------------------------------------------------------------- | - | + | 0097 B.C. 0097 b.c. 0097 bc 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 0097 A.D. 0097 a.d. 0097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 0597 A.D. 0597 a.d. 0597 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1097 A.D. 1097 a.d. 1097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1697 A.D. 1697 a.d. 1697 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1797 A.D. 1797 a.d. 1797 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1897 A.D. 1897 a.d. 1897 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1970 A.D. 1970 a.d. 1970 ad 12:00:00 A.M. 12:00:00 a.m. 12:00:00 am + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1997 A.D. 1997 a.d. 1997 ad 12:00:00 A.M. 12:00:00 a.m. 12:00:00 am + | 1997 A.D. 1997 a.d. 1997 ad 03:04:05 A.M. 03:04:05 a.m. 03:04:05 am + | 1997 A.D. 1997 a.d. 1997 ad 05:32:00 P.M. 05:32:00 p.m. 05:32:00 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 05:32:02 P.M. 05:32:02 p.m. 05:32:02 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 12:00:00 A.M. 12:00:00 a.m. 12:00:00 am - | 1997 A.D. 1997 a.d. 1997 ad 03:04:05 A.M. 03:04:05 a.m. 03:04:05 am | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 2001 A.D. 2001 a.d. 2001 ad 06:19:20 P.M. 06:19:20 p.m. 06:19:20 pm - | 2000 A.D. 2000 a.d. 2000 ad 08:14:01 A.M. 08:14:01 a.m. 08:14:01 am - | 2000 A.D. 2000 a.d. 2000 ad 01:14:02 P.M. 01:14:02 p.m. 01:14:02 pm - | 2000 A.D. 2000 a.d. 2000 ad 12:14:03 P.M. 12:14:03 p.m. 12:14:03 pm - | 2000 A.D. 2000 a.d. 2000 ad 03:14:04 A.M. 03:14:04 a.m. 03:14:04 am - | 2000 A.D. 2000 a.d. 2000 ad 02:14:05 A.M. 02:14:05 a.m. 02:14:05 am | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 05:32:00 P.M. 05:32:00 p.m. 05:32:00 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm @@ -1411,65 +1415,66 @@ SELECT '' AS to_char_9, to_char(d1, 'YYYY A.D. YYYY a.d. YYYY bc HH:MI:SS P.M. H | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 06:32:01 P.M. 06:32:01 p.m. 06:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1997 A.D. 1997 a.d. 1997 ad 05:32:02 P.M. 05:32:02 p.m. 05:32:02 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 0097 B.C. 0097 b.c. 0097 bc 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 0097 A.D. 0097 a.d. 0097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 0597 A.D. 0597 a.d. 0597 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1097 A.D. 1097 a.d. 1097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1697 A.D. 1697 a.d. 1697 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1797 A.D. 1797 a.d. 1797 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1897 A.D. 1897 a.d. 1897 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 2097 A.D. 2097 a.d. 2097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1997 A.D. 1997 a.d. 1997 ad 06:32:01 P.M. 06:32:01 p.m. 06:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1999 A.D. 1999 a.d. 1999 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 2000 A.D. 2000 a.d. 2000 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 2000 A.D. 2000 a.d. 2000 ad 02:14:05 A.M. 02:14:05 a.m. 02:14:05 am + | 2000 A.D. 2000 a.d. 2000 ad 03:14:04 A.M. 03:14:04 a.m. 03:14:04 am + | 2000 A.D. 2000 a.d. 2000 ad 08:14:01 A.M. 08:14:01 a.m. 08:14:01 am + | 2000 A.D. 2000 a.d. 2000 ad 12:14:03 P.M. 12:14:03 p.m. 12:14:03 pm + | 2000 A.D. 2000 a.d. 2000 ad 01:14:02 P.M. 01:14:02 p.m. 01:14:02 pm | 2000 A.D. 2000 a.d. 2000 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 2001 A.D. 2001 a.d. 2001 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 2001 A.D. 2001 a.d. 2001 ad 06:19:20 P.M. 06:19:20 p.m. 06:19:20 pm + | 2097 A.D. 2097 a.d. 2097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | (65 rows) SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_10 | to_char ------------+------------------------ | - | + | 0097 097 97 7 07 044 2 + | 0097 097 97 7 07 048 6 + | 0597 597 97 7 07 046 4 + | 1097 097 97 7 07 044 2 + | 1697 697 97 7 07 048 6 + | 1797 797 97 7 07 046 4 + | 1897 897 97 7 07 044 2 | 1970 970 70 0 01 004 4 + | 1996 996 96 6 09 059 3 + | 1996 996 96 6 09 060 4 + | 1996 996 96 6 09 061 5 + | 1997 997 97 7 01 001 1 + | 1997 997 97 7 01 002 2 + | 1997 997 97 7 01 003 3 + | 1997 997 97 7 01 004 4 + | 1997 997 97 7 01 004 4 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 - | 1997 997 97 7 01 004 4 - | 1997 997 97 7 01 004 4 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 - | 1997 997 97 7 24 163 2 - | 2001 001 01 1 38 265 6 - | 2000 000 00 0 11 073 3 - | 2000 000 00 0 11 073 3 - | 2000 000 00 0 11 073 3 - | 2000 000 00 0 11 073 3 - | 2000 000 00 0 11 073 3 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 @@ -1482,7 +1487,6 @@ SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 - | 1997 997 97 7 24 163 2 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 044 2 | 1997 997 97 7 07 045 3 @@ -1490,57 +1494,58 @@ SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') | 1997 997 97 7 07 047 5 | 1997 997 97 7 07 048 6 | 1997 997 97 7 07 049 7 - | 0097 097 97 7 07 044 2 - | 0097 097 97 7 07 048 6 - | 0597 597 97 7 07 046 4 - | 1097 097 97 7 07 044 2 - | 1697 697 97 7 07 048 6 - | 1797 797 97 7 07 046 4 - | 1897 897 97 7 07 044 2 | 1997 997 97 7 07 049 7 - | 2097 097 97 7 07 048 6 - | 1996 996 96 6 09 059 3 - | 1996 996 96 6 09 060 4 - | 1996 996 96 6 09 061 5 - | 1997 997 97 7 01 001 1 - | 1997 997 97 7 01 002 2 - | 1997 997 97 7 01 003 3 | 1997 997 97 7 09 061 5 | 1997 997 97 7 09 062 6 + | 1997 997 97 7 24 163 2 + | 1997 997 97 7 24 163 2 | 1998 998 98 8 01 002 2 | 1998 998 98 8 01 003 3 | 1999 999 99 9 52 362 5 | 1999 999 99 9 52 363 6 + | 2000 000 00 0 11 073 3 + | 2000 000 00 0 11 073 3 + | 2000 000 00 0 11 073 3 + | 2000 000 00 0 11 073 3 + | 2000 000 00 0 11 073 3 | 2000 000 00 0 52 364 7 | 2001 001 01 1 01 001 1 + | 2001 001 01 1 38 265 6 + | 2097 097 97 7 07 048 6 + | (65 rows) SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; to_char_11 | to_char ------------+------------------------ | - | + | 97 097 97 7 7 44 2 + | 97 097 97 7 7 48 6 + | 597 597 97 7 7 46 4 + | 1097 097 97 7 7 44 2 + | 1697 697 97 7 7 48 6 + | 1797 797 97 7 7 46 4 + | 1897 897 97 7 7 44 2 | 1970 970 70 0 1 4 4 + | 1996 996 96 6 9 59 3 + | 1996 996 96 6 9 60 4 + | 1996 996 96 6 9 61 5 + | 1997 997 97 7 1 1 1 + | 1997 997 97 7 1 2 2 + | 1997 997 97 7 1 3 3 + | 1997 997 97 7 1 4 4 + | 1997 997 97 7 1 4 4 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 - | 1997 997 97 7 1 4 4 - | 1997 997 97 7 1 4 4 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 - | 1997 997 97 7 24 163 2 - | 2001 001 01 1 38 265 6 - | 2000 000 00 0 11 73 3 - | 2000 000 00 0 11 73 3 - | 2000 000 00 0 11 73 3 - | 2000 000 00 0 11 73 3 - | 2000 000 00 0 11 73 3 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 @@ -1553,7 +1558,6 @@ SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 - | 1997 997 97 7 24 163 2 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 44 2 | 1997 997 97 7 7 45 3 @@ -1561,28 +1565,24 @@ SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') | 1997 997 97 7 7 47 5 | 1997 997 97 7 7 48 6 | 1997 997 97 7 7 49 7 - | 97 097 97 7 7 44 2 - | 97 097 97 7 7 48 6 - | 597 597 97 7 7 46 4 - | 1097 097 97 7 7 44 2 - | 1697 697 97 7 7 48 6 - | 1797 797 97 7 7 46 4 - | 1897 897 97 7 7 44 2 | 1997 997 97 7 7 49 7 - | 2097 097 97 7 7 48 6 - | 1996 996 96 6 9 59 3 - | 1996 996 96 6 9 60 4 - | 1996 996 96 6 9 61 5 - | 1997 997 97 7 1 1 1 - | 1997 997 97 7 1 2 2 - | 1997 997 97 7 1 3 3 | 1997 997 97 7 9 61 5 | 1997 997 97 7 9 62 6 + | 1997 997 97 7 24 163 2 + | 1997 997 97 7 24 163 2 | 1998 998 98 8 1 2 2 | 1998 998 98 8 1 3 3 | 1999 999 99 9 52 362 5 | 1999 999 99 9 52 363 6 + | 2000 000 00 0 11 73 3 + | 2000 000 00 0 11 73 3 + | 2000 000 00 0 11 73 3 + | 2000 000 00 0 11 73 3 + | 2000 000 00 0 11 73 3 | 2000 000 00 0 52 364 7 | 2001 001 01 1 1 1 1 + | 2001 001 01 1 38 265 6 + | 2097 097 97 7 7 48 6 + | (65 rows) diff --git a/src/test/regress/expected/timestamptz.out b/src/test/regress/expected/timestamptz.out index f35bb14d35..f8faecc56f 100644 --- a/src/test/regress/expected/timestamptz.out +++ b/src/test/regress/expected/timestamptz.out @@ -324,43 +324,33 @@ SELECT '' AS "64", d1 FROM TIMESTAMPTZ_TBL; -- Demonstrate functions and operators SELECT '' AS "48", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 > timestamp with time zone '1997-01-02'; + WHERE d1 > timestamp with time zone '1997-01-02' ORDER BY d1; 48 | d1 ----+-------------------------------- - | infinity + | Thu Jan 02 03:04:05 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 14:32:01 1997 PST + | Mon Feb 10 17:32:00 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 17:32:02 1997 PST - | Mon Feb 10 17:32:01.4 1997 PST - | Mon Feb 10 17:32:01.5 1997 PST - | Mon Feb 10 17:32:01.6 1997 PST - | Thu Jan 02 03:04:05 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Tue Jun 10 17:32:01 1997 PDT - | Sat Sep 22 18:19:20 2001 PDT - | Wed Mar 15 08:14:01 2000 PST - | Wed Mar 15 04:14:02 2000 PST - | Wed Mar 15 02:14:03 2000 PST - | Wed Mar 15 03:14:04 2000 PST - | Wed Mar 15 01:14:05 2000 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 17:32:00 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 14:32:01 1997 PST - | Thu Jul 10 14:32:01 1997 PDT - | Tue Jun 10 18:32:01 1997 PDT | Mon Feb 10 17:32:01 1997 PST + | Mon Feb 10 17:32:01.4 1997 PST + | Mon Feb 10 17:32:01.5 1997 PST + | Mon Feb 10 17:32:01.6 1997 PST + | Mon Feb 10 17:32:02 1997 PST | Tue Feb 11 17:32:01 1997 PST | Wed Feb 12 17:32:01 1997 PST | Thu Feb 13 17:32:01 1997 PST @@ -368,23 +358,32 @@ SELECT '' AS "48", d1 FROM TIMESTAMPTZ_TBL | Sat Feb 15 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST - | Sat Feb 16 17:32:01 2097 PST | Fri Feb 28 17:32:01 1997 PST | Sat Mar 01 17:32:01 1997 PST + | Tue Jun 10 17:32:01 1997 PDT + | Tue Jun 10 18:32:01 1997 PDT + | Thu Jul 10 14:32:01 1997 PDT | Tue Dec 30 17:32:01 1997 PST | Wed Dec 31 17:32:01 1997 PST | Fri Dec 31 17:32:01 1999 PST | Sat Jan 01 17:32:01 2000 PST + | Wed Mar 15 01:14:05 2000 PST + | Wed Mar 15 02:14:03 2000 PST + | Wed Mar 15 03:14:04 2000 PST + | Wed Mar 15 04:14:02 2000 PST + | Wed Mar 15 08:14:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | Mon Jan 01 17:32:01 2001 PST + | Sat Sep 22 18:19:20 2001 PDT + | Sat Feb 16 17:32:01 2097 PST + | infinity (50 rows) SELECT '' AS "15", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 < timestamp with time zone '1997-01-02'; + WHERE d1 < timestamp with time zone '1997-01-02' ORDER BY d1; 15 | d1 ----+--------------------------------- | -infinity - | Wed Dec 31 16:00:00 1969 PST | Tue Feb 16 17:32:01 0097 PST BC | Sat Feb 16 17:32:01 0097 PST | Thu Feb 16 17:32:01 0597 PST @@ -392,6 +391,7 @@ SELECT '' AS "15", d1 FROM TIMESTAMPTZ_TBL | Sat Feb 16 17:32:01 1697 PST | Thu Feb 16 17:32:01 1797 PST | Tue Feb 16 17:32:01 1897 PST + | Wed Dec 31 16:00:00 1969 PST | Wed Feb 28 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST @@ -401,90 +401,88 @@ SELECT '' AS "15", d1 FROM TIMESTAMPTZ_TBL (15 rows) SELECT '' AS one, d1 FROM TIMESTAMPTZ_TBL - WHERE d1 = timestamp with time zone '1997-01-02'; + WHERE d1 = timestamp with time zone '1997-01-02' ORDER BY d1; one | d1 -----+------------------------------ | Thu Jan 02 00:00:00 1997 PST (1 row) SELECT '' AS "63", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 != timestamp with time zone '1997-01-02'; + WHERE d1 != timestamp with time zone '1997-01-02' ORDER BY d1; 63 | d1 ----+--------------------------------- | -infinity - | infinity + | Tue Feb 16 17:32:01 0097 PST BC + | Sat Feb 16 17:32:01 0097 PST + | Thu Feb 16 17:32:01 0597 PST + | Tue Feb 16 17:32:01 1097 PST + | Sat Feb 16 17:32:01 1697 PST + | Thu Feb 16 17:32:01 1797 PST + | Tue Feb 16 17:32:01 1897 PST | Wed Dec 31 16:00:00 1969 PST + | Wed Feb 28 17:32:01 1996 PST + | Thu Feb 29 17:32:01 1996 PST + | Fri Mar 01 17:32:01 1996 PST + | Mon Dec 30 17:32:01 1996 PST + | Tue Dec 31 17:32:01 1996 PST + | Wed Jan 01 17:32:01 1997 PST + | Thu Jan 02 03:04:05 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 14:32:01 1997 PST + | Mon Feb 10 17:32:00 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 17:32:02 1997 PST - | Mon Feb 10 17:32:01.4 1997 PST - | Mon Feb 10 17:32:01.5 1997 PST - | Mon Feb 10 17:32:01.6 1997 PST - | Thu Jan 02 03:04:05 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Tue Jun 10 17:32:01 1997 PDT - | Sat Sep 22 18:19:20 2001 PDT - | Wed Mar 15 08:14:01 2000 PST - | Wed Mar 15 04:14:02 2000 PST - | Wed Mar 15 02:14:03 2000 PST - | Wed Mar 15 03:14:04 2000 PST - | Wed Mar 15 01:14:05 2000 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 17:32:00 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 14:32:01 1997 PST - | Thu Jul 10 14:32:01 1997 PDT - | Tue Jun 10 18:32:01 1997 PDT | Mon Feb 10 17:32:01 1997 PST + | Mon Feb 10 17:32:01.4 1997 PST + | Mon Feb 10 17:32:01.5 1997 PST + | Mon Feb 10 17:32:01.6 1997 PST + | Mon Feb 10 17:32:02 1997 PST | Tue Feb 11 17:32:01 1997 PST | Wed Feb 12 17:32:01 1997 PST | Thu Feb 13 17:32:01 1997 PST | Fri Feb 14 17:32:01 1997 PST | Sat Feb 15 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST - | Tue Feb 16 17:32:01 0097 PST BC - | Sat Feb 16 17:32:01 0097 PST - | Thu Feb 16 17:32:01 0597 PST - | Tue Feb 16 17:32:01 1097 PST - | Sat Feb 16 17:32:01 1697 PST - | Thu Feb 16 17:32:01 1797 PST - | Tue Feb 16 17:32:01 1897 PST | Sun Feb 16 17:32:01 1997 PST - | Sat Feb 16 17:32:01 2097 PST - | Wed Feb 28 17:32:01 1996 PST - | Thu Feb 29 17:32:01 1996 PST - | Fri Mar 01 17:32:01 1996 PST - | Mon Dec 30 17:32:01 1996 PST - | Tue Dec 31 17:32:01 1996 PST - | Wed Jan 01 17:32:01 1997 PST | Fri Feb 28 17:32:01 1997 PST | Sat Mar 01 17:32:01 1997 PST + | Tue Jun 10 17:32:01 1997 PDT + | Tue Jun 10 18:32:01 1997 PDT + | Thu Jul 10 14:32:01 1997 PDT | Tue Dec 30 17:32:01 1997 PST | Wed Dec 31 17:32:01 1997 PST | Fri Dec 31 17:32:01 1999 PST | Sat Jan 01 17:32:01 2000 PST + | Wed Mar 15 01:14:05 2000 PST + | Wed Mar 15 02:14:03 2000 PST + | Wed Mar 15 03:14:04 2000 PST + | Wed Mar 15 04:14:02 2000 PST + | Wed Mar 15 08:14:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | Mon Jan 01 17:32:01 2001 PST + | Sat Sep 22 18:19:20 2001 PDT + | Sat Feb 16 17:32:01 2097 PST + | infinity (65 rows) SELECT '' AS "16", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 <= timestamp with time zone '1997-01-02'; + WHERE d1 <= timestamp with time zone '1997-01-02' ORDER BY d1; 16 | d1 ----+--------------------------------- | -infinity - | Wed Dec 31 16:00:00 1969 PST - | Thu Jan 02 00:00:00 1997 PST | Tue Feb 16 17:32:01 0097 PST BC | Sat Feb 16 17:32:01 0097 PST | Thu Feb 16 17:32:01 0597 PST @@ -492,53 +490,45 @@ SELECT '' AS "16", d1 FROM TIMESTAMPTZ_TBL | Sat Feb 16 17:32:01 1697 PST | Thu Feb 16 17:32:01 1797 PST | Tue Feb 16 17:32:01 1897 PST + | Wed Dec 31 16:00:00 1969 PST | Wed Feb 28 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST | Wed Jan 01 17:32:01 1997 PST + | Thu Jan 02 00:00:00 1997 PST (16 rows) SELECT '' AS "49", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 >= timestamp with time zone '1997-01-02'; + WHERE d1 >= timestamp with time zone '1997-01-02' ORDER BY d1; 49 | d1 ----+-------------------------------- - | infinity - | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 17:32:02 1997 PST - | Mon Feb 10 17:32:01.4 1997 PST - | Mon Feb 10 17:32:01.5 1997 PST - | Mon Feb 10 17:32:01.6 1997 PST | Thu Jan 02 00:00:00 1997 PST | Thu Jan 02 03:04:05 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 09:32:01 1997 PST + | Mon Feb 10 14:32:01 1997 PST + | Mon Feb 10 17:32:00 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Tue Jun 10 17:32:01 1997 PDT - | Sat Sep 22 18:19:20 2001 PDT - | Wed Mar 15 08:14:01 2000 PST - | Wed Mar 15 04:14:02 2000 PST - | Wed Mar 15 02:14:03 2000 PST - | Wed Mar 15 03:14:04 2000 PST - | Wed Mar 15 01:14:05 2000 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 17:32:00 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 09:32:01 1997 PST - | Mon Feb 10 14:32:01 1997 PST - | Thu Jul 10 14:32:01 1997 PDT - | Tue Jun 10 18:32:01 1997 PDT | Mon Feb 10 17:32:01 1997 PST + | Mon Feb 10 17:32:01 1997 PST + | Mon Feb 10 17:32:01 1997 PST + | Mon Feb 10 17:32:01.4 1997 PST + | Mon Feb 10 17:32:01.5 1997 PST + | Mon Feb 10 17:32:01.6 1997 PST + | Mon Feb 10 17:32:02 1997 PST | Tue Feb 11 17:32:01 1997 PST | Wed Feb 12 17:32:01 1997 PST | Thu Feb 13 17:32:01 1997 PST @@ -546,56 +536,63 @@ SELECT '' AS "49", d1 FROM TIMESTAMPTZ_TBL | Sat Feb 15 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST - | Sat Feb 16 17:32:01 2097 PST | Fri Feb 28 17:32:01 1997 PST | Sat Mar 01 17:32:01 1997 PST + | Tue Jun 10 17:32:01 1997 PDT + | Tue Jun 10 18:32:01 1997 PDT + | Thu Jul 10 14:32:01 1997 PDT | Tue Dec 30 17:32:01 1997 PST | Wed Dec 31 17:32:01 1997 PST | Fri Dec 31 17:32:01 1999 PST | Sat Jan 01 17:32:01 2000 PST + | Wed Mar 15 01:14:05 2000 PST + | Wed Mar 15 02:14:03 2000 PST + | Wed Mar 15 03:14:04 2000 PST + | Wed Mar 15 04:14:02 2000 PST + | Wed Mar 15 08:14:01 2000 PST | Sun Dec 31 17:32:01 2000 PST | Mon Jan 01 17:32:01 2001 PST + | Sat Sep 22 18:19:20 2001 PDT + | Sat Feb 16 17:32:01 2097 PST + | infinity (51 rows) SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff - FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; 54 | diff ----+---------------------------------------- | @ 9863 days 8 hours ago - | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins 2 secs - | @ 39 days 17 hours 32 mins 1.4 secs - | @ 39 days 17 hours 32 mins 1.5 secs - | @ 39 days 17 hours 32 mins 1.6 secs + | @ 308 days 6 hours 27 mins 59 secs ago + | @ 307 days 6 hours 27 mins 59 secs ago + | @ 306 days 6 hours 27 mins 59 secs ago + | @ 2 days 6 hours 27 mins 59 secs ago + | @ 1 day 6 hours 27 mins 59 secs ago + | @ 6 hours 27 mins 59 secs ago | @ 0 | @ 3 hours 4 mins 5 secs + | @ 39 days 9 hours 32 mins 1 sec + | @ 39 days 9 hours 32 mins 1 sec + | @ 39 days 9 hours 32 mins 1 sec + | @ 39 days 14 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 159 days 16 hours 32 mins 1 sec - | @ 1724 days 17 hours 19 mins 20 secs - | @ 1168 days 8 hours 14 mins 1 sec - | @ 1168 days 4 hours 14 mins 2 secs - | @ 1168 days 2 hours 14 mins 3 secs - | @ 1168 days 3 hours 14 mins 4 secs - | @ 1168 days 1 hour 14 mins 5 secs | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 9 hours 32 mins 1 sec - | @ 39 days 9 hours 32 mins 1 sec - | @ 39 days 9 hours 32 mins 1 sec - | @ 39 days 14 hours 32 mins 1 sec - | @ 189 days 13 hours 32 mins 1 sec - | @ 159 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1.4 secs + | @ 39 days 17 hours 32 mins 1.5 secs + | @ 39 days 17 hours 32 mins 1.6 secs + | @ 39 days 17 hours 32 mins 2 secs | @ 40 days 17 hours 32 mins 1 sec | @ 41 days 17 hours 32 mins 1 sec | @ 42 days 17 hours 32 mins 1 sec @@ -603,20 +600,23 @@ SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff | @ 44 days 17 hours 32 mins 1 sec | @ 45 days 17 hours 32 mins 1 sec | @ 45 days 17 hours 32 mins 1 sec - | @ 308 days 6 hours 27 mins 59 secs ago - | @ 307 days 6 hours 27 mins 59 secs ago - | @ 306 days 6 hours 27 mins 59 secs ago - | @ 2 days 6 hours 27 mins 59 secs ago - | @ 1 day 6 hours 27 mins 59 secs ago - | @ 6 hours 27 mins 59 secs ago | @ 57 days 17 hours 32 mins 1 sec | @ 58 days 17 hours 32 mins 1 sec + | @ 159 days 16 hours 32 mins 1 sec + | @ 159 days 17 hours 32 mins 1 sec + | @ 189 days 13 hours 32 mins 1 sec | @ 362 days 17 hours 32 mins 1 sec | @ 363 days 17 hours 32 mins 1 sec | @ 1093 days 17 hours 32 mins 1 sec | @ 1094 days 17 hours 32 mins 1 sec + | @ 1168 days 1 hour 14 mins 5 secs + | @ 1168 days 2 hours 14 mins 3 secs + | @ 1168 days 3 hours 14 mins 4 secs + | @ 1168 days 4 hours 14 mins 2 secs + | @ 1168 days 8 hours 14 mins 1 sec | @ 1459 days 17 hours 32 mins 1 sec | @ 1460 days 17 hours 32 mins 1 sec + | @ 1724 days 17 hours 19 mins 20 secs (56 rows) SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp with time zone '2004-02-29 15:44:17.71393' ) AS week_trunc; @@ -628,44 +628,41 @@ SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp with time zone '2004 -- Test casting within a BETWEEN qualifier SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff FROM TIMESTAMPTZ_TBL - WHERE d1 BETWEEN timestamp with time zone '1902-01-01' AND timestamp with time zone '2038-01-01'; + WHERE d1 BETWEEN timestamp with time zone '1902-01-01' AND timestamp with time zone '2038-01-01' ORDER BY d1; 54 | diff ----+---------------------------------------- | @ 9863 days 8 hours ago - | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins 2 secs - | @ 39 days 17 hours 32 mins 1.4 secs - | @ 39 days 17 hours 32 mins 1.5 secs - | @ 39 days 17 hours 32 mins 1.6 secs + | @ 308 days 6 hours 27 mins 59 secs ago + | @ 307 days 6 hours 27 mins 59 secs ago + | @ 306 days 6 hours 27 mins 59 secs ago + | @ 2 days 6 hours 27 mins 59 secs ago + | @ 1 day 6 hours 27 mins 59 secs ago + | @ 6 hours 27 mins 59 secs ago | @ 0 | @ 3 hours 4 mins 5 secs + | @ 39 days 9 hours 32 mins 1 sec + | @ 39 days 9 hours 32 mins 1 sec + | @ 39 days 9 hours 32 mins 1 sec + | @ 39 days 14 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins + | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 159 days 16 hours 32 mins 1 sec - | @ 1724 days 17 hours 19 mins 20 secs - | @ 1168 days 8 hours 14 mins 1 sec - | @ 1168 days 4 hours 14 mins 2 secs - | @ 1168 days 2 hours 14 mins 3 secs - | @ 1168 days 3 hours 14 mins 4 secs - | @ 1168 days 1 hour 14 mins 5 secs | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 17 hours 32 mins | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec - | @ 39 days 9 hours 32 mins 1 sec - | @ 39 days 9 hours 32 mins 1 sec - | @ 39 days 9 hours 32 mins 1 sec - | @ 39 days 14 hours 32 mins 1 sec - | @ 189 days 13 hours 32 mins 1 sec - | @ 159 days 17 hours 32 mins 1 sec | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1 sec + | @ 39 days 17 hours 32 mins 1.4 secs + | @ 39 days 17 hours 32 mins 1.5 secs + | @ 39 days 17 hours 32 mins 1.6 secs + | @ 39 days 17 hours 32 mins 2 secs | @ 40 days 17 hours 32 mins 1 sec | @ 41 days 17 hours 32 mins 1 sec | @ 42 days 17 hours 32 mins 1 sec @@ -673,64 +670,64 @@ SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff | @ 44 days 17 hours 32 mins 1 sec | @ 45 days 17 hours 32 mins 1 sec | @ 45 days 17 hours 32 mins 1 sec - | @ 308 days 6 hours 27 mins 59 secs ago - | @ 307 days 6 hours 27 mins 59 secs ago - | @ 306 days 6 hours 27 mins 59 secs ago - | @ 2 days 6 hours 27 mins 59 secs ago - | @ 1 day 6 hours 27 mins 59 secs ago - | @ 6 hours 27 mins 59 secs ago | @ 57 days 17 hours 32 mins 1 sec | @ 58 days 17 hours 32 mins 1 sec + | @ 159 days 16 hours 32 mins 1 sec + | @ 159 days 17 hours 32 mins 1 sec + | @ 189 days 13 hours 32 mins 1 sec | @ 362 days 17 hours 32 mins 1 sec | @ 363 days 17 hours 32 mins 1 sec | @ 1093 days 17 hours 32 mins 1 sec | @ 1094 days 17 hours 32 mins 1 sec + | @ 1168 days 1 hour 14 mins 5 secs + | @ 1168 days 2 hours 14 mins 3 secs + | @ 1168 days 3 hours 14 mins 4 secs + | @ 1168 days 4 hours 14 mins 2 secs + | @ 1168 days 8 hours 14 mins 1 sec | @ 1459 days 17 hours 32 mins 1 sec | @ 1460 days 17 hours 32 mins 1 sec + | @ 1724 days 17 hours 19 mins 20 secs (56 rows) SELECT '' AS "54", d1 as timestamptz, date_part( 'year', d1) AS year, date_part( 'month', d1) AS month, date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour, date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second - FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; 54 | timestamptz | year | month | day | hour | minute | second ----+--------------------------------+------+-------+-----+------+--------+-------- | Wed Dec 31 16:00:00 1969 PST | 1969 | 12 | 31 | 16 | 0 | 0 - | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 - | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 - | Mon Feb 10 17:32:02 1997 PST | 1997 | 2 | 10 | 17 | 32 | 2 - | Mon Feb 10 17:32:01.4 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.4 - | Mon Feb 10 17:32:01.5 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.5 - | Mon Feb 10 17:32:01.6 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.6 + | Wed Feb 28 17:32:01 1996 PST | 1996 | 2 | 28 | 17 | 32 | 1 + | Thu Feb 29 17:32:01 1996 PST | 1996 | 2 | 29 | 17 | 32 | 1 + | Fri Mar 01 17:32:01 1996 PST | 1996 | 3 | 1 | 17 | 32 | 1 + | Mon Dec 30 17:32:01 1996 PST | 1996 | 12 | 30 | 17 | 32 | 1 + | Tue Dec 31 17:32:01 1996 PST | 1996 | 12 | 31 | 17 | 32 | 1 + | Wed Jan 01 17:32:01 1997 PST | 1997 | 1 | 1 | 17 | 32 | 1 | Thu Jan 02 00:00:00 1997 PST | 1997 | 1 | 2 | 0 | 0 | 0 | Thu Jan 02 03:04:05 1997 PST | 1997 | 1 | 2 | 3 | 4 | 5 + | Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1 + | Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1 + | Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1 + | Mon Feb 10 14:32:01 1997 PST | 1997 | 2 | 10 | 14 | 32 | 1 + | Mon Feb 10 17:32:00 1997 PST | 1997 | 2 | 10 | 17 | 32 | 0 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 - | Tue Jun 10 17:32:01 1997 PDT | 1997 | 6 | 10 | 17 | 32 | 1 - | Sat Sep 22 18:19:20 2001 PDT | 2001 | 9 | 22 | 18 | 19 | 20 - | Wed Mar 15 08:14:01 2000 PST | 2000 | 3 | 15 | 8 | 14 | 1 - | Wed Mar 15 04:14:02 2000 PST | 2000 | 3 | 15 | 4 | 14 | 2 - | Wed Mar 15 02:14:03 2000 PST | 2000 | 3 | 15 | 2 | 14 | 3 - | Wed Mar 15 03:14:04 2000 PST | 2000 | 3 | 15 | 3 | 14 | 4 - | Wed Mar 15 01:14:05 2000 PST | 2000 | 3 | 15 | 1 | 14 | 5 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 - | Mon Feb 10 17:32:00 1997 PST | 1997 | 2 | 10 | 17 | 32 | 0 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 - | Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1 - | Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1 - | Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1 - | Mon Feb 10 14:32:01 1997 PST | 1997 | 2 | 10 | 14 | 32 | 1 - | Thu Jul 10 14:32:01 1997 PDT | 1997 | 7 | 10 | 14 | 32 | 1 - | Tue Jun 10 18:32:01 1997 PDT | 1997 | 6 | 10 | 18 | 32 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 + | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 + | Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1 + | Mon Feb 10 17:32:01.4 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.4 + | Mon Feb 10 17:32:01.5 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.5 + | Mon Feb 10 17:32:01.6 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.6 + | Mon Feb 10 17:32:02 1997 PST | 1997 | 2 | 10 | 17 | 32 | 2 | Tue Feb 11 17:32:01 1997 PST | 1997 | 2 | 11 | 17 | 32 | 1 | Wed Feb 12 17:32:01 1997 PST | 1997 | 2 | 12 | 17 | 32 | 1 | Thu Feb 13 17:32:01 1997 PST | 1997 | 2 | 13 | 17 | 32 | 1 @@ -738,63 +735,63 @@ SELECT '' AS "54", d1 as timestamptz, | Sat Feb 15 17:32:01 1997 PST | 1997 | 2 | 15 | 17 | 32 | 1 | Sun Feb 16 17:32:01 1997 PST | 1997 | 2 | 16 | 17 | 32 | 1 | Sun Feb 16 17:32:01 1997 PST | 1997 | 2 | 16 | 17 | 32 | 1 - | Wed Feb 28 17:32:01 1996 PST | 1996 | 2 | 28 | 17 | 32 | 1 - | Thu Feb 29 17:32:01 1996 PST | 1996 | 2 | 29 | 17 | 32 | 1 - | Fri Mar 01 17:32:01 1996 PST | 1996 | 3 | 1 | 17 | 32 | 1 - | Mon Dec 30 17:32:01 1996 PST | 1996 | 12 | 30 | 17 | 32 | 1 - | Tue Dec 31 17:32:01 1996 PST | 1996 | 12 | 31 | 17 | 32 | 1 - | Wed Jan 01 17:32:01 1997 PST | 1997 | 1 | 1 | 17 | 32 | 1 | Fri Feb 28 17:32:01 1997 PST | 1997 | 2 | 28 | 17 | 32 | 1 | Sat Mar 01 17:32:01 1997 PST | 1997 | 3 | 1 | 17 | 32 | 1 + | Tue Jun 10 17:32:01 1997 PDT | 1997 | 6 | 10 | 17 | 32 | 1 + | Tue Jun 10 18:32:01 1997 PDT | 1997 | 6 | 10 | 18 | 32 | 1 + | Thu Jul 10 14:32:01 1997 PDT | 1997 | 7 | 10 | 14 | 32 | 1 | Tue Dec 30 17:32:01 1997 PST | 1997 | 12 | 30 | 17 | 32 | 1 | Wed Dec 31 17:32:01 1997 PST | 1997 | 12 | 31 | 17 | 32 | 1 | Fri Dec 31 17:32:01 1999 PST | 1999 | 12 | 31 | 17 | 32 | 1 | Sat Jan 01 17:32:01 2000 PST | 2000 | 1 | 1 | 17 | 32 | 1 + | Wed Mar 15 01:14:05 2000 PST | 2000 | 3 | 15 | 1 | 14 | 5 + | Wed Mar 15 02:14:03 2000 PST | 2000 | 3 | 15 | 2 | 14 | 3 + | Wed Mar 15 03:14:04 2000 PST | 2000 | 3 | 15 | 3 | 14 | 4 + | Wed Mar 15 04:14:02 2000 PST | 2000 | 3 | 15 | 4 | 14 | 2 + | Wed Mar 15 08:14:01 2000 PST | 2000 | 3 | 15 | 8 | 14 | 1 | Sun Dec 31 17:32:01 2000 PST | 2000 | 12 | 31 | 17 | 32 | 1 | Mon Jan 01 17:32:01 2001 PST | 2001 | 1 | 1 | 17 | 32 | 1 + | Sat Sep 22 18:19:20 2001 PDT | 2001 | 9 | 22 | 18 | 19 | 20 (56 rows) SELECT '' AS "54", d1 as timestamptz, date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec, date_part( 'usec', d1) AS usec - FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; 54 | timestamptz | quarter | msec | usec ----+--------------------------------+---------+-------+---------- | Wed Dec 31 16:00:00 1969 PST | 4 | 0 | 0 - | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 - | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 - | Mon Feb 10 17:32:02 1997 PST | 1 | 2000 | 2000000 - | Mon Feb 10 17:32:01.4 1997 PST | 1 | 1400 | 1400000 - | Mon Feb 10 17:32:01.5 1997 PST | 1 | 1500 | 1500000 - | Mon Feb 10 17:32:01.6 1997 PST | 1 | 1600 | 1600000 + | Wed Feb 28 17:32:01 1996 PST | 1 | 1000 | 1000000 + | Thu Feb 29 17:32:01 1996 PST | 1 | 1000 | 1000000 + | Fri Mar 01 17:32:01 1996 PST | 1 | 1000 | 1000000 + | Mon Dec 30 17:32:01 1996 PST | 4 | 1000 | 1000000 + | Tue Dec 31 17:32:01 1996 PST | 4 | 1000 | 1000000 + | Wed Jan 01 17:32:01 1997 PST | 1 | 1000 | 1000000 | Thu Jan 02 00:00:00 1997 PST | 1 | 0 | 0 | Thu Jan 02 03:04:05 1997 PST | 1 | 5000 | 5000000 + | Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000 + | Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000 + | Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000 + | Mon Feb 10 14:32:01 1997 PST | 1 | 1000 | 1000000 + | Mon Feb 10 17:32:00 1997 PST | 1 | 0 | 0 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 - | Tue Jun 10 17:32:01 1997 PDT | 2 | 1000 | 1000000 - | Sat Sep 22 18:19:20 2001 PDT | 3 | 20000 | 20000000 - | Wed Mar 15 08:14:01 2000 PST | 1 | 1000 | 1000000 - | Wed Mar 15 04:14:02 2000 PST | 1 | 2000 | 2000000 - | Wed Mar 15 02:14:03 2000 PST | 1 | 3000 | 3000000 - | Wed Mar 15 03:14:04 2000 PST | 1 | 4000 | 4000000 - | Wed Mar 15 01:14:05 2000 PST | 1 | 5000 | 5000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 - | Mon Feb 10 17:32:00 1997 PST | 1 | 0 | 0 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 - | Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000 - | Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000 - | Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000 - | Mon Feb 10 14:32:01 1997 PST | 1 | 1000 | 1000000 - | Thu Jul 10 14:32:01 1997 PDT | 3 | 1000 | 1000000 - | Tue Jun 10 18:32:01 1997 PDT | 2 | 1000 | 1000000 | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 + | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 + | Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000 + | Mon Feb 10 17:32:01.4 1997 PST | 1 | 1400 | 1400000 + | Mon Feb 10 17:32:01.5 1997 PST | 1 | 1500 | 1500000 + | Mon Feb 10 17:32:01.6 1997 PST | 1 | 1600 | 1600000 + | Mon Feb 10 17:32:02 1997 PST | 1 | 2000 | 2000000 | Tue Feb 11 17:32:01 1997 PST | 1 | 1000 | 1000000 | Wed Feb 12 17:32:01 1997 PST | 1 | 1000 | 1000000 | Thu Feb 13 17:32:01 1997 PST | 1 | 1000 | 1000000 @@ -802,63 +799,63 @@ SELECT '' AS "54", d1 as timestamptz, | Sat Feb 15 17:32:01 1997 PST | 1 | 1000 | 1000000 | Sun Feb 16 17:32:01 1997 PST | 1 | 1000 | 1000000 | Sun Feb 16 17:32:01 1997 PST | 1 | 1000 | 1000000 - | Wed Feb 28 17:32:01 1996 PST | 1 | 1000 | 1000000 - | Thu Feb 29 17:32:01 1996 PST | 1 | 1000 | 1000000 - | Fri Mar 01 17:32:01 1996 PST | 1 | 1000 | 1000000 - | Mon Dec 30 17:32:01 1996 PST | 4 | 1000 | 1000000 - | Tue Dec 31 17:32:01 1996 PST | 4 | 1000 | 1000000 - | Wed Jan 01 17:32:01 1997 PST | 1 | 1000 | 1000000 | Fri Feb 28 17:32:01 1997 PST | 1 | 1000 | 1000000 | Sat Mar 01 17:32:01 1997 PST | 1 | 1000 | 1000000 + | Tue Jun 10 17:32:01 1997 PDT | 2 | 1000 | 1000000 + | Tue Jun 10 18:32:01 1997 PDT | 2 | 1000 | 1000000 + | Thu Jul 10 14:32:01 1997 PDT | 3 | 1000 | 1000000 | Tue Dec 30 17:32:01 1997 PST | 4 | 1000 | 1000000 | Wed Dec 31 17:32:01 1997 PST | 4 | 1000 | 1000000 | Fri Dec 31 17:32:01 1999 PST | 4 | 1000 | 1000000 | Sat Jan 01 17:32:01 2000 PST | 1 | 1000 | 1000000 + | Wed Mar 15 01:14:05 2000 PST | 1 | 5000 | 5000000 + | Wed Mar 15 02:14:03 2000 PST | 1 | 3000 | 3000000 + | Wed Mar 15 03:14:04 2000 PST | 1 | 4000 | 4000000 + | Wed Mar 15 04:14:02 2000 PST | 1 | 2000 | 2000000 + | Wed Mar 15 08:14:01 2000 PST | 1 | 1000 | 1000000 | Sun Dec 31 17:32:01 2000 PST | 4 | 1000 | 1000000 | Mon Jan 01 17:32:01 2001 PST | 1 | 1000 | 1000000 + | Sat Sep 22 18:19:20 2001 PDT | 3 | 20000 | 20000000 (56 rows) SELECT '' AS "54", d1 as timestamptz, date_part( 'isoyear', d1) AS isoyear, date_part( 'week', d1) AS week, date_part( 'dow', d1) AS dow - FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; 54 | timestamptz | isoyear | week | dow ----+--------------------------------+---------+------+----- | Wed Dec 31 16:00:00 1969 PST | 1970 | 1 | 3 - | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 17:32:02 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 17:32:01.4 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 17:32:01.5 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 17:32:01.6 1997 PST | 1997 | 7 | 1 + | Wed Feb 28 17:32:01 1996 PST | 1996 | 9 | 3 + | Thu Feb 29 17:32:01 1996 PST | 1996 | 9 | 4 + | Fri Mar 01 17:32:01 1996 PST | 1996 | 9 | 5 + | Mon Dec 30 17:32:01 1996 PST | 1997 | 1 | 1 + | Tue Dec 31 17:32:01 1996 PST | 1997 | 1 | 2 + | Wed Jan 01 17:32:01 1997 PST | 1997 | 1 | 3 | Thu Jan 02 00:00:00 1997 PST | 1997 | 1 | 4 | Thu Jan 02 03:04:05 1997 PST | 1997 | 1 | 4 + | Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 14:32:01 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 17:32:00 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 - | Tue Jun 10 17:32:01 1997 PDT | 1997 | 24 | 2 - | Sat Sep 22 18:19:20 2001 PDT | 2001 | 38 | 6 - | Wed Mar 15 08:14:01 2000 PST | 2000 | 11 | 3 - | Wed Mar 15 04:14:02 2000 PST | 2000 | 11 | 3 - | Wed Mar 15 02:14:03 2000 PST | 2000 | 11 | 3 - | Wed Mar 15 03:14:04 2000 PST | 2000 | 11 | 3 - | Wed Mar 15 01:14:05 2000 PST | 2000 | 11 | 3 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 17:32:00 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1 - | Mon Feb 10 14:32:01 1997 PST | 1997 | 7 | 1 - | Thu Jul 10 14:32:01 1997 PDT | 1997 | 28 | 4 - | Tue Jun 10 18:32:01 1997 PDT | 1997 | 24 | 2 | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 17:32:01.4 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 17:32:01.5 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 17:32:01.6 1997 PST | 1997 | 7 | 1 + | Mon Feb 10 17:32:02 1997 PST | 1997 | 7 | 1 | Tue Feb 11 17:32:01 1997 PST | 1997 | 7 | 2 | Wed Feb 12 17:32:01 1997 PST | 1997 | 7 | 3 | Thu Feb 13 17:32:01 1997 PST | 1997 | 7 | 4 @@ -866,49 +863,57 @@ SELECT '' AS "54", d1 as timestamptz, | Sat Feb 15 17:32:01 1997 PST | 1997 | 7 | 6 | Sun Feb 16 17:32:01 1997 PST | 1997 | 7 | 0 | Sun Feb 16 17:32:01 1997 PST | 1997 | 7 | 0 - | Wed Feb 28 17:32:01 1996 PST | 1996 | 9 | 3 - | Thu Feb 29 17:32:01 1996 PST | 1996 | 9 | 4 - | Fri Mar 01 17:32:01 1996 PST | 1996 | 9 | 5 - | Mon Dec 30 17:32:01 1996 PST | 1997 | 1 | 1 - | Tue Dec 31 17:32:01 1996 PST | 1997 | 1 | 2 - | Wed Jan 01 17:32:01 1997 PST | 1997 | 1 | 3 | Fri Feb 28 17:32:01 1997 PST | 1997 | 9 | 5 | Sat Mar 01 17:32:01 1997 PST | 1997 | 9 | 6 + | Tue Jun 10 17:32:01 1997 PDT | 1997 | 24 | 2 + | Tue Jun 10 18:32:01 1997 PDT | 1997 | 24 | 2 + | Thu Jul 10 14:32:01 1997 PDT | 1997 | 28 | 4 | Tue Dec 30 17:32:01 1997 PST | 1998 | 1 | 2 | Wed Dec 31 17:32:01 1997 PST | 1998 | 1 | 3 | Fri Dec 31 17:32:01 1999 PST | 1999 | 52 | 5 | Sat Jan 01 17:32:01 2000 PST | 1999 | 52 | 6 + | Wed Mar 15 01:14:05 2000 PST | 2000 | 11 | 3 + | Wed Mar 15 02:14:03 2000 PST | 2000 | 11 | 3 + | Wed Mar 15 03:14:04 2000 PST | 2000 | 11 | 3 + | Wed Mar 15 04:14:02 2000 PST | 2000 | 11 | 3 + | Wed Mar 15 08:14:01 2000 PST | 2000 | 11 | 3 | Sun Dec 31 17:32:01 2000 PST | 2000 | 52 | 0 | Mon Jan 01 17:32:01 2001 PST | 2001 | 1 | 1 + | Sat Sep 22 18:19:20 2001 PDT | 2001 | 38 | 6 (56 rows) -- TO_CHAR() SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_1 | to_char -----------+------------------------------------------------------------------------------------------ | - | + | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb + | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb + | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb + | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb + | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb + | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb + | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb | WEDNESDAY Wednesday wednesday WED Wed wed DECEMBER December december XII DEC Dec dec + | WEDNESDAY Wednesday wednesday WED Wed wed FEBRUARY February february II FEB Feb feb + | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb + | FRIDAY Friday friday FRI Fri fri MARCH March march III MAR Mar mar + | MONDAY Monday monday MON Mon mon DECEMBER December december XII DEC Dec dec + | TUESDAY Tuesday tuesday TUE Tue tue DECEMBER December december XII DEC Dec dec + | WEDNESDAY Wednesday wednesday WED Wed wed JANUARY January january I JAN Jan jan + | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan + | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan - | THURSDAY Thursday thursday THU Thu thu JANUARY January january I JAN Jan jan | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue JUNE June june VI JUN Jun jun - | SATURDAY Saturday saturday SAT Sat sat SEPTEMBER September september IX SEP Sep sep - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar - | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb @@ -921,8 +926,6 @@ SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM M | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu JULY July july VII JUL Jul jul - | TUESDAY Tuesday tuesday TUE Tue tue JUNE June june VI JUN Jun jun | MONDAY Monday monday MON Mon mon FEBRUARY February february II FEB Feb feb | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb | WEDNESDAY Wednesday wednesday WED Wed wed FEBRUARY February february II FEB Feb feb @@ -930,58 +933,60 @@ SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM M | FRIDAY Friday friday FRI Fri fri FEBRUARY February february II FEB Feb feb | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb | SUNDAY Sunday sunday SUN Sun sun FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb - | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb - | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb - | TUESDAY Tuesday tuesday TUE Tue tue FEBRUARY February february II FEB Feb feb | SUNDAY Sunday sunday SUN Sun sun FEBRUARY February february II FEB Feb feb - | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb - | WEDNESDAY Wednesday wednesday WED Wed wed FEBRUARY February february II FEB Feb feb - | THURSDAY Thursday thursday THU Thu thu FEBRUARY February february II FEB Feb feb - | FRIDAY Friday friday FRI Fri fri MARCH March march III MAR Mar mar - | MONDAY Monday monday MON Mon mon DECEMBER December december XII DEC Dec dec - | TUESDAY Tuesday tuesday TUE Tue tue DECEMBER December december XII DEC Dec dec - | WEDNESDAY Wednesday wednesday WED Wed wed JANUARY January january I JAN Jan jan | FRIDAY Friday friday FRI Fri fri FEBRUARY February february II FEB Feb feb | SATURDAY Saturday saturday SAT Sat sat MARCH March march III MAR Mar mar + | TUESDAY Tuesday tuesday TUE Tue tue JUNE June june VI JUN Jun jun + | TUESDAY Tuesday tuesday TUE Tue tue JUNE June june VI JUN Jun jun + | THURSDAY Thursday thursday THU Thu thu JULY July july VII JUL Jul jul | TUESDAY Tuesday tuesday TUE Tue tue DECEMBER December december XII DEC Dec dec | WEDNESDAY Wednesday wednesday WED Wed wed DECEMBER December december XII DEC Dec dec | FRIDAY Friday friday FRI Fri fri DECEMBER December december XII DEC Dec dec | SATURDAY Saturday saturday SAT Sat sat JANUARY January january I JAN Jan jan + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar + | WEDNESDAY Wednesday wednesday WED Wed wed MARCH March march III MAR Mar mar | SUNDAY Sunday sunday SUN Sun sun DECEMBER December december XII DEC Dec dec | MONDAY Monday monday MON Mon mon JANUARY January january I JAN Jan jan + | SATURDAY Saturday saturday SAT Sat sat SEPTEMBER September september IX SEP Sep sep + | SATURDAY Saturday saturday SAT Sat sat FEBRUARY February february II FEB Feb feb + | (66 rows) SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth FMRM') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_2 | to_char -----------+-------------------------------------------------------------- | - | + | TUESDAY Tuesday tuesday FEBRUARY February february II + | SATURDAY Saturday saturday FEBRUARY February february II + | THURSDAY Thursday thursday FEBRUARY February february II + | TUESDAY Tuesday tuesday FEBRUARY February february II + | SATURDAY Saturday saturday FEBRUARY February february II + | THURSDAY Thursday thursday FEBRUARY February february II + | TUESDAY Tuesday tuesday FEBRUARY February february II | WEDNESDAY Wednesday wednesday DECEMBER December december XII + | WEDNESDAY Wednesday wednesday FEBRUARY February february II + | THURSDAY Thursday thursday FEBRUARY February february II + | FRIDAY Friday friday MARCH March march III + | MONDAY Monday monday DECEMBER December december XII + | TUESDAY Tuesday tuesday DECEMBER December december XII + | WEDNESDAY Wednesday wednesday JANUARY January january I + | THURSDAY Thursday thursday JANUARY January january I + | THURSDAY Thursday thursday JANUARY January january I | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II - | THURSDAY Thursday thursday JANUARY January january I - | THURSDAY Thursday thursday JANUARY January january I | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II - | TUESDAY Tuesday tuesday JUNE June june VI - | SATURDAY Saturday saturday SEPTEMBER September september IX - | WEDNESDAY Wednesday wednesday MARCH March march III - | WEDNESDAY Wednesday wednesday MARCH March march III - | WEDNESDAY Wednesday wednesday MARCH March march III - | WEDNESDAY Wednesday wednesday MARCH March march III - | WEDNESDAY Wednesday wednesday MARCH March march III | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II @@ -994,8 +999,6 @@ SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth F | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II | MONDAY Monday monday FEBRUARY February february II - | THURSDAY Thursday thursday JULY July july VII - | TUESDAY Tuesday tuesday JUNE June june VI | MONDAY Monday monday FEBRUARY February february II | TUESDAY Tuesday tuesday FEBRUARY February february II | WEDNESDAY Wednesday wednesday FEBRUARY February february II @@ -1003,57 +1006,59 @@ SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth F | FRIDAY Friday friday FEBRUARY February february II | SATURDAY Saturday saturday FEBRUARY February february II | SUNDAY Sunday sunday FEBRUARY February february II - | TUESDAY Tuesday tuesday FEBRUARY February february II - | SATURDAY Saturday saturday FEBRUARY February february II - | THURSDAY Thursday thursday FEBRUARY February february II - | TUESDAY Tuesday tuesday FEBRUARY February february II - | SATURDAY Saturday saturday FEBRUARY February february II - | THURSDAY Thursday thursday FEBRUARY February february II - | TUESDAY Tuesday tuesday FEBRUARY February february II | SUNDAY Sunday sunday FEBRUARY February february II - | SATURDAY Saturday saturday FEBRUARY February february II - | WEDNESDAY Wednesday wednesday FEBRUARY February february II - | THURSDAY Thursday thursday FEBRUARY February february II - | FRIDAY Friday friday MARCH March march III - | MONDAY Monday monday DECEMBER December december XII - | TUESDAY Tuesday tuesday DECEMBER December december XII - | WEDNESDAY Wednesday wednesday JANUARY January january I | FRIDAY Friday friday FEBRUARY February february II | SATURDAY Saturday saturday MARCH March march III + | TUESDAY Tuesday tuesday JUNE June june VI + | TUESDAY Tuesday tuesday JUNE June june VI + | THURSDAY Thursday thursday JULY July july VII | TUESDAY Tuesday tuesday DECEMBER December december XII | WEDNESDAY Wednesday wednesday DECEMBER December december XII | FRIDAY Friday friday DECEMBER December december XII | SATURDAY Saturday saturday JANUARY January january I + | WEDNESDAY Wednesday wednesday MARCH March march III + | WEDNESDAY Wednesday wednesday MARCH March march III + | WEDNESDAY Wednesday wednesday MARCH March march III + | WEDNESDAY Wednesday wednesday MARCH March march III + | WEDNESDAY Wednesday wednesday MARCH March march III | SUNDAY Sunday sunday DECEMBER December december XII | MONDAY Monday monday JANUARY January january I + | SATURDAY Saturday saturday SEPTEMBER September september IX + | SATURDAY Saturday saturday FEBRUARY February february II + | (66 rows) SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_3 | to_char -----------+------------------------------------------------- | - | + | 0,097 0097 097 97 7 01 1 02 07 047 16 3 1686042 + | 0,097 0097 097 97 7 01 1 02 07 047 16 7 1756536 + | 0,597 0597 597 97 7 06 1 02 07 047 16 5 1939157 + | 1,097 1097 097 97 7 11 1 02 07 047 16 3 2121778 + | 1,697 1697 697 97 7 17 1 02 07 047 16 7 2340924 + | 1,797 1797 797 97 7 18 1 02 07 047 16 5 2377448 + | 1,897 1897 897 97 7 19 1 02 07 047 16 3 2413972 | 1,969 1969 969 69 9 20 4 12 53 365 31 4 2440587 + | 1,996 1996 996 96 6 20 1 02 09 059 28 4 2450142 + | 1,996 1996 996 96 6 20 1 02 09 060 29 5 2450143 + | 1,996 1996 996 96 6 20 1 03 09 061 01 6 2450144 + | 1,996 1996 996 96 6 20 4 12 53 365 30 2 2450448 + | 1,996 1996 996 96 6 20 4 12 53 366 31 3 2450449 + | 1,997 1997 997 97 7 20 1 01 01 001 01 4 2450450 + | 1,997 1997 997 97 7 20 1 01 01 002 02 5 2450451 + | 1,997 1997 997 97 7 20 1 01 01 002 02 5 2450451 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 - | 1,997 1997 997 97 7 20 1 01 01 002 02 5 2450451 - | 1,997 1997 997 97 7 20 1 01 01 002 02 5 2450451 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 - | 1,997 1997 997 97 7 20 2 06 23 161 10 3 2450610 - | 2,001 2001 001 01 1 21 3 09 38 265 22 7 2452175 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 - | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 @@ -1066,8 +1071,6 @@ SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 - | 1,997 1997 997 97 7 20 3 07 28 191 10 5 2450640 - | 1,997 1997 997 97 7 20 2 06 23 161 10 3 2450610 | 1,997 1997 997 97 7 20 1 02 06 041 10 2 2450490 | 1,997 1997 997 97 7 20 1 02 06 042 11 3 2450491 | 1,997 1997 997 97 7 20 1 02 07 043 12 4 2450492 @@ -1075,58 +1078,60 @@ SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') | 1,997 1997 997 97 7 20 1 02 07 045 14 6 2450494 | 1,997 1997 997 97 7 20 1 02 07 046 15 7 2450495 | 1,997 1997 997 97 7 20 1 02 07 047 16 1 2450496 - | 0,097 0097 097 97 7 01 1 02 07 047 16 3 1686042 - | 0,097 0097 097 97 7 01 1 02 07 047 16 7 1756536 - | 0,597 0597 597 97 7 06 1 02 07 047 16 5 1939157 - | 1,097 1097 097 97 7 11 1 02 07 047 16 3 2121778 - | 1,697 1697 697 97 7 17 1 02 07 047 16 7 2340924 - | 1,797 1797 797 97 7 18 1 02 07 047 16 5 2377448 - | 1,897 1897 897 97 7 19 1 02 07 047 16 3 2413972 | 1,997 1997 997 97 7 20 1 02 07 047 16 1 2450496 - | 2,097 2097 097 97 7 21 1 02 07 047 16 7 2487021 - | 1,996 1996 996 96 6 20 1 02 09 059 28 4 2450142 - | 1,996 1996 996 96 6 20 1 02 09 060 29 5 2450143 - | 1,996 1996 996 96 6 20 1 03 09 061 01 6 2450144 - | 1,996 1996 996 96 6 20 4 12 53 365 30 2 2450448 - | 1,996 1996 996 96 6 20 4 12 53 366 31 3 2450449 - | 1,997 1997 997 97 7 20 1 01 01 001 01 4 2450450 | 1,997 1997 997 97 7 20 1 02 09 059 28 6 2450508 | 1,997 1997 997 97 7 20 1 03 09 060 01 7 2450509 + | 1,997 1997 997 97 7 20 2 06 23 161 10 3 2450610 + | 1,997 1997 997 97 7 20 2 06 23 161 10 3 2450610 + | 1,997 1997 997 97 7 20 3 07 28 191 10 5 2450640 | 1,997 1997 997 97 7 20 4 12 52 364 30 3 2450813 | 1,997 1997 997 97 7 20 4 12 53 365 31 4 2450814 | 1,999 1999 999 99 9 20 4 12 53 365 31 6 2451544 | 2,000 2000 000 00 0 20 1 01 01 001 01 7 2451545 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 + | 2,000 2000 000 00 0 20 1 03 11 075 15 4 2451619 | 2,000 2000 000 00 0 20 4 12 53 366 31 1 2451910 | 2,001 2001 001 01 1 21 1 01 01 001 01 2 2451911 + | 2,001 2001 001 01 1 21 3 09 38 265 22 7 2452175 + | 2,097 2097 097 97 7 21 1 02 07 047 16 7 2487021 + | (66 rows) SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM FMWW FMDDD FMDD FMD FMJ') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_4 | to_char -----------+------------------------------------------------- | - | + | 0,097 97 097 97 7 1 1 2 7 47 16 3 1686042 + | 0,097 97 097 97 7 1 1 2 7 47 16 7 1756536 + | 0,597 597 597 97 7 6 1 2 7 47 16 5 1939157 + | 1,097 1097 097 97 7 11 1 2 7 47 16 3 2121778 + | 1,697 1697 697 97 7 17 1 2 7 47 16 7 2340924 + | 1,797 1797 797 97 7 18 1 2 7 47 16 5 2377448 + | 1,897 1897 897 97 7 19 1 2 7 47 16 3 2413972 | 1,969 1969 969 69 9 20 4 12 53 365 31 4 2440587 + | 1,996 1996 996 96 6 20 1 2 9 59 28 4 2450142 + | 1,996 1996 996 96 6 20 1 2 9 60 29 5 2450143 + | 1,996 1996 996 96 6 20 1 3 9 61 1 6 2450144 + | 1,996 1996 996 96 6 20 4 12 53 365 30 2 2450448 + | 1,996 1996 996 96 6 20 4 12 53 366 31 3 2450449 + | 1,997 1997 997 97 7 20 1 1 1 1 1 4 2450450 + | 1,997 1997 997 97 7 20 1 1 1 2 2 5 2450451 + | 1,997 1997 997 97 7 20 1 1 1 2 2 5 2450451 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 - | 1,997 1997 997 97 7 20 1 1 1 2 2 5 2450451 - | 1,997 1997 997 97 7 20 1 1 1 2 2 5 2450451 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 - | 1,997 1997 997 97 7 20 2 6 23 161 10 3 2450610 - | 2,001 2001 001 01 1 21 3 9 38 265 22 7 2452175 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 - | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 @@ -1139,8 +1144,6 @@ SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 - | 1,997 1997 997 97 7 20 3 7 28 191 10 5 2450640 - | 1,997 1997 997 97 7 20 2 6 23 161 10 3 2450610 | 1,997 1997 997 97 7 20 1 2 6 41 10 2 2450490 | 1,997 1997 997 97 7 20 1 2 6 42 11 3 2450491 | 1,997 1997 997 97 7 20 1 2 7 43 12 4 2450492 @@ -1148,72 +1151,55 @@ SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM | 1,997 1997 997 97 7 20 1 2 7 45 14 6 2450494 | 1,997 1997 997 97 7 20 1 2 7 46 15 7 2450495 | 1,997 1997 997 97 7 20 1 2 7 47 16 1 2450496 - | 0,097 97 097 97 7 1 1 2 7 47 16 3 1686042 - | 0,097 97 097 97 7 1 1 2 7 47 16 7 1756536 - | 0,597 597 597 97 7 6 1 2 7 47 16 5 1939157 - | 1,097 1097 097 97 7 11 1 2 7 47 16 3 2121778 - | 1,697 1697 697 97 7 17 1 2 7 47 16 7 2340924 - | 1,797 1797 797 97 7 18 1 2 7 47 16 5 2377448 - | 1,897 1897 897 97 7 19 1 2 7 47 16 3 2413972 | 1,997 1997 997 97 7 20 1 2 7 47 16 1 2450496 - | 2,097 2097 097 97 7 21 1 2 7 47 16 7 2487021 - | 1,996 1996 996 96 6 20 1 2 9 59 28 4 2450142 - | 1,996 1996 996 96 6 20 1 2 9 60 29 5 2450143 - | 1,996 1996 996 96 6 20 1 3 9 61 1 6 2450144 - | 1,996 1996 996 96 6 20 4 12 53 365 30 2 2450448 - | 1,996 1996 996 96 6 20 4 12 53 366 31 3 2450449 - | 1,997 1997 997 97 7 20 1 1 1 1 1 4 2450450 | 1,997 1997 997 97 7 20 1 2 9 59 28 6 2450508 | 1,997 1997 997 97 7 20 1 3 9 60 1 7 2450509 + | 1,997 1997 997 97 7 20 2 6 23 161 10 3 2450610 + | 1,997 1997 997 97 7 20 2 6 23 161 10 3 2450610 + | 1,997 1997 997 97 7 20 3 7 28 191 10 5 2450640 | 1,997 1997 997 97 7 20 4 12 52 364 30 3 2450813 | 1,997 1997 997 97 7 20 4 12 53 365 31 4 2450814 | 1,999 1999 999 99 9 20 4 12 53 365 31 6 2451544 | 2,000 2000 000 00 0 20 1 1 1 1 1 7 2451545 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 + | 2,000 2000 000 00 0 20 1 3 11 75 15 4 2451619 | 2,000 2000 000 00 0 20 4 12 53 366 31 1 2451910 | 2,001 2001 001 01 1 21 1 1 1 1 1 2 2451911 + | 2,001 2001 001 01 1 21 3 9 38 265 22 7 2452175 + | 2,097 2097 097 97 7 21 1 2 7 47 16 7 2487021 + | (66 rows) SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_5 | to_char -----------+---------------------- | - | - | 04 04 16 00 00 57600 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 - | 05 05 17 32 02 63122 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 - | 12 12 00 00 00 0 - | 03 03 03 04 05 11045 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 04 04 16 00 00 57600 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 - | 06 06 18 19 20 65960 - | 08 08 08 14 01 29641 - | 04 04 04 14 02 15242 - | 02 02 02 14 03 8043 - | 03 03 03 14 04 11644 - | 01 01 01 14 05 4445 - | 05 05 17 32 01 63121 - | 05 05 17 32 01 63121 - | 05 05 17 32 00 63120 - | 05 05 17 32 01 63121 - | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 12 12 00 00 00 0 + | 03 03 03 04 05 11045 | 09 09 09 32 01 34321 | 09 09 09 32 01 34321 | 09 09 09 32 01 34321 | 02 02 14 32 01 52321 - | 02 02 14 32 01 52321 - | 06 06 18 32 01 66721 + | 05 05 17 32 00 63120 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 @@ -1231,6 +1217,7 @@ SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 05 05 17 32 02 63122 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 @@ -1241,51 +1228,51 @@ SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 06 06 18 32 01 66721 + | 02 02 14 32 01 52321 + | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 | 05 05 17 32 01 63121 + | 01 01 01 14 05 4445 + | 02 02 02 14 03 8043 + | 03 03 03 14 04 11644 + | 04 04 04 14 02 15242 + | 08 08 08 14 01 29641 + | 05 05 17 32 01 63121 + | 05 05 17 32 01 63121 + | 06 06 18 19 20 65960 + | 05 05 17 32 01 63121 + | (66 rows) SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between quote marks\\""') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_6 | to_char -----------+------------------------------------------------- | - | - | HH:MI:SS is 04:00:00 "text between quote marks" - | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 05:32:02 "text between quote marks" - | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 12:00:00 "text between quote marks" - | HH:MI:SS is 03:04:05 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 06:19:20 "text between quote marks" - | HH:MI:SS is 08:14:01 "text between quote marks" - | HH:MI:SS is 04:14:02 "text between quote marks" - | HH:MI:SS is 02:14:03 "text between quote marks" - | HH:MI:SS is 03:14:04 "text between quote marks" - | HH:MI:SS is 01:14:05 "text between quote marks" - | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 04:00:00 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" - | HH:MI:SS is 05:32:00 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 12:00:00 "text between quote marks" + | HH:MI:SS is 03:04:05 "text between quote marks" | HH:MI:SS is 09:32:01 "text between quote marks" | HH:MI:SS is 09:32:01 "text between quote marks" | HH:MI:SS is 09:32:01 "text between quote marks" | HH:MI:SS is 02:32:01 "text between quote marks" - | HH:MI:SS is 02:32:01 "text between quote marks" - | HH:MI:SS is 06:32:01 "text between quote marks" + | HH:MI:SS is 05:32:00 "text between quote marks" + | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" @@ -1302,6 +1289,7 @@ SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between qu | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 05:32:02 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" @@ -1312,53 +1300,51 @@ SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between qu | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 06:32:01 "text between quote marks" + | HH:MI:SS is 02:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 01:14:05 "text between quote marks" + | HH:MI:SS is 02:14:03 "text between quote marks" + | HH:MI:SS is 03:14:04 "text between quote marks" + | HH:MI:SS is 04:14:02 "text between quote marks" + | HH:MI:SS is 08:14:01 "text between quote marks" + | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 05:32:01 "text between quote marks" + | HH:MI:SS is 06:19:20 "text between quote marks" + | HH:MI:SS is 05:32:01 "text between quote marks" + | (66 rows) SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_7 | to_char -----------+------------------------ | - | - | 16--text--00--text--00 - | 17--text--32--text--01 - | 17--text--32--text--01 - | 17--text--32--text--02 - | 17--text--32--text--01 - | 17--text--32--text--01 | 17--text--32--text--01 - | 00--text--00--text--00 - | 03--text--04--text--05 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 - | 18--text--19--text--20 - | 08--text--14--text--01 - | 04--text--14--text--02 - | 02--text--14--text--03 - | 03--text--14--text--04 - | 01--text--14--text--05 | 17--text--32--text--01 + | 16--text--00--text--00 | 17--text--32--text--01 - | 17--text--32--text--00 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 + | 00--text--00--text--00 + | 03--text--04--text--05 | 09--text--32--text--01 | 09--text--32--text--01 | 09--text--32--text--01 | 14--text--32--text--01 - | 14--text--32--text--01 - | 18--text--32--text--01 + | 17--text--32--text--00 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 @@ -1376,6 +1362,10 @@ SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 + | 17--text--32--text--02 + | 17--text--32--text--01 + | 17--text--32--text--01 + | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 @@ -1383,40 +1373,55 @@ SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 + | 18--text--32--text--01 + | 14--text--32--text--01 + | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 | 17--text--32--text--01 + | 01--text--14--text--05 + | 02--text--14--text--03 + | 03--text--14--text--04 + | 04--text--14--text--02 + | 08--text--14--text--01 | 17--text--32--text--01 | 17--text--32--text--01 + | 18--text--19--text--20 | 17--text--32--text--01 + | (66 rows) SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_8 | to_char -----------+------------------------- | - | + | 0097TH 0097th 1686042nd + | 0097TH 0097th 1756536th + | 0597TH 0597th 1939157th + | 1097TH 1097th 2121778th + | 1697TH 1697th 2340924th + | 1797TH 1797th 2377448th + | 1897TH 1897th 2413972nd | 1969TH 1969th 2440587th + | 1996TH 1996th 2450142nd + | 1996TH 1996th 2450143rd + | 1996TH 1996th 2450144th + | 1996TH 1996th 2450448th + | 1996TH 1996th 2450449th + | 1997TH 1997th 2450450th + | 1997TH 1997th 2450451st + | 1997TH 1997th 2450451st | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th - | 1997TH 1997th 2450451st - | 1997TH 1997th 2450451st | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th - | 1997TH 1997th 2450610th - | 2001ST 2001st 2452175th - | 2000TH 2000th 2451619th - | 2000TH 2000th 2451619th - | 2000TH 2000th 2451619th - | 2000TH 2000th 2451619th - | 2000TH 2000th 2451619th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th @@ -1429,8 +1434,6 @@ SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th | 1997TH 1997th 2450490th - | 1997TH 1997th 2450640th - | 1997TH 1997th 2450610th | 1997TH 1997th 2450490th | 1997TH 1997th 2450491st | 1997TH 1997th 2450492nd @@ -1438,130 +1441,132 @@ SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') | 1997TH 1997th 2450494th | 1997TH 1997th 2450495th | 1997TH 1997th 2450496th - | 0097TH 0097th 1686042nd - | 0097TH 0097th 1756536th - | 0597TH 0597th 1939157th - | 1097TH 1097th 2121778th - | 1697TH 1697th 2340924th - | 1797TH 1797th 2377448th - | 1897TH 1897th 2413972nd | 1997TH 1997th 2450496th - | 2097TH 2097th 2487021st - | 1996TH 1996th 2450142nd - | 1996TH 1996th 2450143rd - | 1996TH 1996th 2450144th - | 1996TH 1996th 2450448th - | 1996TH 1996th 2450449th - | 1997TH 1997th 2450450th | 1997TH 1997th 2450508th | 1997TH 1997th 2450509th + | 1997TH 1997th 2450610th + | 1997TH 1997th 2450610th + | 1997TH 1997th 2450640th | 1997TH 1997th 2450813th | 1997TH 1997th 2450814th | 1999TH 1999th 2451544th | 2000TH 2000th 2451545th + | 2000TH 2000th 2451619th + | 2000TH 2000th 2451619th + | 2000TH 2000th 2451619th + | 2000TH 2000th 2451619th + | 2000TH 2000th 2451619th | 2000TH 2000th 2451910th | 2001ST 2001st 2451911th + | 2001ST 2001st 2452175th + | 2097TH 2097th 2487021st + | (66 rows) SELECT '' AS to_char_9, to_char(d1, 'YYYY A.D. YYYY a.d. YYYY bc HH:MI:SS P.M. HH:MI:SS p.m. HH:MI:SS pm') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_9 | to_char -----------+--------------------------------------------------------------------- | - | + | 0097 B.C. 0097 b.c. 0097 bc 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 0097 A.D. 0097 a.d. 0097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 0597 A.D. 0597 a.d. 0597 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1097 A.D. 1097 a.d. 1097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1697 A.D. 1697 a.d. 1697 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1797 A.D. 1797 a.d. 1797 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1897 A.D. 1897 a.d. 1897 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1969 A.D. 1969 a.d. 1969 ad 04:00:00 P.M. 04:00:00 p.m. 04:00:00 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1997 A.D. 1997 a.d. 1997 ad 12:00:00 A.M. 12:00:00 a.m. 12:00:00 am + | 1997 A.D. 1997 a.d. 1997 ad 03:04:05 A.M. 03:04:05 a.m. 03:04:05 am + | 1997 A.D. 1997 a.d. 1997 ad 09:32:01 A.M. 09:32:01 a.m. 09:32:01 am + | 1997 A.D. 1997 a.d. 1997 ad 09:32:01 A.M. 09:32:01 a.m. 09:32:01 am + | 1997 A.D. 1997 a.d. 1997 ad 09:32:01 A.M. 09:32:01 a.m. 09:32:01 am + | 1997 A.D. 1997 a.d. 1997 ad 02:32:01 P.M. 02:32:01 p.m. 02:32:01 pm + | 1997 A.D. 1997 a.d. 1997 ad 05:32:00 P.M. 05:32:00 p.m. 05:32:00 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 05:32:02 P.M. 05:32:02 p.m. 05:32:02 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 12:00:00 A.M. 12:00:00 a.m. 12:00:00 am - | 1997 A.D. 1997 a.d. 1997 ad 03:04:05 A.M. 03:04:05 a.m. 03:04:05 am | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 2001 A.D. 2001 a.d. 2001 ad 06:19:20 P.M. 06:19:20 p.m. 06:19:20 pm - | 2000 A.D. 2000 a.d. 2000 ad 08:14:01 A.M. 08:14:01 a.m. 08:14:01 am - | 2000 A.D. 2000 a.d. 2000 ad 04:14:02 A.M. 04:14:02 a.m. 04:14:02 am - | 2000 A.D. 2000 a.d. 2000 ad 02:14:03 A.M. 02:14:03 a.m. 02:14:03 am - | 2000 A.D. 2000 a.d. 2000 ad 03:14:04 A.M. 03:14:04 a.m. 03:14:04 am - | 2000 A.D. 2000 a.d. 2000 ad 01:14:05 A.M. 01:14:05 a.m. 01:14:05 am | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 05:32:00 P.M. 05:32:00 p.m. 05:32:00 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 09:32:01 A.M. 09:32:01 a.m. 09:32:01 am - | 1997 A.D. 1997 a.d. 1997 ad 09:32:01 A.M. 09:32:01 a.m. 09:32:01 am - | 1997 A.D. 1997 a.d. 1997 ad 09:32:01 A.M. 09:32:01 a.m. 09:32:01 am - | 1997 A.D. 1997 a.d. 1997 ad 02:32:01 P.M. 02:32:01 p.m. 02:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 02:32:01 P.M. 02:32:01 p.m. 02:32:01 pm - | 1997 A.D. 1997 a.d. 1997 ad 06:32:01 P.M. 06:32:01 p.m. 06:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1997 A.D. 1997 a.d. 1997 ad 05:32:02 P.M. 05:32:02 p.m. 05:32:02 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 0097 B.C. 0097 b.c. 0097 bc 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 0097 A.D. 0097 a.d. 0097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 0597 A.D. 0597 a.d. 0597 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1097 A.D. 1097 a.d. 1097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1697 A.D. 1697 a.d. 1697 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1797 A.D. 1797 a.d. 1797 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1897 A.D. 1897 a.d. 1897 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 2097 A.D. 2097 a.d. 2097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm - | 1996 A.D. 1996 a.d. 1996 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 1997 A.D. 1997 a.d. 1997 ad 06:32:01 P.M. 06:32:01 p.m. 06:32:01 pm + | 1997 A.D. 1997 a.d. 1997 ad 02:32:01 P.M. 02:32:01 p.m. 02:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1997 A.D. 1997 a.d. 1997 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 1999 A.D. 1999 a.d. 1999 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 2000 A.D. 2000 a.d. 2000 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 2000 A.D. 2000 a.d. 2000 ad 01:14:05 A.M. 01:14:05 a.m. 01:14:05 am + | 2000 A.D. 2000 a.d. 2000 ad 02:14:03 A.M. 02:14:03 a.m. 02:14:03 am + | 2000 A.D. 2000 a.d. 2000 ad 03:14:04 A.M. 03:14:04 a.m. 03:14:04 am + | 2000 A.D. 2000 a.d. 2000 ad 04:14:02 A.M. 04:14:02 a.m. 04:14:02 am + | 2000 A.D. 2000 a.d. 2000 ad 08:14:01 A.M. 08:14:01 a.m. 08:14:01 am | 2000 A.D. 2000 a.d. 2000 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm | 2001 A.D. 2001 a.d. 2001 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | 2001 A.D. 2001 a.d. 2001 ad 06:19:20 P.M. 06:19:20 p.m. 06:19:20 pm + | 2097 A.D. 2097 a.d. 2097 ad 05:32:01 P.M. 05:32:01 p.m. 05:32:01 pm + | (66 rows) SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_10 | to_char ------------+------------------------ | - | + | 0097 097 97 7 07 044 2 + | 0097 097 97 7 07 048 6 + | 0597 597 97 7 07 046 4 + | 1097 097 97 7 07 044 2 + | 1697 697 97 7 07 048 6 + | 1797 797 97 7 07 046 4 + | 1897 897 97 7 07 044 2 | 1970 970 70 0 01 003 3 + | 1996 996 96 6 09 059 3 + | 1996 996 96 6 09 060 4 + | 1996 996 96 6 09 061 5 + | 1997 997 97 7 01 001 1 + | 1997 997 97 7 01 002 2 + | 1997 997 97 7 01 003 3 + | 1997 997 97 7 01 004 4 + | 1997 997 97 7 01 004 4 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 - | 1997 997 97 7 01 004 4 - | 1997 997 97 7 01 004 4 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 - | 1997 997 97 7 24 163 2 - | 2001 001 01 1 38 265 6 - | 2000 000 00 0 11 073 3 - | 2000 000 00 0 11 073 3 - | 2000 000 00 0 11 073 3 - | 2000 000 00 0 11 073 3 - | 2000 000 00 0 11 073 3 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 @@ -1574,8 +1579,6 @@ SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 043 1 - | 1997 997 97 7 28 193 4 - | 1997 997 97 7 24 163 2 | 1997 997 97 7 07 043 1 | 1997 997 97 7 07 044 2 | 1997 997 97 7 07 045 3 @@ -1583,57 +1586,59 @@ SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') | 1997 997 97 7 07 047 5 | 1997 997 97 7 07 048 6 | 1997 997 97 7 07 049 7 - | 0097 097 97 7 07 044 2 - | 0097 097 97 7 07 048 6 - | 0597 597 97 7 07 046 4 - | 1097 097 97 7 07 044 2 - | 1697 697 97 7 07 048 6 - | 1797 797 97 7 07 046 4 - | 1897 897 97 7 07 044 2 | 1997 997 97 7 07 049 7 - | 2097 097 97 7 07 048 6 - | 1996 996 96 6 09 059 3 - | 1996 996 96 6 09 060 4 - | 1996 996 96 6 09 061 5 - | 1997 997 97 7 01 001 1 - | 1997 997 97 7 01 002 2 - | 1997 997 97 7 01 003 3 | 1997 997 97 7 09 061 5 | 1997 997 97 7 09 062 6 + | 1997 997 97 7 24 163 2 + | 1997 997 97 7 24 163 2 + | 1997 997 97 7 28 193 4 | 1998 998 98 8 01 002 2 | 1998 998 98 8 01 003 3 | 1999 999 99 9 52 362 5 | 1999 999 99 9 52 363 6 + | 2000 000 00 0 11 073 3 + | 2000 000 00 0 11 073 3 + | 2000 000 00 0 11 073 3 + | 2000 000 00 0 11 073 3 + | 2000 000 00 0 11 073 3 | 2000 000 00 0 52 364 7 | 2001 001 01 1 01 001 1 + | 2001 001 01 1 38 265 6 + | 2097 097 97 7 07 048 6 + | (66 rows) SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; to_char_11 | to_char ------------+------------------------ | - | + | 97 097 97 7 7 44 2 + | 97 097 97 7 7 48 6 + | 597 597 97 7 7 46 4 + | 1097 097 97 7 7 44 2 + | 1697 697 97 7 7 48 6 + | 1797 797 97 7 7 46 4 + | 1897 897 97 7 7 44 2 | 1970 970 70 0 1 3 3 + | 1996 996 96 6 9 59 3 + | 1996 996 96 6 9 60 4 + | 1996 996 96 6 9 61 5 + | 1997 997 97 7 1 1 1 + | 1997 997 97 7 1 2 2 + | 1997 997 97 7 1 3 3 + | 1997 997 97 7 1 4 4 + | 1997 997 97 7 1 4 4 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 - | 1997 997 97 7 1 4 4 - | 1997 997 97 7 1 4 4 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 - | 1997 997 97 7 24 163 2 - | 2001 001 01 1 38 265 6 - | 2000 000 00 0 11 73 3 - | 2000 000 00 0 11 73 3 - | 2000 000 00 0 11 73 3 - | 2000 000 00 0 11 73 3 - | 2000 000 00 0 11 73 3 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 @@ -1646,8 +1651,6 @@ SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 43 1 - | 1997 997 97 7 28 193 4 - | 1997 997 97 7 24 163 2 | 1997 997 97 7 7 43 1 | 1997 997 97 7 7 44 2 | 1997 997 97 7 7 45 3 @@ -1655,28 +1658,25 @@ SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') | 1997 997 97 7 7 47 5 | 1997 997 97 7 7 48 6 | 1997 997 97 7 7 49 7 - | 97 097 97 7 7 44 2 - | 97 097 97 7 7 48 6 - | 597 597 97 7 7 46 4 - | 1097 097 97 7 7 44 2 - | 1697 697 97 7 7 48 6 - | 1797 797 97 7 7 46 4 - | 1897 897 97 7 7 44 2 | 1997 997 97 7 7 49 7 - | 2097 097 97 7 7 48 6 - | 1996 996 96 6 9 59 3 - | 1996 996 96 6 9 60 4 - | 1996 996 96 6 9 61 5 - | 1997 997 97 7 1 1 1 - | 1997 997 97 7 1 2 2 - | 1997 997 97 7 1 3 3 | 1997 997 97 7 9 61 5 | 1997 997 97 7 9 62 6 + | 1997 997 97 7 24 163 2 + | 1997 997 97 7 24 163 2 + | 1997 997 97 7 28 193 4 | 1998 998 98 8 1 2 2 | 1998 998 98 8 1 3 3 | 1999 999 99 9 52 362 5 | 1999 999 99 9 52 363 6 + | 2000 000 00 0 11 73 3 + | 2000 000 00 0 11 73 3 + | 2000 000 00 0 11 73 3 + | 2000 000 00 0 11 73 3 + | 2000 000 00 0 11 73 3 | 2000 000 00 0 52 364 7 | 2001 001 01 1 1 1 1 + | 2001 001 01 1 38 265 6 + | 2097 097 97 7 7 48 6 + | (66 rows) diff --git a/src/test/regress/expected/timetz.out b/src/test/regress/expected/timetz.out index 43911312f9..70e668c23b 100644 --- a/src/test/regress/expected/timetz.out +++ b/src/test/regress/expected/timetz.out @@ -19,24 +19,24 @@ INSERT INTO TIMETZ_TBL VALUES ('15:36:39 America/New_York'); ERROR: invalid input syntax for type time with time zone: "15:36:39 America/New_York" LINE 1: INSERT INTO TIMETZ_TBL VALUES ('15:36:39 America/New_York'); ^ -SELECT f1 AS "Time TZ" FROM TIMETZ_TBL; +SELECT f1 AS "Time TZ" FROM TIMETZ_TBL ORDER BY f1; Time TZ ---------------- 00:01:00-07 01:00:00-07 02:03:00-07 - 07:07:00-08 08:08:00-04 + 07:07:00-08 11:59:00-07 12:00:00-07 12:01:00-07 + 15:36:39-04 + 15:36:39-05 23:59:00-07 23:59:59.99-07 - 15:36:39-05 - 15:36:39-04 (12 rows) -SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07'; +SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07' ORDER BY f1; Three ------------- 00:01:00-07 @@ -44,40 +44,40 @@ SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07'; 02:03:00-07 (3 rows) -SELECT f1 AS "Seven" FROM TIMETZ_TBL WHERE f1 > '05:06:07-07'; +SELECT f1 AS "Seven" FROM TIMETZ_TBL WHERE f1 > '05:06:07-07' ORDER BY f1; Seven ---------------- - 07:07:00-08 08:08:00-04 + 07:07:00-08 11:59:00-07 12:00:00-07 12:01:00-07 + 15:36:39-04 + 15:36:39-05 23:59:00-07 23:59:59.99-07 - 15:36:39-05 - 15:36:39-04 (9 rows) -SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07'; +SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07' ORDER BY f1; None ------ (0 rows) -SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; +SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07' ORDER BY f1; Ten ---------------- 00:01:00-07 01:00:00-07 02:03:00-07 - 07:07:00-08 08:08:00-04 + 07:07:00-08 11:59:00-07 12:00:00-07 12:01:00-07 + 15:36:39-04 + 15:36:39-05 23:59:00-07 23:59:59.99-07 - 15:36:39-05 - 15:36:39-04 (12 rows) -- @@ -88,7 +88,7 @@ SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; -- Leave in one query to show that it is rejected, -- and do the rest of the testing in horology.sql -- where we do mixed-type arithmetic. - thomas 2000-12-02 -SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL; +SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL ORDER BY f1; ERROR: operator does not exist: time with time zone + time with time zone LINE 1: SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TI... ^ diff --git a/src/test/regress/expected/tinterval.out b/src/test/regress/expected/tinterval.out index 89e850cf61..19ae7cc16f 100644 --- a/src/test/regress/expected/tinterval.out +++ b/src/test/regress/expected/tinterval.out @@ -26,20 +26,20 @@ ERROR: invalid input syntax for type abstime: "" LINE 2: VALUES ('["" "infinity"]'); ^ -- test tinterval operators -SELECT '' AS five, * FROM TINTERVAL_TBL; +SELECT '' AS five, * FROM TINTERVAL_TBL ORDER BY f1; five | f1 ------+----------------------------------------------------------------- | ["-infinity" "infinity"] - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] + | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] + | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] (5 rows) -- length == SELECT '' AS one, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #= '@ 1 months'; + WHERE t.f1 #= '@ 1 months' ORDER BY f1; one | f1 -----+----------------------------------------------------------------- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] @@ -48,18 +48,18 @@ SELECT '' AS one, t.* -- length <> SELECT '' AS three, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #<> '@ 1 months'; + WHERE t.f1 #<> '@ 1 months' ORDER BY f1; three | f1 -------+----------------------------------------------------------------- - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] + | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] + | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] (3 rows) -- length < SELECT '' AS zero, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #< '@ 1 month'; + WHERE t.f1 #< '@ 1 month' ORDER BY f1; zero | f1 ------+---- (0 rows) @@ -67,7 +67,7 @@ SELECT '' AS zero, t.* -- length <= SELECT '' AS one, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #<= '@ 1 month'; + WHERE t.f1 #<= '@ 1 month' ORDER BY f1; one | f1 -----+----------------------------------------------------------------- | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] @@ -76,30 +76,30 @@ SELECT '' AS one, t.* -- length > SELECT '' AS three, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #> '@ 1 year'; + WHERE t.f1 #> '@ 1 year' ORDER BY f1; three | f1 -------+----------------------------------------------------------------- - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] + | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] + | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] (3 rows) -- length >= SELECT '' AS three, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #>= '@ 3 years'; + WHERE t.f1 #>= '@ 3 years' ORDER BY f1; three | f1 -------+----------------------------------------------------------------- - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] + | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] + | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] (3 rows) -- overlaps SELECT '' AS three, t1.* FROM TINTERVAL_TBL t1 WHERE t1.f1 && - tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]'; + tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]' ORDER BY f1; three | f1 -------+----------------------------------------------------------------- | ["-infinity" "infinity"] diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out index 51bb3668f3..fa0611f4ba 100644 --- a/src/test/regress/expected/transactions.out +++ b/src/test/regress/expected/transactions.out @@ -31,13 +31,13 @@ SELECT oid FROM pg_class WHERE relname = 'disappear'; (0 rows) -- should have members again -SELECT * FROM aggtest; +SELECT * FROM aggtest order by a, b; a | b -----+--------- - 56 | 7.8 - 100 | 99.097 0 | 0.09561 42 | 324.78 + 56 | 7.8 + 100 | 99.097 (4 rows) -- Read-only tests @@ -126,14 +126,14 @@ LINE 1: INSERT into bar VALUES (1); RELEASE SAVEPOINT three; INSERT INTO foo VALUES (3); COMMIT; -SELECT * FROM foo; -- should have 1 and 3 +SELECT * FROM foo ORDER BY a; -- should have 1 and 3 a --- 1 3 (2 rows) -SELECT * FROM barbaz; -- should have 1 +SELECT * FROM barbaz ORDER BY a; -- should have 1 a --- 1 @@ -160,7 +160,7 @@ LINE 1: SELECT foo; COMMIT; COMMIT; -- should not be in a transaction block WARNING: there is no transaction in progress -SELECT * FROM savepoints; +SELECT * FROM savepoints ORDER BY 1; a --- 1 @@ -180,7 +180,7 @@ ROLLBACK; COMMIT; -- should not be in a transaction block WARNING: there is no transaction in progress -SELECT * FROM savepoints; +SELECT * FROM savepoints ORDER BY 1; a --- 1 @@ -197,7 +197,7 @@ ERROR: column "foo" does not exist LINE 1: SELECT foo; ^ COMMIT; -SELECT * FROM savepoints; +SELECT * FROM savepoints ORDER BY a; a --- 1 @@ -232,7 +232,7 @@ BEGIN; ROLLBACK TO SAVEPOINT one; INSERT INTO savepoints VALUES (11); COMMIT; -SELECT a FROM savepoints WHERE a in (9, 10, 11); +SELECT a FROM savepoints WHERE a in (9, 10, 11) ORDER BY a; a ---- 9 @@ -259,7 +259,7 @@ BEGIN; SAVEPOINT three; INSERT INTO savepoints VALUES (17); COMMIT; -SELECT a FROM savepoints WHERE a BETWEEN 12 AND 17; +SELECT a FROM savepoints WHERE a BETWEEN 12 AND 17 ORDER BY a; a ---- 12 @@ -279,7 +279,7 @@ BEGIN; ROLLBACK TO SAVEPOINT one; INSERT INTO savepoints VALUES (22); COMMIT; -SELECT a FROM savepoints WHERE a BETWEEN 18 AND 22; +SELECT a FROM savepoints WHERE a BETWEEN 18 AND 22 ORDER BY a; a ---- 18 @@ -388,13 +388,13 @@ COMMIT; -- also check that they don't see commits of concurrent transactions, but -- that's a mite hard to do within the limitations of pg_regress.) -- -select * from xacttest; +select * from xacttest order by a, b; a | b -----+--------- - 56 | 7.8 - 100 | 99.097 0 | 0.09561 42 | 324.78 + 56 | 7.8 + 100 | 99.097 777 | 777.777 (5 rows) @@ -402,7 +402,7 @@ create or replace function max_xacttest() returns smallint language sql as 'select max(a) from xacttest' stable; begin; update xacttest set a = max_xacttest() + 10 where a > 0; -select * from xacttest; +select * from xacttest order by a, b; a | b -----+--------- 0 | 0.09561 @@ -418,7 +418,7 @@ create or replace function max_xacttest() returns smallint language sql as 'select max(a) from xacttest' volatile; begin; update xacttest set a = max_xacttest() + 10 where a > 0; -select * from xacttest; +select * from xacttest order by a, b; a | b -----+--------- 0 | 0.09561 @@ -434,7 +434,7 @@ create or replace function max_xacttest() returns smallint language plpgsql as 'begin return max(a) from xacttest; end' stable; begin; update xacttest set a = max_xacttest() + 10 where a > 0; -select * from xacttest; +select * from xacttest order by a, b; a | b -----+--------- 0 | 0.09561 @@ -449,7 +449,7 @@ create or replace function max_xacttest() returns smallint language plpgsql as 'begin return max(a) from xacttest; end' volatile; begin; update xacttest set a = max_xacttest() + 10 where a > 0; -select * from xacttest; +select * from xacttest order by a, b; a | b -----+--------- 0 | 0.09561 diff --git a/src/test/regress/expected/triggers.out b/src/test/regress/expected/triggers.out index 2a5cb909d7..250580157a 100644 --- a/src/test/regress/expected/triggers.out +++ b/src/test/regress/expected/triggers.out @@ -153,7 +153,7 @@ create trigger ttserial insert into tttest values (1, 1, null); insert into tttest values (2, 2, null); insert into tttest values (3, 3, 0); -select * from tttest; +select * from tttest order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- 1 | 1 | 10 | 999999 @@ -162,17 +162,17 @@ select * from tttest; (3 rows) delete from tttest where price_id = 2; -select * from tttest; +select * from tttest order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- 1 | 1 | 10 | 999999 - 3 | 3 | 30 | 999999 2 | 2 | 20 | 40 + 3 | 3 | 30 | 999999 (3 rows) -- what do we see ? -- get current prices -select * from tttest where price_off = 999999; +select * from tttest where price_off = 999999 order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- 1 | 1 | 10 | 999999 @@ -181,26 +181,26 @@ select * from tttest where price_off = 999999; -- change price for price_id == 3 update tttest set price_val = 30 where price_id = 3; -select * from tttest; +select * from tttest order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- 1 | 1 | 10 | 999999 2 | 2 | 20 | 40 - 3 | 30 | 50 | 999999 3 | 3 | 30 | 50 + 3 | 30 | 50 | 999999 (4 rows) -- now we want to change pric_id in ALL tuples -- this gets us not what we need update tttest set price_id = 5 where price_id = 3; -select * from tttest; +select * from tttest order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- 1 | 1 | 10 | 999999 2 | 2 | 20 | 40 3 | 3 | 30 | 50 - 5 | 30 | 60 | 999999 3 | 30 | 50 | 60 + 5 | 30 | 60 | 999999 (5 rows) -- restore data as before last update: @@ -212,7 +212,7 @@ select set_ttdummy(0); delete from tttest where price_id = 5; update tttest set price_off = 999999 where price_val = 30; -select * from tttest; +select * from tttest order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- 1 | 1 | 10 | 999999 @@ -223,7 +223,7 @@ select * from tttest; -- and try change price_id now! update tttest set price_id = 5 where price_id = 3; -select * from tttest; +select * from tttest order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- 1 | 1 | 10 | 999999 @@ -251,18 +251,18 @@ select set_ttdummy(0); (1 row) update tttest set price_on = -1 where price_id = 1; -select * from tttest; +select * from tttest order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- + 1 | 1 | -1 | 999999 2 | 2 | 20 | 40 5 | 3 | 30 | 50 5 | 30 | 50 | 999999 - 1 | 1 | -1 | 999999 (4 rows) -- isn't it what we need ? -- get price for price_id == 5 as it was @ "date" 35 -select * from tttest where price_on <= 35 and price_off > 35 and price_id = 5; +select * from tttest where price_on <= 35 and price_off > 35 and price_id = 5 order by 1,2,3,4; price_id | price_val | price_on | price_off ----------+-----------+----------+----------- 5 | 3 | 30 | 50 @@ -360,7 +360,7 @@ insert into trigtest2 values(1); insert into trigtest2 values(2); delete from trigtest where i=2; NOTICE: trigtest DELETE AFTER STATEMENT -select * from trigtest2; +select * from trigtest2 order by 1; i --- 1 @@ -368,7 +368,7 @@ select * from trigtest2; alter table trigtest disable trigger all; delete from trigtest where i=1; -select * from trigtest2; +select * from trigtest2 order by 1; i --- 1 @@ -376,7 +376,7 @@ select * from trigtest2; -- ensure we still insert, even when all triggers are disabled insert into trigtest default values; -select * from trigtest; +select * from trigtest order by 1; i --- 3 @@ -568,14 +568,14 @@ UPDATE 2 UPDATE min_updates_test_oids SET f3 = 2 WHERE f3 is null; UPDATE 1 \set QUIET true -SELECT * FROM min_updates_test; +SELECT * FROM min_updates_test ORDER BY 1,2,3; f1 | f2 | f3 ----+----+---- a | 2 | 2 b | 3 | 2 (2 rows) -SELECT * FROM min_updates_test_oids; +SELECT * FROM min_updates_test_oids ORDER BY 1,2,3; f1 | f2 | f3 ----+----+---- a | 2 | 2 diff --git a/src/test/regress/expected/truncate.out b/src/test/regress/expected/truncate.out index 7f43df710c..404869684e 100644 --- a/src/test/regress/expected/truncate.out +++ b/src/test/regress/expected/truncate.out @@ -3,7 +3,7 @@ CREATE TABLE truncate_a (col1 integer primary key); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "truncate_a_pkey" for table "truncate_a" INSERT INTO truncate_a VALUES (1); INSERT INTO truncate_a VALUES (2); -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY 1; col1 ------ 1 @@ -14,7 +14,7 @@ SELECT * FROM truncate_a; BEGIN; TRUNCATE truncate_a; ROLLBACK; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY 1; col1 ------ 1 @@ -25,7 +25,7 @@ SELECT * FROM truncate_a; BEGIN; TRUNCATE truncate_a; COMMIT; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY 1; col1 ------ (0 rows) @@ -153,7 +153,7 @@ INSERT INTO trunc_fb VALUES (4, 444); CREATE TABLE trunc_faa (col3 text) INHERITS (trunc_fa); INSERT INTO trunc_faa VALUES (5, 'five', 'FIVE'); BEGIN; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; col1 ------ 1 @@ -164,14 +164,14 @@ SELECT * FROM trunc_f; (5 rows) TRUNCATE trunc_f; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; col1 ------ (0 rows) ROLLBACK; BEGIN; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; col1 ------ 1 @@ -182,7 +182,7 @@ SELECT * FROM trunc_f; (5 rows) TRUNCATE ONLY trunc_f; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; col1 ------ 3 @@ -192,7 +192,7 @@ SELECT * FROM trunc_f; ROLLBACK; BEGIN; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; col1 ------ 1 @@ -202,21 +202,21 @@ SELECT * FROM trunc_f; 5 (5 rows) -SELECT * FROM trunc_fa; +SELECT * FROM trunc_fa ORDER BY 1, 2; col1 | col2a ------+------- 3 | three 5 | five (2 rows) -SELECT * FROM trunc_faa; +SELECT * FROM trunc_faa ORDER BY 1, 2; col1 | col2a | col3 ------+-------+------ 5 | five | FIVE (1 row) TRUNCATE ONLY trunc_fb, ONLY trunc_fa; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; col1 ------ 1 @@ -224,13 +224,13 @@ SELECT * FROM trunc_f; 5 (3 rows) -SELECT * FROM trunc_fa; +SELECT * FROM trunc_fa ORDER BY 1, 2; col1 | col2a ------+------- 5 | five (1 row) -SELECT * FROM trunc_faa; +SELECT * FROM trunc_faa ORDER BY 1, 2; col1 | col2a | col3 ------+-------+------ 5 | five | FIVE @@ -238,7 +238,7 @@ SELECT * FROM trunc_faa; ROLLBACK; BEGIN; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; col1 ------ 1 @@ -248,33 +248,33 @@ SELECT * FROM trunc_f; 5 (5 rows) -SELECT * FROM trunc_fa; +SELECT * FROM trunc_fa ORDER BY 1, 2; col1 | col2a ------+------- 3 | three 5 | five (2 rows) -SELECT * FROM trunc_faa; +SELECT * FROM trunc_faa ORDER BY 1, 2; col1 | col2a | col3 ------+-------+------ 5 | five | FIVE (1 row) TRUNCATE ONLY trunc_fb, trunc_fa; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; col1 ------ 1 2 (2 rows) -SELECT * FROM trunc_fa; +SELECT * FROM trunc_fa ORDER BY 1, 2; col1 | col2a ------+------- (0 rows) -SELECT * FROM trunc_faa; +SELECT * FROM trunc_faa ORDER BY 1, 2; col1 | col2a | col3 ------+-------+------ (0 rows) @@ -371,7 +371,7 @@ NOTICE: CREATE TABLE will create implicit sequence "truncate_a_id_seq" for seri ALTER SEQUENCE truncate_a_id1 OWNED BY truncate_a.id1; INSERT INTO truncate_a DEFAULT VALUES; INSERT INTO truncate_a DEFAULT VALUES; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY id; id | id1 ----+----- 1 | 33 @@ -381,7 +381,7 @@ SELECT * FROM truncate_a; TRUNCATE truncate_a; INSERT INTO truncate_a DEFAULT VALUES; INSERT INTO truncate_a DEFAULT VALUES; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY id; id | id1 ----+----- 3 | 35 @@ -391,7 +391,7 @@ SELECT * FROM truncate_a; TRUNCATE truncate_a RESTART IDENTITY; INSERT INTO truncate_a DEFAULT VALUES; INSERT INTO truncate_a DEFAULT VALUES; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY id; id | id1 ----+----- 1 | 33 diff --git a/src/test/regress/expected/tsearch.out b/src/test/regress/expected/tsearch.out index 04b75dc6d0..6005beb6df 100644 --- a/src/test/regress/expected/tsearch.out +++ b/src/test/regress/expected/tsearch.out @@ -225,7 +225,7 @@ SELECT ts_lexize('english_stem', 'identity'); {ident} (1 row) -SELECT * FROM ts_token_type('default'); +SELECT * FROM ts_token_type('default') ORDER BY tokid; tokid | alias | description -------+-----------------+------------------------------------------ 1 | asciiword | Word, all ASCII @@ -255,142 +255,142 @@ SELECT * FROM ts_token_type('default'); SELECT * FROM ts_parse('default', '345 [email protected] '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 [email protected] qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>"> /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 -<i <b> wow < jqw <> qwerty'); +<i <b> wow < jqw <> qwerty') ORDER BY tokid,token; tokid | token -------+-------------------------------------- - 22 | 345 - 12 | + 1 | ad + 1 | asdf + 1 | dw + 1 | hjwer + 1 | i + 1 | jf + 1 | jqw 1 | qwe - 12 | @ - 19 | efd.r - 12 | ' - 14 | http:// - 6 | www.com - 12 | / - 14 | http:// + 1 | qwe + 1 | qwe + 1 | qwe + 1 | qwer + 1 | qwerty + 1 | qwqwe + 1 | readline + 1 | readline + 1 | readline + 1 | sdjk + 1 | we + 1 | wefjn + 1 | wow + 3 | ewr1 + 3 | ewri2 + 4 | [email protected] + 5 | 1aew.werc.ewr/?ad=qwe&dw + 5 | 3aew.werc.ewr/?ad=qwe&dw + 5 | 6aew.werc.ewr:8100/?ad=qwe&dw + 5 | 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 5 | aew.werc.ewr/?ad=qwe&dw + 6 | 1aew.werc.ewr + 6 | 2aew.werc.ewr + 6 | 3aew.werc.ewr + 6 | 4aew.werc.ewr + 6 | 5aew.werc.ewr:8100 + 6 | 6aew.werc.ewr:8100 + 6 | 7aew.werc.ewr:8100 6 | aew.werc.ewr - 18 | /?ad=qwe&dw + 6 | www.com + 7 | +4.0e-10 + 11 | qwe + 11 | wer + 12 | + : + 12 | + : + 12 | + 12 | 12 | - 5 | 1aew.werc.ewr/?ad=qwe&dw - 6 | 1aew.werc.ewr - 18 | /?ad=qwe&dw 12 | - 6 | 2aew.werc.ewr 12 | - 14 | http:// - 5 | 3aew.werc.ewr/?ad=qwe&dw - 6 | 3aew.werc.ewr - 18 | /?ad=qwe&dw 12 | - 14 | http:// - 6 | 4aew.werc.ewr 12 | - 14 | http:// - 6 | 5aew.werc.ewr:8100 - 12 | /? - 1 | ad - 12 | = - 1 | qwe - 12 | & - 1 | dw 12 | - 5 | 6aew.werc.ewr:8100/?ad=qwe&dw - 6 | 6aew.werc.ewr:8100 - 18 | /?ad=qwe&dw 12 | - 5 | 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 - 6 | 7aew.werc.ewr:8100 - 18 | /?ad=qwe&dw=%20%32 12 | - 7 | +4.0e-10 12 | - 1 | qwe 12 | - 1 | qwe 12 | - 1 | qwqwe 12 | - 20 | 234.435 12 | - 22 | 455 12 | - 20 | 5.005 12 | - 4 | [email protected] 12 | - 16 | qwe-wer - 11 | qwe - 12 | - - 11 | wer 12 | - 1 | asdf 12 | - 13 | <fr> - 1 | qwer 12 | - 1 | jf 12 | - 1 | sdjk - 12 | < - 1 | we 12 | - 1 | hjwer 12 | - 13 | <werrwe> 12 | - 3 | ewr1 - 12 | > - 3 | ewri2 12 | - 13 | <a href="qwe<qwe>"> - 12 | - : - 19 | /usr/local/fff 12 | - 19 | /awdf/dwqe/4325 12 | - 19 | rewt/ewr 12 | - 1 | wefjn 12 | - 19 | /wqe-324/ewr 12 | - 19 | gist.h 12 | - 19 | gist.h.c 12 | - 19 | gist.c - 12 | . - 1 | readline 12 | - 20 | 4.2 12 | - 20 | 4.2 - 12 | . - 20 | 4.2 - 12 | , - 1 | readline - 20 | -4.2 12 | - 1 | readline - 20 | -4.2 - 12 | . - 22 | 234 - 12 | - : - 12 | < - 1 | i 12 | - 13 | <b> 12 | - 1 | wow 12 | + 12 | ' + 12 | & + 12 | , + 12 | - + 12 | . + 12 | . + 12 | . + 12 | / + 12 | /? + 12 | < + 12 | < 12 | < - 1 | jqw - 12 | 12 | <> - 1 | qwerty + 12 | = + 12 | > + 12 | @ + 13 | <a href="qwe<qwe>"> + 13 | <b> + 13 | <fr> + 13 | <werrwe> + 14 | http:// + 14 | http:// + 14 | http:// + 14 | http:// + 14 | http:// + 16 | qwe-wer + 18 | /?ad=qwe&dw + 18 | /?ad=qwe&dw + 18 | /?ad=qwe&dw + 18 | /?ad=qwe&dw + 18 | /?ad=qwe&dw=%20%32 + 19 | /awdf/dwqe/4325 + 19 | /usr/local/fff + 19 | /wqe-324/ewr + 19 | efd.r + 19 | gist.c + 19 | gist.h + 19 | gist.h.c + 19 | rewt/ewr + 20 | -4.2 + 20 | -4.2 + 20 | 234.435 + 20 | 4.2 + 20 | 4.2 + 20 | 4.2 + 20 | 5.005 + 22 | 234 + 22 | 345 + 22 | 455 (131 rows) SELECT to_tsvector('english', '345 [email protected] '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 [email protected] qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>"> @@ -410,18 +410,18 @@ SELECT length(to_tsvector('english', '345 [email protected] '' http://www.com/ http://ae (1 row) -- ts_debug -SELECT * from ts_debug('english', '<myns:foo-bar_baz.blurfl>abc&nm1;def©ghiõjkl</myns:foo-bar_baz.blurfl>'); +SELECT * from ts_debug('english', '<myns:foo-bar_baz.blurfl>abc&nm1;def©ghiõjkl</myns:foo-bar_baz.blurfl>') ORDER BY alias, description, token; alias | description | token | dictionaries | dictionary | lexemes -----------+-----------------+----------------------------+----------------+--------------+--------- - tag | XML tag | <myns:foo-bar_baz.blurfl> | {} | | asciiword | Word, all ASCII | abc | {english_stem} | english_stem | {abc} - entity | XML entity | &nm1; | {} | | asciiword | Word, all ASCII | def | {english_stem} | english_stem | {def} - entity | XML entity | © | {} | | asciiword | Word, all ASCII | ghi | {english_stem} | english_stem | {ghi} - entity | XML entity | õ | {} | | asciiword | Word, all ASCII | jkl | {english_stem} | english_stem | {jkl} + entity | XML entity | õ | {} | | + entity | XML entity | © | {} | | + entity | XML entity | &nm1; | {} | | tag | XML tag | </myns:foo-bar_baz.blurfl> | {} | | + tag | XML tag | <myns:foo-bar_baz.blurfl> | {} | | (9 rows) -- to_tsquery @@ -1044,7 +1044,7 @@ select * from pendtest where 'ipsa:*'::tsquery @@ ts; 'ipsam':2 'lore':1 (1 row) -select * from pendtest where 'ips:*'::tsquery @@ ts; +select * from pendtest where 'ips:*'::tsquery @@ ts ORDER BY 1; ts -------------------- 'ipsam':2 'lore':1 diff --git a/src/test/regress/expected/union.out b/src/test/regress/expected/union.out index be046a9b63..4bfa9c405f 100644 --- a/src/test/regress/expected/union.out +++ b/src/test/regress/expected/union.out @@ -2,34 +2,34 @@ -- UNION (also INTERSECT, EXCEPT) -- -- Simple UNION constructs -SELECT 1 AS two UNION SELECT 2; +SELECT 1 AS two UNION SELECT 2 ORDER BY 1; two ----- 1 2 (2 rows) -SELECT 1 AS one UNION SELECT 1; +SELECT 1 AS one UNION SELECT 1 ORDER BY 1; one ----- 1 (1 row) -SELECT 1 AS two UNION ALL SELECT 2; +SELECT 1 AS two UNION ALL SELECT 2 ORDER BY 1; two ----- 1 2 (2 rows) -SELECT 1 AS two UNION ALL SELECT 1; +SELECT 1 AS two UNION ALL SELECT 1 ORDER BY 1; two ----- 1 1 (2 rows) -SELECT 1 AS three UNION SELECT 2 UNION SELECT 3; +SELECT 1 AS three UNION SELECT 2 UNION SELECT 3 ORDER BY 1; three ------- 1 @@ -37,14 +37,14 @@ SELECT 1 AS three UNION SELECT 2 UNION SELECT 3; 3 (3 rows) -SELECT 1 AS two UNION SELECT 2 UNION SELECT 2; +SELECT 1 AS two UNION SELECT 2 UNION SELECT 2 ORDER BY 1; two ----- 1 2 (2 rows) -SELECT 1 AS three UNION SELECT 2 UNION ALL SELECT 2; +SELECT 1 AS three UNION SELECT 2 UNION ALL SELECT 2 ORDER BY 1; three ------- 1 @@ -52,7 +52,7 @@ SELECT 1 AS three UNION SELECT 2 UNION ALL SELECT 2; 2 (3 rows) -SELECT 1.1 AS two UNION SELECT 2.2; +SELECT 1.1 AS two UNION SELECT 2.2 ORDER BY 1; two ----- 1.1 @@ -60,41 +60,41 @@ SELECT 1.1 AS two UNION SELECT 2.2; (2 rows) -- Mixed types -SELECT 1.1 AS two UNION SELECT 2; +SELECT 1.1 AS two UNION SELECT 2 ORDER BY 1; two ----- 1.1 2 (2 rows) -SELECT 1 AS two UNION SELECT 2.2; +SELECT 1 AS two UNION SELECT 2.2 ORDER BY 1; two ----- 1 2.2 (2 rows) -SELECT 1 AS one UNION SELECT 1.0::float8; +SELECT 1 AS one UNION SELECT 1.0::float8 ORDER BY 1; one ----- 1 (1 row) -SELECT 1.1 AS two UNION ALL SELECT 2; +SELECT 1.1 AS two UNION ALL SELECT 2 ORDER BY 1; two ----- 1.1 2 (2 rows) -SELECT 1.0::float8 AS two UNION ALL SELECT 1; +SELECT 1.0::float8 AS two UNION ALL SELECT 1 ORDER BY 1; two ----- 1 1 (2 rows) -SELECT 1.1 AS three UNION SELECT 2 UNION SELECT 3; +SELECT 1.1 AS three UNION SELECT 2 UNION SELECT 3 ORDER BY 1; three ------- 1.1 @@ -109,7 +109,7 @@ SELECT 1.1::float8 AS two UNION SELECT 2 UNION SELECT 2.0::float8 ORDER BY 1; 2 (2 rows) -SELECT 1.1 AS three UNION SELECT 2 UNION ALL SELECT 2; +SELECT 1.1 AS three UNION SELECT 2 UNION ALL SELECT 2 ORDER BY 1; three ------- 1.1 @@ -117,7 +117,7 @@ SELECT 1.1 AS three UNION SELECT 2 UNION ALL SELECT 2; 2 (3 rows) -SELECT 1.1 AS two UNION (SELECT 2 UNION ALL SELECT 2); +SELECT 1.1 AS two UNION (SELECT 2 UNION ALL SELECT 2) ORDER BY 1; two ----- 1.1 @@ -142,19 +142,20 @@ ORDER BY 1; SELECT f1 AS ten FROM FLOAT8_TBL UNION ALL -SELECT f1 FROM FLOAT8_TBL; +SELECT f1 FROM FLOAT8_TBL +ORDER BY 1; ten ----------------------- - 0 - -34.84 - -1004.3 -1.2345678901234e+200 - -1.2345678901234e-200 - 0 - -34.84 - -1004.3 -1.2345678901234e+200 + -1004.3 + -1004.3 + -34.84 + -34.84 -1.2345678901234e-200 + -1.2345678901234e-200 + 0 + 0 (10 rows) SELECT f1 AS nine FROM FLOAT8_TBL @@ -176,26 +177,28 @@ ORDER BY 1; SELECT f1 AS ten FROM FLOAT8_TBL UNION ALL -SELECT f1 FROM INT4_TBL; +SELECT f1 FROM INT4_TBL +ORDER BY 1; ten ----------------------- - 0 - -34.84 - -1004.3 -1.2345678901234e+200 + -2147483647 + -123456 + -1004.3 + -34.84 -1.2345678901234e-200 0 + 0 123456 - -123456 2147483647 - -2147483647 (10 rows) SELECT f1 AS five FROM FLOAT8_TBL WHERE f1 BETWEEN -1e6 AND 1e6 UNION SELECT f1 FROM INT4_TBL - WHERE f1 BETWEEN 0 AND 1000000; + WHERE f1 BETWEEN 0 AND 1000000 + ORDER BY 1; five ----------------------- -1004.3 @@ -229,15 +232,16 @@ ORDER BY 1; SELECT f1 AS eight FROM VARCHAR_TBL UNION ALL -SELECT f1 FROM CHAR_TBL; +SELECT f1 FROM CHAR_TBL +ORDER BY 1; eight ------- a + a + ab ab abcd abcd - a - ab abcd abcd (8 rows) @@ -260,19 +264,19 @@ ORDER BY 1; -- -- INTERSECT and EXCEPT -- -SELECT q2 FROM int8_tbl INTERSECT SELECT q1 FROM int8_tbl; +SELECT q2 FROM int8_tbl INTERSECT SELECT q1 FROM int8_tbl ORDER BY 1; q2 ------------------ - 4567890123456789 123 + 4567890123456789 (2 rows) -SELECT q2 FROM int8_tbl INTERSECT ALL SELECT q1 FROM int8_tbl; +SELECT q2 FROM int8_tbl INTERSECT ALL SELECT q1 FROM int8_tbl ORDER BY 1; q2 ------------------ + 123 4567890123456789 4567890123456789 - 123 (3 rows) SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; @@ -297,30 +301,30 @@ SELECT q2 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q1 FROM int8_tbl ORDER BY 1; 4567890123456789 (3 rows) -SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl; +SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY 1; q1 ---- (0 rows) -SELECT q1 FROM int8_tbl EXCEPT ALL SELECT q2 FROM int8_tbl; +SELECT q1 FROM int8_tbl EXCEPT ALL SELECT q2 FROM int8_tbl ORDER BY 1; q1 ------------------ - 4567890123456789 123 + 4567890123456789 (2 rows) -SELECT q1 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q2 FROM int8_tbl; +SELECT q1 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q2 FROM int8_tbl ORDER BY 1; q1 ------------------ + 123 4567890123456789 4567890123456789 - 123 (3 rows) -- -- Mixed types -- -SELECT f1 FROM float8_tbl INTERSECT SELECT f1 FROM int4_tbl; +SELECT f1 FROM float8_tbl INTERSECT SELECT f1 FROM int4_tbl ORDER BY 1; f1 ---- 0 @@ -338,35 +342,35 @@ SELECT f1 FROM float8_tbl EXCEPT SELECT f1 FROM int4_tbl ORDER BY 1; -- -- Operator precedence and (((((extra))))) parentheses -- -SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl; +SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl ORDER BY 1; q1 ------------------- - 4567890123456789 + -4567890123456789 + 123 123 456 4567890123456789 - 123 4567890123456789 - -4567890123456789 + 4567890123456789 (7 rows) -SELECT q1 FROM int8_tbl INTERSECT (((SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))); +SELECT q1 FROM int8_tbl INTERSECT (((SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) ORDER BY 1; q1 ------------------ - 4567890123456789 123 + 4567890123456789 (2 rows) -(((SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl))) UNION ALL SELECT q2 FROM int8_tbl; +(((SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl))) UNION ALL SELECT q2 FROM int8_tbl ORDER BY 1; q1 ------------------- - 4567890123456789 + -4567890123456789 + 123 123 456 4567890123456789 - 123 4567890123456789 - -4567890123456789 + 4567890123456789 (7 rows) SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; @@ -376,16 +380,16 @@ SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM 456 (2 rows) -SELECT q1 FROM int8_tbl UNION ALL (((SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1))); +SELECT q1 FROM int8_tbl UNION ALL (((SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1))) ORDER BY 1; q1 ------------------- + -4567890123456789 123 123 + 456 4567890123456789 4567890123456789 4567890123456789 - -4567890123456789 - 456 (7 rows) (((SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; @@ -423,13 +427,13 @@ SELECT q1 FROM int8_tbl EXCEPT (((SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1))) -- -- New syntaxes (7.1) permit new tests -- -(((((select * from int8_tbl))))); +(((((select * from int8_tbl ORDER BY q1, q2))))); q1 | q2 ------------------+------------------- 123 | 456 123 | 4567890123456789 + 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 - 4567890123456789 | -4567890123456789 (5 rows) diff --git a/src/test/regress/expected/update.out b/src/test/regress/expected/update.out index 33d52a55a0..7b0d99a156 100644 --- a/src/test/regress/expected/update.out +++ b/src/test/regress/expected/update.out @@ -8,7 +8,7 @@ CREATE TABLE update_test ( ); INSERT INTO update_test VALUES (5, 10, 'foo'); INSERT INTO update_test(b, a) VALUES (15, 10); -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; a | b | c ----+----+----- 5 | 10 | foo @@ -16,7 +16,7 @@ SELECT * FROM update_test; (2 rows) UPDATE update_test SET a = DEFAULT, b = DEFAULT; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; a | b | c ----+---+----- 10 | | foo @@ -25,7 +25,7 @@ SELECT * FROM update_test; -- aliases for the UPDATE target table UPDATE update_test AS t SET b = 10 WHERE t.a = 10; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; a | b | c ----+----+----- 10 | 10 | foo @@ -33,7 +33,7 @@ SELECT * FROM update_test; (2 rows) UPDATE update_test t SET b = t.b + 10 WHERE t.a = 10; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; a | b | c ----+----+----- 10 | 20 | foo @@ -45,7 +45,7 @@ SELECT * FROM update_test; -- UPDATE update_test SET a=v.i FROM (VALUES(100, 20)) AS v(i, j) WHERE update_test.b = v.j; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; a | b | c -----+----+----- 100 | 20 | foo @@ -56,19 +56,19 @@ SELECT * FROM update_test; -- Test multiple-set-clause syntax -- UPDATE update_test SET (c,b,a) = ('bugle', b+11, DEFAULT) WHERE c = 'foo'; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; a | b | c -----+----+------- - 100 | 20 | 10 | 31 | bugle + 100 | 20 | (2 rows) UPDATE update_test SET (c,b) = ('car', a+b), a = a + 1 WHERE a = 10; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; a | b | c -----+----+----- - 100 | 20 | 11 | 41 | car + 100 | 20 | (2 rows) -- fail, multi assignment to same column: diff --git a/src/test/regress/expected/uuid.out b/src/test/regress/expected/uuid.out index 03bd73bd0c..f9a0a8d0cc 100644 --- a/src/test/regress/expected/uuid.out +++ b/src/test/regress/expected/uuid.out @@ -44,7 +44,7 @@ INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111'); INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222}'); INSERT INTO guid1(guid_field) VALUES('3f3e3c3b3a3039383736353433a2313e'); -- retrieving the inserted data -SELECT guid_field FROM guid1; +SELECT guid_field FROM guid1 ORDER BY guid_field; guid_field -------------------------------------- 11111111-1111-1111-1111-111111111111 diff --git a/src/test/regress/expected/varchar.out b/src/test/regress/expected/varchar.out index 48a77f5e13..586e5b5dd9 100644 --- a/src/test/regress/expected/varchar.out +++ b/src/test/regress/expected/varchar.out @@ -14,28 +14,28 @@ INSERT INTO VARCHAR_TBL (f1) VALUES (''); INSERT INTO VARCHAR_TBL (f1) VALUES ('cd'); ERROR: value too long for type character varying(1) INSERT INTO VARCHAR_TBL (f1) VALUES ('c '); -SELECT '' AS seven, * FROM VARCHAR_TBL; +SELECT '' AS seven, * FROM VARCHAR_TBL ORDER BY f1; seven | f1 -------+---- - | a - | A + | | 1 | 2 | 3 - | + | A + | a | c (7 rows) SELECT '' AS six, c.* FROM VARCHAR_TBL c - WHERE c.f1 <> 'a'; + WHERE c.f1 <> 'a' ORDER BY f1; six | f1 -----+---- - | A + | | 1 | 2 | 3 - | + | A | c (6 rows) @@ -49,27 +49,27 @@ SELECT '' AS one, c.* SELECT '' AS five, c.* FROM VARCHAR_TBL c - WHERE c.f1 < 'a'; + WHERE c.f1 < 'a' ORDER BY f1; five | f1 ------+---- - | A + | | 1 | 2 | 3 - | + | A (5 rows) SELECT '' AS six, c.* FROM VARCHAR_TBL c - WHERE c.f1 <= 'a'; + WHERE c.f1 <= 'a' ORDER BY f1; six | f1 -----+---- - | a - | A + | | 1 | 2 | 3 - | + | A + | a (6 rows) SELECT '' AS one, c.* @@ -82,7 +82,7 @@ SELECT '' AS one, c.* SELECT '' AS two, c.* FROM VARCHAR_TBL c - WHERE c.f1 >= 'a'; + WHERE c.f1 >= 'a' ORDER BY f1; two | f1 -----+---- | a @@ -100,7 +100,7 @@ INSERT INTO VARCHAR_TBL (f1) VALUES ('abcd'); INSERT INTO VARCHAR_TBL (f1) VALUES ('abcde'); ERROR: value too long for type character varying(4) INSERT INTO VARCHAR_TBL (f1) VALUES ('abcd '); -SELECT '' AS four, * FROM VARCHAR_TBL; +SELECT '' AS four, * FROM VARCHAR_TBL ORDER BY f1; four | f1 ------+------ | a diff --git a/src/test/regress/expected/window.out b/src/test/regress/expected/window.out index 5ef3e6c317..8007abe125 100644 --- a/src/test/regress/expected/window.out +++ b/src/test/regress/expected/window.out @@ -33,19 +33,19 @@ SELECT depname, empno, salary, sum(salary) OVER (PARTITION BY depname) FROM emps sales | 1 | 5000 | 14600 (10 rows) -SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary) FROM empsalary; +SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary) FROM empsalary ORDER BY empno,salary; depname | empno | salary | rank -----------+-------+--------+------ - develop | 7 | 4200 | 1 - develop | 9 | 4500 | 2 - develop | 11 | 5200 | 3 - develop | 10 | 5200 | 3 - develop | 8 | 6000 | 5 - personnel | 5 | 3500 | 1 + sales | 1 | 5000 | 3 personnel | 2 | 3900 | 2 sales | 3 | 4800 | 1 sales | 4 | 4800 | 1 - sales | 1 | 5000 | 3 + personnel | 5 | 3500 | 1 + develop | 7 | 4200 | 1 + develop | 8 | 6000 | 5 + develop | 9 | 4500 | 2 + develop | 10 | 5200 | 3 + develop | 11 | 5200 | 3 (10 rows) -- with GROUP BY @@ -75,38 +75,38 @@ GROUP BY four, ten ORDER BY four, ten; 3 | 9 | 7500 | 9.0000000000000000 (20 rows) -SELECT depname, empno, salary, sum(salary) OVER w FROM empsalary WINDOW w AS (PARTITION BY depname); +SELECT depname, empno, salary, sum(salary) OVER w FROM empsalary WINDOW w AS (PARTITION BY depname) ORDER BY empno,salary; depname | empno | salary | sum -----------+-------+--------+------- - develop | 11 | 5200 | 25100 - develop | 7 | 4200 | 25100 - develop | 9 | 4500 | 25100 - develop | 8 | 6000 | 25100 - develop | 10 | 5200 | 25100 - personnel | 5 | 3500 | 7400 + sales | 1 | 5000 | 14600 personnel | 2 | 3900 | 7400 sales | 3 | 4800 | 14600 - sales | 1 | 5000 | 14600 sales | 4 | 4800 | 14600 + personnel | 5 | 3500 | 7400 + develop | 7 | 4200 | 25100 + develop | 8 | 6000 | 25100 + develop | 9 | 4500 | 25100 + develop | 10 | 5200 | 25100 + develop | 11 | 5200 | 25100 (10 rows) -SELECT depname, empno, salary, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary) ORDER BY rank() OVER w; +SELECT depname, empno, salary, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary) ORDER BY rank() OVER w,empno; depname | empno | salary | rank -----------+-------+--------+------ - develop | 7 | 4200 | 1 - personnel | 5 | 3500 | 1 sales | 3 | 4800 | 1 sales | 4 | 4800 | 1 + personnel | 5 | 3500 | 1 + develop | 7 | 4200 | 1 personnel | 2 | 3900 | 2 develop | 9 | 4500 | 2 sales | 1 | 5000 | 3 - develop | 11 | 5200 | 3 develop | 10 | 5200 | 3 + develop | 11 | 5200 | 3 develop | 8 | 6000 | 5 (10 rows) -- empty window specification -SELECT COUNT(*) OVER () FROM tenk1 WHERE unique2 < 10; +SELECT COUNT(*) OVER () FROM tenk1 WHERE unique2 < 10 ORDER BY 1; count ------- 10 @@ -121,7 +121,7 @@ SELECT COUNT(*) OVER () FROM tenk1 WHERE unique2 < 10; 10 (10 rows) -SELECT COUNT(*) OVER w FROM tenk1 WHERE unique2 < 10 WINDOW w AS (); +SELECT COUNT(*) OVER w FROM tenk1 WHERE unique2 < 10 WINDOW w AS () ORDER BY 1; count ------- 10 @@ -143,22 +143,22 @@ SELECT four FROM tenk1 WHERE FALSE WINDOW w AS (PARTITION BY ten); (0 rows) -- cumulative aggregate -SELECT sum(four) OVER (PARTITION BY ten ORDER BY unique2) AS sum_1, ten, four FROM tenk1 WHERE unique2 < 10; +SELECT sum(four) OVER (PARTITION BY ten ORDER BY unique2) AS sum_1, ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; sum_1 | ten | four -------+-----+------ 0 | 0 | 0 0 | 0 | 0 + 0 | 4 | 0 + 1 | 7 | 1 + 1 | 9 | 1 2 | 0 | 2 3 | 1 | 3 + 3 | 3 | 3 4 | 1 | 1 5 | 1 | 1 - 3 | 3 | 3 - 0 | 4 | 0 - 1 | 7 | 1 - 1 | 9 | 1 (10 rows) -SELECT row_number() OVER (ORDER BY unique2) FROM tenk1 WHERE unique2 < 10; +SELECT row_number() OVER (ORDER BY unique2) FROM tenk1 WHERE unique2 < 10 ORDER BY 1; row_number ------------ 1 @@ -173,67 +173,67 @@ SELECT row_number() OVER (ORDER BY unique2) FROM tenk1 WHERE unique2 < 10; 10 (10 rows) -SELECT rank() OVER (PARTITION BY four ORDER BY ten) AS rank_1, ten, four FROM tenk1 WHERE unique2 < 10; +SELECT rank() OVER (PARTITION BY four ORDER BY ten) AS rank_1, ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; rank_1 | ten | four --------+-----+------ 1 | 0 | 0 1 | 0 | 0 - 3 | 4 | 0 + 1 | 0 | 2 1 | 1 | 1 1 | 1 | 1 - 3 | 7 | 1 - 4 | 9 | 1 - 1 | 0 | 2 1 | 1 | 3 2 | 3 | 3 + 3 | 4 | 0 + 3 | 7 | 1 + 4 | 9 | 1 (10 rows) -SELECT dense_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT dense_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; dense_rank | ten | four ------------+-----+------ 1 | 0 | 0 1 | 0 | 0 - 2 | 4 | 0 + 1 | 0 | 2 1 | 1 | 1 1 | 1 | 1 - 2 | 7 | 1 - 3 | 9 | 1 - 1 | 0 | 2 1 | 1 | 3 2 | 3 | 3 + 2 | 4 | 0 + 2 | 7 | 1 + 3 | 9 | 1 (10 rows) -SELECT percent_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT percent_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; percent_rank | ten | four -------------------+-----+------ 0 | 0 | 0 0 | 0 | 0 - 1 | 4 | 0 + 0 | 0 | 2 0 | 1 | 1 0 | 1 | 1 - 0.666666666666667 | 7 | 1 - 1 | 9 | 1 - 0 | 0 | 2 0 | 1 | 3 + 0.666666666666667 | 7 | 1 1 | 3 | 3 + 1 | 4 | 0 + 1 | 9 | 1 (10 rows) -SELECT cume_dist() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT cume_dist() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; cume_dist | ten | four -------------------+-----+------ - 0.666666666666667 | 0 | 0 - 0.666666666666667 | 0 | 0 - 1 | 4 | 0 0.5 | 1 | 1 0.5 | 1 | 1 + 0.5 | 1 | 3 + 0.666666666666667 | 0 | 0 + 0.666666666666667 | 0 | 0 0.75 | 7 | 1 - 1 | 9 | 1 1 | 0 | 2 - 0.5 | 1 | 3 1 | 3 | 3 + 1 | 4 | 0 + 1 | 9 | 1 (10 rows) -SELECT ntile(3) OVER (ORDER BY ten, four), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT ntile(3) OVER (ORDER BY ten, four), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; ntile | ten | four -------+-----+------ 1 | 0 | 0 @@ -255,125 +255,125 @@ SELECT ntile(NULL) OVER (ORDER BY ten, four), ten, four FROM tenk1 LIMIT 2; | 0 | 0 (2 rows) -SELECT lag(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lag(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; lag | ten | four -----+-----+------ - | 0 | 0 0 | 0 | 0 0 | 4 | 0 - | 1 | 1 1 | 1 | 1 + 1 | 3 | 3 1 | 7 | 1 7 | 9 | 1 + | 0 | 0 | 0 | 2 + | 1 | 1 | 1 | 3 - 1 | 3 | 3 (10 rows) -SELECT lag(ten, four) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lag(ten, four) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; lag | ten | four -----+-----+------ 0 | 0 | 0 0 | 0 | 0 - 4 | 4 | 0 - | 1 | 1 1 | 1 | 1 1 | 7 | 1 + 4 | 4 | 0 7 | 9 | 1 | 0 | 2 + | 1 | 1 | 1 | 3 | 3 | 3 (10 rows) -SELECT lag(ten, four, 0) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lag(ten, four, 0) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; lag | ten | four -----+-----+------ 0 | 0 | 0 0 | 0 | 0 - 4 | 4 | 0 + 0 | 0 | 2 0 | 1 | 1 + 0 | 1 | 3 + 0 | 3 | 3 1 | 1 | 1 1 | 7 | 1 + 4 | 4 | 0 7 | 9 | 1 - 0 | 0 | 2 - 0 | 1 | 3 - 0 | 3 | 3 (10 rows) -SELECT lead(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lead(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; lead | ten | four ------+-----+------ 0 | 0 | 0 - 4 | 0 | 0 - | 4 | 0 1 | 1 | 1 + 3 | 1 | 3 + 4 | 0 | 0 7 | 1 | 1 9 | 7 | 1 - | 9 | 1 | 0 | 2 - 3 | 1 | 3 | 3 | 3 + | 4 | 0 + | 9 | 1 (10 rows) -SELECT lead(ten * 2, 1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lead(ten * 2, 1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; lead | ten | four ------+-----+------ 0 | 0 | 0 - 8 | 0 | 0 - | 4 | 0 2 | 1 | 1 + 6 | 1 | 3 + 8 | 0 | 0 14 | 1 | 1 18 | 7 | 1 - | 9 | 1 | 0 | 2 - 6 | 1 | 3 | 3 | 3 + | 4 | 0 + | 9 | 1 (10 rows) -SELECT lead(ten * 2, 1, -1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lead(ten * 2, 1, -1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; lead | ten | four ------+-----+------ - 0 | 0 | 0 - 8 | 0 | 0 + -1 | 0 | 2 + -1 | 3 | 3 -1 | 4 | 0 + -1 | 9 | 1 + 0 | 0 | 0 2 | 1 | 1 + 6 | 1 | 3 + 8 | 0 | 0 14 | 1 | 1 18 | 7 | 1 - -1 | 9 | 1 - -1 | 0 | 2 - 6 | 1 | 3 - -1 | 3 | 3 (10 rows) -SELECT first_value(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT first_value(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; first_value | ten | four -------------+-----+------ 0 | 0 | 0 0 | 0 | 0 + 0 | 0 | 2 0 | 4 | 0 1 | 1 | 1 1 | 1 | 1 - 1 | 7 | 1 - 1 | 9 | 1 - 0 | 0 | 2 1 | 1 | 3 1 | 3 | 3 + 1 | 7 | 1 + 1 | 9 | 1 (10 rows) -- last_value returns the last row of the frame, which is CURRENT ROW in ORDER BY window. -SELECT last_value(four) OVER (ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT last_value(four) OVER (ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; last_value | ten | four ------------+-----+------ 0 | 0 | 0 - 0 | 0 | 2 0 | 0 | 0 + 0 | 0 | 2 + 0 | 4 | 0 1 | 1 | 1 - 1 | 1 | 3 1 | 1 | 1 - 3 | 3 | 3 - 0 | 4 | 0 + 1 | 1 | 3 1 | 7 | 1 1 | 9 | 1 + 3 | 3 | 3 (10 rows) SELECT last_value(ten) OVER (PARTITION BY four), ten, four FROM @@ -394,7 +394,8 @@ SELECT last_value(ten) OVER (PARTITION BY four), ten, four FROM (10 rows) SELECT nth_value(ten, four + 1) OVER (PARTITION BY four), ten, four - FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s; + FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s + ORDER BY four, ten; nth_value | ten | four -----------+-----+------ 0 | 0 | 0 @@ -410,47 +411,48 @@ SELECT nth_value(ten, four + 1) OVER (PARTITION BY four), ten, four (10 rows) SELECT ten, two, sum(hundred) AS gsum, sum(sum(hundred)) OVER (PARTITION BY two ORDER BY ten) AS wsum -FROM tenk1 GROUP BY ten, two; +FROM tenk1 GROUP BY ten, two +ORDER BY ten, two; ten | two | gsum | wsum -----+-----+-------+-------- 0 | 0 | 45000 | 45000 - 2 | 0 | 47000 | 92000 - 4 | 0 | 49000 | 141000 - 6 | 0 | 51000 | 192000 - 8 | 0 | 53000 | 245000 1 | 1 | 46000 | 46000 + 2 | 0 | 47000 | 92000 3 | 1 | 48000 | 94000 + 4 | 0 | 49000 | 141000 5 | 1 | 50000 | 144000 + 6 | 0 | 51000 | 192000 7 | 1 | 52000 | 196000 + 8 | 0 | 53000 | 245000 9 | 1 | 54000 | 250000 (10 rows) -SELECT count(*) OVER (PARTITION BY four), four FROM (SELECT * FROM tenk1 WHERE two = 1)s WHERE unique2 < 10; +SELECT count(*) OVER (PARTITION BY four), four FROM (SELECT * FROM tenk1 WHERE two = 1)s WHERE unique2 < 10 ORDER BY 1, 2; count | four -------+------ + 2 | 3 + 2 | 3 4 | 1 4 | 1 4 | 1 4 | 1 - 2 | 3 - 2 | 3 (6 rows) SELECT (count(*) OVER (PARTITION BY four ORDER BY ten) + sum(hundred) OVER (PARTITION BY four ORDER BY ten))::varchar AS cntsum - FROM tenk1 WHERE unique2 < 10; + FROM tenk1 WHERE unique2 < 10 ORDER BY 1; cntsum -------- + 136 22 22 - 87 24 24 + 51 82 + 87 92 - 51 92 - 136 (10 rows) -- opexpr with different windows evaluation. @@ -466,7 +468,7 @@ WHERE total <> fourcount + twosum; -------+-----------+-------- (0 rows) -SELECT avg(four) OVER (PARTITION BY four ORDER BY thousand / 100) FROM tenk1 WHERE unique2 < 10; +SELECT avg(four) OVER (PARTITION BY four ORDER BY thousand / 100) FROM tenk1 WHERE unique2 < 10 ORDER BY 1; avg ------------------------ 0.00000000000000000000 @@ -482,18 +484,18 @@ SELECT avg(four) OVER (PARTITION BY four ORDER BY thousand / 100) FROM tenk1 WHE (10 rows) SELECT ten, two, sum(hundred) AS gsum, sum(sum(hundred)) OVER win AS wsum -FROM tenk1 GROUP BY ten, two WINDOW win AS (PARTITION BY two ORDER BY ten); +FROM tenk1 GROUP BY ten, two WINDOW win AS (PARTITION BY two ORDER BY ten) ORDER BY 1, 2, 3, 4; ten | two | gsum | wsum -----+-----+-------+-------- 0 | 0 | 45000 | 45000 - 2 | 0 | 47000 | 92000 - 4 | 0 | 49000 | 141000 - 6 | 0 | 51000 | 192000 - 8 | 0 | 53000 | 245000 1 | 1 | 46000 | 46000 + 2 | 0 | 47000 | 92000 3 | 1 | 48000 | 94000 + 4 | 0 | 49000 | 141000 5 | 1 | 50000 | 144000 + 6 | 0 | 51000 | 192000 7 | 1 | 52000 | 196000 + 8 | 0 | 53000 | 245000 9 | 1 | 54000 | 250000 (10 rows) @@ -511,7 +513,7 @@ FROM empsalary GROUP BY depname; -- identical windows with different names SELECT sum(salary) OVER w1, count(*) OVER w2 -FROM empsalary WINDOW w1 AS (ORDER BY salary), w2 AS (ORDER BY salary); +FROM empsalary WINDOW w1 AS (ORDER BY salary), w2 AS (ORDER BY salary) ORDER BY 1, 2; sum | count -------+------- 3500 | 1 @@ -528,18 +530,18 @@ FROM empsalary WINDOW w1 AS (ORDER BY salary), w2 AS (ORDER BY salary); -- subplan SELECT lead(ten, (SELECT two FROM tenk1 WHERE s.unique2 = unique2)) OVER (PARTITION BY four ORDER BY ten) -FROM tenk1 s WHERE unique2 < 10; +FROM tenk1 s WHERE unique2 < 10 ORDER BY 1; lead ------ 0 0 - 4 + 0 1 + 3 + 4 7 9 - 0 - 3 (10 rows) @@ -550,19 +552,19 @@ SELECT count(*) OVER (PARTITION BY four) FROM (SELECT * FROM tenk1 WHERE FALSE)s (0 rows) -- mixture of agg/wfunc in the same window -SELECT sum(salary) OVER w, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary DESC); +SELECT sum(salary) OVER w, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary DESC) ORDER BY 1, 2; sum | rank -------+------ + 3900 | 1 + 5000 | 1 6000 | 1 + 7400 | 2 + 14600 | 2 + 14600 | 2 16400 | 2 16400 | 2 20900 | 4 25100 | 5 - 3900 | 1 - 7400 | 2 - 5000 | 1 - 14600 | 2 - 14600 | 2 (10 rows) -- strict aggs @@ -572,7 +574,7 @@ SELECT empno, depname, salary, bonus, depadj, MIN(bonus) OVER (ORDER BY empno), CASE WHEN AVG(salary) OVER (PARTITION BY depname) < salary THEN 200 END AS depadj FROM empsalary -)s; +)s ORDER BY empno; empno | depname | salary | bonus | depadj | min | max -------+-----------+--------+-------+--------+------+----- 1 | sales | 5000 | 1000 | 200 | 1000 | 200 @@ -591,7 +593,7 @@ SELECT empno, depname, salary, bonus, depadj, MIN(bonus) OVER (ORDER BY empno), SELECT four, ten, sum(ten) over (partition by four order by ten), last_value(ten) over (partition by four order by ten) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; four | ten | sum | last_value ------+-----+-----+------------ 0 | 0 | 0 | 0 @@ -619,7 +621,7 @@ FROM (select distinct ten, four from tenk1) ss; SELECT four, ten, sum(ten) over (partition by four order by ten range between unbounded preceding and current row), last_value(ten) over (partition by four order by ten range between unbounded preceding and current row) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; four | ten | sum | last_value ------+-----+-----+------------ 0 | 0 | 0 | 0 @@ -647,7 +649,7 @@ FROM (select distinct ten, four from tenk1) ss; SELECT four, ten, sum(ten) over (partition by four order by ten range between unbounded preceding and unbounded following), last_value(ten) over (partition by four order by ten range between unbounded preceding and unbounded following) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; four | ten | sum | last_value ------+-----+-----+------------ 0 | 0 | 20 | 8 @@ -675,7 +677,7 @@ FROM (select distinct ten, four from tenk1) ss; SELECT four, ten/4 as two, sum(ten/4) over (partition by four order by ten/4 range between unbounded preceding and current row), last_value(ten/4) over (partition by four order by ten/4 range between unbounded preceding and current row) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; four | two | sum | last_value ------+-----+-----+------------ 0 | 0 | 0 | 0 @@ -703,7 +705,7 @@ FROM (select distinct ten, four from tenk1) ss; SELECT four, ten/4 as two, sum(ten/4) over (partition by four order by ten/4 rows between unbounded preceding and current row), last_value(ten/4) over (partition by four order by ten/4 rows between unbounded preceding and current row) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; four | two | sum | last_value ------+-----+-----+------------ 0 | 0 | 0 | 0 diff --git a/src/test/regress/expected/with.out b/src/test/regress/expected/with.out index 4a2f18c9e9..540e12a134 100644 --- a/src/test/regress/expected/with.out +++ b/src/test/regress/expected/with.out @@ -39,7 +39,7 @@ WITH RECURSIVE t(n) AS ( UNION ALL SELECT n+1 FROM t WHERE n < 5 ) -SELECT * FROM t; +SELECT * FROM t ORDER BY n; n --- 1 @@ -54,7 +54,7 @@ WITH RECURSIVE t(n) AS ( SELECT 1 UNION SELECT 10-n FROM t) -SELECT * FROM t; +SELECT * FROM t ORDER BY n; n --- 1 @@ -66,7 +66,7 @@ WITH RECURSIVE t(n) AS ( VALUES (1) UNION ALL SELECT n+1 FROM t) -SELECT * FROM t LIMIT 10; +SELECT * FROM t LIMIT 10 ; n ---- 1 @@ -86,7 +86,7 @@ WITH RECURSIVE t(n) AS ( SELECT 1 UNION SELECT n+1 FROM t) -SELECT * FROM t LIMIT 10; +SELECT * FROM t LIMIT 10; n ---- 1 @@ -114,7 +114,7 @@ WITH RECURSIVE t(n) AS ( UNION ALL SELECT n || ' bar' FROM t WHERE length(n) < 20 ) -SELECT n, n IS OF (text) as is_text FROM t; +SELECT n, n IS OF (text) as is_text FROM t ORDER BY n; n | is_text -------------------------+--------- foo | t @@ -294,7 +294,7 @@ SELECT pg_get_viewdef('vsubdepartment'::regclass, true); -- corner case in which sub-WITH gets initialized first with recursive q as ( - select * from department + (select * from department order by id) union all (with x as (select * from q) select * from x) @@ -329,7 +329,7 @@ select * from q limit 24; (24 rows) with recursive q as ( - select * from department + (select * from department order by id) union all (with recursive x as ( select * from department @@ -382,7 +382,7 @@ WITH RECURSIVE t(i,j) AS ( SELECT t2.i, t.j+1 FROM (SELECT 2 AS i UNION ALL SELECT 3 AS i) AS t2 JOIN t ON (t2.i = t.i+1)) - SELECT * FROM t; + SELECT * FROM t order by i; i | j ---+--- 1 | 2 @@ -459,7 +459,7 @@ UNION ALL FROM tree JOIN t ON (tree.parent_id = t.id) ) SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON -(t1.id=t2.id); +(t1.id=t2.id) ORDER BY id; id | path | t2 ----+-------------+-------------------- 1 | {} | (1,{}) @@ -498,34 +498,34 @@ with recursive search_graph(f, t, label, path, cycle) as ( from graph g, search_graph sg where g.f = sg.t and not cycle ) -select * from search_graph; +select * from search_graph order by path; f | t | label | path | cycle ---+---+------------+-------------------------------------------+------- 1 | 2 | arc 1 -> 2 | {"(1,2)"} | f + 2 | 3 | arc 2 -> 3 | {"(1,2)","(2,3)"} | f 1 | 3 | arc 1 -> 3 | {"(1,3)"} | f - 2 | 3 | arc 2 -> 3 | {"(2,3)"} | f 1 | 4 | arc 1 -> 4 | {"(1,4)"} | f - 4 | 5 | arc 4 -> 5 | {"(4,5)"} | f - 5 | 1 | arc 5 -> 1 | {"(5,1)"} | f - 1 | 2 | arc 1 -> 2 | {"(5,1)","(1,2)"} | f - 1 | 3 | arc 1 -> 3 | {"(5,1)","(1,3)"} | f - 1 | 4 | arc 1 -> 4 | {"(5,1)","(1,4)"} | f - 2 | 3 | arc 2 -> 3 | {"(1,2)","(2,3)"} | f 4 | 5 | arc 4 -> 5 | {"(1,4)","(4,5)"} | f - 5 | 1 | arc 5 -> 1 | {"(4,5)","(5,1)"} | f - 1 | 2 | arc 1 -> 2 | {"(4,5)","(5,1)","(1,2)"} | f - 1 | 3 | arc 1 -> 3 | {"(4,5)","(5,1)","(1,3)"} | f - 1 | 4 | arc 1 -> 4 | {"(4,5)","(5,1)","(1,4)"} | f - 2 | 3 | arc 2 -> 3 | {"(5,1)","(1,2)","(2,3)"} | f - 4 | 5 | arc 4 -> 5 | {"(5,1)","(1,4)","(4,5)"} | f 5 | 1 | arc 5 -> 1 | {"(1,4)","(4,5)","(5,1)"} | f 1 | 2 | arc 1 -> 2 | {"(1,4)","(4,5)","(5,1)","(1,2)"} | f + 2 | 3 | arc 2 -> 3 | {"(1,4)","(4,5)","(5,1)","(1,2)","(2,3)"} | f 1 | 3 | arc 1 -> 3 | {"(1,4)","(4,5)","(5,1)","(1,3)"} | f 1 | 4 | arc 1 -> 4 | {"(1,4)","(4,5)","(5,1)","(1,4)"} | t + 2 | 3 | arc 2 -> 3 | {"(2,3)"} | f + 4 | 5 | arc 4 -> 5 | {"(4,5)"} | f + 5 | 1 | arc 5 -> 1 | {"(4,5)","(5,1)"} | f + 1 | 2 | arc 1 -> 2 | {"(4,5)","(5,1)","(1,2)"} | f 2 | 3 | arc 2 -> 3 | {"(4,5)","(5,1)","(1,2)","(2,3)"} | f + 1 | 3 | arc 1 -> 3 | {"(4,5)","(5,1)","(1,3)"} | f + 1 | 4 | arc 1 -> 4 | {"(4,5)","(5,1)","(1,4)"} | f 4 | 5 | arc 4 -> 5 | {"(4,5)","(5,1)","(1,4)","(4,5)"} | t + 5 | 1 | arc 5 -> 1 | {"(5,1)"} | f + 1 | 2 | arc 1 -> 2 | {"(5,1)","(1,2)"} | f + 2 | 3 | arc 2 -> 3 | {"(5,1)","(1,2)","(2,3)"} | f + 1 | 3 | arc 1 -> 3 | {"(5,1)","(1,3)"} | f + 1 | 4 | arc 1 -> 4 | {"(5,1)","(1,4)"} | f + 4 | 5 | arc 4 -> 5 | {"(5,1)","(1,4)","(4,5)"} | f 5 | 1 | arc 5 -> 1 | {"(5,1)","(1,4)","(4,5)","(5,1)"} | t - 2 | 3 | arc 2 -> 3 | {"(1,4)","(4,5)","(5,1)","(1,2)","(2,3)"} | f (25 rows) -- ordering by the path column has same effect as SEARCH DEPTH FIRST @@ -572,7 +572,7 @@ select * from search_graph order by path; WITH RECURSIVE y (id) AS (VALUES (1)), x (id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM x WHERE id < 5) -SELECT * FROM x; +SELECT * FROM x ORDER BY id; id ---- 1 @@ -586,7 +586,7 @@ SELECT * FROM x; WITH RECURSIVE x(id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM x WHERE id < 5), y(id) AS (values (1)) - SELECT * FROM x; + SELECT * FROM x ORDER BY id; id ---- 1 @@ -601,7 +601,7 @@ WITH RECURSIVE (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 5), y(id) AS (VALUES (1) UNION ALL SELECT id+1 FROM y WHERE id < 10) - SELECT y.*, x.* FROM y LEFT JOIN x USING (id); + SELECT y.*, x.* FROM y LEFT JOIN x USING (id) ORDER BY 1; id | id ----+---- 1 | 1 @@ -621,7 +621,7 @@ WITH RECURSIVE (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 5), y(id) AS (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 10) - SELECT y.*, x.* FROM y LEFT JOIN x USING (id); + SELECT y.*, x.* FROM y LEFT JOIN x USING (id) ORDER BY 1; id | id ----+---- 1 | 1 @@ -639,36 +639,36 @@ WITH RECURSIVE (SELECT * FROM x UNION ALL SELECT * FROM x), z(id) AS (SELECT * FROM x UNION ALL SELECT id+1 FROM z WHERE id < 10) - SELECT * FROM z; + SELECT * FROM z ORDER BY id; id ---- 1 2 - 3 2 3 - 4 + 3 3 4 - 5 + 4 4 5 - 6 + 5 5 6 - 7 + 6 6 7 - 8 + 7 7 8 - 9 + 8 8 9 - 10 + 9 9 10 10 + 10 (27 rows) WITH RECURSIVE @@ -678,60 +678,60 @@ WITH RECURSIVE (SELECT * FROM x UNION ALL SELECT * FROM x), z(id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM z WHERE id < 10) - SELECT * FROM z; + SELECT * FROM z ORDER BY id; id ---- 1 - 2 - 3 1 2 - 3 2 - 3 - 4 + 2 2 3 - 4 3 - 4 - 5 + 3 + 3 + 3 3 4 - 5 4 - 5 - 6 + 4 + 4 + 4 4 5 - 6 5 - 6 - 7 + 5 + 5 + 5 5 6 - 7 6 - 7 - 8 + 6 + 6 + 6 6 7 - 8 7 - 8 - 9 + 7 + 7 + 7 7 8 - 9 8 - 9 - 10 + 8 + 8 + 8 8 9 - 10 9 - 10 9 + 9 + 9 + 9 + 10 + 10 + 10 10 10 10 diff --git a/src/test/regress/input/constraints.source b/src/test/regress/input/constraints.source index 350f29152a..f9a3aa7fae 100644 --- a/src/test/regress/input/constraints.source +++ b/src/test/regress/input/constraints.source @@ -20,7 +20,7 @@ INSERT INTO DEFAULT_TBL (i, f) VALUES (2, 987.654); INSERT INTO DEFAULT_TBL (x) VALUES ('marc'); INSERT INTO DEFAULT_TBL VALUES (3, null, 1.0); -SELECT '' AS five, * FROM DEFAULT_TBL; +SELECT '' AS five, * FROM DEFAULT_TBL ORDER BY i,x,f; CREATE SEQUENCE DEFAULT_SEQ; @@ -32,7 +32,7 @@ INSERT INTO DEFAULTEXPR_TBL (i1) VALUES (-3); INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (-4); INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (NULL); -SELECT '' AS four, * FROM DEFAULTEXPR_TBL; +SELECT '' AS four, * FROM DEFAULTEXPR_TBL ORDER BY i1,i2; -- syntax errors -- test for extraneous comma @@ -60,7 +60,7 @@ INSERT INTO CHECK_TBL VALUES (2); INSERT INTO CHECK_TBL VALUES (6); INSERT INTO CHECK_TBL VALUES (1); -SELECT '' AS three, * FROM CHECK_TBL; +SELECT '' AS three, * FROM CHECK_TBL ORDER BY x; CREATE SEQUENCE CHECK_SEQ; @@ -75,7 +75,7 @@ INSERT INTO CHECK2_TBL VALUES (0, 'check failed', -2); INSERT INTO CHECK2_TBL VALUES (6, 'check failed', 11); INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7); -SELECT '' AS two, * from CHECK2_TBL; +SELECT '' AS two, * from CHECK2_TBL ORDER BY x,y,z; -- -- Check constraints on INSERT @@ -91,7 +91,7 @@ CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'), INSERT INTO INSERT_TBL(x,z) VALUES (2, -2); -SELECT '' AS zero, * FROM INSERT_TBL; +SELECT '' AS zero, * FROM INSERT_TBL order by x,y,z; SELECT 'one' AS one, nextval('insert_seq'); @@ -103,14 +103,14 @@ INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5); INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7); INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); -SELECT '' AS four, * FROM INSERT_TBL; +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4); INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed'); INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed'); INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); -SELECT '' AS six, * FROM INSERT_TBL; +SELECT '' AS six, * FROM INSERT_TBL order by x,y,z; SELECT 'seven' AS one, nextval('insert_seq'); @@ -123,7 +123,7 @@ SELECT 'eight' AS one, currval('insert_seq'); -- was wrong: INSERT INTO INSERT_TBL VALUES (null, null, null); -SELECT '' AS nine, * FROM INSERT_TBL; +SELECT '' AS nine, * FROM INSERT_TBL order by x,y,z; -- -- Check inheritance of defaults and constraints @@ -138,7 +138,7 @@ INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6); INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7); INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7); -SELECT * FROM INSERT_CHILD; +SELECT * FROM INSERT_CHILD order by 1,2,3; DROP TABLE INSERT_CHILD; @@ -157,13 +157,13 @@ INSERT INTO tmp VALUES (5, '!check failed', null); INSERT INTO tmp VALUES (null, 'try again', null); INSERT INTO INSERT_TBL(y) select yd from tmp; -SELECT '' AS three, * FROM INSERT_TBL; +SELECT '' AS three, * FROM INSERT_TBL order by x,y,z; INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again'; INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again'; INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again'; -SELECT '' AS four, * FROM INSERT_TBL; +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; DROP TABLE tmp; @@ -176,7 +176,7 @@ UPDATE INSERT_TBL SET x = 6 WHERE x = 6; UPDATE INSERT_TBL SET x = -z, z = -x; UPDATE INSERT_TBL SET x = z, z = x; -SELECT * FROM INSERT_TBL; +SELECT * FROM INSERT_TBL order by x,y,z; -- DROP TABLE INSERT_TBL; @@ -190,11 +190,11 @@ CREATE TABLE COPY_TBL (x INT, y TEXT, z INT, COPY COPY_TBL FROM '@abs_srcdir@/data/constro.data'; -SELECT '' AS two, * FROM COPY_TBL; +SELECT '' AS two, * FROM COPY_TBL order by x,y,z; COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data'; -SELECT * FROM COPY_TBL; +SELECT * FROM COPY_TBL order by x,y,z; -- -- Primary keys @@ -209,7 +209,7 @@ INSERT INTO PRIMARY_TBL VALUES (4, 'three'); INSERT INTO PRIMARY_TBL VALUES (5, 'one'); INSERT INTO PRIMARY_TBL (t) VALUES ('six'); -SELECT '' AS four, * FROM PRIMARY_TBL; +SELECT '' AS four, * FROM PRIMARY_TBL order by i,t; DROP TABLE PRIMARY_TBL; @@ -223,7 +223,7 @@ INSERT INTO PRIMARY_TBL VALUES (4, 'three'); INSERT INTO PRIMARY_TBL VALUES (5, 'one'); INSERT INTO PRIMARY_TBL (t) VALUES ('six'); -SELECT '' AS three, * FROM PRIMARY_TBL; +SELECT '' AS three, * FROM PRIMARY_TBL order by i,t; DROP TABLE PRIMARY_TBL; @@ -241,7 +241,7 @@ INSERT INTO UNIQUE_TBL VALUES (5, 'one'); INSERT INTO UNIQUE_TBL (t) VALUES ('six'); INSERT INTO UNIQUE_TBL (t) VALUES ('seven'); -SELECT '' AS five, * FROM UNIQUE_TBL; +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; DROP TABLE UNIQUE_TBL; @@ -255,7 +255,7 @@ INSERT INTO UNIQUE_TBL VALUES (1, 'one'); INSERT INTO UNIQUE_TBL VALUES (5, 'one'); INSERT INTO UNIQUE_TBL (t) VALUES ('six'); -SELECT '' AS five, * FROM UNIQUE_TBL; +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; DROP TABLE UNIQUE_TBL; diff --git a/src/test/regress/input/misc.source b/src/test/regress/input/misc.source index c581363062..156fbb4df4 100644 --- a/src/test/regress/input/misc.source +++ b/src/test/regress/input/misc.source @@ -71,7 +71,7 @@ DELETE FROM stud_emp; COPY BINARY stud_emp FROM '@abs_builddir@/results/stud_emp.data'; -SELECT * FROM stud_emp; +SELECT * FROM stud_emp ORDER BY 1,2; -- COPY aggtest FROM stdin; -- 56 7.8 @@ -85,7 +85,7 @@ SELECT * FROM stud_emp; -- -- inheritance stress test -- -SELECT * FROM a_star*; +SELECT * FROM a_star* ORDER BY 1,2; SELECT * FROM b_star* x @@ -93,15 +93,15 @@ SELECT * SELECT class, a FROM c_star* x - WHERE x.c ~ text 'hi'; + WHERE x.c ~ text 'hi' ORDER BY 1,2; SELECT class, b, c FROM d_star* x - WHERE x.a < 100; + WHERE x.a < 100 ORDER BY 1,2,3; -SELECT class, c FROM e_star* x WHERE x.c NOTNULL; +SELECT class, c FROM e_star* x WHERE x.c NOTNULL ORDER BY 1,2; -SELECT * FROM f_star* x WHERE x.c ISNULL; +SELECT * FROM f_star* x WHERE x.c ISNULL ORDER BY 1,2; -- grouping and aggregation on inherited sets have been busted in the past... @@ -124,7 +124,7 @@ ALTER TABLE a_star* RENAME COLUMN a TO aa; SELECT class, aa FROM a_star* x - WHERE aa ISNULL; + WHERE aa ISNULL ORDER BY 1,2; -- As of Postgres 7.1, ALTER implicitly recurses, -- so this should be same as ALTER a_star* @@ -133,13 +133,13 @@ ALTER TABLE a_star RENAME COLUMN aa TO foo; SELECT class, foo FROM a_star* x - WHERE x.foo >= 2; + WHERE x.foo >= 2 ORDER BY 1,2; ALTER TABLE a_star RENAME COLUMN foo TO aa; SELECT * from a_star* - WHERE aa < 1000; + WHERE aa < 1000 ORDER BY 1,2; ALTER TABLE f_star ADD COLUMN f int4; @@ -149,7 +149,7 @@ ALTER TABLE e_star* ADD COLUMN e int4; --UPDATE e_star* SET e = 42; -SELECT * FROM e_star*; +SELECT * FROM e_star* ORDER BY 1,2; ALTER TABLE a_star* ADD COLUMN a text; @@ -157,7 +157,7 @@ ALTER TABLE a_star* ADD COLUMN a text; -- SET a = text 'gazpacho' -- WHERE aa > 4; -SELECT class, aa, a FROM a_star*; +SELECT class, aa, a FROM a_star* ORDER BY 1,2; -- @@ -172,12 +172,12 @@ SELECT class, aa, a FROM a_star*; -- joe and sally play basketball, and -- everyone else does nothing. -- -SELECT p.name, name(p.hobbies) FROM ONLY person p; +SELECT p.name, name(p.hobbies) FROM ONLY person p ORDER BY 1,2; -- -- as above, but jeff also does post_hacking. -- -SELECT p.name, name(p.hobbies) FROM person* p; +SELECT p.name, name(p.hobbies) FROM person* p ORDER BY 1,2; -- -- the next two queries demonstrate how functions generate bogus duplicates. @@ -186,31 +186,31 @@ SELECT p.name, name(p.hobbies) FROM person* p; SELECT DISTINCT hobbies_r.name, name(hobbies_r.equipment) FROM hobbies_r ORDER BY 1,2; -SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r; +SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r ORDER BY 1,2; -- -- mike needs advil and peet's coffee, -- joe and sally need hightops, and -- everyone else is fine. -- -SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p; +SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p ORDER BY 1,2,3; -- -- as above, but jeff needs advil and peet's coffee as well. -- -SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p; +SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p ORDER BY 1,2,3; -- -- just like the last two, but make sure that the target list fixup and -- unflattening is being done correctly. -- -SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p; +SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p ORDER BY 1,2,3; -SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p; +SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p ORDER BY 1,2,3; -SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p; +SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p ORDER BY 1,2,3; -SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p; +SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p ORDER BY 1,2,3; SELECT user_relns() AS user_relns ORDER BY user_relns; @@ -219,7 +219,7 @@ SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))); SELECT hobbies_by_name('basketball'); -SELECT name, overpaid(emp.*) FROM emp; +SELECT name, overpaid(emp.*) FROM emp ORDER BY 1,2; -- -- Try a few cases with SQL-spec row constructor expressions @@ -228,9 +228,9 @@ SELECT * FROM equipment(ROW('skywalking', 'mer')); SELECT name(equipment(ROW('skywalking', 'mer'))); -SELECT *, name(equipment(h.*)) FROM hobbies_r h; +SELECT *, name(equipment(h.*)) FROM hobbies_r h ORDER BY 1,2,3; -SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h; +SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h ORDER BY 1,2,3; -- -- check that old-style C functions work properly with TOASTed values @@ -241,7 +241,7 @@ insert into oldstyle_test values(0,'12'); insert into oldstyle_test values(1000,'12'); insert into oldstyle_test values(0, repeat('x', 50000)); -select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test; +select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test ORDER BY 1,2,3; drop table oldstyle_test; diff --git a/src/test/regress/output/constraints.source b/src/test/regress/output/constraints.source index 654e8d9953..5f572bb83d 100644 --- a/src/test/regress/output/constraints.source +++ b/src/test/regress/output/constraints.source @@ -16,14 +16,14 @@ INSERT INTO DEFAULT_TBL VALUES (1, 'bruce'); INSERT INTO DEFAULT_TBL (i, f) VALUES (2, 987.654); INSERT INTO DEFAULT_TBL (x) VALUES ('marc'); INSERT INTO DEFAULT_TBL VALUES (3, null, 1.0); -SELECT '' AS five, * FROM DEFAULT_TBL; +SELECT '' AS five, * FROM DEFAULT_TBL ORDER BY i,x,f; five | i | x | f ------+-----+--------+--------- - | 1 | thomas | 57.0613 | 1 | bruce | 123.456 + | 1 | thomas | 57.0613 | 2 | vadim | 987.654 - | 100 | marc | 123.456 | 3 | | 1 + | 100 | marc | 123.456 (5 rows) CREATE SEQUENCE DEFAULT_SEQ; @@ -33,11 +33,11 @@ INSERT INTO DEFAULTEXPR_TBL VALUES (-1, -2); INSERT INTO DEFAULTEXPR_TBL (i1) VALUES (-3); INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (-4); INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (NULL); -SELECT '' AS four, * FROM DEFAULTEXPR_TBL; +SELECT '' AS four, * FROM DEFAULTEXPR_TBL ORDER BY i1,i2; four | i1 | i2 ------+-----+---- - | -1 | -2 | -3 | 1 + | -1 | -2 | 102 | -4 | 102 | (4 rows) @@ -72,11 +72,11 @@ ERROR: new row for relation "check_tbl" violates check constraint "check_con" INSERT INTO CHECK_TBL VALUES (6); INSERT INTO CHECK_TBL VALUES (1); ERROR: new row for relation "check_tbl" violates check constraint "check_con" -SELECT '' AS three, * FROM CHECK_TBL; +SELECT '' AS three, * FROM CHECK_TBL ORDER BY x; three | x -------+--- - | 5 | 4 + | 5 | 6 (3 rows) @@ -94,7 +94,7 @@ ERROR: new row for relation "check2_tbl" violates check constraint "sequence_co INSERT INTO CHECK2_TBL VALUES (6, 'check failed', 11); ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7); -SELECT '' AS two, * from CHECK2_TBL; +SELECT '' AS two, * from CHECK2_TBL ORDER BY x,y,z; two | x | y | z -----+---+----------+---- | 4 | check ok | -2 @@ -112,7 +112,7 @@ CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'), CHECK (x + z = 0)); INSERT INTO INSERT_TBL(x,z) VALUES (2, -2); ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" -SELECT '' AS zero, * FROM INSERT_TBL; +SELECT '' AS zero, * FROM INSERT_TBL order by x,y,z; zero | x | y | z ------+---+---+--- (0 rows) @@ -133,13 +133,13 @@ INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5); ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7); INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); -SELECT '' AS four, * FROM INSERT_TBL; +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; four | x | y | z ------+---+---------------+---- | 3 | Y | -3 - | 7 | -NULL- | -7 - | 7 | !check failed | -7 | 4 | -!NULL- | -4 + | 7 | !check failed | -7 + | 7 | -NULL- | -7 (4 rows) INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4); @@ -148,15 +148,15 @@ INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed'); ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed'); INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); -SELECT '' AS six, * FROM INSERT_TBL; +SELECT '' AS six, * FROM INSERT_TBL order by x,y,z; six | x | y | z -----+---+---------------+---- | 3 | Y | -3 - | 7 | -NULL- | -7 - | 7 | !check failed | -7 | 4 | -!NULL- | -4 | 5 | !check failed | -5 | 6 | -!NULL- | -6 + | 7 | !check failed | -7 + | 7 | -NULL- | -7 (6 rows) SELECT 'seven' AS one, nextval('insert_seq'); @@ -177,15 +177,15 @@ SELECT 'eight' AS one, currval('insert_seq'); -- constraint-condition results. Postgres used to reject this, but it -- was wrong: INSERT INTO INSERT_TBL VALUES (null, null, null); -SELECT '' AS nine, * FROM INSERT_TBL; +SELECT '' AS nine, * FROM INSERT_TBL order by x,y,z; nine | x | y | z ------+---+---------------+---- | 3 | Y | -3 - | 7 | -NULL- | -7 - | 7 | !check failed | -7 | 4 | -!NULL- | -4 | 5 | !check failed | -5 | 6 | -!NULL- | -6 + | 7 | !check failed | -7 + | 7 | -NULL- | -7 | | | (7 rows) @@ -202,7 +202,7 @@ INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7); ERROR: new row for relation "insert_child" violates check constraint "insert_tbl_check" INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7); ERROR: new row for relation "insert_child" violates check constraint "insert_con" -SELECT * FROM INSERT_CHILD; +SELECT * FROM INSERT_CHILD order by 1,2,3; x | y | z | cx | cy ---+--------+----+----+---- 7 | -NULL- | -7 | 42 | 11 @@ -219,7 +219,7 @@ INSERT INTO tmp VALUES (null, 'Y', null); INSERT INTO tmp VALUES (5, '!check failed', null); INSERT INTO tmp VALUES (null, 'try again', null); INSERT INTO INSERT_TBL(y) select yd from tmp; -SELECT '' AS three, * FROM INSERT_TBL; +SELECT '' AS three, * FROM INSERT_TBL order by x,y,z; three | x | y | z -------+---+---------------+---- | 4 | Y | -4 @@ -231,14 +231,14 @@ INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again'; INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again'; INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again'; ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" -SELECT '' AS four, * FROM INSERT_TBL; +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; four | x | y | z ------+---+---------------+---- | 4 | Y | -4 | 5 | !check failed | -5 | 6 | try again | -6 - | | try again | | 7 | try again | -7 + | | try again | (5 rows) DROP TABLE tmp; @@ -250,14 +250,14 @@ UPDATE INSERT_TBL SET x = 6 WHERE x = 6; UPDATE INSERT_TBL SET x = -z, z = -x; UPDATE INSERT_TBL SET x = z, z = x; ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" -SELECT * FROM INSERT_TBL; +SELECT * FROM INSERT_TBL order by x,y,z; x | y | z ---+---------------+---- 4 | Y | -4 - | try again | - 7 | try again | -7 5 | !check failed | 6 | try again | -6 + 7 | try again | -7 + | try again | (5 rows) -- DROP TABLE INSERT_TBL; @@ -268,7 +268,7 @@ CREATE TABLE COPY_TBL (x INT, y TEXT, z INT, CONSTRAINT COPY_CON CHECK (x > 3 AND y <> 'check failed' AND x < 7 )); COPY COPY_TBL FROM '@abs_srcdir@/data/constro.data'; -SELECT '' AS two, * FROM COPY_TBL; +SELECT '' AS two, * FROM COPY_TBL order by x,y,z; two | x | y | z -----+---+---------------+--- | 4 | !check failed | 5 @@ -278,7 +278,7 @@ SELECT '' AS two, * FROM COPY_TBL; COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data'; ERROR: new row for relation "copy_tbl" violates check constraint "copy_con" CONTEXT: COPY copy_tbl, line 2: "7 check failed 6" -SELECT * FROM COPY_TBL; +SELECT * FROM COPY_TBL order by x,y,z; x | y | z ---+---------------+--- 4 | !check failed | 5 @@ -298,7 +298,7 @@ INSERT INTO PRIMARY_TBL VALUES (4, 'three'); INSERT INTO PRIMARY_TBL VALUES (5, 'one'); INSERT INTO PRIMARY_TBL (t) VALUES ('six'); ERROR: null value in column "i" violates not-null constraint -SELECT '' AS four, * FROM PRIMARY_TBL; +SELECT '' AS four, * FROM PRIMARY_TBL order by i,t; four | i | t ------+---+------- | 1 | one @@ -318,12 +318,12 @@ INSERT INTO PRIMARY_TBL VALUES (4, 'three'); INSERT INTO PRIMARY_TBL VALUES (5, 'one'); INSERT INTO PRIMARY_TBL (t) VALUES ('six'); ERROR: null value in column "i" violates not-null constraint -SELECT '' AS three, * FROM PRIMARY_TBL; +SELECT '' AS three, * FROM PRIMARY_TBL order by i,t; three | i | t -------+---+------- | 1 | one - | 2 | two | 1 | three + | 2 | two | 4 | three | 5 | one (5 rows) @@ -342,15 +342,15 @@ INSERT INTO UNIQUE_TBL VALUES (4, 'four'); INSERT INTO UNIQUE_TBL VALUES (5, 'one'); INSERT INTO UNIQUE_TBL (t) VALUES ('six'); INSERT INTO UNIQUE_TBL (t) VALUES ('seven'); -SELECT '' AS five, * FROM UNIQUE_TBL; +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; five | i | t ------+---+------- | 1 | one | 2 | two | 4 | four | 5 | one - | | six | | seven + | | six (6 rows) DROP TABLE UNIQUE_TBL; @@ -364,12 +364,12 @@ INSERT INTO UNIQUE_TBL VALUES (1, 'one'); ERROR: duplicate key value violates unique constraint "unique_tbl_i_key" INSERT INTO UNIQUE_TBL VALUES (5, 'one'); INSERT INTO UNIQUE_TBL (t) VALUES ('six'); -SELECT '' AS five, * FROM UNIQUE_TBL; +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; five | i | t ------+---+------- | 1 | one - | 2 | two | 1 | three + | 2 | two | 5 | one | | six (5 rows) diff --git a/src/test/regress/output/misc.source b/src/test/regress/output/misc.source index 91e0d2b04d..fcd9499b5d 100644 --- a/src/test/regress/output/misc.source +++ b/src/test/regress/output/misc.source @@ -63,11 +63,11 @@ SELECT unique1 FROM onek2 WHERE unique1 < 2 ORDER BY unique1; COPY BINARY stud_emp TO '@abs_builddir@/results/stud_emp.data'; DELETE FROM stud_emp; COPY BINARY stud_emp FROM '@abs_builddir@/results/stud_emp.data'; -SELECT * FROM stud_emp; +SELECT * FROM stud_emp ORDER BY 1, 2; name | age | location | salary | manager | gpa | percent -------+-----+------------+--------+---------+-----+--------- - jeff | 23 | (8,7.7) | 600 | sharon | 3.5 | cim | 30 | (10.5,4.7) | 400 | | 3.4 | + jeff | 23 | (8,7.7) | 600 | sharon | 3.5 | linda | 19 | (0.9,6.1) | 100 | | 2.9 | (3 rows) @@ -81,7 +81,7 @@ SELECT * FROM stud_emp; -- -- inheritance stress test -- -SELECT * FROM a_star*; +SELECT * FROM a_star* ORDER BY 1,2; class | a -------+---- a | 1 @@ -99,14 +99,14 @@ SELECT * FROM a_star*; d | 8 d | 9 d | 10 - d | d | 11 d | 12 d | 13 + d | 14 + d | d | d | d | - d | 14 d | d | d | @@ -114,22 +114,22 @@ SELECT * FROM a_star*; e | 15 e | 16 e | 17 - e | e | 18 e | e | + e | f | 19 f | 20 f | 21 f | 22 - f | f | 24 f | 25 f | 26 + f | 27 + f | f | f | f | - f | 27 f | f | f | @@ -146,7 +146,7 @@ SELECT * SELECT class, a FROM c_star* x - WHERE x.c ~ text 'hi'; + WHERE x.c ~ text 'hi' ORDER BY 1,2; class | a -------+---- c | 5 @@ -154,11 +154,11 @@ SELECT class, a d | 7 d | 8 d | 10 - d | d | 12 d | d | d | + d | e | 15 e | 16 e | @@ -166,53 +166,53 @@ SELECT class, a f | 19 f | 20 f | 21 - f | f | 24 f | f | f | + f | (22 rows) SELECT class, b, c FROM d_star* x - WHERE x.a < 100; + WHERE x.a < 100 ORDER BY 1,2,3; class | b | c -------+---------+------------ + d | fumble | d | grumble | hi sunita - d | stumble | hi koko d | rumble | - d | | hi kristin - d | fumble | + d | stumble | hi koko d | | hi avi + d | | hi kristin d | | d | | (8 rows) -SELECT class, c FROM e_star* x WHERE x.c NOTNULL; +SELECT class, c FROM e_star* x WHERE x.c NOTNULL ORDER BY 1,2; class | c -------+------------- - e | hi carol e | hi bob - e | hi michelle + e | hi carol e | hi elisa + e | hi michelle + f | hi allison + f | hi carl f | hi claire - f | hi mike - f | hi marcel + f | hi jeff f | hi keith f | hi marc - f | hi allison - f | hi jeff - f | hi carl + f | hi marcel + f | hi mike (12 rows) -SELECT * FROM f_star* x WHERE x.c ISNULL; +SELECT * FROM f_star* x WHERE x.c ISNULL ORDER BY 1,2; class | a | c | e | f -------+----+---+-----+------------------------------------------- f | 22 | | -7 | ((111,555),(222,666),(333,777),(444,888)) f | 25 | | -9 | f | 26 | | | ((11111,33333),(22222,44444)) - f | | | -11 | ((1111111,3333333),(2222222,4444444)) f | 27 | | | + f | | | -11 | ((1111111,3333333),(2222222,4444444)) f | | | -12 | f | | | | ((11111111,33333333),(22222222,44444444)) f | | | | @@ -244,7 +244,7 @@ ALTER TABLE b_star* RENAME COLUMN b TO bb; ALTER TABLE a_star* RENAME COLUMN a TO aa; SELECT class, aa FROM a_star* x - WHERE aa ISNULL; + WHERE aa ISNULL ORDER BY 1,2; class | aa -------+---- a | @@ -278,7 +278,7 @@ SELECT class, aa ALTER TABLE a_star RENAME COLUMN aa TO foo; SELECT class, foo FROM a_star* x - WHERE x.foo >= 2; + WHERE x.foo >= 2 ORDER BY 1,2; class | foo -------+----- a | 2 @@ -311,7 +311,7 @@ SELECT class, foo ALTER TABLE a_star RENAME COLUMN foo TO aa; SELECT * from a_star* - WHERE aa < 1000; + WHERE aa < 1000 ORDER BY 1,2; class | aa -------+---- a | 1 @@ -346,32 +346,32 @@ ALTER TABLE f_star ADD COLUMN f int4; UPDATE f_star SET f = 10; ALTER TABLE e_star* ADD COLUMN e int4; --UPDATE e_star* SET e = 42; -SELECT * FROM e_star*; +SELECT * FROM e_star* ORDER BY 1,2; class | aa | cc | ee | e -------+----+-------------+-----+--- e | 15 | hi carol | -1 | e | 16 | hi bob | | e | 17 | | -2 | - e | | hi michelle | -3 | e | 18 | | | e | | hi elisa | | e | | | -4 | + e | | hi michelle | -3 | f | 19 | hi claire | -5 | f | 20 | hi mike | -6 | f | 21 | hi marcel | | f | 22 | | -7 | - f | | hi keith | -8 | f | 24 | hi marc | | f | 25 | | -9 | f | 26 | | | + f | 27 | | | + f | | | | + f | | hi keith | -8 | f | | hi allison | -10 | f | | hi jeff | | f | | | -11 | - f | 27 | | | f | | hi carl | | f | | | -12 | f | | | | - f | | | | (23 rows) ALTER TABLE a_star* ADD COLUMN a text; @@ -379,7 +379,7 @@ NOTICE: merging definition of column "a" for child "d_star" --UPDATE b_star* -- SET a = text 'gazpacho' -- WHERE aa > 4; -SELECT class, aa, a FROM a_star*; +SELECT class, aa, a FROM a_star* ORDER BY 1,2; class | aa | a -------+----+--- a | 1 | @@ -397,14 +397,14 @@ SELECT class, aa, a FROM a_star*; d | 8 | d | 9 | d | 10 | - d | | d | 11 | d | 12 | d | 13 | + d | 14 | + d | | d | | d | | d | | - d | 14 | d | | d | | d | | @@ -412,22 +412,22 @@ SELECT class, aa, a FROM a_star*; e | 15 | e | 16 | e | 17 | - e | | e | 18 | e | | e | | + e | | f | 19 | f | 20 | f | 21 | f | 22 | - f | | f | 24 | f | 25 | f | 26 | + f | 27 | + f | | f | | f | | f | | - f | 27 | f | | f | | f | | @@ -445,24 +445,24 @@ SELECT class, aa, a FROM a_star*; -- joe and sally play basketball, and -- everyone else does nothing. -- -SELECT p.name, name(p.hobbies) FROM ONLY person p; +SELECT p.name, name(p.hobbies) FROM ONLY person p ORDER BY 1,2; name | name -------+------------- - mike | posthacking joe | basketball + mike | posthacking sally | basketball (3 rows) -- -- as above, but jeff also does post_hacking. -- -SELECT p.name, name(p.hobbies) FROM person* p; +SELECT p.name, name(p.hobbies) FROM person* p ORDER BY 1,2; name | name -------+------------- - mike | posthacking + jeff | posthacking joe | basketball + mike | posthacking sally | basketball - jeff | posthacking (4 rows) -- @@ -479,15 +479,15 @@ SELECT DISTINCT hobbies_r.name, name(hobbies_r.equipment) FROM hobbies_r skywalking | guts (4 rows) -SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r; +SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r ORDER BY 1,2; name | name -------------+--------------- + basketball | hightops + basketball | hightops posthacking | advil - posthacking | peet's coffee posthacking | advil posthacking | peet's coffee - basketball | hightops - basketball | hightops + posthacking | peet's coffee skywalking | guts (7 rows) @@ -496,71 +496,71 @@ SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r; -- joe and sally need hightops, and -- everyone else is fine. -- -SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p; +SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p ORDER BY 1,2,3; name | name | name -------+-------------+--------------- + joe | basketball | hightops mike | posthacking | advil mike | posthacking | peet's coffee - joe | basketball | hightops sally | basketball | hightops (4 rows) -- -- as above, but jeff needs advil and peet's coffee as well. -- -SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p; +SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p ORDER BY 1,2,3; name | name | name -------+-------------+--------------- + jeff | posthacking | advil + jeff | posthacking | peet's coffee + joe | basketball | hightops mike | posthacking | advil mike | posthacking | peet's coffee - joe | basketball | hightops sally | basketball | hightops - jeff | posthacking | advil - jeff | posthacking | peet's coffee (6 rows) -- -- just like the last two, but make sure that the target list fixup and -- unflattening is being done correctly. -- -SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p; +SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p ORDER BY 1,2,3; name | name | name ---------------+-------+------------- advil | mike | posthacking - peet's coffee | mike | posthacking hightops | joe | basketball hightops | sally | basketball + peet's coffee | mike | posthacking (4 rows) -SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p; +SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p ORDER BY 1,2,3; name | name | name ---------------+-------+------------- + advil | jeff | posthacking advil | mike | posthacking - peet's coffee | mike | posthacking hightops | joe | basketball hightops | sally | basketball - advil | jeff | posthacking peet's coffee | jeff | posthacking + peet's coffee | mike | posthacking (6 rows) -SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p; +SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p ORDER BY 1,2,3; name | name | name ---------------+-------------+------- advil | posthacking | mike - peet's coffee | posthacking | mike hightops | basketball | joe hightops | basketball | sally + peet's coffee | posthacking | mike (4 rows) -SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p; +SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p ORDER BY 1,2,3; name | name | name ---------------+-------------+------- + advil | posthacking | jeff advil | posthacking | mike - peet's coffee | posthacking | mike hightops | basketball | joe hightops | basketball | sally - advil | posthacking | jeff peet's coffee | posthacking | jeff + peet's coffee | posthacking | mike (6 rows) SELECT user_relns() AS user_relns @@ -682,15 +682,15 @@ SELECT hobbies_by_name('basketball'); joe (1 row) -SELECT name, overpaid(emp.*) FROM emp; +SELECT name, overpaid(emp.*) FROM emp ORDER BY 1,2; name | overpaid --------+---------- - sharon | t - sam | t bill | t - jeff | f cim | f + jeff | f linda | f + sam | t + sharon | t (6 rows) -- @@ -708,27 +708,27 @@ SELECT name(equipment(ROW('skywalking', 'mer'))); guts (1 row) -SELECT *, name(equipment(h.*)) FROM hobbies_r h; +SELECT *, name(equipment(h.*)) FROM hobbies_r h ORDER BY 1,2,3; name | person | name -------------+--------+--------------- - posthacking | mike | advil - posthacking | mike | peet's coffee - posthacking | jeff | advil - posthacking | jeff | peet's coffee basketball | joe | hightops basketball | sally | hightops + posthacking | jeff | advil + posthacking | jeff | peet's coffee + posthacking | mike | advil + posthacking | mike | peet's coffee skywalking | | guts (7 rows) -SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h; +SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h ORDER BY 1,2,3; name | person | name -------------+--------+--------------- - posthacking | mike | advil - posthacking | mike | peet's coffee - posthacking | jeff | advil - posthacking | jeff | peet's coffee basketball | joe | hightops basketball | sally | hightops + posthacking | jeff | advil + posthacking | jeff | peet's coffee + posthacking | mike | advil + posthacking | mike | peet's coffee skywalking | | guts (7 rows) @@ -740,13 +740,13 @@ insert into oldstyle_test values(null,null); insert into oldstyle_test values(0,'12'); insert into oldstyle_test values(1000,'12'); insert into oldstyle_test values(0, repeat('x', 50000)); -select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test; +select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test ORDER BY 1,2,3; i | length | octet_length | oldstyle_length ------+--------+--------------+----------------- - | | | 0 | 2 | 2 | 2 - 1000 | 2 | 2 | 1002 0 | 50000 | 50000 | 50000 + 1000 | 2 | 2 | 1002 + | | | (4 rows) drop table oldstyle_test; diff --git a/src/test/regress/sql/abstime.sql b/src/test/regress/sql/abstime.sql index cbaeb62957..894805a1b7 100644 --- a/src/test/regress/sql/abstime.sql +++ b/src/test/regress/sql/abstime.sql @@ -37,26 +37,26 @@ INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843'); -- test abstime operators -SELECT '' AS eight, * FROM ABSTIME_TBL; +SELECT '' AS eight, * FROM ABSTIME_TBL ORDER BY f1; SELECT '' AS six, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001'; + WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001' ORDER BY f1; SELECT '' AS six, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 > abstime '-infinity'; + WHERE ABSTIME_TBL.f1 > abstime '-infinity' ORDER BY f1; SELECT '' AS six, * FROM ABSTIME_TBL - WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1; + WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1 ORDER BY f1; SELECT '' AS three, * FROM ABSTIME_TBL - WHERE abstime 'epoch' >= ABSTIME_TBL.f1; + WHERE abstime 'epoch' >= ABSTIME_TBL.f1 ORDER BY f1; SELECT '' AS four, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21'; + WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21' ORDER BY f1; SELECT '' AS four, * FROM ABSTIME_TBL WHERE ABSTIME_TBL.f1 <?> - tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]'; + tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]' ORDER BY f1; SELECT '' AS four, f1 AS abstime, date_part('year', f1) AS year, date_part('month', f1) AS month, diff --git a/src/test/regress/sql/aggregates.sql b/src/test/regress/sql/aggregates.sql index 39b0187a1e..2f016fed46 100644 --- a/src/test/regress/sql/aggregates.sql +++ b/src/test/regress/sql/aggregates.sql @@ -72,7 +72,8 @@ SELECT sum2(q1,q2) FROM int8_tbl; -- this should work select ten, sum(distinct four) from onek a group by ten -having exists (select 1 from onek b where sum(distinct a.four) = b.four); +having exists (select 1 from onek b where sum(distinct a.four) = b.four) +order by ten; -- this should fail because subquery has an agg of its own in WHERE select ten, sum(distinct four) from onek a @@ -222,7 +223,8 @@ select min(tenthous) from tenk1 where thousand = 33; -- check parameter propagation into an indexscan subquery select f1, (select min(unique1) from tenk1 where unique1 > f1) AS gt -from int4_tbl; +from int4_tbl +order by f1; -- check some cases that were handled incorrectly in 8.3.0 select distinct max(unique2) from tenk1; diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index e041cec843..17ed48bd75 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -177,7 +177,7 @@ ANALYZE tenk1; set enable_seqscan to off; set enable_bitmapscan to off; -- 5 values, sorted -SELECT unique1 FROM tenk1 WHERE unique1 < 5; +SELECT unique1 FROM tenk1 WHERE unique1 < 5 ORDER BY unique1; reset enable_seqscan; reset enable_bitmapscan; @@ -617,7 +617,7 @@ insert into def_test default values; alter table def_test alter column c1 set default 10; alter table def_test alter column c2 set default 'new_default'; insert into def_test default values; -select * from def_test; +select * from def_test order by 1, 2; -- set defaults to an incorrect type: this should fail alter table def_test alter column c1 set default 'wrong_datatype'; @@ -638,7 +638,7 @@ alter table def_view_test alter column c1 set default 45; insert into def_view_test default values; alter table def_view_test alter column c2 set default 'view_default'; insert into def_view_test default values; -select * from def_view_test; +select * from def_view_test order by 1, 2; drop rule def_view_test_ins on def_view_test; drop view def_view_test; @@ -774,10 +774,10 @@ alter table parent drop a; create table child (d varchar(255)) inherits (parent); insert into child values (12, 13, 'testing'); -select * from parent; +select * from parent order by b; select * from child; alter table parent drop c; -select * from parent; +select * from parent order by b; select * from child; drop table child; @@ -793,17 +793,17 @@ copy test("........pg.dropped.1........") to stdout; copy test from stdin; 10 11 12 \. -select * from test; +select * from test order by b; copy test from stdin; 21 22 \. -select * from test; +select * from test order by b; copy test(a) from stdin; copy test("........pg.dropped.1........") from stdin; copy test(b,c) from stdin; 31 32 \. -select * from test; +select * from test order by b; drop table test; -- test inheritance @@ -1000,9 +1000,9 @@ insert into p1 values (1,2,'abc'); insert into c1 values(11,'xyz',33,0); -- should fail insert into c1 values(11,'xyz',33,22); -select * from p1; +select * from p1 order by f1; update p1 set a1 = a1 + 1, f2 = upper(f2); -select * from p1; +select * from p1 order by f1; drop table p1 cascade; @@ -1013,15 +1013,15 @@ create domain mytype as text; create temp table foo (f1 text, f2 mytype, f3 text); insert into foo values('bb','cc','dd'); -select * from foo; +select * from foo order by f1; drop domain mytype cascade; -select * from foo; +select * from foo order by f1; insert into foo values('qq','rr'); -select * from foo; +select * from foo order by f1; update foo set f3 = 'zz'; -select * from foo; +select * from foo order by f1; select f3,max(f1) from foo group by f3; -- Simple tests for alter table column type @@ -1033,24 +1033,24 @@ create table anothertab (atcol1 serial8, atcol2 boolean, insert into anothertab (atcol1, atcol2) values (default, true); insert into anothertab (atcol1, atcol2) values (default, false); -select * from anothertab; +select * from anothertab order by atcol1, atcol2; alter table anothertab alter column atcol1 type boolean; -- fails alter table anothertab alter column atcol1 type integer; -select * from anothertab; +select * from anothertab order by atcol1, atcol2; insert into anothertab (atcol1, atcol2) values (45, null); -- fails insert into anothertab (atcol1, atcol2) values (default, null); -select * from anothertab; +select * from anothertab order by atcol1, atcol2; alter table anothertab alter column atcol2 type text using case when atcol2 is true then 'IT WAS TRUE' when atcol2 is false then 'IT WAS FALSE' else 'IT WAS NULL!' end; -select * from anothertab; +select * from anothertab order by atcol1, atcol2; alter table anothertab alter column atcol1 type boolean using case when atcol1 % 2 = 0 then true else false end; -- fails alter table anothertab alter column atcol1 drop default; @@ -1061,7 +1061,7 @@ alter table anothertab drop constraint anothertab_chk; alter table anothertab alter column atcol1 type boolean using case when atcol1 % 2 = 0 then true else false end; -select * from anothertab; +select * from anothertab order by atcol1, atcol2; drop table anothertab; @@ -1071,13 +1071,13 @@ insert into another values(1, 'one'); insert into another values(2, 'two'); insert into another values(3, 'three'); -select * from another; +select * from another order by f1, f2; alter table another alter f1 type text using f2 || ' more', alter f2 type bigint using f1 * 10; -select * from another; +select * from another order by f1, f2; drop table another; @@ -1130,9 +1130,9 @@ drop schema alter1; insert into alter2.t1(f2) values(13); insert into alter2.t1(f2) values(14); -select * from alter2.t1; +select * from alter2.t1 order by f1, f2; -select * from alter2.v1; +select * from alter2.v1 order by f1, f2; select alter2.plus1(41); diff --git a/src/test/regress/sql/arrays.sql b/src/test/regress/sql/arrays.sql index 5e4933c31d..a222c4383b 100644 --- a/src/test/regress/sql/arrays.sql +++ b/src/test/regress/sql/arrays.sql @@ -35,29 +35,34 @@ INSERT INTO arrtest (a, b[1:2], c, d[1:2]) VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}'); -SELECT * FROM arrtest; +SELECT * FROM arrtest ORDER BY a, b, c; SELECT arrtest.a[1], arrtest.b[1][1][1], arrtest.c[1], arrtest.d[1][1], arrtest.e[0] - FROM arrtest; + FROM arrtest + ORDER BY a, b, c; SELECT a[1], b[1][1][1], c[1], d[1][1], e[0] - FROM arrtest; + FROM arrtest + ORDER BY a, b, c; SELECT a[1:3], b[1:1][1:2][1:2], c[1:2], d[1:1][1:2] - FROM arrtest; + FROM arrtest + ORDER BY a, b, c; SELECT array_ndims(a) AS a,array_ndims(b) AS b,array_ndims(c) AS c - FROM arrtest; + FROM arrtest + ORDER BY b; SELECT array_dims(a) AS a,array_dims(b) AS b,array_dims(c) AS c - FROM arrtest; + FROM arrtest + ORDER BY b; -- returns nothing SELECT * @@ -78,20 +83,21 @@ UPDATE arrtest SET c[2:2] = '{"new_word"}' WHERE array_dims(c) is not null; -SELECT a,b,c FROM arrtest; +SELECT a,b,c FROM arrtest ORDER BY a, b, c; SELECT a[1:3], b[1:1][1:2][1:2], c[1:2], d[1:1][2:2] - FROM arrtest; + FROM arrtest + ORDER BY a, b, c; INSERT INTO arrtest(a) VALUES('{1,null,3}'); -SELECT a FROM arrtest; +SELECT a FROM arrtest ORDER BY 1; UPDATE arrtest SET a[4] = NULL WHERE a[2] IS NULL; -SELECT a FROM arrtest WHERE a[2] IS NULL; +SELECT a FROM arrtest WHERE a[2] IS NULL ORDER BY 1; DELETE FROM arrtest WHERE a[2] IS NULL AND b IS NULL; -SELECT a,b,c FROM arrtest; +SELECT a,b,c FROM arrtest ORDER BY a, b, c; -- -- test array extension @@ -256,8 +262,8 @@ insert into arr_tbl values ('{1,2,10}'); set enable_seqscan to off; set enable_bitmapscan to off; -select * from arr_tbl where f1 > '{1,2,3}' and f1 <= '{1,5,3}'; -select * from arr_tbl where f1 >= '{1,2,3}' and f1 < '{1,5,3}'; +select * from arr_tbl where f1 > '{1,2,3}' and f1 <= '{1,5,3}' ORDER BY 1; +select * from arr_tbl where f1 >= '{1,2,3}' and f1 < '{1,5,3}' ORDER BY 1; -- note: if above selects don't produce the expected tuple order, -- then you didn't get an indexscan plan, and something is busted. reset enable_seqscan; diff --git a/src/test/regress/sql/bit.sql b/src/test/regress/sql/bit.sql index f178991d8f..5034495437 100644 --- a/src/test/regress/sql/bit.sql +++ b/src/test/regress/sql/bit.sql @@ -16,7 +16,7 @@ INSERT INTO BIT_TABLE VALUES (B'101011111010'); -- too long --INSERT INTO BIT_TABLE VALUES ('X554'); --INSERT INTO BIT_TABLE VALUES ('X555'); -SELECT * FROM BIT_TABLE; +SELECT * FROM BIT_TABLE ORDER BY b; CREATE TABLE VARBIT_TABLE(v BIT VARYING(11)); @@ -27,7 +27,7 @@ INSERT INTO VARBIT_TABLE VALUES (B'01010101010'); INSERT INTO VARBIT_TABLE VALUES (B'101011111010'); -- too long --INSERT INTO VARBIT_TABLE VALUES ('X554'); --INSERT INTO VARBIT_TABLE VALUES ('X555'); -SELECT * FROM VARBIT_TABLE; +SELECT * FROM VARBIT_TABLE ORDER BY v; -- Concatenation @@ -37,21 +37,21 @@ SELECT v, b, (v || b) AS concat -- Length SELECT b, length(b) AS lb - FROM BIT_TABLE; + FROM BIT_TABLE ORDER BY b; SELECT v, length(v) AS lv - FROM VARBIT_TABLE; + FROM VARBIT_TABLE ORDER BY v; -- Substring SELECT b, SUBSTRING(b FROM 2 FOR 4) AS sub_2_4, SUBSTRING(b FROM 7 FOR 13) AS sub_7_13, SUBSTRING(b FROM 6) AS sub_6 - FROM BIT_TABLE; + FROM BIT_TABLE ORDER BY b; SELECT v, SUBSTRING(v FROM 2 FOR 4) AS sub_2_4, SUBSTRING(v FROM 7 FOR 13) AS sub_7_13, SUBSTRING(v FROM 6) AS sub_6 - FROM VARBIT_TABLE; + FROM VARBIT_TABLE ORDER BY v; --- Bit operations DROP TABLE varbit_table; @@ -70,10 +70,10 @@ X1234 XFFF5 \. SELECT a, b, ~a AS "~ a", a & b AS "a & b", - a | b AS "a | b", a # b AS "a # b" FROM varbit_table; + a | b AS "a | b", a # b AS "a # b" FROM varbit_table ORDER BY a,b; SELECT a,b,a<b AS "a<b",a<=b AS "a<=b",a=b AS "a=b", - a>=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM varbit_table; -SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM varbit_table; + a>=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM varbit_table ORDER BY a,b; +SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM varbit_table ORDER BY a,b; DROP TABLE varbit_table; @@ -94,10 +94,10 @@ X1234 XFFF5 \. SELECT a,b,~a AS "~ a",a & b AS "a & b", - a|b AS "a | b", a # b AS "a # b" FROM bit_table; + a|b AS "a | b", a # b AS "a # b" FROM bit_table ORDER BY a,b; SELECT a,b,a<b AS "a<b",a<=b AS "a<=b",a=b AS "a=b", - a>=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM bit_table; -SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM bit_table; + a>=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM bit_table ORDER BY a,b; +SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM bit_table ORDER BY a,b; DROP TABLE bit_table; @@ -167,7 +167,7 @@ INSERT INTO BIT_SHIFT_TABLE SELECT b>>8 FROM BIT_SHIFT_TABLE; SELECT POSITION(B'1101' IN b), POSITION(B'11011' IN b), b - FROM BIT_SHIFT_TABLE ; + FROM BIT_SHIFT_TABLE ORDER BY b; CREATE TABLE VARBIT_SHIFT_TABLE(v BIT VARYING(20)); @@ -179,7 +179,7 @@ INSERT INTO VARBIT_SHIFT_TABLE SELECT CAST(v || B'00000000' AS BIT VARYING(20)) SELECT POSITION(B'1101' IN v), POSITION(B'11011' IN v), v - FROM VARBIT_SHIFT_TABLE ; + FROM VARBIT_SHIFT_TABLE ORDER BY v; DROP TABLE BIT_SHIFT_TABLE; diff --git a/src/test/regress/sql/box.sql b/src/test/regress/sql/box.sql index a689295a8b..baf86ae705 100644 --- a/src/test/regress/sql/box.sql +++ b/src/test/regress/sql/box.sql @@ -40,81 +40,82 @@ INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad'); SELECT '' AS four, * FROM BOX_TBL; SELECT '' AS four, b.*, area(b.f1) as barea - FROM BOX_TBL b; + FROM BOX_TBL b ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- overlap SELECT '' AS three, b.f1 FROM BOX_TBL b - WHERE b.f1 && box '(2.5,2.5,1.0,1.0)'; + WHERE b.f1 && box '(2.5,2.5,1.0,1.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- left-or-overlap (x only) SELECT '' AS two, b1.* FROM BOX_TBL b1 - WHERE b1.f1 &< box '(2.0,2.0,2.5,2.5)'; + WHERE b1.f1 &< box '(2.0,2.0,2.5,2.5)' ORDER BY (b1.f1[0])[0], (b1.f1[0])[1], (b1.f1[2])[0], (b1.f1[2])[1]; -- right-or-overlap (x only) SELECT '' AS two, b1.* FROM BOX_TBL b1 - WHERE b1.f1 &> box '(2.0,2.0,2.5,2.5)'; + WHERE b1.f1 &> box '(2.0,2.0,2.5,2.5)' ORDER BY (b1.f1[0])[0], (b1.f1[0])[1], (b1.f1[2])[0], (b1.f1[2])[1]; -- left of SELECT '' AS two, b.f1 FROM BOX_TBL b - WHERE b.f1 << box '(3.0,3.0,5.0,5.0)'; + WHERE b.f1 << box '(3.0,3.0,5.0,5.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- area <= SELECT '' AS four, b.f1 FROM BOX_TBL b - WHERE b.f1 <= box '(3.0,3.0,5.0,5.0)'; + WHERE b.f1 <= box '(3.0,3.0,5.0,5.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- area < SELECT '' AS two, b.f1 FROM BOX_TBL b - WHERE b.f1 < box '(3.0,3.0,5.0,5.0)'; + WHERE b.f1 < box '(3.0,3.0,5.0,5.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- area = SELECT '' AS two, b.f1 FROM BOX_TBL b - WHERE b.f1 = box '(3.0,3.0,5.0,5.0)'; + WHERE b.f1 = box '(3.0,3.0,5.0,5.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- area > SELECT '' AS two, b.f1 FROM BOX_TBL b -- zero area - WHERE b.f1 > box '(3.5,3.0,4.5,3.0)'; + WHERE b.f1 > box '(3.5,3.0,4.5,3.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- area >= SELECT '' AS four, b.f1 FROM BOX_TBL b -- zero area - WHERE b.f1 >= box '(3.5,3.0,4.5,3.0)'; + WHERE b.f1 >= box '(3.5,3.0,4.5,3.0)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- right of SELECT '' AS two, b.f1 FROM BOX_TBL b - WHERE box '(3.0,3.0,5.0,5.0)' >> b.f1; + WHERE box '(3.0,3.0,5.0,5.0)' >> b.f1 ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- contained in SELECT '' AS three, b.f1 FROM BOX_TBL b - WHERE b.f1 <@ box '(0,0,3,3)'; + WHERE b.f1 <@ box '(0,0,3,3)' ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- contains SELECT '' AS three, b.f1 FROM BOX_TBL b - WHERE box '(0,0,3,3)' @> b.f1; + WHERE box '(0,0,3,3)' @> b.f1 ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- box equality SELECT '' AS one, b.f1 FROM BOX_TBL b - WHERE box '(1,1,3,3)' ~= b.f1; + WHERE box '(1,1,3,3)' ~= b.f1 ORDER BY (b.f1[0])[0], (b.f1[0])[1], (b.f1[2])[0], (b.f1[2])[1]; -- center of box, left unary operator SELECT '' AS four, @@(b1.f1) AS p - FROM BOX_TBL b1; + FROM BOX_TBL b1 ORDER BY (b1.f1[0])[0], (b1.f1[0])[1], (b1.f1[2])[0], (b1.f1[2])[1]; -- wholly-contained SELECT '' AS one, b1.*, b2.* FROM BOX_TBL b1, BOX_TBL b2 - WHERE b1.f1 @> b2.f1 and not b1.f1 ~= b2.f1; + WHERE b1.f1 @> b2.f1 and not b1.f1 ~= b2.f1 + ORDER BY (b1.f1[0])[0], (b1.f1[0])[1], (b1.f1[2])[0], (b1.f1[2])[1], (b2.f1[0])[0], (b2.f1[0])[1], (b2.f1[2])[0], (b2.f1[2])[1]; -SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL; +SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL ORDER BY (f1[0])[0], (f1[0])[1], (f1[2])[0], (f1[2])[1]; diff --git a/src/test/regress/sql/case.sql b/src/test/regress/sql/case.sql index 2ab22fb1c6..b689d29a6f 100644 --- a/src/test/regress/sql/case.sql +++ b/src/test/regress/sql/case.sql @@ -77,13 +77,15 @@ SELECT '' AS "Five", CASE WHEN i >= 3 THEN i END AS ">= 3 or Null" - FROM CASE_TBL; + FROM CASE_TBL + ORDER BY 2; SELECT '' AS "Five", CASE WHEN i >= 3 THEN (i + i) ELSE i END AS "Simplest Math" - FROM CASE_TBL; + FROM CASE_TBL + ORDER BY 2; SELECT '' AS "Five", i AS "Value", CASE WHEN (i < 0) THEN 'small' @@ -92,7 +94,8 @@ SELECT '' AS "Five", i AS "Value", WHEN (i = 2) THEN 'two' ELSE 'big' END AS "Category" - FROM CASE_TBL; + FROM CASE_TBL + ORDER BY 2, 3; SELECT '' AS "Five", CASE WHEN ((i < 0) or (i < 0)) THEN 'small' @@ -101,7 +104,8 @@ SELECT '' AS "Five", WHEN ((i = 2) or (i = 2)) THEN 'two' ELSE 'big' END AS "Category" - FROM CASE_TBL; + FROM CASE_TBL + ORDER BY 2; -- -- Examples of qualifications involving tables @@ -118,19 +122,23 @@ SELECT * FROM CASE_TBL WHERE COALESCE(f,i) = 4; SELECT * FROM CASE_TBL WHERE NULLIF(f,i) = 2; SELECT COALESCE(a.f, b.i, b.j) - FROM CASE_TBL a, CASE2_TBL b; + FROM CASE_TBL a, CASE2_TBL b + ORDER BY coalesce; SELECT * FROM CASE_TBL a, CASE2_TBL b - WHERE COALESCE(a.f, b.i, b.j) = 2; + WHERE COALESCE(a.f, b.i, b.j) = 2 + ORDER BY a.i, a.f, b.i, b.j; SELECT '' AS Five, NULLIF(a.i,b.i) AS "NULLIF(a.i,b.i)", NULLIF(b.i, 4) AS "NULLIF(b.i,4)" - FROM CASE_TBL a, CASE2_TBL b; + FROM CASE_TBL a, CASE2_TBL b + ORDER BY 2, 3; SELECT '' AS "Two", * FROM CASE_TBL a, CASE2_TBL b - WHERE COALESCE(f,b.i) = 2; + WHERE COALESCE(f,b.i) = 2 + ORDER BY a.i, a.f, b.i, b.j; -- -- Examples of updates involving tables @@ -140,13 +148,13 @@ UPDATE CASE_TBL SET i = CASE WHEN i >= 3 THEN (- i) ELSE (2 * i) END; -SELECT * FROM CASE_TBL; +SELECT * FROM CASE_TBL ORDER BY i, f; UPDATE CASE_TBL SET i = CASE WHEN i >= 2 THEN (2 * i) ELSE (3 * i) END; -SELECT * FROM CASE_TBL; +SELECT * FROM CASE_TBL ORDER BY i, f; UPDATE CASE_TBL SET i = CASE WHEN b.i >= 2 THEN (2 * j) @@ -154,7 +162,7 @@ UPDATE CASE_TBL FROM CASE2_TBL b WHERE j = -CASE_TBL.i; -SELECT * FROM CASE_TBL; +SELECT * FROM CASE_TBL ORDER BY i, f; -- -- Clean up diff --git a/src/test/regress/sql/char.sql b/src/test/regress/sql/char.sql index fcaef7e086..7c5fa65691 100644 --- a/src/test/regress/sql/char.sql +++ b/src/test/regress/sql/char.sql @@ -32,11 +32,11 @@ INSERT INTO CHAR_TBL (f1) VALUES ('cd'); INSERT INTO CHAR_TBL (f1) VALUES ('c '); -SELECT '' AS seven, * FROM CHAR_TBL; +SELECT '' AS seven, * FROM CHAR_TBL ORDER BY f1; SELECT '' AS six, c.* FROM CHAR_TBL c - WHERE c.f1 <> 'a'; + WHERE c.f1 <> 'a' ORDER BY f1; SELECT '' AS one, c.* FROM CHAR_TBL c @@ -44,19 +44,19 @@ SELECT '' AS one, c.* SELECT '' AS five, c.* FROM CHAR_TBL c - WHERE c.f1 < 'a'; + WHERE c.f1 < 'a' ORDER BY f1; SELECT '' AS six, c.* FROM CHAR_TBL c - WHERE c.f1 <= 'a'; + WHERE c.f1 <= 'a' ORDER BY f1; SELECT '' AS one, c.* FROM CHAR_TBL c - WHERE c.f1 > 'a'; + WHERE c.f1 > 'a' ORDER BY f1; SELECT '' AS two, c.* FROM CHAR_TBL c - WHERE c.f1 >= 'a'; + WHERE c.f1 >= 'a' ORDER BY f1; DROP TABLE CHAR_TBL; @@ -72,4 +72,4 @@ INSERT INTO CHAR_TBL (f1) VALUES ('abcd'); INSERT INTO CHAR_TBL (f1) VALUES ('abcde'); INSERT INTO CHAR_TBL (f1) VALUES ('abcd '); -SELECT '' AS four, * FROM CHAR_TBL; +SELECT '' AS four, * FROM CHAR_TBL ORDER BY f1; diff --git a/src/test/regress/sql/circle.sql b/src/test/regress/sql/circle.sql index c0284b2b59..19cff0e3ea 100644 --- a/src/test/regress/sql/circle.sql +++ b/src/test/regress/sql/circle.sql @@ -24,20 +24,20 @@ INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5'); INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)'); -SELECT * FROM CIRCLE_TBL; +SELECT * FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); SELECT '' AS six, center(f1) AS center - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); SELECT '' AS six, radius(f1) AS radius - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); SELECT '' AS six, diameter(f1) AS diameter - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); -SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5; +SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5 ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); -SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10; +SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10 ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); SELECT '' as five, c1.f1 AS one, c2.f1 AS two, (c1.f1 <-> c2.f1) AS distance FROM CIRCLE_TBL c1, CIRCLE_TBL c2 diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql index a54d6e07f5..5a9a5123b7 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -61,14 +61,14 @@ INSERT INTO clstr_tst (b, c, d) VALUES (6, 'seis', repeat('xyzzy', 100000)); CLUSTER clstr_tst_c ON clstr_tst; -SELECT a,b,c,substring(d for 30), length(d) from clstr_tst; +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY a, b, c; SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY a; SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY b; SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY c; -- Verify that inheritance link still works INSERT INTO clstr_tst_inh VALUES (0, 100, 'in child table'); -SELECT a,b,c,substring(d for 30), length(d) from clstr_tst; +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY a, b, c; -- Verify that foreign key link still works INSERT INTO clstr_tst (b, c) VALUES (1111, 'this should fail'); @@ -126,7 +126,8 @@ CLUSTER clstr_1_pkey ON clstr_1; CLUSTER clstr_2 USING clstr_2_pkey; SELECT * FROM clstr_1 UNION ALL SELECT * FROM clstr_2 UNION ALL - SELECT * FROM clstr_3; + SELECT * FROM clstr_3 + ORDER BY 1; -- revert to the original state DELETE FROM clstr_1; @@ -145,14 +146,16 @@ SET SESSION AUTHORIZATION clstr_user; CLUSTER; SELECT * FROM clstr_1 UNION ALL SELECT * FROM clstr_2 UNION ALL - SELECT * FROM clstr_3; + SELECT * FROM clstr_3 + ORDER BY 1; -- cluster a single table using the indisclustered bit previously set DELETE FROM clstr_1; INSERT INTO clstr_1 VALUES (2); INSERT INTO clstr_1 VALUES (1); CLUSTER clstr_1; -SELECT * FROM clstr_1; +SELECT * FROM clstr_1 +ORDER BY 1; -- Test MVCC-safety of cluster. There isn't much we can do to verify the -- results with a single backend... @@ -179,13 +182,13 @@ UPDATE clustertest SET key = 60 WHERE key = 50; UPDATE clustertest SET key = 70 WHERE key = 60; UPDATE clustertest SET key = 80 WHERE key = 70; -SELECT * FROM clustertest; +SELECT * FROM clustertest ORDER BY 1; CLUSTER clustertest_pkey ON clustertest; -SELECT * FROM clustertest; +SELECT * FROM clustertest ORDER BY 1; COMMIT; -SELECT * FROM clustertest; +SELECT * FROM clustertest ORDER BY 1; -- clean up \c - diff --git a/src/test/regress/sql/combocid.sql b/src/test/regress/sql/combocid.sql index f24ac6b01a..709ca4d5b0 100644 --- a/src/test/regress/sql/combocid.sql +++ b/src/test/regress/sql/combocid.sql @@ -20,19 +20,19 @@ INSERT INTO combocidtest SELECT 1 LIMIT 0; INSERT INTO combocidtest VALUES (1); INSERT INTO combocidtest VALUES (2); -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; SAVEPOINT s1; UPDATE combocidtest SET foobar = foobar + 10; -- here we should see only updated tuples -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ROLLBACK TO s1; -- now we should see old tuples, but with combo CIDs starting at 0 -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; COMMIT; @@ -44,7 +44,7 @@ BEGIN; INSERT INTO combocidtest VALUES (333); -DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest; +DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; DELETE FROM combocidtest; @@ -52,7 +52,7 @@ FETCH ALL FROM c; ROLLBACK; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; -- check behavior with locked tuples BEGIN; @@ -71,23 +71,23 @@ INSERT INTO combocidtest SELECT 1 LIMIT 0; INSERT INTO combocidtest VALUES (444); -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; SAVEPOINT s1; -- this doesn't affect cmin SELECT ctid,cmin,* FROM combocidtest FOR UPDATE; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; -- but this does UPDATE combocidtest SET foobar = foobar + 10; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; ROLLBACK TO s1; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; COMMIT; -SELECT ctid,cmin,* FROM combocidtest; +SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid; diff --git a/src/test/regress/sql/constraints.sql b/src/test/regress/sql/constraints.sql new file mode 100644 index 0000000000..06528ec5b5 --- /dev/null +++ b/src/test/regress/sql/constraints.sql @@ -0,0 +1,261 @@ +-- +-- CONSTRAINTS +-- Constraints can be specified with: +-- - DEFAULT clause +-- - CHECK clauses +-- - PRIMARY KEY clauses +-- - UNIQUE clauses +-- + +-- +-- DEFAULT syntax +-- + +CREATE TABLE DEFAULT_TBL (i int DEFAULT 100, + x text DEFAULT 'vadim', f float8 DEFAULT 123.456); + +INSERT INTO DEFAULT_TBL VALUES (1, 'thomas', 57.0613); +INSERT INTO DEFAULT_TBL VALUES (1, 'bruce'); +INSERT INTO DEFAULT_TBL (i, f) VALUES (2, 987.654); +INSERT INTO DEFAULT_TBL (x) VALUES ('marc'); +INSERT INTO DEFAULT_TBL VALUES (3, null, 1.0); + +SELECT '' AS five, * FROM DEFAULT_TBL ORDER BY i,x,f; + +CREATE SEQUENCE DEFAULT_SEQ; + +CREATE TABLE DEFAULTEXPR_TBL (i1 int DEFAULT 100 + (200-199) * 2, + i2 int DEFAULT nextval('default_seq')); + +INSERT INTO DEFAULTEXPR_TBL VALUES (-1, -2); +INSERT INTO DEFAULTEXPR_TBL (i1) VALUES (-3); +INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (-4); +INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (NULL); + +SELECT '' AS four, * FROM DEFAULTEXPR_TBL ORDER BY i1,i2; + +-- syntax errors +-- test for extraneous comma +CREATE TABLE error_tbl (i int DEFAULT (100, )); +-- this will fail because gram.y uses b_expr not a_expr for defaults, +-- to avoid a shift/reduce conflict that arises from NOT NULL being +-- part of the column definition syntax: +CREATE TABLE error_tbl (b1 bool DEFAULT 1 IN (1, 2)); +-- this should work, however: +CREATE TABLE error_tbl (b1 bool DEFAULT (1 IN (1, 2))); + +DROP TABLE error_tbl; + +-- +-- CHECK syntax +-- + +CREATE TABLE CHECK_TBL (x int, + CONSTRAINT CHECK_CON CHECK (x > 3)); + +INSERT INTO CHECK_TBL VALUES (5); +INSERT INTO CHECK_TBL VALUES (4); +INSERT INTO CHECK_TBL VALUES (3); +INSERT INTO CHECK_TBL VALUES (2); +INSERT INTO CHECK_TBL VALUES (6); +INSERT INTO CHECK_TBL VALUES (1); + +SELECT '' AS three, * FROM CHECK_TBL ORDER BY x; + +CREATE SEQUENCE CHECK_SEQ; + +CREATE TABLE CHECK2_TBL (x int, y text, z int, + CONSTRAINT SEQUENCE_CON + CHECK (x > 3 and y <> 'check failed' and z < 8)); + +INSERT INTO CHECK2_TBL VALUES (4, 'check ok', -2); +INSERT INTO CHECK2_TBL VALUES (1, 'x check failed', -2); +INSERT INTO CHECK2_TBL VALUES (5, 'z check failed', 10); +INSERT INTO CHECK2_TBL VALUES (0, 'check failed', -2); +INSERT INTO CHECK2_TBL VALUES (6, 'check failed', 11); +INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7); + +SELECT '' AS two, * from CHECK2_TBL ORDER BY x,y,z; + +-- +-- Check constraints on INSERT +-- + +CREATE SEQUENCE INSERT_SEQ; + +CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'), + y TEXT DEFAULT '-NULL-', + z INT DEFAULT -1 * currval('insert_seq'), + CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8), + CHECK (x + z = 0)); + +INSERT INTO INSERT_TBL(x,z) VALUES (2, -2); + +SELECT '' AS zero, * FROM INSERT_TBL order by x,y,z; + +SELECT 'one' AS one, nextval('insert_seq'); + +INSERT INTO INSERT_TBL(y) VALUES ('Y'); +INSERT INTO INSERT_TBL(y) VALUES ('Y'); +INSERT INTO INSERT_TBL(x,z) VALUES (1, -2); +INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7); +INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5); +INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7); +INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); + +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; + +INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4); +INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed'); +INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed'); +INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); + +SELECT '' AS six, * FROM INSERT_TBL order by x,y,z; + +SELECT 'seven' AS one, nextval('insert_seq'); + +INSERT INTO INSERT_TBL(y) VALUES ('Y'); + +SELECT 'eight' AS one, currval('insert_seq'); + +-- According to SQL92, it is OK to insert a record that gives rise to NULL +-- constraint-condition results. Postgres used to reject this, but it +-- was wrong: +INSERT INTO INSERT_TBL VALUES (null, null, null); + +SELECT '' AS nine, * FROM INSERT_TBL order by x,y,z; + +-- +-- Check inheritance of defaults and constraints +-- + +CREATE TABLE INSERT_CHILD (cx INT default 42, + cy INT CHECK (cy > x)) + INHERITS (INSERT_TBL); + +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11); +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6); +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7); +INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7); + +SELECT * FROM INSERT_CHILD order by 1,2,3; + +DROP TABLE INSERT_CHILD; + +-- +-- Check constraints on INSERT INTO +-- + +DELETE FROM INSERT_TBL; + +ALTER SEQUENCE INSERT_SEQ RESTART WITH 4; + +CREATE TABLE tmp (xd INT, yd TEXT, zd INT); + +INSERT INTO tmp VALUES (null, 'Y', null); +INSERT INTO tmp VALUES (5, '!check failed', null); +INSERT INTO tmp VALUES (null, 'try again', null); +INSERT INTO INSERT_TBL(y) select yd from tmp; + +SELECT '' AS three, * FROM INSERT_TBL order by x,y,z; + +INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again'; +INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again'; +INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again'; + +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; + +DROP TABLE tmp; + +-- +-- Check constraints on UPDATE +-- + +UPDATE INSERT_TBL SET x = NULL WHERE x = 5; +UPDATE INSERT_TBL SET x = 6 WHERE x = 6; +UPDATE INSERT_TBL SET x = -z, z = -x; +UPDATE INSERT_TBL SET x = z, z = x; + +SELECT * FROM INSERT_TBL order by x,y,z; + +-- DROP TABLE INSERT_TBL; + +-- +-- Check constraints on COPY FROM +-- + +CREATE TABLE COPY_TBL (x INT, y TEXT, z INT, + CONSTRAINT COPY_CON + CHECK (x > 3 AND y <> 'check failed' AND x < 7 )); + +COPY COPY_TBL FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/constro.data'; + +SELECT '' AS two, * FROM COPY_TBL order by x,y,z; + +COPY COPY_TBL FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/constrf.data'; + +SELECT * FROM COPY_TBL order by x,y,z; + +-- +-- Primary keys +-- + +CREATE TABLE PRIMARY_TBL (i int PRIMARY KEY, t text); + +INSERT INTO PRIMARY_TBL VALUES (1, 'one'); +INSERT INTO PRIMARY_TBL VALUES (2, 'two'); +INSERT INTO PRIMARY_TBL VALUES (1, 'three'); +INSERT INTO PRIMARY_TBL VALUES (4, 'three'); +INSERT INTO PRIMARY_TBL VALUES (5, 'one'); +INSERT INTO PRIMARY_TBL (t) VALUES ('six'); + +SELECT '' AS four, * FROM PRIMARY_TBL order by i,t; + +DROP TABLE PRIMARY_TBL; + +CREATE TABLE PRIMARY_TBL (i int, t text, + PRIMARY KEY(i,t)); + +INSERT INTO PRIMARY_TBL VALUES (1, 'one'); +INSERT INTO PRIMARY_TBL VALUES (2, 'two'); +INSERT INTO PRIMARY_TBL VALUES (1, 'three'); +INSERT INTO PRIMARY_TBL VALUES (4, 'three'); +INSERT INTO PRIMARY_TBL VALUES (5, 'one'); +INSERT INTO PRIMARY_TBL (t) VALUES ('six'); + +SELECT '' AS three, * FROM PRIMARY_TBL order by i,t; + +DROP TABLE PRIMARY_TBL; + +-- +-- Unique keys +-- + +CREATE TABLE UNIQUE_TBL (i int UNIQUE, t text); + +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +INSERT INTO UNIQUE_TBL VALUES (2, 'two'); +INSERT INTO UNIQUE_TBL VALUES (1, 'three'); +INSERT INTO UNIQUE_TBL VALUES (4, 'four'); +INSERT INTO UNIQUE_TBL VALUES (5, 'one'); +INSERT INTO UNIQUE_TBL (t) VALUES ('six'); +INSERT INTO UNIQUE_TBL (t) VALUES ('seven'); + +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; + +DROP TABLE UNIQUE_TBL; + +CREATE TABLE UNIQUE_TBL (i int, t text, + UNIQUE(i,t)); + +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +INSERT INTO UNIQUE_TBL VALUES (2, 'two'); +INSERT INTO UNIQUE_TBL VALUES (1, 'three'); +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +INSERT INTO UNIQUE_TBL VALUES (5, 'one'); +INSERT INTO UNIQUE_TBL (t) VALUES ('six'); + +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; + +DROP TABLE UNIQUE_TBL; + diff --git a/src/test/regress/sql/copy.sql b/src/test/regress/sql/copy.sql new file mode 100644 index 0000000000..fda4f85357 --- /dev/null +++ b/src/test/regress/sql/copy.sql @@ -0,0 +1,109 @@ +-- +-- COPY +-- + +-- CLASS POPULATION +-- (any resemblance to real life is purely coincidental) +-- +COPY aggtest FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/agg.data'; + +COPY onek FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/onek.data'; + +COPY onek TO '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; + +DELETE FROM onek; + +COPY onek FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; + +COPY tenk1 FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/tenk.data'; + +COPY slow_emp4000 FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/rect.data'; + +COPY person FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/person.data'; + +COPY emp FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/emp.data'; + +COPY student FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/student.data'; + +COPY stud_emp FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/stud_emp.data'; + +COPY road FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/streets.data'; + +COPY real_city FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/real_city.data'; + +COPY hash_i4_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; + +COPY hash_name_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; + +COPY hash_txt_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; + +COPY hash_f8_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; + +COPY test_tsvector FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/tsearch.data'; + +-- the data in this file has a lot of duplicates in the index key +-- fields, leading to long bucket chains and lots of table expansion. +-- this is therefore a stress test of the bucket overflow code (unlike +-- the data in hash.data, which has unique index keys). +-- +-- COPY hash_ovfl_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hashovfl.data'; + +COPY bt_i4_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/desc.data'; + +COPY bt_name_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; + +COPY bt_txt_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/desc.data'; + +COPY bt_f8_heap FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/hash.data'; + +COPY array_op_test FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/array.data'; + +COPY array_index_op_test FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/array.data'; + +--- test copying in CSV mode with various styles +--- of embedded line ending characters + +create temp table copytest ( + style text, + test text, + filler int); + +insert into copytest values('DOS',E'abc\r\ndef',1); +insert into copytest values('Unix',E'abc\ndef',2); +insert into copytest values('Mac',E'abc\rdef',3); +insert into copytest values(E'esc\\ape',E'a\\r\\\r\\\n\\nb',4); + +copy copytest to '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/copytest.csv' csv; + +create temp table copytest2 (like copytest); + +copy copytest2 from '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/copytest.csv' csv; + +select * from copytest except select * from copytest2; + +truncate copytest2; + +--- same test but with an escape char different from quote char + +copy copytest to '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/copytest.csv' csv quote '''' escape E'\\'; + +copy copytest2 from '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/copytest.csv' csv quote '''' escape E'\\'; + +select * from copytest except select * from copytest2; + + +-- test header line feature + +create temp table copytest3 ( + c1 int, + "col with , comma" text, + "col with "" quote" int); + +copy copytest3 from stdin csv header; +this is just a line full of junk that would error out if parsed +1,a,1 +2,b,2 +\. + +copy copytest3 to stdout csv header; + diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql index 7c23ba253c..dca0a2cb5a 100644 --- a/src/test/regress/sql/copy2.sql +++ b/src/test/regress/sql/copy2.sql @@ -96,7 +96,7 @@ COPY x from stdin WITH DELIMITER AS ':' NULL AS E'\\X'; \. -- check results of copy in -SELECT * FROM x; +SELECT * FROM x ORDER BY a, b; -- COPY w/ oids on a table w/o oids should fail CREATE TABLE no_oids ( diff --git a/src/test/regress/sql/create_function_1.sql b/src/test/regress/sql/create_function_1.sql new file mode 100644 index 0000000000..968e5e2ce3 --- /dev/null +++ b/src/test/regress/sql/create_function_1.sql @@ -0,0 +1,79 @@ +-- +-- CREATE_FUNCTION_1 +-- + +CREATE FUNCTION widget_in(cstring) + RETURNS widget + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; + +CREATE FUNCTION widget_out(widget) + RETURNS cstring + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; + +CREATE FUNCTION int44in(cstring) + RETURNS city_budget + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; + +CREATE FUNCTION int44out(city_budget) + RETURNS cstring + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; + +CREATE FUNCTION check_primary_key () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/refint.so' + LANGUAGE C; + +CREATE FUNCTION check_foreign_key () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/refint.so' + LANGUAGE C; + +CREATE FUNCTION autoinc () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/autoinc.so' + LANGUAGE C; + +CREATE FUNCTION funny_dup17 () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; + +CREATE FUNCTION ttdummy () + RETURNS trigger + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; + +CREATE FUNCTION set_ttdummy (int4) + RETURNS int4 + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C STRICT; + +-- Things that shouldn't work: + +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'SELECT ''not an integer'';'; + +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'not even SQL'; + +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'SELECT 1, 2, 3;'; + +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'SELECT $2;'; + +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS 'a', 'b'; + +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C + AS 'nosuchfile'; + +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so', 'nosuchsymbol'; + +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal + AS 'nosuch'; diff --git a/src/test/regress/sql/create_function_2.sql b/src/test/regress/sql/create_function_2.sql new file mode 100644 index 0000000000..1bf236c54a --- /dev/null +++ b/src/test/regress/sql/create_function_2.sql @@ -0,0 +1,71 @@ +-- +-- CREATE_FUNCTION_2 +-- +CREATE FUNCTION hobbies(person) + RETURNS setof hobbies_r + AS 'select * from hobbies_r where person = $1.name' + LANGUAGE SQL; + + +CREATE FUNCTION hobby_construct(text, text) + RETURNS hobbies_r + AS 'select $1 as name, $2 as hobby' + LANGUAGE SQL; + + +CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE) + RETURNS hobbies_r.person%TYPE + AS 'select person from hobbies_r where name = $1' + LANGUAGE SQL; + + +CREATE FUNCTION equipment(hobbies_r) + RETURNS setof equipment_r + AS 'select * from equipment_r where hobby = $1.name' + LANGUAGE SQL; + + +CREATE FUNCTION user_relns() + RETURNS setof name + AS 'select relname + from pg_class c, pg_namespace n + where relnamespace = n.oid and + (nspname !~ ''pg_.*'' and nspname <> ''information_schema'') and + relkind <> ''i'' ' + LANGUAGE SQL; + +CREATE FUNCTION pt_in_widget(point, widget) + RETURNS bool + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; + +CREATE FUNCTION overpaid(emp) + RETURNS bool + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; + +CREATE FUNCTION boxarea(box) + RETURNS float8 + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; + +CREATE FUNCTION interpt_pp(path, path) + RETURNS point + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; + +CREATE FUNCTION reverse_name(name) + RETURNS name + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; + +CREATE FUNCTION oldstyle_length(int4, text) + RETURNS int4 + AS '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so' + LANGUAGE C; + +-- +-- Function dynamic loading +-- +LOAD '/Users/masonsharp/dev/pgxc/postgres-xc/inst/lib/regress.so'; + diff --git a/src/test/regress/sql/create_view.sql b/src/test/regress/sql/create_view.sql index f8942c93f5..baf64e16b1 100644 --- a/src/test/regress/sql/create_view.sql +++ b/src/test/regress/sql/create_view.sql @@ -42,12 +42,12 @@ CREATE OR REPLACE VIEW viewtest AS CREATE OR REPLACE VIEW viewtest AS SELECT * FROM viewtest_tbl WHERE a > 10; -SELECT * FROM viewtest; +SELECT * FROM viewtest ORDER BY a; CREATE OR REPLACE VIEW viewtest AS SELECT a, b FROM viewtest_tbl WHERE a > 5 ORDER BY b DESC; -SELECT * FROM viewtest; +SELECT * FROM viewtest ORDER BY a; -- should fail CREATE OR REPLACE VIEW viewtest AS diff --git a/src/test/regress/sql/date.sql b/src/test/regress/sql/date.sql index d179ddf09b..a6e7f9a913 100644 --- a/src/test/regress/sql/date.sql +++ b/src/test/regress/sql/date.sql @@ -21,12 +21,12 @@ INSERT INTO DATE_TBL VALUES ('2038-04-08'); INSERT INTO DATE_TBL VALUES ('2039-04-09'); INSERT INTO DATE_TBL VALUES ('2040-04-10'); -SELECT f1 AS "Fifteen" FROM DATE_TBL; +SELECT f1 AS "Fifteen" FROM DATE_TBL ORDER BY f1; -SELECT f1 AS "Nine" FROM DATE_TBL WHERE f1 < '2000-01-01'; +SELECT f1 AS "Nine" FROM DATE_TBL WHERE f1 < '2000-01-01' ORDER BY f1; SELECT f1 AS "Three" FROM DATE_TBL - WHERE f1 BETWEEN '2000-01-01' AND '2001-01-01'; + WHERE f1 BETWEEN '2000-01-01' AND '2001-01-01' ORDER BY f1; -- -- Check all the documented input formats @@ -193,9 +193,9 @@ RESET datestyle; -- Leave most of it for the horology tests -- -SELECT f1 - date '2000-01-01' AS "Days From 2K" FROM DATE_TBL; +SELECT f1 - date '2000-01-01' AS "Days From 2K" FROM DATE_TBL ORDER BY f1; -SELECT f1 - date 'epoch' AS "Days From Epoch" FROM DATE_TBL; +SELECT f1 - date 'epoch' AS "Days From Epoch" FROM DATE_TBL ORDER BY f1; SELECT date 'yesterday' - date 'today' AS "One day"; diff --git a/src/test/regress/sql/delete.sql b/src/test/regress/sql/delete.sql index 86cabfcf64..05567f58dc 100644 --- a/src/test/regress/sql/delete.sql +++ b/src/test/regress/sql/delete.sql @@ -17,6 +17,6 @@ SET LOCAL add_missing_from = false; DELETE FROM delete_test dt WHERE delete_test.a > 25; ROLLBACK; -SELECT * FROM delete_test; +SELECT * FROM delete_test ORDER BY id; -DROP TABLE delete_test;
\ No newline at end of file +DROP TABLE delete_test; diff --git a/src/test/regress/sql/domain.sql b/src/test/regress/sql/domain.sql index 1e5295899b..d14edb4e43 100644 --- a/src/test/regress/sql/domain.sql +++ b/src/test/regress/sql/domain.sql @@ -52,7 +52,7 @@ COPY basictest (testvarchar) FROM stdin; short \. -select * from basictest; +select * from basictest order by 1, 2, 3, 4; -- check that domains inherit operations from base types select testtext || testvarchar as concat, testnumeric + 42 as sum @@ -85,8 +85,8 @@ INSERT INTO domarrtest values ('{2,2}', '{{"a","b"},{"c","d"},{"e","f"}}'); INSERT INTO domarrtest values ('{2,2}', '{{"a"},{"c"}}'); INSERT INTO domarrtest values (NULL, '{{"a","b","c"},{"d","e","f"}}'); INSERT INTO domarrtest values (NULL, '{{"toolong","b","c"},{"d","e","f"}}'); -select * from domarrtest; -select testint4arr[1], testchar4arr[2:2] from domarrtest; +select * from domarrtest order by 1, 2; +select testint4arr[1], testchar4arr[2:2] from domarrtest order by 1, 2; COPY domarrtest FROM stdin; {3,4} {q,w,e} @@ -97,7 +97,7 @@ COPY domarrtest FROM stdin; -- fail {3,4} {qwerty,w,e} \. -select * from domarrtest; +select * from domarrtest order by 1, 2; drop table domarrtest; drop domain domainint4arr restrict; @@ -140,7 +140,7 @@ a b c \N d a b c \N a \. -select * from nulltest; +select * from nulltest order by 1, 2, 3, 4, 5; -- Test out coerced (casted) constraints SELECT cast('1' as dnotnull); @@ -188,7 +188,7 @@ COPY defaulttest(col5) FROM stdin; 42 \. -select * from defaulttest; +select * from defaulttest order by 1,2,3,4,5,6,7,8; drop table defaulttest cascade; @@ -225,7 +225,7 @@ select * from domdeftest; alter domain ddef1 set default '42'; insert into domdeftest default values; -select * from domdeftest; +select * from domdeftest order by 1; alter domain ddef1 drop default; insert into domdeftest default values; @@ -258,19 +258,19 @@ create domain dom as integer; create view domview as select cast(col1 as dom) from domtab; insert into domtab (col1) values (null); insert into domtab (col1) values (5); -select * from domview; +select * from domview order by 1; alter domain dom set not null; select * from domview; -- fail alter domain dom drop not null; -select * from domview; +select * from domview order by 1; alter domain dom add constraint domchkgt6 check(value > 6); select * from domview; --fail alter domain dom drop constraint domchkgt6 restrict; -select * from domview; +select * from domview order by 1; -- cleanup drop domain ddef1 restrict; diff --git a/src/test/regress/sql/enum.sql b/src/test/regress/sql/enum.sql index 387e8e72ed..4e11f41706 100644 --- a/src/test/regress/sql/enum.sql +++ b/src/test/regress/sql/enum.sql @@ -24,7 +24,7 @@ COPY enumtest FROM stdin; blue purple \. -SELECT * FROM enumtest; +SELECT * FROM enumtest ORDER BY col; -- -- Operators, no index diff --git a/src/test/regress/sql/float4.sql b/src/test/regress/sql/float4.sql index 5944e2fc14..8182f9ce21 100644 --- a/src/test/regress/sql/float4.sql +++ b/src/test/regress/sql/float4.sql @@ -42,43 +42,43 @@ SELECT 'Infinity'::float4 / 'Infinity'::float4; SELECT 'nan'::float4 / 'nan'::float4; -SELECT '' AS five, * FROM FLOAT4_TBL; +SELECT '' AS five, * FROM FLOAT4_TBL ORDER BY f1; -SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <> '1004.3'; +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <> '1004.3' ORDER BY f1; SELECT '' AS one, f.* FROM FLOAT4_TBL f WHERE f.f1 = '1004.3'; -SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE '1004.3' > f.f1; +SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE '1004.3' > f.f1 ORDER BY f1; -SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE f.f1 < '1004.3'; +SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE f.f1 < '1004.3' ORDER BY f1; -SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE '1004.3' >= f.f1; +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE '1004.3' >= f.f1 ORDER BY f1; -SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <= '1004.3'; +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <= '1004.3' ORDER BY f1; SELECT '' AS three, f.f1, f.f1 * '-10' AS x FROM FLOAT4_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; SELECT '' AS three, f.f1, f.f1 + '-10' AS x FROM FLOAT4_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; SELECT '' AS three, f.f1, f.f1 / '-10' AS x FROM FLOAT4_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; SELECT '' AS three, f.f1, f.f1 - '-10' AS x FROM FLOAT4_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; -- test divide by zero SELECT '' AS bad, f.f1 / '0.0' from FLOAT4_TBL f; -SELECT '' AS five, * FROM FLOAT4_TBL; +SELECT '' AS five, * FROM FLOAT4_TBL ORDER BY f1; -- test the unary float4abs operator -SELECT '' AS five, f.f1, @f.f1 AS abs_f1 FROM FLOAT4_TBL f; +SELECT '' AS five, f.f1, @f.f1 AS abs_f1 FROM FLOAT4_TBL f ORDER BY f1; UPDATE FLOAT4_TBL SET f1 = FLOAT4_TBL.f1 * '-1' WHERE FLOAT4_TBL.f1 > '0.0'; -SELECT '' AS five, * FROM FLOAT4_TBL; +SELECT '' AS five, * FROM FLOAT4_TBL ORDER BY f1; diff --git a/src/test/regress/sql/float8.sql b/src/test/regress/sql/float8.sql index 92b6b0d7b9..270011e647 100644 --- a/src/test/regress/sql/float8.sql +++ b/src/test/regress/sql/float8.sql @@ -41,60 +41,60 @@ SELECT 'Infinity'::float8 + 100.0; SELECT 'Infinity'::float8 / 'Infinity'::float8; SELECT 'nan'::float8 / 'nan'::float8; -SELECT '' AS five, * FROM FLOAT8_TBL; +SELECT '' AS five, * FROM FLOAT8_TBL ORDER BY f1; -SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <> '1004.3'; +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <> '1004.3' ORDER BY f1; SELECT '' AS one, f.* FROM FLOAT8_TBL f WHERE f.f1 = '1004.3'; -SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1; +SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1 ORDER BY f1; -SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE f.f1 < '1004.3'; +SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE f.f1 < '1004.3' ORDER BY f1; -SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE '1004.3' >= f.f1; +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE '1004.3' >= f.f1 ORDER BY f1; -SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <= '1004.3'; +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <= '1004.3' ORDER BY f1; SELECT '' AS three, f.f1, f.f1 * '-10' AS x FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; SELECT '' AS three, f.f1, f.f1 + '-10' AS x FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; SELECT '' AS three, f.f1, f.f1 / '-10' AS x FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; SELECT '' AS three, f.f1, f.f1 - '-10' AS x FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; SELECT '' AS one, f.f1 ^ '2.0' AS square_f1 FROM FLOAT8_TBL f where f.f1 = '1004.3'; -- absolute value SELECT '' AS five, f.f1, @f.f1 AS abs_f1 - FROM FLOAT8_TBL f; + FROM FLOAT8_TBL f ORDER BY f1; -- truncate SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1 - FROM FLOAT8_TBL f; + FROM FLOAT8_TBL f ORDER BY f1; -- round SELECT '' AS five, f.f1, round(f.f1) AS round_f1 - FROM FLOAT8_TBL f; + FROM FLOAT8_TBL f ORDER BY f1; -- ceil / ceiling -select ceil(f1) as ceil_f1 from float8_tbl f; -select ceiling(f1) as ceiling_f1 from float8_tbl f; +select ceil(f1) as ceil_f1 from float8_tbl f ORDER BY f1; +select ceiling(f1) as ceiling_f1 from float8_tbl f ORDER BY f1; -- floor -select floor(f1) as floor_f1 from float8_tbl f; +select floor(f1) as floor_f1 from float8_tbl f ORDER BY f1; -- sign -select sign(f1) as sign_f1 from float8_tbl f; +select sign(f1) as sign_f1 from float8_tbl f ORDER BY f1; -- square root SELECT sqrt(float8 '64') AS eight; @@ -103,7 +103,7 @@ SELECT |/ float8 '64' AS eight; SELECT '' AS three, f.f1, |/f.f1 AS sqrt_f1 FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; -- power SELECT power(float8 '144', float8 '0.5'); @@ -111,35 +111,35 @@ SELECT power(float8 '144', float8 '0.5'); -- take exp of ln(f.f1) SELECT '' AS three, f.f1, exp(ln(f.f1)) AS exp_ln_f1 FROM FLOAT8_TBL f - WHERE f.f1 > '0.0'; + WHERE f.f1 > '0.0' ORDER BY f1; -- cube root SELECT ||/ float8 '27' AS three; -SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f; +SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f ORDER BY f1; -SELECT '' AS five, * FROM FLOAT8_TBL; +SELECT '' AS five, * FROM FLOAT8_TBL ORDER BY f1; UPDATE FLOAT8_TBL SET f1 = FLOAT8_TBL.f1 * '-1' WHERE FLOAT8_TBL.f1 > '0.0'; + +SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f ORDER BY f1; -SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f; - -SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f; +SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f ORDER BY f1; SELECT 0 ^ 0 + 0 ^ 1 + 0 ^ 0.0 + 0 ^ 0.5; SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ; -SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ; +SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0'; -SELECT '' AS bad, exp(f.f1) from FLOAT8_TBL f; +SELECT '' AS bad, exp(f.f1) from FLOAT8_TBL f ORDER BY f1; SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f; -SELECT '' AS five, * FROM FLOAT8_TBL; +SELECT '' AS five, * FROM FLOAT8_TBL ORDER BY f1; -- test for over- and underflow INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); @@ -165,5 +165,5 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e+200'); INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e-200'); -SELECT '' AS five, * FROM FLOAT8_TBL; +SELECT '' AS five, * FROM FLOAT8_TBL ORDER BY f1; diff --git a/src/test/regress/sql/foreign_key.sql b/src/test/regress/sql/foreign_key.sql index cc7b23f113..241b2a90ca 100644 --- a/src/test/regress/sql/foreign_key.sql +++ b/src/test/regress/sql/foreign_key.sql @@ -26,19 +26,19 @@ INSERT INTO FKTABLE VALUES (NULL, 1); INSERT INTO FKTABLE VALUES (100, 2); -- Check FKTABLE -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2; -- Delete a row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=1; -- Check FKTABLE for removal of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2; -- Update a row from PK TABLE UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; -- Check FKTABLE for update of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2; DROP TABLE FKTABLE; DROP TABLE PKTABLE; @@ -77,31 +77,31 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 4); INSERT INTO FKTABLE VALUES (1, NULL, 4); -- Check FKTABLE -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; -- Delete a row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=1 and ptest2=2; -- Check FKTABLE for removal of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; -- Delete another row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=5 and ptest2=10; -- Check FKTABLE (should be no change) -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; -- Update a row from PK TABLE UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; -- Check FKTABLE for update of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; -- Try altering the column type where foreign keys are involved ALTER TABLE PKTABLE ALTER COLUMN ptest1 TYPE bigint; ALTER TABLE FKTABLE ALTER COLUMN ftest1 TYPE bigint; -SELECT * FROM PKTABLE; -SELECT * FROM FKTABLE; +SELECT * FROM PKTABLE ORDER BY 1, 2, 3; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; DROP TABLE PKTABLE CASCADE; DROP TABLE FKTABLE; @@ -138,25 +138,25 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 4); INSERT INTO FKTABLE VALUES (1, NULL, 4); -- Check FKTABLE -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; -- Delete a row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=1 and ptest2=2; -- Check FKTABLE to check for removal -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; -- Delete another row from PK TABLE DELETE FROM PKTABLE WHERE ptest1=5 and ptest2=10; -- Check FKTABLE (should be no change) -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; -- Update a row from PK TABLE UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; -- Check FKTABLE for update of matched row -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2, 3; -- this should fail for lack of CASCADE DROP TABLE PKTABLE; @@ -187,10 +187,10 @@ INSERT INTO FKTABLE VALUES (NULL, 1); INSERT INTO FKTABLE VALUES (100, 2); -- Check FKTABLE -SELECT * FROM FKTABLE; +SELECT * FROM FKTABLE ORDER BY 1, 2; -- Check PKTABLE -SELECT * FROM PKTABLE; +SELECT * FROM PKTABLE ORDER BY 1, 2; -- Delete a row from PK TABLE (should fail) DELETE FROM PKTABLE WHERE ptest1=1; @@ -199,7 +199,7 @@ DELETE FROM PKTABLE WHERE ptest1=1; DELETE FROM PKTABLE WHERE ptest1=5; -- Check PKTABLE for deletes -SELECT * FROM PKTABLE; +SELECT * FROM PKTABLE ORDER BY 1, 2; -- Update a row from PK TABLE (should fail) UPDATE PKTABLE SET ptest1=0 WHERE ptest1=2; @@ -208,7 +208,7 @@ UPDATE PKTABLE SET ptest1=0 WHERE ptest1=2; UPDATE PKTABLE SET ptest1=0 WHERE ptest1=4; -- Check PKTABLE for updates -SELECT * FROM PKTABLE; +SELECT * FROM PKTABLE ORDER BY 1, 2; DROP TABLE FKTABLE; DROP TABLE PKTABLE; @@ -238,7 +238,7 @@ INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5); INSERT INTO FKTABLE VALUES (1, 2, 7, 6); -- Show FKTABLE -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to update something that should fail UPDATE PKTABLE set ptest2=5 where ptest2=2; @@ -253,9 +253,9 @@ DELETE FROM PKTABLE where ptest1=1 and ptest2=2 and ptest3=3; DELETE FROM PKTABLE where ptest1=2; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; DROP TABLE FKTABLE; DROP TABLE PKTABLE; @@ -283,7 +283,7 @@ INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5); INSERT INTO FKTABLE VALUES (1, 2, 7, 6); -- Show FKTABLE -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to update something that will cascade UPDATE PKTABLE set ptest2=5 where ptest2=2; @@ -292,22 +292,22 @@ UPDATE PKTABLE set ptest2=5 where ptest2=2; UPDATE PKTABLE set ptest1=1 WHERE ptest2=3; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to delete something that should cascade DELETE FROM PKTABLE where ptest1=1 and ptest2=5 and ptest3=3; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to delete something that should not have a cascade DELETE FROM PKTABLE where ptest1=2; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; DROP TABLE FKTABLE; DROP TABLE PKTABLE; @@ -336,7 +336,7 @@ INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5); INSERT INTO FKTABLE VALUES (1, 2, 7, 6); -- Show FKTABLE -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to update something that will set null UPDATE PKTABLE set ptest2=5 where ptest2=2; @@ -345,22 +345,22 @@ UPDATE PKTABLE set ptest2=5 where ptest2=2; UPDATE PKTABLE set ptest2=2 WHERE ptest2=3 and ptest1=1; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to delete something that should set default DELETE FROM PKTABLE where ptest1=2 and ptest2=3 and ptest3=4; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to delete something that should not set default DELETE FROM PKTABLE where ptest2=5; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; DROP TABLE FKTABLE; DROP TABLE PKTABLE; @@ -391,7 +391,7 @@ INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5); INSERT INTO FKTABLE VALUES (1, 2, 7, 6); -- Show FKTABLE -SELECT * from FKTABLE; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to update something that will fail UPDATE PKTABLE set ptest2=5 where ptest2=2; @@ -404,22 +404,22 @@ UPDATE PKTABLE set ptest2=10 where ptest2=4; UPDATE PKTABLE set ptest2=2 WHERE ptest2=3 and ptest1=1; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to delete something that should set null DELETE FROM PKTABLE where ptest1=2 and ptest2=3 and ptest3=4; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; -- Try to delete something that should not set null DELETE FROM PKTABLE where ptest2=5; -- Show PKTABLE and FKTABLE -SELECT * from PKTABLE; -SELECT * from FKTABLE; +SELECT * from PKTABLE ORDER BY 1, 2, 3,4; +SELECT * from FKTABLE ORDER BY 1, 2, 3,4; DROP TABLE FKTABLE; DROP TABLE PKTABLE; @@ -904,20 +904,20 @@ INSERT INTO tasks VALUES (1,1,NULL,NULL); INSERT INTO tasks VALUES (2,2,2,NULL); INSERT INTO tasks VALUES (3,3,3,3); -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; UPDATE users SET id = 4 WHERE id = 3; -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; DELETE FROM users WHERE id = 4; -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; -- could fail with only 2 changes to make, if row was already updated BEGIN; UPDATE tasks set id=id WHERE id=2; -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; DELETE FROM users WHERE id = 2; -SELECT * FROM tasks; +SELECT * FROM tasks ORDER BY 1, 2, 3,4; COMMIT; diff --git a/src/test/regress/sql/geometry.sql b/src/test/regress/sql/geometry.sql index 73f8032bb1..31319876c3 100644 --- a/src/test/regress/sql/geometry.sql +++ b/src/test/regress/sql/geometry.sql @@ -11,40 +11,40 @@ SET extra_float_digits TO -3; -- SELECT '' AS four, center(f1) AS center - FROM BOX_TBL; + FROM BOX_TBL ORDER BY (center(f1))[0], (center(f1))[1]; SELECT '' AS four, (@@ f1) AS center - FROM BOX_TBL; + FROM BOX_TBL ORDER BY (center(f1))[0], (center(f1))[1]; SELECT '' AS six, point(f1) AS center - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[1], radius(f1); SELECT '' AS six, (@@ f1) AS center - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[1], radius(f1); SELECT '' AS two, (@@ f1) AS center FROM POLYGON_TBL - WHERE (# f1) > 2; + WHERE (# f1) > 2 ORDER BY ID; -- "is horizontal" function SELECT '' AS two, p1.f1 FROM POINT_TBL p1 - WHERE ishorizontal(p1.f1, point '(0,0)'); + WHERE ishorizontal(p1.f1, point '(0,0)') ORDER BY f1[0], f1[1]; -- "is horizontal" operator SELECT '' AS two, p1.f1 FROM POINT_TBL p1 - WHERE p1.f1 ?- point '(0,0)'; + WHERE p1.f1 ?- point '(0,0)' ORDER BY f1[0], f1[1]; -- "is vertical" function SELECT '' AS one, p1.f1 FROM POINT_TBL p1 - WHERE isvertical(p1.f1, point '(5.1,34.5)'); + WHERE isvertical(p1.f1, point '(5.1,34.5)') ORDER BY f1[0], f1[1]; -- "is vertical" operator SELECT '' AS one, p1.f1 FROM POINT_TBL p1 - WHERE p1.f1 ?| point '(5.1,34.5)'; + WHERE p1.f1 ?| point '(5.1,34.5)' ORDER BY f1[0], f1[1]; -- -- Line segments @@ -52,11 +52,11 @@ SELECT '' AS one, p1.f1 -- intersection SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection - FROM LSEG_TBL l, POINT_TBL p; + FROM LSEG_TBL l, POINT_TBL p ORDER BY (l.s[0])[0], (l.s[0])[1], p.f1[0], p.f1[1]; -- closest point SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest - FROM LSEG_TBL l, POINT_TBL p; + FROM LSEG_TBL l, POINT_TBL p ORDER BY (l.s[0])[0], (l.s[0])[1], p.f1[0], p.f1[1]; -- -- Lines @@ -66,38 +66,38 @@ SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest -- Boxes -- -SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL; +SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[0], radius(f1); -- translation SELECT '' AS twentyfour, b.f1 + p.f1 AS translation - FROM BOX_TBL b, POINT_TBL p; + FROM BOX_TBL b, POINT_TBL p ORDER BY (center(b.f1))[0], (center(b.f1))[1], p.f1[0], p.f1[1]; SELECT '' AS twentyfour, b.f1 - p.f1 AS translation - FROM BOX_TBL b, POINT_TBL p; + FROM BOX_TBL b, POINT_TBL p ORDER BY (center(b.f1))[0], (center(b.f1))[1], p.f1[0], p.f1[1]; -- scaling and rotation SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation - FROM BOX_TBL b, POINT_TBL p; + FROM BOX_TBL b, POINT_TBL p ORDER BY (center(b.f1))[0], (center(b.f1))[1], p.f1[0], p.f1[1]; SELECT '' AS twenty, b.f1 / p.f1 AS rotation FROM BOX_TBL b, POINT_TBL p - WHERE (p.f1 <-> point '(0,0)') >= 1; + WHERE (p.f1 <-> point '(0,0)') >= 1 ORDER BY (center(b.f1))[0], (center(b.f1))[1], p.f1[0], p.f1[1]; -- -- Paths -- -SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL; +SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL ORDER BY ID; -SELECT '' AS four, path(f1) FROM POLYGON_TBL; +SELECT '' AS four, path(f1) FROM POLYGON_TBL ORDER BY ID; -- translation SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add - FROM PATH_TBL p1; + FROM PATH_TBL p1 ORDER BY ID; -- scaling and rotation SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul - FROM PATH_TBL p1; + FROM PATH_TBL p1 ORDER BY ID; -- -- Polygons @@ -105,45 +105,45 @@ SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul -- containment SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 @> p.f1 AS contains - FROM POLYGON_TBL poly, POINT_TBL p; + FROM POLYGON_TBL poly, POINT_TBL p ORDER BY poly.ID, p.f1[0], p.f1[1]; SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 <@ poly.f1 AS contained - FROM POLYGON_TBL poly, POINT_TBL p; + FROM POLYGON_TBL poly, POINT_TBL p ORDER BY poly.ID, p.f1[0], p.f1[1]; SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon - FROM POLYGON_TBL; + FROM POLYGON_TBL ORDER BY ID; SELECT '' AS four, polygon(f1) - FROM BOX_TBL; + FROM BOX_TBL ORDER BY (center(f1))[0], (center(f1))[1]; SELECT '' AS four, polygon(f1) - FROM PATH_TBL WHERE isclosed(f1); + FROM PATH_TBL WHERE isclosed(f1) ORDER BY ID; SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon FROM PATH_TBL - WHERE isopen(f1); + WHERE isopen(f1) ORDER BY ID; -- convert circles to polygons using the default number of points SELECT '' AS six, polygon(f1) - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[1], radius(f1); -- convert the circle to an 8-point polygon SELECT '' AS six, polygon(8, f1) - FROM CIRCLE_TBL; + FROM CIRCLE_TBL ORDER BY (point(f1))[0], (point(f1))[1], radius(f1); -- -- Circles -- SELECT '' AS six, circle(f1, 50.0) - FROM POINT_TBL; + FROM POINT_TBL ORDER BY f1[0], f1[1]; SELECT '' AS four, circle(f1) - FROM BOX_TBL; + FROM BOX_TBL ORDER BY (center(f1))[0], (center(f1))[1]; SELECT '' AS two, circle(f1) FROM POLYGON_TBL - WHERE (# f1) >= 3; + WHERE (# f1) >= 3 ORDER BY ID; SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance FROM CIRCLE_TBL c1, POINT_TBL p1 diff --git a/src/test/regress/sql/horology.sql b/src/test/regress/sql/horology.sql index 615755e3de..09480d1ad9 100644 --- a/src/test/regress/sql/horology.sql +++ b/src/test/regress/sql/horology.sql @@ -99,8 +99,8 @@ SELECT date '1994-01-01' + time '10:00' AS "Jan_01_1994_10am"; SELECT date '1994-01-01' + timetz '11:00-5' AS "Jan_01_1994_8am"; SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am"; -SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL; -SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL ORDER BY d1; +SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL ORDER BY d1; SELECT timestamp with time zone '1996-03-01' - interval '1 second' AS "Feb 29"; SELECT timestamp with time zone '1999-03-01' - interval '1 second' AS "Feb 28"; @@ -127,8 +127,8 @@ SELECT timestamptz(date '1994-01-01', time with time zone '11:00-8') AS "Jan_01_ SELECT timestamptz(date '1994-01-01', time with time zone '10:00-8') AS "Jan_01_1994_10am"; SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am"; -SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; -SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; +SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL ORDER BY d1; +SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL ORDER BY d1; -- -- time, interval arithmetic @@ -233,7 +233,7 @@ CREATE TABLE TEMP_TIMESTAMP (f1 timestamp with time zone); INSERT INTO TEMP_TIMESTAMP (f1) SELECT d1 FROM TIMESTAMP_TBL WHERE d1 BETWEEN '13-jun-1957' AND '1-jan-1997' - OR d1 BETWEEN '1-jan-1999' AND '1-jan-2010'; + OR d1 BETWEEN '1-jan-1999' AND '1-jan-2010' ; SELECT '' AS "16", f1 AS "timestamp" FROM TEMP_TIMESTAMP @@ -273,19 +273,19 @@ SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime SELECT '' AS three, * FROM ABSTIME_TBL WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years - < abstime 'Jan 14 14:00:00 1977'; + < abstime 'Jan 14 14:00:00 1977' ORDER BY f1; SELECT '' AS three, * FROM ABSTIME_TBL WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years - < abstime 'Jan 14 14:00:00 1971'; + < abstime 'Jan 14 14:00:00 1971' ORDER BY f1; SELECT '' AS three, * FROM ABSTIME_TBL WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years - < abstime 'Jan 14 14:00:00 1971'; + < abstime 'Jan 14 14:00:00 1971' ORDER BY f1; SELECT '' AS three, * FROM ABSTIME_TBL WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years - < abstime 'Jan 14 14:00:00 1977'; + < abstime 'Jan 14 14:00:00 1977' ORDER BY f1; -- -- Conversions @@ -306,16 +306,16 @@ SELECT '' AS four, f1 AS abstime, date(f1) AS date ORDER BY date, abstime; SELECT '' AS two, d1 AS "timestamp", abstime(d1) AS abstime - FROM TIMESTAMP_TBL WHERE NOT isfinite(d1); + FROM TIMESTAMP_TBL WHERE NOT isfinite(d1) ORDER BY d1; SELECT '' AS three, f1 as abstime, cast(f1 as timestamp) AS "timestamp" - FROM ABSTIME_TBL WHERE NOT isfinite(f1); + FROM ABSTIME_TBL WHERE NOT isfinite(f1) ORDER BY f1; SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime - FROM INTERVAL_TBL; + FROM INTERVAL_TBL ORDER BY f1; SELECT '' AS six, f1 as reltime, CAST(f1 AS interval) AS interval - FROM RELTIME_TBL; + FROM RELTIME_TBL ORDER BY f1; DROP TABLE TEMP_TIMESTAMP; @@ -327,23 +327,23 @@ SET DateStyle TO 'US,Postgres'; SHOW DateStyle; -SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL ORDER BY d1; -SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL ORDER BY f1; SET DateStyle TO 'US,ISO'; -SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL ORDER BY d1; -SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL ORDER BY f1; SET DateStyle TO 'US,SQL'; SHOW DateStyle; -SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL ORDER BY d1; -SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL ORDER BY f1; SET DateStyle TO 'European,Postgres'; @@ -353,25 +353,25 @@ INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957'); SELECT count(*) as one FROM TIMESTAMP_TBL WHERE d1 = 'Jun 13 1957'; -SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL; +SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL ORDER BY d1; -SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL ORDER BY f1; SET DateStyle TO 'European,ISO'; SHOW DateStyle; -SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; +SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL ORDER BY d1; -SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL ORDER BY f1; SET DateStyle TO 'European,SQL'; SHOW DateStyle; -SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; +SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL ORDER BY d1; -SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL; +SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL ORDER BY f1; RESET DateStyle; diff --git a/src/test/regress/sql/inet.sql b/src/test/regress/sql/inet.sql index f88a17eabc..7ba1080b44 100644 --- a/src/test/regress/sql/inet.sql +++ b/src/test/regress/sql/inet.sql @@ -33,45 +33,45 @@ SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL; -- now test some support functions -SELECT '' AS ten, i AS inet, host(i), text(i), family(i) FROM INET_TBL; +SELECT '' AS ten, i AS inet, host(i), text(i), family(i) FROM INET_TBL ORDER BY i; SELECT '' AS ten, c AS cidr, broadcast(c), - i AS inet, broadcast(i) FROM INET_TBL; + i AS inet, broadcast(i) FROM INET_TBL ORDER BY i, c; SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)", - i AS inet, network(i) AS "network(inet)" FROM INET_TBL; + i AS inet, network(i) AS "network(inet)" FROM INET_TBL ORDER BY i, c; SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)", - i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL; + i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL ORDER BY i, c; SELECT '' AS four, c AS cidr, masklen(c) AS "masklen(cidr)", i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL - WHERE masklen(c) <= 8; + WHERE masklen(c) <= 8 ORDER BY i, c; SELECT '' AS six, c AS cidr, i AS inet FROM INET_TBL - WHERE c = i; + WHERE c = i ORDER BY i, c; SELECT '' AS ten, i, c, i < c AS lt, i <= c AS le, i = c AS eq, i >= c AS ge, i > c AS gt, i <> c AS ne, i << c AS sb, i <<= c AS sbe, i >> c AS sup, i >>= c AS spe - FROM INET_TBL; + FROM INET_TBL ORDER BY i, c; -- check the conversion to/from text and set_netmask -SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL; +SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL ORDER BY i; -- check that index works correctly CREATE INDEX inet_idx1 ON inet_tbl(i); SET enable_seqscan TO off; -SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr; -SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr; +SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr ORDER BY i, c; +SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr ORDER BY i; SET enable_seqscan TO on; DROP INDEX inet_idx1; -- simple tests of inet boolean and arithmetic operators -SELECT i, ~i AS "~i" FROM inet_tbl; -SELECT i, c, i & c AS "and" FROM inet_tbl; -SELECT i, c, i | c AS "or" FROM inet_tbl; -SELECT i, i + 500 AS "i+500" FROM inet_tbl; -SELECT i, i - 500 AS "i-500" FROM inet_tbl; -SELECT i, c, i - c AS "minus" FROM inet_tbl; +SELECT i, ~i AS "~i" FROM inet_tbl ORDER BY i; +SELECT i, c, i & c AS "and" FROM inet_tbl ORDER BY i, c; +SELECT i, c, i | c AS "or" FROM inet_tbl ORDER BY i, c; +SELECT i, i + 500 AS "i+500" FROM inet_tbl ORDER BY i; +SELECT i, i - 500 AS "i-500" FROM inet_tbl ORDER BY i; +SELECT i, c, i - c AS "minus" FROM inet_tbl ORDER BY i, c; SELECT '127.0.0.1'::inet + 257; SELECT ('127.0.0.1'::inet + 257) - 257; SELECT '127::1'::inet + 257; diff --git a/src/test/regress/sql/inherit.sql b/src/test/regress/sql/inherit.sql index 1730a48575..1242396ee7 100644 --- a/src/test/regress/sql/inherit.sql +++ b/src/test/regress/sql/inherit.sql @@ -34,14 +34,14 @@ INSERT INTO d(aa) VALUES('dddddd'); INSERT INTO d(aa) VALUES('ddddddd'); INSERT INTO d(aa) VALUES('dddddddd'); -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; UPDATE a SET aa='zzzz' WHERE aa='aaaa'; UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa'; @@ -49,49 +49,49 @@ UPDATE b SET aa='zzz' WHERE aa='aaa'; UPDATE ONLY b SET aa='zzz' WHERE aa='aaa'; UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%'; -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; UPDATE b SET aa='new'; -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; UPDATE a SET aa='new'; DELETE FROM ONLY c WHERE aa='new'; -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; DELETE FROM a; -SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; -SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; -SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; -SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; -SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid ORDER BY relname, a.aa; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid ORDER BY relname, b.aa; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid ORDER BY relname, c.aa; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid ORDER BY relname, d.aa; -- Confirm PRIMARY KEY adds NOT NULL constraint to child table CREATE TEMP TABLE z (b TEXT, PRIMARY KEY(aa, b)) inherits (a); @@ -153,7 +153,7 @@ CREATE TABLE inhg (x text, LIKE inhx INCLUDING CONSTRAINTS, y text); /* Copies c INSERT INTO inhg VALUES ('x', 'text', 'y'); /* Succeeds */ INSERT INTO inhg VALUES ('x', 'text', 'y'); /* Succeeds -- Unique constraints not copied */ INSERT INTO inhg VALUES ('x', 'foo', 'y'); /* fails due to constraint */ -SELECT * FROM inhg; /* Two records with three columns in order x=x, xx=text, y=y */ +SELECT * FROM inhg ORDER BY 1,2,3; /* Two records with three columns in order x=x, xx=text, y=y */ DROP TABLE inhg; CREATE TABLE inhg (x text, LIKE inhx INCLUDING INDEXES, y text); /* copies indexes */ diff --git a/src/test/regress/sql/int2.sql b/src/test/regress/sql/int2.sql index 65c89e4abd..5ddabaedc2 100644 --- a/src/test/regress/sql/int2.sql +++ b/src/test/regress/sql/int2.sql @@ -29,60 +29,60 @@ INSERT INTO INT2_TBL(f1) VALUES ('123 dt'); INSERT INTO INT2_TBL(f1) VALUES (''); -SELECT '' AS five, * FROM INT2_TBL; +SELECT '' AS five, * FROM INT2_TBL ORDER BY f1; -SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int2 '0'; +SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int2 '0' ORDER BY f1; -SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int4 '0'; +SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int4 '0' ORDER BY f1; -SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int2 '0'; +SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int2 '0' ORDER BY f1; -SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int4 '0'; +SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int4 '0' ORDER BY f1; -SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int2 '0'; +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int2 '0' ORDER BY f1; -SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int4 '0'; +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int4 '0' ORDER BY f1; -SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int2 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int2 '0' ORDER BY f1; -SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int4 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int4 '0' ORDER BY f1; -SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int2 '0'; +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int2 '0' ORDER BY f1; -SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int4 '0'; +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int4 '0' ORDER BY f1; -SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0' ORDER BY f1; -SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0' ORDER BY f1; -- positive odds -SELECT '' AS one, i.* FROM INT2_TBL i WHERE (i.f1 % int2 '2') = int2 '1'; +SELECT '' AS one, i.* FROM INT2_TBL i WHERE (i.f1 % int2 '2') = int2 '1' ORDER BY f1; -- any evens -SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0'; +SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0' ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i -WHERE abs(f1) < 16384; +WHERE abs(f1) < 16384 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i -WHERE f1 < 32766; +WHERE f1 < 32766 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i -WHERE f1 > -32767; +WHERE f1 > -32767 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT2_TBL i; +SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT2_TBL i ORDER BY f1; diff --git a/src/test/regress/sql/int4.sql b/src/test/regress/sql/int4.sql index 5212c68795..53104a085c 100644 --- a/src/test/regress/sql/int4.sql +++ b/src/test/regress/sql/int4.sql @@ -31,69 +31,69 @@ INSERT INTO INT4_TBL(f1) VALUES (''); SELECT '' AS five, * FROM INT4_TBL; -SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int2 '0'; +SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int2 '0' ORDER BY f1; -SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int4 '0'; +SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int4 '0' ORDER BY f1; SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int2 '0'; SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int4 '0'; -SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int2 '0'; +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int2 '0' ORDER BY f1; -SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int4 '0'; +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int4 '0' ORDER BY f1; -SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int2 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int2 '0' ORDER BY f1; -SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int4 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int4 '0' ORDER BY f1; -SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int2 '0'; +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int2 '0' ORDER BY f1; -SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int4 '0'; +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int4 '0' ORDER BY f1; -SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0' ORDER BY f1; -SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0' ORDER BY f1; -- positive odds -SELECT '' AS one, i.* FROM INT4_TBL i WHERE (i.f1 % int2 '2') = int2 '1'; +SELECT '' AS one, i.* FROM INT4_TBL i WHERE (i.f1 % int2 '2') = int2 '1' ORDER BY f1; -- any evens -SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0'; +SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0' ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i -WHERE abs(f1) < 1073741824; +WHERE abs(f1) < 1073741824 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i -WHERE abs(f1) < 1073741824; +WHERE abs(f1) < 1073741824 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i -WHERE f1 < 2147483646; +WHERE f1 < 2147483646 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i -WHERE f1 < 2147483646; +WHERE f1 < 2147483646 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i -WHERE f1 > -2147483647; +WHERE f1 > -2147483647 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i ORDER BY f1; SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i -WHERE f1 > -2147483647; +WHERE f1 > -2147483647 ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i ORDER BY f1; -SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i; +SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i ORDER BY f1; -- -- more complex expressions diff --git a/src/test/regress/sql/int8.sql b/src/test/regress/sql/int8.sql index 648563c374..6a6c31a68a 100644 --- a/src/test/regress/sql/int8.sql +++ b/src/test/regress/sql/int8.sql @@ -19,77 +19,77 @@ INSERT INTO INT8_TBL(q1) VALUES ('- 123'); INSERT INTO INT8_TBL(q1) VALUES (' 345 5'); INSERT INTO INT8_TBL(q1) VALUES (''); -SELECT * FROM INT8_TBL; +SELECT * FROM INT8_TBL ORDER BY q1,q2; -- int8/int8 cmp -SELECT * FROM INT8_TBL WHERE q2 = 4567890123456789; -SELECT * FROM INT8_TBL WHERE q2 <> 4567890123456789; -SELECT * FROM INT8_TBL WHERE q2 < 4567890123456789; -SELECT * FROM INT8_TBL WHERE q2 > 4567890123456789; -SELECT * FROM INT8_TBL WHERE q2 <= 4567890123456789; -SELECT * FROM INT8_TBL WHERE q2 >= 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 = 4567890123456789 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 <> 4567890123456789 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 < 4567890123456789 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 > 4567890123456789 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 <= 4567890123456789 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 >= 4567890123456789 ORDER BY q1,q2; -- int8/int4 cmp -SELECT * FROM INT8_TBL WHERE q2 = 456; -SELECT * FROM INT8_TBL WHERE q2 <> 456; -SELECT * FROM INT8_TBL WHERE q2 < 456; -SELECT * FROM INT8_TBL WHERE q2 > 456; -SELECT * FROM INT8_TBL WHERE q2 <= 456; -SELECT * FROM INT8_TBL WHERE q2 >= 456; +SELECT * FROM INT8_TBL WHERE q2 = 456 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 <> 456 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 < 456 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 > 456 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 <= 456 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 >= 456 ORDER BY q1,q2; -- int4/int8 cmp -SELECT * FROM INT8_TBL WHERE 123 = q1; -SELECT * FROM INT8_TBL WHERE 123 <> q1; -SELECT * FROM INT8_TBL WHERE 123 < q1; -SELECT * FROM INT8_TBL WHERE 123 > q1; -SELECT * FROM INT8_TBL WHERE 123 <= q1; -SELECT * FROM INT8_TBL WHERE 123 >= q1; +SELECT * FROM INT8_TBL WHERE 123 = q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE 123 <> q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE 123 < q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE 123 > q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE 123 <= q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE 123 >= q1 ORDER BY q1,q2; -- int8/int2 cmp -SELECT * FROM INT8_TBL WHERE q2 = '456'::int2; -SELECT * FROM INT8_TBL WHERE q2 <> '456'::int2; -SELECT * FROM INT8_TBL WHERE q2 < '456'::int2; -SELECT * FROM INT8_TBL WHERE q2 > '456'::int2; -SELECT * FROM INT8_TBL WHERE q2 <= '456'::int2; -SELECT * FROM INT8_TBL WHERE q2 >= '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 = '456'::int2 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 <> '456'::int2 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 < '456'::int2 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 > '456'::int2 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 <= '456'::int2 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE q2 >= '456'::int2 ORDER BY q1,q2; -- int2/int8 cmp -SELECT * FROM INT8_TBL WHERE '123'::int2 = q1; -SELECT * FROM INT8_TBL WHERE '123'::int2 <> q1; -SELECT * FROM INT8_TBL WHERE '123'::int2 < q1; -SELECT * FROM INT8_TBL WHERE '123'::int2 > q1; -SELECT * FROM INT8_TBL WHERE '123'::int2 <= q1; -SELECT * FROM INT8_TBL WHERE '123'::int2 >= q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 = q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE '123'::int2 <> q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE '123'::int2 < q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE '123'::int2 > q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE '123'::int2 <= q1 ORDER BY q1,q2; +SELECT * FROM INT8_TBL WHERE '123'::int2 >= q1 ORDER BY q1,q2; -SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL; +SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL ORDER BY q1; -SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL; -SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL; -SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL; +SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL ORDER BY q1,q2; +SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL ORDER BY q1,q2; +SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL ORDER BY q1,q2; SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL - WHERE q1 < 1000 or (q2 > 0 and q2 < 1000); -SELECT '' AS five, q1, q2, q1 / q2 AS divide, q1 % q2 AS mod FROM INT8_TBL; + WHERE q1 < 1000 or (q2 > 0 and q2 < 1000) ORDER BY q1,q2; +SELECT '' AS five, q1, q2, q1 / q2 AS divide, q1 % q2 AS mod FROM INT8_TBL ORDER BY q1,q2; -SELECT '' AS five, q1, float8(q1) FROM INT8_TBL; -SELECT '' AS five, q2, float8(q2) FROM INT8_TBL; +SELECT '' AS five, q1, float8(q1) FROM INT8_TBL ORDER BY q1; +SELECT '' AS five, q2, float8(q2) FROM INT8_TBL ORDER BY q2; -SELECT 37 + q1 AS plus4 FROM INT8_TBL; -SELECT 37 - q1 AS minus4 FROM INT8_TBL; -SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL; -SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL; +SELECT 37 + q1 AS plus4 FROM INT8_TBL ORDER BY q1; +SELECT 37 - q1 AS minus4 FROM INT8_TBL ORDER BY q1; +SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL ORDER BY q1; +SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL ORDER BY q1; -- int8 op int4 -SELECT q1 + 42::int4 AS "8plus4", q1 - 42::int4 AS "8minus4", q1 * 42::int4 AS "8mul4", q1 / 42::int4 AS "8div4" FROM INT8_TBL; +SELECT q1 + 42::int4 AS "8plus4", q1 - 42::int4 AS "8minus4", q1 * 42::int4 AS "8mul4", q1 / 42::int4 AS "8div4" FROM INT8_TBL ORDER BY q1; -- int4 op int8 -SELECT 246::int4 + q1 AS "4plus8", 246::int4 - q1 AS "4minus8", 246::int4 * q1 AS "4mul8", 246::int4 / q1 AS "4div8" FROM INT8_TBL; +SELECT 246::int4 + q1 AS "4plus8", 246::int4 - q1 AS "4minus8", 246::int4 * q1 AS "4mul8", 246::int4 / q1 AS "4div8" FROM INT8_TBL ORDER BY q1; -- int8 op int2 -SELECT q1 + 42::int2 AS "8plus2", q1 - 42::int2 AS "8minus2", q1 * 42::int2 AS "8mul2", q1 / 42::int2 AS "8div2" FROM INT8_TBL; +SELECT q1 + 42::int2 AS "8plus2", q1 - 42::int2 AS "8minus2", q1 * 42::int2 AS "8mul2", q1 / 42::int2 AS "8div2" FROM INT8_TBL ORDER BY q1; -- int2 op int8 -SELECT 246::int2 + q1 AS "2plus8", 246::int2 - q1 AS "2minus8", 246::int2 * q1 AS "2mul8", 246::int2 / q1 AS "2div8" FROM INT8_TBL; +SELECT 246::int2 + q1 AS "2plus8", 246::int2 - q1 AS "2minus8", 246::int2 * q1 AS "2mul8", 246::int2 / q1 AS "2div8" FROM INT8_TBL ORDER BY q1; -SELECT q2, abs(q2) FROM INT8_TBL; +SELECT q2, abs(q2) FROM INT8_TBL ORDER BY q2; SELECT min(q1), min(q2) FROM INT8_TBL; SELECT max(q1), max(q2) FROM INT8_TBL; @@ -97,30 +97,30 @@ SELECT max(q1), max(q2) FROM INT8_TBL; -- TO_CHAR() -- SELECT '' AS to_char_1, to_char(q1, '9G999G999G999G999G999'), to_char(q2, '9,999,999,999,999,999') - FROM INT8_TBL; + FROM INT8_TBL ORDER BY q1,q2; SELECT '' AS to_char_2, to_char(q1, '9G999G999G999G999G999D999G999'), to_char(q2, '9,999,999,999,999,999.999,999') - FROM INT8_TBL; + FROM INT8_TBL ORDER BY q1,q2; SELECT '' AS to_char_3, to_char( (q1 * -1), '9999999999999999PR'), to_char( (q2 * -1), '9999999999999999.999PR') - FROM INT8_TBL; + FROM INT8_TBL ORDER BY q1,q2; SELECT '' AS to_char_4, to_char( (q1 * -1), '9999999999999999S'), to_char( (q2 * -1), 'S9999999999999999') - FROM INT8_TBL; - -SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL; -SELECT '' AS to_char_6, to_char(q2, 'FMS9999999999999999') FROM INT8_TBL; -SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL; -SELECT '' AS to_char_8, to_char(q2, 'SG9999999999999999th') FROM INT8_TBL; -SELECT '' AS to_char_9, to_char(q2, '0999999999999999') FROM INT8_TBL; -SELECT '' AS to_char_10, to_char(q2, 'S0999999999999999') FROM INT8_TBL; -SELECT '' AS to_char_11, to_char(q2, 'FM0999999999999999') FROM INT8_TBL; -SELECT '' AS to_char_12, to_char(q2, 'FM9999999999999999.000') FROM INT8_TBL; -SELECT '' AS to_char_13, to_char(q2, 'L9999999999999999.000') FROM INT8_TBL; -SELECT '' AS to_char_14, to_char(q2, 'FM9999999999999999.999') FROM INT8_TBL; -SELECT '' AS to_char_15, to_char(q2, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9') FROM INT8_TBL; -SELECT '' AS to_char_16, to_char(q2, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL; -SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL; + FROM INT8_TBL ORDER BY q1,q2; + +SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_6, to_char(q2, 'FMS9999999999999999') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_8, to_char(q2, 'SG9999999999999999th') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_9, to_char(q2, '0999999999999999') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_10, to_char(q2, 'S0999999999999999') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_11, to_char(q2, 'FM0999999999999999') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_12, to_char(q2, 'FM9999999999999999.000') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_13, to_char(q2, 'L9999999999999999.000') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_14, to_char(q2, 'FM9999999999999999.999') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_15, to_char(q2, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_16, to_char(q2, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL ORDER BY q2; +SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL ORDER BY q2; -- check min/max values and overflow behavior @@ -163,26 +163,26 @@ select '-100'::int2 - '9223372036854775800'::int8; select '100'::int2 * '9223372036854775800'::int8; select '100'::int2 / '0'::int8; -SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 = 456; -SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 <> 456; +SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 = 456 ORDER BY q1; +SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 <> 456 ORDER BY q1; -SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 = 456; -SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 <> 456; +SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 = 456 ORDER BY q1; +SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 <> 456 ORDER BY q1; SELECT CAST('42'::int2 AS int8), CAST('-37'::int2 AS int8); -SELECT CAST(q1 AS float4), CAST(q2 AS float8) FROM INT8_TBL; +SELECT CAST(q1 AS float4), CAST(q2 AS float8) FROM INT8_TBL ORDER BY q1,q2; SELECT CAST('36854775807.0'::float4 AS int8); SELECT CAST('922337203685477580700.0'::float8 AS int8); -SELECT CAST(q1 AS oid) FROM INT8_TBL; -SELECT oid::int8 FROM pg_class WHERE relname = 'pg_class'; +SELECT CAST(q1 AS oid) FROM INT8_TBL ORDER BY q1; +SELECT oid::int8 FROM pg_class WHERE relname = 'pg_class' ORDER BY oid; -- bit operations -SELECT q1, q2, q1 & q2 AS "and", q1 | q2 AS "or", q1 # q2 AS "xor", ~q1 AS "not" FROM INT8_TBL; -SELECT q1, q1 << 2 AS "shl", q1 >> 3 AS "shr" FROM INT8_TBL; +SELECT q1, q2, q1 & q2 AS "and", q1 | q2 AS "or", q1 # q2 AS "xor", ~q1 AS "not" FROM INT8_TBL ORDER BY q1,q2; +SELECT q1, q1 << 2 AS "shl", q1 >> 3 AS "shr" FROM INT8_TBL ORDER BY q1; -- generate_series diff --git a/src/test/regress/sql/interval.sql b/src/test/regress/sql/interval.sql index f342a18af2..b0a60cee7a 100644 --- a/src/test/regress/sql/interval.sql +++ b/src/test/regress/sql/interval.sql @@ -34,25 +34,25 @@ INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 30 eons ago'); -- test interval operators -SELECT '' AS ten, * FROM INTERVAL_TBL; +SELECT '' AS ten, * FROM INTERVAL_TBL ORDER BY f1; SELECT '' AS nine, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 <> interval '@ 10 days'; + WHERE INTERVAL_TBL.f1 <> interval '@ 10 days' ORDER BY f1; SELECT '' AS three, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 <= interval '@ 5 hours'; + WHERE INTERVAL_TBL.f1 <= interval '@ 5 hours' ORDER BY f1; SELECT '' AS three, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 < interval '@ 1 day'; + WHERE INTERVAL_TBL.f1 < interval '@ 1 day' ORDER BY f1; SELECT '' AS one, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 = interval '@ 34 years'; + WHERE INTERVAL_TBL.f1 = interval '@ 34 years' ORDER BY f1; SELECT '' AS five, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 >= interval '@ 1 month'; + WHERE INTERVAL_TBL.f1 >= interval '@ 1 month' ORDER BY f1; SELECT '' AS nine, * FROM INTERVAL_TBL - WHERE INTERVAL_TBL.f1 > interval '@ 3 seconds ago'; + WHERE INTERVAL_TBL.f1 > interval '@ 3 seconds ago' ORDER BY f1; SELECT '' AS fortyfive, r1.*, r2.* FROM INTERVAL_TBL r1, INTERVAL_TBL r2 @@ -81,23 +81,23 @@ COPY INTERVAL_MULDIV_TBL FROM STDIN; \. SELECT span * 0.3 AS product -FROM INTERVAL_MULDIV_TBL; +FROM INTERVAL_MULDIV_TBL ORDER BY span; SELECT span * 8.2 AS product -FROM INTERVAL_MULDIV_TBL; +FROM INTERVAL_MULDIV_TBL ORDER BY span; SELECT span / 10 AS quotient -FROM INTERVAL_MULDIV_TBL; +FROM INTERVAL_MULDIV_TBL ORDER BY span; SELECT span / 100 AS quotient -FROM INTERVAL_MULDIV_TBL; +FROM INTERVAL_MULDIV_TBL ORDER BY span; DROP TABLE INTERVAL_MULDIV_TBL; SET DATESTYLE = 'postgres'; SET IntervalStyle to postgres_verbose; -SELECT '' AS ten, * FROM INTERVAL_TBL; +SELECT '' AS ten, * FROM INTERVAL_TBL ORDER BY f1; -- test avg(interval), which is somewhat fragile since people have been -- known to change the allowed input syntax for type interval without diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index 149530e14d..05867cbe54 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -44,23 +44,29 @@ INSERT INTO J2_TBL VALUES (NULL, 0); -- SELECT '' AS "xxx", * - FROM J1_TBL AS tx; + FROM J1_TBL AS tx + ORDER BY i, j, t; SELECT '' AS "xxx", * - FROM J1_TBL tx; + FROM J1_TBL tx + ORDER BY i, j, t; SELECT '' AS "xxx", * - FROM J1_TBL AS t1 (a, b, c); + FROM J1_TBL AS t1 (a, b, c) + ORDER BY a, b, c; SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b, c); + FROM J1_TBL t1 (a, b, c) + ORDER BY a, b, c; SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e); + FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e) + ORDER BY a, b, c, d, e; SELECT '' AS "xxx", t1.a, t2.e FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e) - WHERE t1.a = t2.d; + WHERE t1.a = t2.d + ORDER BY a, e; -- @@ -70,7 +76,8 @@ SELECT '' AS "xxx", t1.a, t2.e -- SELECT '' AS "xxx", * - FROM J1_TBL CROSS JOIN J2_TBL; + FROM J1_TBL CROSS JOIN J2_TBL + ORDER BY J1_TBL.i, J1_TBL.j, J1_TBL.t, J2_TBL.i, J2_TBL.k; -- ambiguous column SELECT '' AS "xxx", i, k, t @@ -78,18 +85,22 @@ SELECT '' AS "xxx", i, k, t -- resolve previous ambiguity by specifying the table name SELECT '' AS "xxx", t1.i, k, t - FROM J1_TBL t1 CROSS JOIN J2_TBL t2; + FROM J1_TBL t1 CROSS JOIN J2_TBL t2 + ORDER BY i, k, t; SELECT '' AS "xxx", ii, tt, kk FROM (J1_TBL CROSS JOIN J2_TBL) - AS tx (ii, jj, tt, ii2, kk); + AS tx (ii, jj, tt, ii2, kk) + ORDER BY ii, tt, kk; SELECT '' AS "xxx", tx.ii, tx.jj, tx.kk FROM (J1_TBL t1 (a, b, c) CROSS JOIN J2_TBL t2 (d, e)) - AS tx (ii, jj, tt, ii2, kk); + AS tx (ii, jj, tt, ii2, kk) + ORDER BY ii, jj, kk; SELECT '' AS "xxx", * - FROM J1_TBL CROSS JOIN J2_TBL a CROSS JOIN J2_TBL b; + FROM J1_TBL CROSS JOIN J2_TBL a CROSS JOIN J2_TBL b + ORDER BY J1_TBL.i,J1_TBL.j,J1_TBL.t,a.i,a.k,b.i,b.k; -- @@ -106,11 +117,13 @@ SELECT '' AS "xxx", * -- Inner equi-join on specified column SELECT '' AS "xxx", * - FROM J1_TBL INNER JOIN J2_TBL USING (i); + FROM J1_TBL INNER JOIN J2_TBL USING (i) + ORDER BY i, j, k, t; -- Same as above, slightly different syntax SELECT '' AS "xxx", * - FROM J1_TBL JOIN J2_TBL USING (i); + FROM J1_TBL JOIN J2_TBL USING (i) + ORDER BY i, j, k, t; SELECT '' AS "xxx", * FROM J1_TBL t1 (a, b, c) JOIN J2_TBL t2 (a, d) USING (a) @@ -127,18 +140,22 @@ SELECT '' AS "xxx", * -- SELECT '' AS "xxx", * - FROM J1_TBL NATURAL JOIN J2_TBL; + FROM J1_TBL NATURAL JOIN J2_TBL + ORDER BY i, j, k, t; SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (a, d); + FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (a, d) + ORDER BY a, b, c, d; SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (d, a); + FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (d, a) + ORDER BY a, b, c, d; -- mismatch number of columns -- currently, Postgres will fill in with underlying names SELECT '' AS "xxx", * - FROM J1_TBL t1 (a, b) NATURAL JOIN J2_TBL t2 (a); + FROM J1_TBL t1 (a, b) NATURAL JOIN J2_TBL t2 (a) + ORDER BY a, b, t, k; -- @@ -146,10 +163,12 @@ SELECT '' AS "xxx", * -- SELECT '' AS "xxx", * - FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.i); + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.i) + ORDER BY J1_TBL.i, J1_TBL.j, J1_TBL.t, J2_TBL.i, J2_TBL.k; SELECT '' AS "xxx", * - FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.k); + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.k) + ORDER BY J1_TBL.i, J1_TBL.j, J1_TBL.t, J2_TBL.i, J2_TBL.k; -- @@ -157,7 +176,8 @@ SELECT '' AS "xxx", * -- SELECT '' AS "xxx", * - FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i <= J2_TBL.k); + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i <= J2_TBL.k) + ORDER BY J1_TBL.i, J1_TBL.j, J1_TBL.t, J2_TBL.i, J2_TBL.k; -- @@ -174,10 +194,12 @@ SELECT '' AS "xxx", * ORDER BY i, k, t; SELECT '' AS "xxx", * - FROM J1_TBL RIGHT OUTER JOIN J2_TBL USING (i); + FROM J1_TBL RIGHT OUTER JOIN J2_TBL USING (i) + ORDER BY i, j, k, t; SELECT '' AS "xxx", * - FROM J1_TBL RIGHT JOIN J2_TBL USING (i); + FROM J1_TBL RIGHT JOIN J2_TBL USING (i) + ORDER BY i, j, k, t; SELECT '' AS "xxx", * FROM J1_TBL FULL OUTER JOIN J2_TBL USING (i) @@ -214,7 +236,8 @@ INSERT INTO t3 VALUES ( 'bb', 13 ); INSERT INTO t3 VALUES ( 'cc', 23 ); INSERT INTO t3 VALUES ( 'dd', 33 ); -SELECT * FROM t1 FULL JOIN t2 USING (name) FULL JOIN t3 USING (name); +SELECT * FROM t1 FULL JOIN t2 USING (name) FULL JOIN t3 USING (name) +ORDER BY name,t1.n, t2.n, t3.n; -- -- Test interactions of join syntax and subqueries @@ -225,50 +248,58 @@ SELECT * FROM (SELECT * FROM t2) as s2 INNER JOIN (SELECT * FROM t3) s3 -USING (name); +USING (name) +ORDER BY name, s2.n, s3.n; SELECT * FROM (SELECT * FROM t2) as s2 LEFT JOIN (SELECT * FROM t3) s3 -USING (name); +USING (name) +ORDER BY name, s2.n, s3.n; SELECT * FROM (SELECT * FROM t2) as s2 FULL JOIN (SELECT * FROM t3) s3 -USING (name); +USING (name) +ORDER BY name, s2.n, s3.n; -- Cases with non-nullable expressions in subquery results; -- make sure these go to null as expected SELECT * FROM (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL INNER JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s2_n, s3_n; SELECT * FROM (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL LEFT JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s2_n, s3_n; SELECT * FROM (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL FULL JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s2_n, s3_n; SELECT * FROM (SELECT name, n as s1_n, 1 as s1_1 FROM t1) as s1 NATURAL INNER JOIN (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL INNER JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s1_n, s2_n, s3_n; SELECT * FROM (SELECT name, n as s1_n, 1 as s1_1 FROM t1) as s1 NATURAL FULL JOIN (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL FULL JOIN -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3 +ORDER BY name, s1_n, s2_n, s3_n; SELECT * FROM (SELECT name, n as s1_n FROM t1) as s1 @@ -277,7 +308,8 @@ NATURAL FULL JOIN (SELECT name, n as s2_n FROM t2) as s2 NATURAL FULL JOIN (SELECT name, n as s3_n FROM t3) as s3 - ) ss2; + ) ss2 + ORDER BY name, s1_n, s2_n, s3_n; SELECT * FROM (SELECT name, n as s1_n FROM t1) as s1 @@ -286,7 +318,8 @@ NATURAL FULL JOIN (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 NATURAL FULL JOIN (SELECT name, n as s3_n FROM t3) as s3 - ) ss2; + ) ss2 + ORDER BY name, s1_n, s2_n, s3_n; -- Test for propagation of nullability constraints into sub-joins @@ -304,27 +337,30 @@ insert into y values (2,222); insert into y values (3,333); insert into y values (4,null); -select * from x; -select * from y; +select * from x ORDER BY x1; +select * from y ORDER BY y1; -select * from x left join y on (x1 = y1 and x2 is not null); -select * from x left join y on (x1 = y1 and y2 is not null); +select * from x left join y on (x1 = y1 and x2 is not null) ORDER BY x1, x2, y1, y2; +select * from x left join y on (x1 = y1 and y2 is not null) ORDER BY x1, x2, y1, y2; select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1); +on (x1 = xx1) ORDER BY x1, x2, y1, y2; select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1 and x2 is not null); +on (x1 = xx1 and x2 is not null) ORDER BY x1, x2, y1, y2; select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1 and y2 is not null); +on (x1 = xx1 and y2 is not null) ORDER BY x1, x2, y1, y2; select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1 and xx2 is not null); +on (x1 = xx1 and xx2 is not null) ORDER BY x1, x2, y1, y2; -- these should NOT give the same answers as above select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1) where (x2 is not null); +on (x1 = xx1) where (x2 is not null) +ORDER BY x1, x2, y1, y2; select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1) where (y2 is not null); +on (x1 = xx1) where (y2 is not null) +ORDER BY x1, x2, y1, y2; select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) -on (x1 = xx1) where (xx2 is not null); +on (x1 = xx1) where (xx2 is not null) +ORDER BY x1, x2, y1, y2; -- -- regression test: check for bug with propagation of implied equality @@ -373,11 +409,11 @@ INSERT INTO t3 VALUES (7, 8); INSERT INTO t3 VALUES (500, 100); DELETE FROM t3 USING t1 table1 WHERE t3.x = table1.a; -SELECT * FROM t3; +SELECT * FROM t3 ORDER By x, y; DELETE FROM t3 USING t1 JOIN t2 USING (a) WHERE t3.x > t1.a; -SELECT * FROM t3; +SELECT * FROM t3 ORDER By x, y; DELETE FROM t3 USING t3 t3_other WHERE t3.x = t3_other.x AND t3.y = t3_other.y; -SELECT * FROM t3; +SELECT * FROM t3 ORDER By x, y; -- -- regression test for 8.1 merge right join bug @@ -396,9 +432,11 @@ set enable_nestloop to off; -- these should give the same results -select tt1.*, tt2.* from tt1 left join tt2 on tt1.joincol = tt2.joincol; +select tt1.*, tt2.* from tt1 left join tt2 on tt1.joincol = tt2.joincol + ORDER BY tt1_id, tt2_id; -select tt1.*, tt2.* from tt2 right join tt1 on tt1.joincol = tt2.joincol; +select tt1.*, tt2.* from tt2 right join tt1 on tt1.joincol = tt2.joincol + ORDER BY tt1_id, tt2_id; reset enable_hashjoin; reset enable_nestloop; @@ -423,7 +461,7 @@ LEFT JOIN ( FROM tt3 b LEFT JOIN tt3 c ON (b.f1 = c.f1) WHERE c.f1 IS NULL ) AS d ON (a.f1 = d.f1) -WHERE d.f1 IS NULL; +WHERE d.f1 IS NULL ORDER BY f1; -- -- regression test for problems of the sort depicted in bug #3494 @@ -439,7 +477,8 @@ insert into tt6 values(1, 9); insert into tt6 values(1, 2); insert into tt6 values(2, 9); -select * from tt5,tt6 where tt5.f1 = tt6.f1 and tt5.f1 = tt5.f2 - tt6.f2; +select * from tt5,tt6 where tt5.f1 = tt6.f1 and tt5.f1 = tt5.f2 - tt6.f2 + ORDER BY tt5.f1, tt5.f2, tt6.f1, tt6.f2; -- -- regression test for problems of the sort depicted in bug #3588 @@ -461,7 +500,8 @@ select yy.pkyy as yy_pkyy, yy.pkxx as yy_pkxx, yya.pkyy as yya_pkyy, from yy left join (SELECT * FROM yy where pkyy = 101) as yya ON yy.pkyy = yya.pkyy left join xx xxa on yya.pkxx = xxa.pkxx - left join xx xxb on coalesce (xxa.pkxx, 1) = xxb.pkxx; + left join xx xxb on coalesce (xxa.pkxx, 1) = xxb.pkxx + ORDER BY yy_pkyy, yy_pkxx, yya_pkyy, xxa_pkxx, xxb_pkxx; -- -- regression test for improper pushing of constants across outer-join clauses @@ -477,14 +517,16 @@ insert into zt2 values(53); select * from zt2 left join zt3 on (f2 = f3) left join zt1 on (f3 = f1) -where f2 = 53; +where f2 = 53 +ORDER BY f1, f2, f3; create temp view zv1 as select *,'dummy'::text AS junk from zt1; select * from zt2 left join zt3 on (f2 = f3) left join zv1 on (f3 = f1) -where f2 = 53; +where f2 = 53 +ORDER BY f1, f2, f3; -- -- regression test for improper extraction of OR indexqual conditions diff --git a/src/test/regress/sql/largeobject.sql b/src/test/regress/sql/largeobject.sql new file mode 100644 index 0000000000..3e0a2c3a8e --- /dev/null +++ b/src/test/regress/sql/largeobject.sql @@ -0,0 +1,162 @@ +-- +-- Test large object support +-- + +-- Load a file +CREATE TABLE lotest_stash_values (loid oid, fd integer); +-- lo_creat(mode integer) returns oid +-- The mode arg to lo_creat is unused, some vestigal holdover from ancient times +-- returns the large object id +INSERT INTO lotest_stash_values (loid) SELECT lo_creat(42); + +-- NOTE: large objects require transactions +BEGIN; + +-- lo_open(lobjId oid, mode integer) returns integer +-- The mode parameter to lo_open uses two constants: +-- INV_READ = 0x20000 +-- INV_WRITE = 0x40000 +-- The return value is a file descriptor-like value which remains valid for the +-- transaction. +UPDATE lotest_stash_values SET fd = lo_open(loid, CAST(x'20000' | x'40000' AS integer)); + +-- loread/lowrite names are wonky, different from other functions which are lo_* +-- lowrite(fd integer, data bytea) returns integer +-- the integer is the number of bytes written +SELECT lowrite(fd, ' +Whose woods these are I think I know, +His house is in the village though. +He will not see me stopping here, +To watch his woods fill up with snow. + +My little horse must think it queer, +To stop without a farmhouse near, +Between the woods and frozen lake, +The darkest evening of the year. + +He gives his harness bells a shake, +To ask if there is some mistake. +The only other sound''s the sweep, +Of easy wind and downy flake. + +The woods are lovely, dark and deep, +But I have promises to keep, +And miles to go before I sleep, +And miles to go before I sleep. + + -- Robert Frost +') FROM lotest_stash_values; + +-- lo_close(fd integer) returns integer +-- return value is 0 for success, or <0 for error (actually only -1, but...) +SELECT lo_close(fd) FROM lotest_stash_values; + +END; + +-- Read out a portion +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); + +-- lo_lseek(fd integer, offset integer, whence integer) returns integer +-- offset is in bytes, whence is one of three values: +-- SEEK_SET (= 0) meaning relative to beginning +-- SEEK_CUR (= 1) meaning relative to current position +-- SEEK_END (= 2) meaning relative to end (offset better be negative) +-- returns current position in file +SELECT lo_lseek(fd, 422, 0) FROM lotest_stash_values; + +-- loread/lowrite names are wonky, different from other functions which are lo_* +-- loread(fd integer, len integer) returns bytea +SELECT loread(fd, 35) FROM lotest_stash_values; + +SELECT lo_lseek(fd, -19, 1) FROM lotest_stash_values; + +SELECT lowrite(fd, 'n') FROM lotest_stash_values; + +SELECT lo_tell(fd) FROM lotest_stash_values; + +SELECT lo_lseek(fd, -156, 2) FROM lotest_stash_values; + +SELECT loread(fd, 35) FROM lotest_stash_values; + +SELECT lo_close(fd) FROM lotest_stash_values; + +END; + +-- Test resource management +BEGIN; +SELECT lo_open(loid, x'40000'::int) from lotest_stash_values; +ABORT; + +-- Test truncation. +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); + +SELECT lo_truncate(fd, 10) FROM lotest_stash_values; +SELECT loread(fd, 15) FROM lotest_stash_values; + +SELECT lo_truncate(fd, 10000) FROM lotest_stash_values; +SELECT loread(fd, 10) FROM lotest_stash_values; +SELECT lo_lseek(fd, 0, 2) FROM lotest_stash_values; +SELECT lo_tell(fd) FROM lotest_stash_values; + +SELECT lo_truncate(fd, 5000) FROM lotest_stash_values; +SELECT lo_lseek(fd, 0, 2) FROM lotest_stash_values; +SELECT lo_tell(fd) FROM lotest_stash_values; + +SELECT lo_close(fd) FROM lotest_stash_values; +END; + +-- lo_unlink(lobjId oid) returns integer +-- return value appears to always be 1 +SELECT lo_unlink(loid) from lotest_stash_values; + +TRUNCATE lotest_stash_values; + +INSERT INTO lotest_stash_values (loid) SELECT lo_import('/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/data/tenk.data'); + +BEGIN; +UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer)); + +-- with the default BLKSZ, LOBLKSZ = 2048, so this positions us for a block +-- edge case +SELECT lo_lseek(fd, 2030, 0) FROM lotest_stash_values; + +-- this should get half of the value from page 0 and half from page 1 of the +-- large object +SELECT loread(fd, 36) FROM lotest_stash_values; + +SELECT lo_tell(fd) FROM lotest_stash_values; + +SELECT lo_lseek(fd, -26, 1) FROM lotest_stash_values; + +SELECT lowrite(fd, 'abcdefghijklmnop') FROM lotest_stash_values; + +SELECT lo_lseek(fd, 2030, 0) FROM lotest_stash_values; + +SELECT loread(fd, 36) FROM lotest_stash_values; + +SELECT lo_close(fd) FROM lotest_stash_values; +END; + +SELECT lo_export(loid, '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/lotest.txt') FROM lotest_stash_values; + +\lo_import 'results/lotest.txt' + +\set newloid :LASTOID + +-- just make sure \lo_export does not barf +\lo_export :newloid 'results/lotest2.txt' + +-- This is a hack to test that export/import are reversible +-- This uses knowledge about the inner workings of large object mechanism +-- which should not be used outside it. This makes it a HACK +SELECT pageno, data FROM pg_largeobject WHERE loid = (SELECT loid from lotest_stash_values) +EXCEPT +SELECT pageno, data FROM pg_largeobject WHERE loid = :newloid; + + +SELECT lo_unlink(loid) FROM lotest_stash_values; +\lo_unlink :newloid + +TRUNCATE lotest_stash_values; diff --git a/src/test/regress/sql/lseg.sql b/src/test/regress/sql/lseg.sql index 9202f2d284..e7a348afd8 100644 --- a/src/test/regress/sql/lseg.sql +++ b/src/test/regress/sql/lseg.sql @@ -18,9 +18,9 @@ INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4'); INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]'); INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)'); -select * from LSEG_TBL; +select * from LSEG_TBL ORDER BY (s[0])[0], (s[0])[1]; -SELECT * FROM LSEG_TBL WHERE s <= lseg '[(1,2),(3,4)]'; +SELECT * FROM LSEG_TBL WHERE s <= lseg '[(1,2),(3,4)]' ORDER BY (s[0])[0], (s[0])[1]; -SELECT * FROM LSEG_TBL WHERE (s <-> lseg '[(1,2),(3,4)]') < 10; +SELECT * FROM LSEG_TBL WHERE (s <-> lseg '[(1,2),(3,4)]') < 10 ORDER BY (s[0])[0], (s[0])[1]; diff --git a/src/test/regress/sql/macaddr.sql b/src/test/regress/sql/macaddr.sql index ce8d920932..7fde7b1a9e 100644 --- a/src/test/regress/sql/macaddr.sql +++ b/src/test/regress/sql/macaddr.sql @@ -19,7 +19,7 @@ INSERT INTO macaddr_data VALUES (12, '08:00:2a:01:02:03'); INSERT INTO macaddr_data VALUES (13, '08:00:2c:01:02:03'); INSERT INTO macaddr_data VALUES (14, '08:00:2a:01:02:04'); -SELECT * FROM macaddr_data; +SELECT * FROM macaddr_data ORDER BY a; CREATE INDEX macaddr_data_btree ON macaddr_data USING btree (b); CREATE INDEX macaddr_data_hash ON macaddr_data USING hash (b); diff --git a/src/test/regress/sql/misc.sql b/src/test/regress/sql/misc.sql new file mode 100644 index 0000000000..42ad1ffcdc --- /dev/null +++ b/src/test/regress/sql/misc.sql @@ -0,0 +1,259 @@ +-- +-- MISC +-- + +-- +-- BTREE +-- +UPDATE onek + SET unique1 = onek.unique1 + 1; + +UPDATE onek + SET unique1 = onek.unique1 - 1; + +-- +-- BTREE partial +-- +-- UPDATE onek2 +-- SET unique1 = onek2.unique1 + 1; + +--UPDATE onek2 +-- SET unique1 = onek2.unique1 - 1; + +-- +-- BTREE shutting out non-functional updates +-- +-- the following two tests seem to take a long time on some +-- systems. This non-func update stuff needs to be examined +-- more closely. - jolly (2/22/96) +-- +UPDATE tmp + SET stringu1 = reverse_name(onek.stringu1) + FROM onek + WHERE onek.stringu1 = 'JBAAAA' and + onek.stringu1 = tmp.stringu1; + +UPDATE tmp + SET stringu1 = reverse_name(onek2.stringu1) + FROM onek2 + WHERE onek2.stringu1 = 'JCAAAA' and + onek2.stringu1 = tmp.stringu1; + +DROP TABLE tmp; + +--UPDATE person* +-- SET age = age + 1; + +--UPDATE person* +-- SET age = age + 3 +-- WHERE name = 'linda'; + +-- +-- copy +-- +COPY onek TO '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; + +DELETE FROM onek; + +COPY onek FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; + +SELECT unique1 FROM onek WHERE unique1 < 2 ORDER BY unique1; + +DELETE FROM onek2; + +COPY onek2 FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/onek.data'; + +SELECT unique1 FROM onek2 WHERE unique1 < 2 ORDER BY unique1; + +COPY BINARY stud_emp TO '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/stud_emp.data'; + +DELETE FROM stud_emp; + +COPY BINARY stud_emp FROM '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/results/stud_emp.data'; + +SELECT * FROM stud_emp ORDER BY 1,2; + +-- COPY aggtest FROM stdin; +-- 56 7.8 +-- 100 99.097 +-- 0 0.09561 +-- 42 324.78 +-- . +-- COPY aggtest TO stdout; + + +-- +-- inheritance stress test +-- +SELECT * FROM a_star* ORDER BY 1,2; + +SELECT * + FROM b_star* x + WHERE x.b = text 'bumble' or x.a < 3; + +SELECT class, a + FROM c_star* x + WHERE x.c ~ text 'hi' ORDER BY 1,2; + +SELECT class, b, c + FROM d_star* x + WHERE x.a < 100 ORDER BY 1,2,3; + +SELECT class, c FROM e_star* x WHERE x.c NOTNULL ORDER BY 1,2; + +SELECT * FROM f_star* x WHERE x.c ISNULL ORDER BY 1,2; + +-- grouping and aggregation on inherited sets have been busted in the past... + +SELECT sum(a) FROM a_star*; + +SELECT class, sum(a) FROM a_star* GROUP BY class ORDER BY class; + + +ALTER TABLE f_star RENAME COLUMN f TO ff; + +ALTER TABLE e_star* RENAME COLUMN e TO ee; + +ALTER TABLE d_star* RENAME COLUMN d TO dd; + +ALTER TABLE c_star* RENAME COLUMN c TO cc; + +ALTER TABLE b_star* RENAME COLUMN b TO bb; + +ALTER TABLE a_star* RENAME COLUMN a TO aa; + +SELECT class, aa + FROM a_star* x + WHERE aa ISNULL ORDER BY 1,2; + +-- As of Postgres 7.1, ALTER implicitly recurses, +-- so this should be same as ALTER a_star* + +ALTER TABLE a_star RENAME COLUMN aa TO foo; + +SELECT class, foo + FROM a_star* x + WHERE x.foo >= 2 ORDER BY 1,2; + +ALTER TABLE a_star RENAME COLUMN foo TO aa; + +SELECT * + from a_star* + WHERE aa < 1000 ORDER BY 1,2; + +ALTER TABLE f_star ADD COLUMN f int4; + +UPDATE f_star SET f = 10; + +ALTER TABLE e_star* ADD COLUMN e int4; + +--UPDATE e_star* SET e = 42; + +SELECT * FROM e_star* ORDER BY 1,2; + +ALTER TABLE a_star* ADD COLUMN a text; + +--UPDATE b_star* +-- SET a = text 'gazpacho' +-- WHERE aa > 4; + +SELECT class, aa, a FROM a_star* ORDER BY 1,2; + + +-- +-- versions +-- + +-- +-- postquel functions +-- +-- +-- mike does post_hacking, +-- joe and sally play basketball, and +-- everyone else does nothing. +-- +SELECT p.name, name(p.hobbies) FROM ONLY person p ORDER BY 1,2; + +-- +-- as above, but jeff also does post_hacking. +-- +SELECT p.name, name(p.hobbies) FROM person* p ORDER BY 1,2; + +-- +-- the next two queries demonstrate how functions generate bogus duplicates. +-- this is a "feature" .. +-- +SELECT DISTINCT hobbies_r.name, name(hobbies_r.equipment) FROM hobbies_r + ORDER BY 1,2; + +SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r ORDER BY 1,2; + +-- +-- mike needs advil and peet's coffee, +-- joe and sally need hightops, and +-- everyone else is fine. +-- +SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p ORDER BY 1,2,3; + +-- +-- as above, but jeff needs advil and peet's coffee as well. +-- +SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p ORDER BY 1,2,3; + +-- +-- just like the last two, but make sure that the target list fixup and +-- unflattening is being done correctly. +-- +SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p ORDER BY 1,2,3; + +SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p ORDER BY 1,2,3; + +SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p ORDER BY 1,2,3; + +SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p ORDER BY 1,2,3; + +SELECT user_relns() AS user_relns + ORDER BY user_relns; + +SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))); + +SELECT hobbies_by_name('basketball'); + +SELECT name, overpaid(emp.*) FROM emp ORDER BY 1,2; + +-- +-- Try a few cases with SQL-spec row constructor expressions +-- +SELECT * FROM equipment(ROW('skywalking', 'mer')); + +SELECT name(equipment(ROW('skywalking', 'mer'))); + +SELECT *, name(equipment(h.*)) FROM hobbies_r h ORDER BY 1,2,3; + +SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h ORDER BY 1,2,3; + +-- +-- check that old-style C functions work properly with TOASTed values +-- +create table oldstyle_test(i int4, t text); +insert into oldstyle_test values(null,null); +insert into oldstyle_test values(0,'12'); +insert into oldstyle_test values(1000,'12'); +insert into oldstyle_test values(0, repeat('x', 50000)); + +select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test ORDER BY 1,2,3; + +drop table oldstyle_test; + +-- +-- functional joins +-- + +-- +-- instance rules +-- + +-- +-- rewrite rules +-- + diff --git a/src/test/regress/sql/name.sql b/src/test/regress/sql/name.sql index 1c7a6716ee..0dd2fcd4fa 100644 --- a/src/test/regress/sql/name.sql +++ b/src/test/regress/sql/name.sql @@ -29,26 +29,26 @@ INSERT INTO NAME_TBL(f1) VALUES (''); INSERT INTO NAME_TBL(f1) VALUES ('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'); -SELECT '' AS seven, * FROM NAME_TBL; +SELECT '' AS seven, * FROM NAME_TBL ORDER BY f1; -SELECT '' AS six, c.f1 FROM NAME_TBL c WHERE c.f1 <> '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS six, c.f1 FROM NAME_TBL c WHERE c.f1 <> '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; SELECT '' AS one, c.f1 FROM NAME_TBL c WHERE c.f1 = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; -SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 < '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 < '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; -SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 <= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 <= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; -SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 > '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 > '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; -SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 >= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; +SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 >= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR' ORDER BY f1; -SELECT '' AS seven, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*'; +SELECT '' AS seven, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*' ORDER BY f1; -SELECT '' AS zero, c.f1 FROM NAME_TBL c WHERE c.f1 !~ '.*'; +SELECT '' AS zero, c.f1 FROM NAME_TBL c WHERE c.f1 !~ '.*' ORDER BY f1; -SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '[0-9]'; +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '[0-9]' ORDER BY f1; -SELECT '' AS two, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*asdf.*'; +SELECT '' AS two, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*asdf.*' ORDER BY f1; DROP TABLE NAME_TBL; diff --git a/src/test/regress/sql/namespace.sql b/src/test/regress/sql/namespace.sql index 919f72ada2..10870e9e05 100644 --- a/src/test/regress/sql/namespace.sql +++ b/src/test/regress/sql/namespace.sql @@ -21,8 +21,8 @@ INSERT INTO test_schema_1.abc DEFAULT VALUES; INSERT INTO test_schema_1.abc DEFAULT VALUES; INSERT INTO test_schema_1.abc DEFAULT VALUES; -SELECT * FROM test_schema_1.abc; -SELECT * FROM test_schema_1.abc_view; +SELECT * FROM test_schema_1.abc ORDER BY a; +SELECT * FROM test_schema_1.abc_view ORDER BY a; DROP SCHEMA test_schema_1 CASCADE; diff --git a/src/test/regress/sql/numeric.sql b/src/test/regress/sql/numeric.sql index 9fd6bba31e..83ee939b1a 100644 --- a/src/test/regress/sql/numeric.sql +++ b/src/test/regress/sql/numeric.sql @@ -518,7 +518,7 @@ INSERT INTO num_result SELECT t1.id, t2.id, t1.val + t2.val SELECT t1.id1, t1.id2, t1.result, t2.expected FROM num_result t1, num_exp_add t2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 - AND t1.result != t2.expected; + AND t1.result != t2.expected ORDER BY t1.id1, t1.id2, t2.expected; DELETE FROM num_result; INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val + t2.val, 10) @@ -526,7 +526,7 @@ INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val + t2.val, 10) SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 10) as expected FROM num_result t1, num_exp_add t2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 - AND t1.result != round(t2.expected, 10); + AND t1.result != round(t2.expected, 10) ORDER BY t1.id1, t1.id2; -- ****************************** -- * Subtraction check @@ -537,7 +537,7 @@ INSERT INTO num_result SELECT t1.id, t2.id, t1.val - t2.val SELECT t1.id1, t1.id2, t1.result, t2.expected FROM num_result t1, num_exp_sub t2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 - AND t1.result != t2.expected; + AND t1.result != t2.expected ORDER BY t1.id1, t1.id2, t2.expected; DELETE FROM num_result; INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val - t2.val, 40) @@ -652,7 +652,7 @@ INSERT INTO fract_only VALUES (5, '0.99994'); INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail INSERT INTO fract_only VALUES (7, '0.00001'); INSERT INTO fract_only VALUES (8, '0.00017'); -SELECT * FROM fract_only; +SELECT * FROM fract_only ORDER BY id; DROP TABLE fract_only; -- Simple check that ceil(), floor(), and round() work correctly @@ -664,7 +664,7 @@ INSERT INTO ceil_floor_round VALUES ('9.4999999'); INSERT INTO ceil_floor_round VALUES ('0.0'); INSERT INTO ceil_floor_round VALUES ('0.0000001'); INSERT INTO ceil_floor_round VALUES ('-0.000001'); -SELECT a, ceil(a), ceiling(a), floor(a), round(a) FROM ceil_floor_round; +SELECT a, ceil(a), ceiling(a), floor(a), round(a) FROM ceil_floor_round ORDER BY a; DROP TABLE ceil_floor_round; -- Testing for width_bucket(). For convenience, we test both the @@ -719,7 +719,7 @@ SELECT width_bucket(operand_f8, 5.0, 5.5, 20) AS wb_4f, width_bucket(operand_num, -25, 25, 10) AS wb_5, width_bucket(operand_f8, -25, 25, 10) AS wb_5f - FROM width_bucket_test; + FROM width_bucket_test ORDER BY operand_num; -- for float8 only, check positive and negative infinity: we require -- finite bucket bounds, but allow an infinite operand @@ -733,35 +733,35 @@ DROP TABLE width_bucket_test; -- TO_CHAR() -- SELECT '' AS to_char_1, to_char(val, '9G999G999G999G999G999') - FROM num_data; + FROM num_data ORDER BY val; SELECT '' AS to_char_2, to_char(val, '9G999G999G999G999G999D999G999G999G999G999') - FROM num_data; + FROM num_data ORDER BY val; SELECT '' AS to_char_3, to_char(val, '9999999999999999.999999999999999PR') - FROM num_data; + FROM num_data ORDER BY val; SELECT '' AS to_char_4, to_char(val, '9999999999999999.999999999999999S') - FROM num_data; - -SELECT '' AS to_char_5, to_char(val, 'MI9999999999999999.999999999999999') FROM num_data; -SELECT '' AS to_char_6, to_char(val, 'FMS9999999999999999.999999999999999') FROM num_data; -SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data; -SELECT '' AS to_char_8, to_char(val, 'SG9999999999999999.999999999999999th') FROM num_data; -SELECT '' AS to_char_9, to_char(val, '0999999999999999.999999999999999') FROM num_data; -SELECT '' AS to_char_10, to_char(val, 'S0999999999999999.999999999999999') FROM num_data; -SELECT '' AS to_char_11, to_char(val, 'FM0999999999999999.999999999999999') FROM num_data; -SELECT '' AS to_char_12, to_char(val, 'FM9999999999999999.099999999999999') FROM num_data; -SELECT '' AS to_char_13, to_char(val, 'FM9999999999990999.990999999999999') FROM num_data; -SELECT '' AS to_char_14, to_char(val, 'FM0999999999999999.999909999999999') FROM num_data; -SELECT '' AS to_char_15, to_char(val, 'FM9999999990999999.099999999999999') FROM num_data; -SELECT '' AS to_char_16, to_char(val, 'L9999999999999999.099999999999999') FROM num_data; -SELECT '' AS to_char_17, to_char(val, 'FM9999999999999999.99999999999999') FROM num_data; -SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data; -SELECT '' AS to_char_19, to_char(val, 'FMS 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data; -SELECT '' AS to_char_20, to_char(val, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM num_data; -SELECT '' AS to_char_21, to_char(val, '999999SG9999999999') FROM num_data; -SELECT '' AS to_char_22, to_char(val, 'FM9999999999999999.999999999999999') FROM num_data; + FROM num_data ORDER BY val; + +SELECT '' AS to_char_5, to_char(val, 'MI9999999999999999.999999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_6, to_char(val, 'FMS9999999999999999.999999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data ORDER BY val; +SELECT '' AS to_char_8, to_char(val, 'SG9999999999999999.999999999999999th') FROM num_data ORDER BY val; +SELECT '' AS to_char_9, to_char(val, '0999999999999999.999999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_10, to_char(val, 'S0999999999999999.999999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_11, to_char(val, 'FM0999999999999999.999999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_12, to_char(val, 'FM9999999999999999.099999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_13, to_char(val, 'FM9999999999990999.990999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_14, to_char(val, 'FM0999999999999999.999909999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_15, to_char(val, 'FM9999999990999999.099999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_16, to_char(val, 'L9999999999999999.099999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_17, to_char(val, 'FM9999999999999999.99999999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data ORDER BY val; +SELECT '' AS to_char_19, to_char(val, 'FMS 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data ORDER BY val; +SELECT '' AS to_char_20, to_char(val, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM num_data ORDER BY val; +SELECT '' AS to_char_21, to_char(val, '999999SG9999999999') FROM num_data ORDER BY val; +SELECT '' AS to_char_22, to_char(val, 'FM9999999999999999.999999999999999') FROM num_data ORDER BY val; -- TO_NUMBER() -- @@ -804,7 +804,7 @@ INSERT INTO num_input_test(n1) VALUES ('5. 0 '); INSERT INTO num_input_test(n1) VALUES (''); INSERT INTO num_input_test(n1) VALUES (' N aN '); -SELECT * FROM num_input_test; +SELECT * FROM num_input_test ORDER BY n1; -- -- Test some corner cases for division diff --git a/src/test/regress/sql/oid.sql b/src/test/regress/sql/oid.sql index 1bdb127a4a..6eb37b5d7b 100644 --- a/src/test/regress/sql/oid.sql +++ b/src/test/regress/sql/oid.sql @@ -26,18 +26,18 @@ INSERT INTO OID_TBL(f1) VALUES (' - 500'); INSERT INTO OID_TBL(f1) VALUES ('32958209582039852935'); INSERT INTO OID_TBL(f1) VALUES ('-23582358720398502385'); -SELECT '' AS six, * FROM OID_TBL; +SELECT '' AS six, * FROM OID_TBL ORDER BY f1; -SELECT '' AS one, o.* FROM OID_TBL o WHERE o.f1 = 1234; +SELECT '' AS one, o.* FROM OID_TBL o WHERE o.f1 = 1234 ORDER BY f1; -SELECT '' AS five, o.* FROM OID_TBL o WHERE o.f1 <> '1234'; +SELECT '' AS five, o.* FROM OID_TBL o WHERE o.f1 <> '1234' ORDER BY f1; -SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 <= '1234'; +SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 <= '1234' ORDER BY f1; -SELECT '' AS two, o.* FROM OID_TBL o WHERE o.f1 < '1234'; +SELECT '' AS two, o.* FROM OID_TBL o WHERE o.f1 < '1234' ORDER BY f1; -SELECT '' AS four, o.* FROM OID_TBL o WHERE o.f1 >= '1234'; +SELECT '' AS four, o.* FROM OID_TBL o WHERE o.f1 >= '1234' ORDER BY f1; -SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 > '1234'; +SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 > '1234' ORDER BY f1; DROP TABLE OID_TBL; diff --git a/src/test/regress/sql/path.sql b/src/test/regress/sql/path.sql index 36cb7c8109..dd93912613 100644 --- a/src/test/regress/sql/path.sql +++ b/src/test/regress/sql/path.sql @@ -4,36 +4,36 @@ --DROP TABLE PATH_TBL; -CREATE TABLE PATH_TBL (f1 path); +CREATE TABLE PATH_TBL (ID int, f1 path); -INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]'); +INSERT INTO PATH_TBL VALUES (1,'[(1,2),(3,4)]'); -INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))'); +INSERT INTO PATH_TBL VALUES (2,'((1,2),(3,4))'); -INSERT INTO PATH_TBL VALUES ('[(0,0),(3,0),(4,5),(1,6)]'); +INSERT INTO PATH_TBL VALUES (3,'[(0,0),(3,0),(4,5),(1,6)]'); -INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))'); +INSERT INTO PATH_TBL VALUES (4, '((1,2),(3,4))'); -INSERT INTO PATH_TBL VALUES ('1,2 ,3,4'); +INSERT INTO PATH_TBL VALUES (5, '1,2 ,3,4'); -INSERT INTO PATH_TBL VALUES ('[1,2,3, 4]'); +INSERT INTO PATH_TBL VALUES (6, '[1,2,3, 4]'); -INSERT INTO PATH_TBL VALUES ('[11,12,13,14]'); +INSERT INTO PATH_TBL VALUES (7, '[11,12,13,14]'); -INSERT INTO PATH_TBL VALUES ('(11,12,13,14)'); +INSERT INTO PATH_TBL VALUES (8, '(11,12,13,14)'); -- bad values for parser testing -INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]'); +INSERT INTO PATH_TBL VALUES (9, '[(,2),(3,4)]'); -INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)'); +INSERT INTO PATH_TBL VALUES (10, '[(1,2),(3,4)'); -SELECT f1 FROM PATH_TBL; +SELECT f1 FROM PATH_TBL ORDER BY ID; -SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1); +SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1) ORDER BY ID; -SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1); +SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1) ORDER BY ID; -SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL; +SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL ORDER BY ID; -SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL; +SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL ORDER BY ID; diff --git a/src/test/regress/sql/plancache.sql b/src/test/regress/sql/plancache.sql index 26848168f0..bba9d1d385 100644 --- a/src/test/regress/sql/plancache.sql +++ b/src/test/regress/sql/plancache.sql @@ -5,12 +5,12 @@ CREATE TEMP TABLE pcachetest AS SELECT * FROM int8_tbl; -- create and use a cached plan -PREPARE prepstmt AS SELECT * FROM pcachetest; +PREPARE prepstmt AS SELECT * FROM pcachetest ORDER BY q1, q2; EXECUTE prepstmt; -- and one with parameters -PREPARE prepstmt2(bigint) AS SELECT * FROM pcachetest WHERE q1 = $1; +PREPARE prepstmt2(bigint) AS SELECT * FROM pcachetest WHERE q1 = $1 ORDER BY q1, q2; EXECUTE prepstmt2(123); @@ -22,7 +22,7 @@ EXECUTE prepstmt2(123); -- recreate the temp table (this demonstrates that the raw plan is -- purely textual and doesn't depend on OIDs, for instance) -CREATE TEMP TABLE pcachetest AS SELECT * FROM int8_tbl ORDER BY 2; +CREATE TEMP TABLE pcachetest AS SELECT * FROM int8_tbl ORDER BY q1, q2; EXECUTE prepstmt; EXECUTE prepstmt2(123); @@ -45,12 +45,12 @@ EXECUTE prepstmt2(123); CREATE TEMP VIEW pcacheview AS SELECT * FROM pcachetest; -PREPARE vprep AS SELECT * FROM pcacheview; +PREPARE vprep AS SELECT * FROM pcacheview ORDER BY q1, q2; EXECUTE vprep; CREATE OR REPLACE TEMP VIEW pcacheview AS - SELECT q1, q2/2 AS q2 FROM pcachetest; + SELECT q1, q2/2 AS q2 FROM pcachetest ORDER BY q1, q2; EXECUTE vprep; diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql index 3dcfc9e781..873d7f14f0 100644 --- a/src/test/regress/sql/plpgsql.sql +++ b/src/test/regress/sql/plpgsql.sql @@ -1483,7 +1483,7 @@ create function test_found() end;' language plpgsql; select test_found(); -select * from found_test_tbl; +select * from found_test_tbl order by 1; -- -- Test set-returning functions for PL/pgSQL @@ -1499,7 +1499,7 @@ BEGIN RETURN; END;' language plpgsql; -select * from test_table_func_rec(); +select * from test_table_func_rec() order by 1; create function test_table_func_row() returns setof found_test_tbl as ' DECLARE @@ -1511,7 +1511,7 @@ BEGIN RETURN; END;' language plpgsql; -select * from test_table_func_row(); +select * from test_table_func_row() order by 1; create function test_ret_set_scalar(int,int) returns setof int as ' DECLARE @@ -1523,7 +1523,7 @@ BEGIN RETURN; END;' language plpgsql; -select * from test_ret_set_scalar(1,10); +select * from test_ret_set_scalar(1,10) order by 1; create function test_ret_set_rec_dyn(int) returns setof record as ' DECLARE @@ -1541,8 +1541,8 @@ BEGIN RETURN; END;' language plpgsql; -SELECT * FROM test_ret_set_rec_dyn(1500) AS (a int, b int, c int); -SELECT * FROM test_ret_set_rec_dyn(5) AS (a int, b numeric, c text); +SELECT * FROM test_ret_set_rec_dyn(1500) AS (a int, b int, c int) order by a, b, c; +SELECT * FROM test_ret_set_rec_dyn(5) AS (a int, b numeric, c text) order by a, b, c; create function test_ret_rec_dyn(int) returns record as ' DECLARE @@ -1557,8 +1557,8 @@ BEGIN END IF; END;' language plpgsql; -SELECT * FROM test_ret_rec_dyn(1500) AS (a int, b int, c int); -SELECT * FROM test_ret_rec_dyn(5) AS (a int, b numeric, c text); +SELECT * FROM test_ret_rec_dyn(1500) AS (a int, b int, c int) order by a, b, c; +SELECT * FROM test_ret_rec_dyn(5) AS (a int, b numeric, c text) order by a, b, c; -- -- Test handling of OUT parameters, including polymorphic cases. @@ -1599,7 +1599,7 @@ begin return; end$$ language plpgsql; -select * from f1(42); +select * from f1(42) order by 1; drop function f1(int); @@ -1625,7 +1625,7 @@ begin return next; end$$ language plpgsql; -select * from f1(42); +select * from f1(42) order by j, k;; drop function f1(int); @@ -1682,7 +1682,7 @@ BEGIN END;' language plpgsql; SELECT perform_test_func(); -SELECT * FROM perform_test; +SELECT * FROM perform_test order by a, b; drop table perform_test; @@ -1775,7 +1775,7 @@ select blockme(); reset statement_timeout; -select * from foo; +select * from foo order by 1; drop table foo; @@ -2377,7 +2377,7 @@ end$$ language plpgsql; select footest(); -select * from foo; +select * from foo order by 1, 2; create or replace function footest() returns void as $$ declare x record; @@ -2458,7 +2458,7 @@ begin end; $$ language plpgsql; -select * from sc_test(); +select * from sc_test() order by 1; create or replace function sc_test() returns setof integer as $$ declare @@ -2475,7 +2475,7 @@ begin end; $$ language plpgsql; -select * from sc_test(); -- fails because of NO SCROLL specification +select * from sc_test() order by 1; -- fails because of NO SCROLL specification create or replace function sc_test() returns setof integer as $$ declare @@ -2492,7 +2492,7 @@ begin end; $$ language plpgsql; -select * from sc_test(); +select * from sc_test() order by 1; create or replace function sc_test() returns setof integer as $$ declare @@ -2509,7 +2509,7 @@ begin end; $$ language plpgsql; -select * from sc_test(); +select * from sc_test() order by 1; create or replace function sc_test() returns setof integer as $$ declare @@ -2531,7 +2531,7 @@ begin end; $$ language plpgsql; -select * from sc_test(); +select * from sc_test() order by 1; drop function sc_test(); @@ -2569,7 +2569,7 @@ begin end; $$ language plpgsql; -select * from ret_query1(); +select * from ret_query1() order by 1, 2; create type record_type as (x text, y int, z boolean); @@ -2580,7 +2580,7 @@ begin end; $$ language plpgsql; -select * from ret_query2(8); +select * from ret_query2(8) order by 1; -- test EXECUTE USING create function exc_using(int, text) returns int as $$ @@ -2654,7 +2654,7 @@ $$ language plpgsql; select forc01(); -select * from forc_test; +select * from forc_test order by 1, 2; drop function forc01(); @@ -2680,7 +2680,7 @@ begin end; $$ language plpgsql; -select * from return_dquery(); +select * from return_dquery() order by 1; drop function return_dquery(); @@ -2934,7 +2934,7 @@ begin end; $$ language plpgsql immutable strict; -select * from tftest(10); +select * from tftest(10) order by 1, 2; create or replace function tftest(a1 int) returns table(a int, b int) as $$ begin @@ -2945,7 +2945,7 @@ begin end; $$ language plpgsql immutable strict; -select * from tftest(10); +select * from tftest(10) order by 1, 2; drop function tftest(int); @@ -2968,7 +2968,7 @@ begin end; $$ language plpgsql; -select * from rttest(); +select * from rttest() order by 1; drop function rttest(); diff --git a/src/test/regress/sql/point.sql b/src/test/regress/sql/point.sql index 8523c2ee9f..c62348429e 100644 --- a/src/test/regress/sql/point.sql +++ b/src/test/regress/sql/point.sql @@ -27,33 +27,33 @@ INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0'); SELECT '' AS six, * FROM POINT_TBL; -- left of -SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)'; +SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)' ORDER BY p.f1[0], p.f1[1]; -- right of -SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1; +SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1 ORDER BY p.f1[0], p.f1[1]; -- above -SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1 ORDER BY p.f1[0], p.f1[1]; -- below -SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)' ORDER BY p.f1[0], p.f1[1]; -- equal -SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)'; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)' ORDER BY p.f1[0], p.f1[1]; -- point in box SELECT '' AS three, p.* FROM POINT_TBL p - WHERE p.f1 <@ box '(0,0,100,100)'; + WHERE p.f1 <@ box '(0,0,100,100)' ORDER BY p.f1[0], p.f1[1]; SELECT '' AS three, p.* FROM POINT_TBL p - WHERE not p.f1 <@ box '(0,0,100,100)'; + WHERE not p.f1 <@ box '(0,0,100,100)' ORDER BY p.f1[0], p.f1[1]; SELECT '' AS two, p.* FROM POINT_TBL p - WHERE p.f1 <@ path '[(0,0),(-10,0),(-10,10)]'; + WHERE p.f1 <@ path '[(0,0),(-10,0),(-10,10)]' ORDER BY p.f1[0], p.f1[1]; SELECT '' AS six, p.f1, p.f1 <-> point '(0,0)' AS dist FROM POINT_TBL p - ORDER BY dist; + ORDER BY dist, p.f1[0], p.f1[1]; SELECT '' AS thirtysix, p1.f1 AS point1, p2.f1 AS point2, p1.f1 <-> p2.f1 AS dist FROM POINT_TBL p1, POINT_TBL p2 @@ -61,7 +61,7 @@ SELECT '' AS thirtysix, p1.f1 AS point1, p2.f1 AS point2, p1.f1 <-> p2.f1 AS dis SELECT '' AS thirty, p1.f1 AS point1, p2.f1 AS point2 FROM POINT_TBL p1, POINT_TBL p2 - WHERE (p1.f1 <-> p2.f1) > 3; + WHERE (p1.f1 <-> p2.f1) > 3 ORDER BY p1.f1[0], p1.f1[1], p2.f1[0], p2.f1[1]; -- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10 SELECT '' AS fifteen, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance @@ -73,4 +73,4 @@ SELECT '' AS fifteen, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS dis SELECT '' AS three, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance FROM POINT_TBL p1, POINT_TBL p2 WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 >^ p2.f1 - ORDER BY distance; + ORDER BY distance, p1.f1[0], p1.f1[1], p2.f1[0], p2.f1[1]; diff --git a/src/test/regress/sql/polygon.sql b/src/test/regress/sql/polygon.sql index 1f45de0a6d..0bbfcddb3b 100644 --- a/src/test/regress/sql/polygon.sql +++ b/src/test/regress/sql/polygon.sql @@ -14,71 +14,71 @@ -- 0 1 2 3 4 -- -CREATE TABLE POLYGON_TBL(f1 polygon); +CREATE TABLE POLYGON_TBL(ID int, f1 polygon); -INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,0.0),(2.0,4.0),(0.0,0.0)'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (1, '(2.0,0.0),(2.0,4.0),(0.0,0.0)'); -INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (2, '(3.0,1.0),(3.0,3.0),(1.0,0.0)'); -- degenerate polygons -INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (3, '(0.0,0.0)'); -INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (4, '(0.0,1.0),(0.0,1.0)'); -- bad polygon input strings -INSERT INTO POLYGON_TBL(f1) VALUES ('0.0'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (5, '0.0'); -INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (6, '(0.0 0.0'); -INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (7, '(0,1,2)'); -INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (8, '(0,1,2,3'); -INSERT INTO POLYGON_TBL(f1) VALUES ('asdf'); +INSERT INTO POLYGON_TBL(ID,f1) VALUES (9, 'asdf'); -SELECT '' AS four, * FROM POLYGON_TBL; +SELECT '' AS four, * FROM POLYGON_TBL ORDER BY ID; -- overlap SELECT '' AS three, p.* FROM POLYGON_TBL p - WHERE p.f1 && '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; + WHERE p.f1 && '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; -- left overlap SELECT '' AS four, p.* FROM POLYGON_TBL p - WHERE p.f1 &< '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; + WHERE p.f1 &< '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; -- right overlap SELECT '' AS two, p.* FROM POLYGON_TBL p - WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; + WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; -- left of SELECT '' AS one, p.* FROM POLYGON_TBL p - WHERE p.f1 << '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; + WHERE p.f1 << '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; -- right of SELECT '' AS zero, p.* FROM POLYGON_TBL p - WHERE p.f1 >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; + WHERE p.f1 >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; -- contained SELECT '' AS one, p.* FROM POLYGON_TBL p - WHERE p.f1 <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; + WHERE p.f1 <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; -- same SELECT '' AS one, p.* FROM POLYGON_TBL p - WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; + WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; -- contains SELECT '' AS one, p.* FROM POLYGON_TBL p - WHERE p.f1 @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)'; + WHERE p.f1 @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' ORDER BY ID; -- -- polygon logic diff --git a/src/test/regress/sql/polymorphism.sql b/src/test/regress/sql/polymorphism.sql index c01871de00..f4d7ddd88d 100644 --- a/src/test/regress/sql/polymorphism.sql +++ b/src/test/regress/sql/polymorphism.sql @@ -387,9 +387,9 @@ select case when $1 then $2 else $3 end $$ language sql; -- Note this would fail with integer overflow, never mind wrong bleat() output, -- if the CASE expression were not successfully inlined -select f1, sql_if(f1 > 0, bleat(f1), bleat(f1 + 1)) from int4_tbl; +select f1, sql_if(f1 > 0, bleat(f1), bleat(f1 + 1)) from int4_tbl order by 1, 2; -select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl; +select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl order by 1, 2; -- another kind of polymorphic aggregate diff --git a/src/test/regress/sql/portals.sql b/src/test/regress/sql/portals.sql index 4265aaa43c..cf47fad9df 100644 --- a/src/test/regress/sql/portals.sql +++ b/src/test/regress/sql/portals.sql @@ -238,7 +238,7 @@ BEGIN; CREATE FUNCTION declares_cursor(text) RETURNS void - AS 'DECLARE c CURSOR FOR SELECT stringu1 FROM tenk1 WHERE stringu1 LIKE $1;' + AS 'DECLARE c CURSOR FOR SELECT stringu1 FROM tenk1 WHERE stringu1 LIKE $1 ORDER BY stringu1;' LANGUAGE SQL; SELECT declares_cursor('AB%'); @@ -322,15 +322,15 @@ COMMIT; CREATE TEMP TABLE uctest(f1 int, f2 text); INSERT INTO uctest VALUES (1, 'one'), (2, 'two'), (3, 'three'); -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; -- Check DELETE WHERE CURRENT BEGIN; -DECLARE c1 CURSOR FOR SELECT * FROM uctest; +DECLARE c1 CURSOR FOR SELECT * FROM uctest ORDER BY f1; FETCH 2 FROM c1; DELETE FROM uctest WHERE CURRENT OF c1; -- should show deletion -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; -- cursor did not move FETCH ALL FROM c1; -- cursor is insensitive @@ -338,16 +338,16 @@ MOVE BACKWARD ALL IN c1; FETCH ALL FROM c1; COMMIT; -- should still see deletion -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; -- Check UPDATE WHERE CURRENT; this time use FOR UPDATE BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; FETCH c1; UPDATE uctest SET f1 = 8 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; COMMIT; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; -- Check repeated-update and update-then-delete cases BEGIN; @@ -356,41 +356,41 @@ FETCH c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; SELECT * FROM uctest; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY 1; -- insensitive cursor should not show effects of updates or deletes FETCH RELATIVE 0 FROM c1; DELETE FROM uctest WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; DELETE FROM uctest WHERE CURRENT OF c1; -- no-op -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- no-op -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; FETCH RELATIVE 0 FROM c1; ROLLBACK; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; FETCH c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; DELETE FROM uctest WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; DELETE FROM uctest WHERE CURRENT OF c1; -- no-op -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- no-op -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; --- sensitive cursors can't currently scroll back, so this is an error: FETCH RELATIVE 0 FROM c1; ROLLBACK; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; -- Check inheritance cases CREATE TEMP TABLE ucchild () inherits (uctest); INSERT INTO ucchild values(100, 'hundred'); -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; @@ -402,7 +402,7 @@ FETCH 1 FROM c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; FETCH 1 FROM c1; COMMIT; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; -- Can update from a self-join, but only if FOR UPDATE says which to use BEGIN; @@ -419,7 +419,7 @@ BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5 FOR SHARE OF a; FETCH 1 FROM c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -SELECT * FROM uctest; +SELECT * FROM uctest ORDER BY f1; ROLLBACK; -- Check various error cases diff --git a/src/test/regress/sql/prepare.sql b/src/test/regress/sql/prepare.sql index 1dc4db188e..9a3b838dba 100644 --- a/src/test/regress/sql/prepare.sql +++ b/src/test/regress/sql/prepare.sql @@ -18,7 +18,7 @@ PREPARE q1 AS SELECT 2; EXECUTE q1; PREPARE q2 AS SELECT 2 AS b; -SELECT name, statement, parameter_types FROM pg_prepared_statements; +SELECT name, statement, parameter_types FROM pg_prepared_statements ORDER BY name; -- sql92 syntax DEALLOCATE PREPARE q1; diff --git a/src/test/regress/sql/prepared_xacts.sql b/src/test/regress/sql/prepared_xacts.sql index 39d323a15b..b8915bda77 100644 --- a/src/test/regress/sql/prepared_xacts.sql +++ b/src/test/regress/sql/prepared_xacts.sql @@ -16,54 +16,54 @@ INSERT INTO pxtest1 VALUES ('aaa'); -- Test PREPARE TRANSACTION BEGIN; UPDATE pxtest1 SET foobar = 'bbb' WHERE foobar = 'aaa'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; PREPARE TRANSACTION 'foo1'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; -- Test pg_prepared_xacts system view -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; -- Test ROLLBACK PREPARED ROLLBACK PREPARED 'foo1'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; -- Test COMMIT PREPARED BEGIN; INSERT INTO pxtest1 VALUES ('ddd'); -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; PREPARE TRANSACTION 'foo2'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; COMMIT PREPARED 'foo2'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; -- Test duplicate gids BEGIN; UPDATE pxtest1 SET foobar = 'eee' WHERE foobar = 'ddd'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; PREPARE TRANSACTION 'foo3'; -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; BEGIN; INSERT INTO pxtest1 VALUES ('fff'); -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; -- This should fail, because the gid foo3 is already in use PREPARE TRANSACTION 'foo3'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; ROLLBACK PREPARED 'foo3'; -SELECT * FROM pxtest1; +SELECT * FROM pxtest1 ORDER BY foobar; -- Clean up DROP TABLE pxtest1; @@ -99,7 +99,7 @@ FETCH 1 FROM foo; SELECT * FROM pxtest2; -- There should be two prepared transactions -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; -- pxtest3 should be locked because of the pending DROP set statement_timeout to 2000; @@ -110,7 +110,7 @@ reset statement_timeout; \c - -- There should still be two prepared transactions -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; -- pxtest3 should still be locked because of the pending DROP set statement_timeout to 2000; @@ -130,7 +130,7 @@ COMMIT PREPARED 'regress-two'; SELECT * FROM pxtest3; -- There should be no prepared transactions -SELECT gid FROM pg_prepared_xacts; +SELECT gid FROM pg_prepared_xacts ORDER BY gid; -- Clean up DROP TABLE pxtest2; diff --git a/src/test/regress/sql/rangefuncs.sql b/src/test/regress/sql/rangefuncs.sql index 3727a36aaf..ee9d920446 100644 --- a/src/test/regress/sql/rangefuncs.sql +++ b/src/test/regress/sql/rangefuncs.sql @@ -1,4 +1,4 @@ -SELECT name, setting FROM pg_settings WHERE name LIKE 'enable%'; +SELECT name, setting FROM pg_settings WHERE name LIKE 'enable%' ORDER BY name; CREATE TABLE foo2(fooid int, f2 int); INSERT INTO foo2 VALUES(1, 11); @@ -45,9 +45,9 @@ SELECT * FROM vw_getfoo; DROP VIEW vw_getfoo; DROP FUNCTION getfoo(int); CREATE FUNCTION getfoo(int) RETURNS setof text AS 'SELECT fooname FROM foo WHERE fooid = $1;' LANGUAGE SQL; -SELECT * FROM getfoo(1) AS t1; +SELECT * FROM getfoo(1) AS t1 ORDER BY 1; CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1); -SELECT * FROM vw_getfoo; +SELECT * FROM vw_getfoo ORDER BY 1; -- sql, proretset = f, prorettype = c DROP VIEW vw_getfoo; @@ -61,9 +61,9 @@ SELECT * FROM vw_getfoo; DROP VIEW vw_getfoo; DROP FUNCTION getfoo(int); CREATE FUNCTION getfoo(int) RETURNS setof foo AS 'SELECT * FROM foo WHERE fooid = $1;' LANGUAGE SQL; -SELECT * FROM getfoo(1) AS t1; +SELECT * FROM getfoo(1) AS t1 ORDER BY foosubid; CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1); -SELECT * FROM vw_getfoo; +SELECT * FROM vw_getfoo ORDER BY foosubid; -- sql, proretset = f, prorettype = record DROP VIEW vw_getfoo; @@ -78,10 +78,10 @@ SELECT * FROM vw_getfoo; DROP VIEW vw_getfoo; DROP FUNCTION getfoo(int); CREATE FUNCTION getfoo(int) RETURNS setof record AS 'SELECT * FROM foo WHERE fooid = $1;' LANGUAGE SQL; -SELECT * FROM getfoo(1) AS t1(fooid int, foosubid int, fooname text); +SELECT * FROM getfoo(1) AS t1(fooid int, foosubid int, fooname text) ORDER BY foosubid; CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1) AS (fooid int, foosubid int, fooname text); -SELECT * FROM vw_getfoo; +SELECT * FROM vw_getfoo ORDER BY foosubid; -- plpgsql, proretset = f, prorettype = b DROP VIEW vw_getfoo; @@ -225,13 +225,13 @@ AS 'select $1+1' LANGUAGE sql; CREATE OR REPLACE FUNCTION foor(in f1 int, out f2 int, out text) AS $$select $1-1, $1::text || 'z'$$ LANGUAGE sql; -SELECT f1, foor(f1) FROM int4_tbl; +SELECT f1, foor(f1) FROM int4_tbl ORDER BY 1, 2; SELECT * FROM foor(42); SELECT * FROM foor(42) AS p(a,b); CREATE OR REPLACE FUNCTION foob(in f1 int, inout f2 int, out text) AS $$select $2-1, $1::text || 'z'$$ LANGUAGE sql; -SELECT f1, foob(f1, f1/2) FROM int4_tbl; +SELECT f1, foob(f1, f1/2) FROM int4_tbl ORDER BY 1, 2; SELECT * FROM foob(42, 99); SELECT * FROM foob(42, 99) AS p(a,b); @@ -269,7 +269,7 @@ AS 'select $1, array[$1,$1]' LANGUAGE sql; CREATE OR REPLACE FUNCTION foo() RETURNS TABLE(a int) AS $$ SELECT a FROM generate_series(1,5) a(a) $$ LANGUAGE sql; -SELECT * FROM foo(); +SELECT * FROM foo() ORDER BY 1; DROP FUNCTION foo(); CREATE OR REPLACE FUNCTION foo(int) @@ -277,7 +277,7 @@ RETURNS TABLE(a int, b int) AS $$ SELECT a, b FROM generate_series(1,$1) a(a), generate_series(1,$1) b(b) $$ LANGUAGE sql; -SELECT * FROM foo(3); +SELECT * FROM foo(3) ORDER BY 1, 2; DROP FUNCTION foo(int); -- @@ -292,7 +292,7 @@ language sql; select insert_tt('foo'); select insert_tt('bar'); -select * from tt; +select * from tt order by 1, 2; -- insert will execute to completion even if function needs just 1 row create or replace function insert_tt(text) returns int as @@ -300,7 +300,7 @@ $$ insert into tt(data) values($1),($1||$1) returning f1 $$ language sql; select insert_tt('fool'); -select * from tt; +select * from tt order by 1, 2; -- setof does what's expected create or replace function insert_tt2(text,text) returns setof int as @@ -308,12 +308,12 @@ $$ insert into tt(data) values($1),($2) returning f1 $$ language sql; select insert_tt2('foolish','barrish'); -select * from insert_tt2('baz','quux'); -select * from tt; +select * from insert_tt2('baz','quux') order by 1; +select * from tt order by 1, 2; -- limit doesn't prevent execution to completion select insert_tt2('foolish','barrish') limit 1; -select * from tt; +select * from tt order by 1, 2; -- triggers will fire, too create function noticetrigger() returns trigger as $$ @@ -325,7 +325,7 @@ create trigger tnoticetrigger after insert on tt for each row execute procedure noticetrigger(); select insert_tt2('foolme','barme') limit 1; -select * from tt; +select * from tt order by 1, 2; -- and rules work create temp table tt_log(f1 int, data text); @@ -334,10 +334,10 @@ create rule insert_tt_rule as on insert to tt do also insert into tt_log values(new.*); select insert_tt2('foollog','barlog') limit 1; -select * from tt; +select * from tt order by 1, 2; -- note that nextval() gets executed a second time in the rule expansion, -- which is expected. -select * from tt_log; +select * from tt_log order by 1, 2; -- test case for a whole-row-variable bug create function foo1(n integer, out a text, out b text) @@ -361,7 +361,7 @@ create function array_to_set(anyarray) returns setof record as $$ $$ language sql strict immutable; select array_to_set(array['one', 'two']); -select * from array_to_set(array['one', 'two']) as t(f1 int,f2 text); +select * from array_to_set(array['one', 'two']) as t(f1 int,f2 text) order by 1, 2; select * from array_to_set(array['one', 'two']); -- fail create temp table foo(f1 int8, f2 int8); @@ -381,7 +381,7 @@ create function testfoo() returns setof record as $$ $$ language sql; select testfoo(); -select * from testfoo() as t(f1 int8,f2 int8); +select * from testfoo() as t(f1 int8,f2 int8) order by 1, 2; select * from testfoo(); -- fail drop function testfoo(); diff --git a/src/test/regress/sql/reltime.sql b/src/test/regress/sql/reltime.sql index a07b64e29d..8495d78c63 100644 --- a/src/test/regress/sql/reltime.sql +++ b/src/test/regress/sql/reltime.sql @@ -24,25 +24,25 @@ INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago'); -- test reltime operators -SELECT '' AS six, * FROM RELTIME_TBL; +SELECT '' AS six, * FROM RELTIME_TBL ORDER BY f1; SELECT '' AS five, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 <> reltime '@ 10 days'; + WHERE RELTIME_TBL.f1 <> reltime '@ 10 days' ORDER BY f1; SELECT '' AS three, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours'; + WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours' ORDER BY f1; SELECT '' AS three, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 < reltime '@ 1 day'; + WHERE RELTIME_TBL.f1 < reltime '@ 1 day' ORDER BY f1; SELECT '' AS one, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 = reltime '@ 34 years'; + WHERE RELTIME_TBL.f1 = reltime '@ 34 years' ORDER BY f1; SELECT '' AS two, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 >= reltime '@ 1 month'; + WHERE RELTIME_TBL.f1 >= reltime '@ 1 month' ORDER BY f1; SELECT '' AS five, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago'; + WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago' ORDER BY f1; SELECT '' AS fifteen, r1.*, r2.* FROM RELTIME_TBL r1, RELTIME_TBL r2 diff --git a/src/test/regress/sql/returning.sql b/src/test/regress/sql/returning.sql index 0ed9a48951..4552ac0b8d 100644 --- a/src/test/regress/sql/returning.sql +++ b/src/test/regress/sql/returning.sql @@ -10,15 +10,15 @@ INSERT INTO foo (f2,f3) VALUES ('test', DEFAULT), ('More', 11), (upper('more'), 7+9) RETURNING *, f1+f3 AS sum; -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; UPDATE foo SET f2 = lower(f2), f3 = DEFAULT RETURNING foo.*, f1+f3 AS sum13; -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; DELETE FROM foo WHERE f1 > 2 RETURNING f3, f2, f1, least(f1,f3); -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; -- Subplans and initplans in the RETURNING list @@ -43,14 +43,14 @@ UPDATE foo SET f3 = f3*2 WHERE foo.f1 + 123455 = i.f1 RETURNING foo.*, i.f1 as "i.f1"; -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; DELETE FROM foo USING int4_tbl i WHERE foo.f1 + 123455 = i.f1 RETURNING foo.*, i.f1 as "i.f1"; -SELECT * FROM foo; +SELECT * FROM foo ORDER BY f1; -- Check inheritance cases @@ -60,29 +60,29 @@ INSERT INTO foochild VALUES(123,'child',999,-123); ALTER TABLE foo ADD COLUMN f4 int8 DEFAULT 99; -SELECT * FROM foo; -SELECT * FROM foochild; +SELECT * FROM foo ORDER BY f1; +SELECT * FROM foochild ORDER BY f1; UPDATE foo SET f4 = f4 + f3 WHERE f4 = 99 RETURNING *; -SELECT * FROM foo; -SELECT * FROM foochild; +SELECT * FROM foo ORDER BY f1; +SELECT * FROM foochild ORDER BY f1; UPDATE foo SET f3 = f3*2 FROM int8_tbl i WHERE foo.f1 = i.q2 RETURNING *; -SELECT * FROM foo; -SELECT * FROM foochild; +SELECT * FROM foo ORDER BY f1; +SELECT * FROM foochild ORDER BY f1; DELETE FROM foo USING int8_tbl i WHERE foo.f1 = i.q2 RETURNING *; -SELECT * FROM foo; -SELECT * FROM foochild; +SELECT * FROM foo ORDER BY f1; +SELECT * FROM foochild ORDER BY f1; DROP TABLE foochild; @@ -109,8 +109,8 @@ INSERT INTO voo VALUES(13,'zit2'); -- works now INSERT INTO voo VALUES(14,'zoo2') RETURNING *; -SELECT * FROM foo; -SELECT * FROM voo; +SELECT * FROM foo ORDER BY f1; +SELECT * FROM voo ORDER BY f1; CREATE OR REPLACE RULE voo_u AS ON UPDATE TO voo DO INSTEAD UPDATE foo SET f1 = new.f1, f2 = new.f2 WHERE f1 = old.f1 @@ -119,8 +119,8 @@ CREATE OR REPLACE RULE voo_u AS ON UPDATE TO voo DO INSTEAD update voo set f1 = f1 + 1 where f2 = 'zoo2'; update voo set f1 = f1 + 1 where f2 = 'zoo2' RETURNING *, f1*2; -SELECT * FROM foo; -SELECT * FROM voo; +SELECT * FROM foo ORDER BY f1; +SELECT * FROM voo ORDER BY f1; CREATE OR REPLACE RULE voo_d AS ON DELETE TO voo DO INSTEAD DELETE FROM foo WHERE f1 = old.f1 @@ -129,8 +129,8 @@ CREATE OR REPLACE RULE voo_d AS ON DELETE TO voo DO INSTEAD DELETE FROM foo WHERE f1 = 13; DELETE FROM foo WHERE f2 = 'zit' RETURNING *; -SELECT * FROM foo; -SELECT * FROM voo; +SELECT * FROM foo ORDER BY f1; +SELECT * FROM voo ORDER BY f1; -- Try a join case @@ -142,7 +142,7 @@ INSERT INTO joinme VALUES('other', 0); CREATE TEMP VIEW joinview AS SELECT foo.*, other FROM foo JOIN joinme ON (f2 = f2j); -SELECT * FROM joinview; +SELECT * FROM joinview ORDER BY f1; CREATE RULE joinview_u AS ON UPDATE TO joinview DO INSTEAD UPDATE foo SET f1 = new.f1, f3 = new.f3 @@ -151,6 +151,6 @@ CREATE RULE joinview_u AS ON UPDATE TO joinview DO INSTEAD UPDATE joinview SET f1 = f1 + 1 WHERE f3 = 57 RETURNING *, other + 1; -SELECT * FROM joinview; -SELECT * FROM foo; -SELECT * FROM voo; +SELECT * FROM joinview ORDER BY f1; +SELECT * FROM foo ORDER BY f1; +SELECT * FROM voo ORDER BY f1; diff --git a/src/test/regress/sql/rowtypes.sql b/src/test/regress/sql/rowtypes.sql index a8520c5bd2..c95bd836fc 100644 --- a/src/test/regress/sql/rowtypes.sql +++ b/src/test/regress/sql/rowtypes.sql @@ -33,14 +33,14 @@ create temp table quadtable(f1 int, q quad); insert into quadtable values (1, ((3.3,4.4),(5.5,6.6))); insert into quadtable values (2, ((null,4.4),(5.5,6.6))); -select * from quadtable; +select * from quadtable order by f1, q; begin; set local add_missing_from = false; select f1, q.c1 from quadtable; -- fails, q is a table reference rollback; -select f1, (q).c1, (qq.q).c1.i from quadtable qq; +select f1, (q).c1, (qq.q).c1.i from quadtable qq order by 1; create temp table people (fn fullname, bd date); @@ -63,7 +63,7 @@ select * from people; insert into quadtable (f1, q.c1.r, q.c2.i) values(44,55,66); -select * from quadtable; +select * from quadtable order by f1, q; -- The object here is to ensure that toasted references inside -- composite values don't cause problems. The large f1 value will @@ -74,7 +74,7 @@ insert into pp values (repeat('abcdefghijkl', 100000)); insert into people select ('Jim', f1, null)::fullname, current_date from pp; -select (fn).first, substr((fn).last, 1, 20), length((fn).last) from people; +select (fn).first, substr((fn).last, 1, 20), length((fn).last) from people order by 1, 2; -- Test row comparison semantics. Prior to PG 8.2 we did this in a totally -- non-spec-compliant way. diff --git a/src/test/regress/sql/rules.sql b/src/test/regress/sql/rules.sql index a522d52d19..c7f271a7fd 100644 --- a/src/test/regress/sql/rules.sql +++ b/src/test/regress/sql/rules.sql @@ -171,67 +171,67 @@ insert into rtest_t3 values (5, 35); -- insert values insert into rtest_v1 values (1, 11); insert into rtest_v1 values (2, 12); -select * from rtest_v1; +select * from rtest_v1 order by a, b; -- delete with constant expression delete from rtest_v1 where a = 1; -select * from rtest_v1; +select * from rtest_v1 order by a, b; insert into rtest_v1 values (1, 11); delete from rtest_v1 where b = 12; -select * from rtest_v1; +select * from rtest_v1 order by a, b; insert into rtest_v1 values (2, 12); insert into rtest_v1 values (2, 13); -select * from rtest_v1; +select * from rtest_v1 order by a, b; ** Remember the delete rule on rtest_v1: It says ** DO INSTEAD DELETE FROM rtest_t1 WHERE a = old.a ** So this time both rows with a = 2 must get deleted \p \r delete from rtest_v1 where b = 12; -select * from rtest_v1; +select * from rtest_v1 order by a, b; delete from rtest_v1; -- insert select insert into rtest_v1 select * from rtest_t2; -select * from rtest_v1; +select * from rtest_v1 order by a, b; delete from rtest_v1; -- same with swapped targetlist insert into rtest_v1 (b, a) select b, a from rtest_t2; -select * from rtest_v1; +select * from rtest_v1 order by a, b; -- now with only one target attribute insert into rtest_v1 (a) select a from rtest_t3; -select * from rtest_v1; -select * from rtest_v1 where b isnull; +select * from rtest_v1 order by a, b; +select * from rtest_v1 where b isnull order by a, b; -- let attribute a differ (must be done on rtest_t1 - see above) update rtest_t1 set a = a + 10 where b isnull; delete from rtest_v1 where b isnull; -select * from rtest_v1; +select * from rtest_v1 order by a, b; -- now updates with constant expression update rtest_v1 set b = 42 where a = 2; -select * from rtest_v1; +select * from rtest_v1 order by a, b; update rtest_v1 set b = 99 where b = 42; -select * from rtest_v1; +select * from rtest_v1 order by a, b; update rtest_v1 set b = 88 where b < 50; -select * from rtest_v1; +select * from rtest_v1 order by a, b; delete from rtest_v1; insert into rtest_v1 select rtest_t2.a, rtest_t3.b from rtest_t2, rtest_t3 where rtest_t2.a = rtest_t3.a; -select * from rtest_v1; +select * from rtest_v1 order by a, b; -- updates in a mergejoin update rtest_v1 set b = rtest_t2.b from rtest_t2 where rtest_v1.a = rtest_t2.a; -select * from rtest_v1; +select * from rtest_v1 order by a, b; insert into rtest_v1 select * from rtest_t3; -select * from rtest_v1; +select * from rtest_v1 order by a, b; update rtest_t1 set a = a + 10 where b > 30; -select * from rtest_v1; +select * from rtest_v1 order by a, b; update rtest_v1 set a = rtest_t3.a + 20 from rtest_t3 where rtest_v1.b = rtest_t3.b; -select * from rtest_v1; +select * from rtest_v1 order by a, b; -- -- Test for constraint updates/deletes @@ -254,8 +254,8 @@ insert into rtest_admin values ('bm', 'neptun'); update rtest_system set sysname = 'pluto' where sysname = 'neptun'; -select * from rtest_interface; -select * from rtest_admin; +select * from rtest_interface order by sysname, ifname; +select * from rtest_admin order by pname, sysname; update rtest_person set pname = 'jwieck' where pdesc = 'Jan Wieck'; @@ -267,8 +267,8 @@ select * from rtest_admin order by pname, sysname; delete from rtest_system where sysname = 'orion'; -select * from rtest_interface; -select * from rtest_admin; +select * from rtest_interface order by sysname, ifname; +select * from rtest_admin order by pname, sysname; -- -- Rule qualification test @@ -306,11 +306,11 @@ insert into rtest_t4 values (28, 'Record should go to rtest_t4 and t8'); insert into rtest_t4 values (30, 'Record should go to rtest_t4'); insert into rtest_t4 values (40, 'Record should go to rtest_t4'); -select * from rtest_t4; -select * from rtest_t5; -select * from rtest_t6; -select * from rtest_t7; -select * from rtest_t8; +select * from rtest_t4 order by a, b; +select * from rtest_t5 order by a, b; +select * from rtest_t6 order by a, b; +select * from rtest_t7 order by a, b; +select * from rtest_t8 order by a, b; delete from rtest_t4; delete from rtest_t5; @@ -331,33 +331,33 @@ insert into rtest_t9 values (40, 'Record should go to rtest_t4'); insert into rtest_t4 select * from rtest_t9 where a < 20; -select * from rtest_t4; -select * from rtest_t5; -select * from rtest_t6; -select * from rtest_t7; -select * from rtest_t8; +select * from rtest_t4 order by a, b; +select * from rtest_t5 order by a, b; +select * from rtest_t6 order by a, b; +select * from rtest_t7 order by a, b; +select * from rtest_t8 order by a, b; insert into rtest_t4 select * from rtest_t9 where b ~ 'and t8'; -select * from rtest_t4; -select * from rtest_t5; -select * from rtest_t6; -select * from rtest_t7; -select * from rtest_t8; +select * from rtest_t4 order by a, b; +select * from rtest_t5 order by a, b; +select * from rtest_t6 order by a, b; +select * from rtest_t7 order by a, b; +select * from rtest_t8 order by a, b; insert into rtest_t4 select a + 1, b from rtest_t9 where a in (20, 30, 40); -select * from rtest_t4; -select * from rtest_t5; -select * from rtest_t6; -select * from rtest_t7; -select * from rtest_t8; +select * from rtest_t4 order by a, b; +select * from rtest_t5 order by a, b; +select * from rtest_t6 order by a, b; +select * from rtest_t7 order by a, b; +select * from rtest_t8 order by a, b; -- -- Check that the ordering of rules fired is correct -- insert into rtest_order1 values (1); -select * from rtest_order2; +select * from rtest_order2 order by a, b, c; -- -- Check if instead nothing w/without qualification works @@ -374,15 +374,15 @@ insert into rtest_nothn1 values (40, 'want this'); insert into rtest_nothn1 values (50, 'want this'); insert into rtest_nothn1 values (60, 'want this'); -select * from rtest_nothn1; +select * from rtest_nothn1 order by a, b; insert into rtest_nothn2 values (10, 'too small'); insert into rtest_nothn2 values (50, 'too small'); insert into rtest_nothn2 values (100, 'OK'); insert into rtest_nothn2 values (200, 'OK'); -select * from rtest_nothn2; -select * from rtest_nothn3; +select * from rtest_nothn2 order by a, b; +select * from rtest_nothn3 order by a, b; delete from rtest_nothn1; delete from rtest_nothn2; @@ -402,7 +402,7 @@ insert into rtest_nothn4 values (60, 'want this'); insert into rtest_nothn1 select * from rtest_nothn4; -select * from rtest_nothn1; +select * from rtest_nothn1 order by a, b; delete from rtest_nothn4; @@ -413,8 +413,8 @@ insert into rtest_nothn4 values (200, 'OK'); insert into rtest_nothn2 select * from rtest_nothn4; -select * from rtest_nothn2; -select * from rtest_nothn3; +select * from rtest_nothn2 order by a, b; +select * from rtest_nothn3 order by a, b; create table rtest_view1 (a int4, b text, v bool); create table rtest_view2 (a int4); @@ -453,22 +453,22 @@ insert into rtest_view2 values (7); insert into rtest_view2 values (7); insert into rtest_view2 values (7); -select * from rtest_vview1; -select * from rtest_vview2; -select * from rtest_vview3; +select * from rtest_vview1 order by a, b; +select * from rtest_vview2 order by a, b; +select * from rtest_vview3 order by a, b; select * from rtest_vview4 order by a, b; -select * from rtest_vview5; +select * from rtest_vview5 order by a, b; insert into rtest_view3 select * from rtest_vview1 where a < 7; -select * from rtest_view3; +select * from rtest_view3 order by a, b; delete from rtest_view3; insert into rtest_view3 select * from rtest_vview2 where a != 5 and b !~ '2'; -select * from rtest_view3; +select * from rtest_view3 order by a, b; delete from rtest_view3; insert into rtest_view3 select * from rtest_vview3; -select * from rtest_view3; +select * from rtest_view3 order by a, b; delete from rtest_view3; insert into rtest_view4 select * from rtest_vview4 where 3 > refcount; @@ -476,7 +476,7 @@ select * from rtest_view4 order by a, b; delete from rtest_view4; insert into rtest_view4 select * from rtest_vview5 where a > 2 and refcount = 0; -select * from rtest_view4; +select * from rtest_view4 order by a, b; delete from rtest_view4; -- -- Test for computations in views @@ -705,7 +705,7 @@ do instead nothing; insert into foo values(1); insert into foo values(1001); -select * from foo; +select * from foo order by f1; drop rule foorule on foo; @@ -719,8 +719,8 @@ do instead insert into foo2 values (new.f1); insert into foo values(2); insert into foo values(100); -select * from foo; -select * from foo2; +select * from foo order by f1; +select * from foo2 order by f1; drop rule foorule on foo; drop table foo; @@ -750,14 +750,14 @@ create rule rrule as update cchild set descrip = new.descrip where cchild.pid = old.pid; ); -select * from vview; +select * from vview order by pid; update vview set descrip='test1' where pid=1; -select * from vview; +select * from vview order by pid; update vview set descrip='test2' where pid=2; -select * from vview; +select * from vview order by pid; update vview set descrip='test3' where pid=3; -select * from vview; -select * from cchild; +select * from vview order by pid; +select * from cchild order by pid; drop rule rrule on vview; drop view vview; @@ -790,7 +790,7 @@ CREATE OR REPLACE RULE myrule AS ON INSERT TO ruletest_tbl INSERT INTO ruletest_tbl VALUES (99, 99); -SELECT * FROM ruletest_tbl2; +SELECT * FROM ruletest_tbl2 ORDER BY a; -- Check that rewrite rules splitting one INSERT into multiple -- conditional statements does not disable FK checking. @@ -873,11 +873,11 @@ create view id_ordered as select * from id order by id; create rule update_id_ordered as on update to id_ordered do instead update id set name = new.name where id = old.id; -select * from id_ordered; +select * from id_ordered order by id; update id_ordered set name = 'update 2' where id = 2; update id_ordered set name = 'update 4' where id = 4; update id_ordered set name = 'update 5' where id = 5; -select * from id_ordered; +select * from id_ordered order by id; set client_min_messages to warning; -- suppress cascade notices drop table id cascade; @@ -916,6 +916,6 @@ set constraint_exclusion = on; insert into t1 select * from generate_series(5,19,1) g; update t1 set a = 4 where a = 5; -select * from only t1; -select * from only t1_1; -select * from only t1_2; +select * from only t1 order by 1; +select * from only t1_1 order by 1; +select * from only t1_2 order by 1; diff --git a/src/test/regress/sql/select.sql b/src/test/regress/sql/select.sql index a9ddd5e586..2fce4c776b 100644 --- a/src/test/regress/sql/select.sql +++ b/src/test/regress/sql/select.sql @@ -71,7 +71,7 @@ SET enable_sort TO off; -- -- awk '{if($1<10){print $0;}else{next;}}' onek.data | sort +0n -1 -- -SELECT onek2.* FROM onek2 WHERE onek2.unique1 < 10; +SELECT onek2.* FROM onek2 WHERE onek2.unique1 < 10 ORDER BY unique1; -- -- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 @@ -84,7 +84,8 @@ SELECT onek2.unique1, onek2.stringu1 FROM onek2 -- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 -- SELECT onek2.unique1, onek2.stringu1 FROM onek2 - WHERE onek2.unique1 > 980; + WHERE onek2.unique1 > 980 + ORDER BY unique1 using <; RESET enable_seqscan; RESET enable_bitmapscan; @@ -102,7 +103,8 @@ SELECT two, stringu1, ten, string4 -- awk 'BEGIN{FS=" ";}{if(NF!=2){print $4,$5;}else{print;}}' - stud_emp.data -- -- SELECT name, age FROM person*; ??? check if different -SELECT p.name, p.age FROM person* p; +SELECT p.name, p.age FROM person* p + ORDER BY p.name, p.age; -- -- awk '{print $1,$2;}' person.data | @@ -124,7 +126,8 @@ select foo from (select 'xyzzy',1,null) as foo; -- Test VALUES lists -- select * from onek, (values(147, 'RFAAAA'), (931, 'VJAAAA')) as v (i, j) - WHERE onek.unique1 = v.i and onek.stringu1 = v.j; + WHERE onek.unique1 = v.i and onek.stringu1 = v.j + ORDER BY unique1; -- a more complex case -- looks like we're coding lisp :-) @@ -132,7 +135,8 @@ select * from onek, (values ((select i from (values(10000), (2), (389), (1000), (2000), ((select 10029))) as foo(i) order by i asc limit 1))) bar (i) - where onek.unique1 = bar.i; + where onek.unique1 = bar.i + ORDER BY unique1; -- try VALUES in a subquery select * from onek @@ -146,7 +150,8 @@ VALUES (1,2), (3,4+4), (7,77.7) UNION ALL SELECT 2+2, 57 UNION ALL -TABLE int8_tbl; +TABLE int8_tbl +ORDER BY column1,column2; -- -- Test ORDER BY options @@ -198,7 +203,7 @@ SELECT 1 AS x ORDER BY x; create function sillysrf(int) returns setof int as 'values (1),(10),(2),($1)' language sql immutable; -select sillysrf(42); +select sillysrf(42) order by 1; select sillysrf(-1) order by 1; drop function sillysrf(int); diff --git a/src/test/regress/sql/select_distinct.sql b/src/test/regress/sql/select_distinct.sql index d97c397d06..0358ed55f9 100644 --- a/src/test/regress/sql/select_distinct.sql +++ b/src/test/regress/sql/select_distinct.sql @@ -46,10 +46,10 @@ INSERT INTO DISTTABLE VALUES(3); INSERT INTO DISTTABLE VALUES(NULL); -- basic cases -SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable; -SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable; -SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable; -SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable; +SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable ORDER BY f1; +SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable ORDER BY f1; +SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable ORDER BY f1; +SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable ORDER BY f1; -- check that optimizer constant-folds it properly SELECT 1 IS DISTINCT FROM 2 as "yes"; diff --git a/src/test/regress/sql/select_implicit.sql b/src/test/regress/sql/select_implicit.sql index 4e934da093..6ed9c787cd 100644 --- a/src/test/regress/sql/select_implicit.sql +++ b/src/test/regress/sql/select_implicit.sql @@ -38,7 +38,7 @@ SELECT test_missing_target.b, count(*) FROM test_missing_target GROUP BY b ORDER BY b; -- w/o existing GROUP BY target -SELECT c FROM test_missing_target ORDER BY a; +SELECT c FROM test_missing_target ORDER BY c; -- w/o existing ORDER BY target SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b desc; @@ -90,7 +90,7 @@ SELECT count(*) INTO TABLE test_missing_target2 FROM test_missing_target x, test_missing_target y WHERE x.a = y.a GROUP BY x.b ORDER BY x.b; -SELECT * FROM test_missing_target2; +SELECT * FROM test_missing_target2 ORDER BY 1; -- Functions and expressions @@ -146,7 +146,7 @@ SELECT count(x.b) INTO TABLE test_missing_target3 FROM test_missing_target x, test_missing_target y WHERE x.a = y.a GROUP BY x.b/2 ORDER BY x.b/2; -SELECT * FROM test_missing_target3; +SELECT * FROM test_missing_target3 ORDER BY 1; -- Cleanup DROP TABLE test_missing_target; diff --git a/src/test/regress/sql/select_views.sql b/src/test/regress/sql/select_views.sql index dd1837f797..894eec6f34 100644 --- a/src/test/regress/sql/select_views.sql +++ b/src/test/regress/sql/select_views.sql @@ -3,7 +3,7 @@ -- test the views defined in CREATE_VIEWS -- -SELECT * FROM street; +SELECT * FROM street ORDER BY 1,3; SELECT name, #thepath FROM iexit ORDER BY 1, 2; diff --git a/src/test/regress/sql/sequence.sql b/src/test/regress/sql/sequence.sql index f3eb81ec13..b9a04c0838 100644 --- a/src/test/regress/sql/sequence.sql +++ b/src/test/regress/sql/sequence.sql @@ -9,7 +9,7 @@ INSERT INTO serialTest VALUES ('bar'); INSERT INTO serialTest VALUES ('force', 100); INSERT INTO serialTest VALUES ('wrong', NULL); -SELECT * FROM serialTest; +SELECT * FROM serialTest ORDER BY f1, f2; -- basic sequence operations using both text and oid references CREATE SEQUENCE sequence_test; @@ -41,7 +41,7 @@ DROP SEQUENCE foo_seq_new; -- renaming serial sequences ALTER TABLE serialtest_f2_seq RENAME TO serialtest_f2_foo; INSERT INTO serialTest VALUES ('more'); -SELECT * FROM serialTest; +SELECT * FROM serialTest ORDER BY f1, f2; -- -- Check dependencies of serial and ordinary sequences diff --git a/src/test/regress/sql/strings.sql b/src/test/regress/sql/strings.sql index 681a0e1e62..aeb92e12ed 100644 --- a/src/test/regress/sql/strings.sql +++ b/src/test/regress/sql/strings.sql @@ -48,25 +48,25 @@ RESET standard_conforming_strings; -- E021-10 implicit casting among the character data types -- -SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL; +SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL ORDER BY f1; -SELECT CAST(f1 AS text) AS "text(varchar)" FROM VARCHAR_TBL; +SELECT CAST(f1 AS text) AS "text(varchar)" FROM VARCHAR_TBL ORDER BY f1; SELECT CAST(name 'namefield' AS text) AS "text(name)"; -- since this is an explicit cast, it should truncate w/o error: -SELECT CAST(f1 AS char(10)) AS "char(text)" FROM TEXT_TBL; +SELECT CAST(f1 AS char(10)) AS "char(text)" FROM TEXT_TBL ORDER BY f1; -- note: implicit-cast case is tested in char.sql -SELECT CAST(f1 AS char(20)) AS "char(text)" FROM TEXT_TBL; +SELECT CAST(f1 AS char(20)) AS "char(text)" FROM TEXT_TBL ORDER BY f1; -SELECT CAST(f1 AS char(10)) AS "char(varchar)" FROM VARCHAR_TBL; +SELECT CAST(f1 AS char(10)) AS "char(varchar)" FROM VARCHAR_TBL ORDER BY f1; SELECT CAST(name 'namefield' AS char(10)) AS "char(name)"; -SELECT CAST(f1 AS varchar) AS "varchar(text)" FROM TEXT_TBL; +SELECT CAST(f1 AS varchar) AS "varchar(text)" FROM TEXT_TBL ORDER BY f1; -SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL; +SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL ORDER BY f1; SELECT CAST(name 'namefield' AS varchar) AS "varchar(name)"; diff --git a/src/test/regress/sql/subselect.sql b/src/test/regress/sql/subselect.sql index fd8d5df3a0..41764b22c1 100644 --- a/src/test/regress/sql/subselect.sql +++ b/src/test/regress/sql/subselect.sql @@ -25,45 +25,52 @@ INSERT INTO SUBSELECT_TBL VALUES (3, 3, 3); INSERT INTO SUBSELECT_TBL VALUES (6, 7, 8); INSERT INTO SUBSELECT_TBL VALUES (8, 9, NULL); -SELECT '' AS eight, * FROM SUBSELECT_TBL; +SELECT '' AS eight, * FROM SUBSELECT_TBL ORDER BY f1, f2, f3; -- Uncorrelated subselects SELECT '' AS two, f1 AS "Constant Select" FROM SUBSELECT_TBL - WHERE f1 IN (SELECT 1); + WHERE f1 IN (SELECT 1) ORDER BY 2; SELECT '' AS six, f1 AS "Uncorrelated Field" FROM SUBSELECT_TBL - WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL); + WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL) + ORDER BY 2; SELECT '' AS six, f1 AS "Uncorrelated Field" FROM SUBSELECT_TBL WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL WHERE - f2 IN (SELECT f1 FROM SUBSELECT_TBL)); + f2 IN (SELECT f1 FROM SUBSELECT_TBL)) + ORDER BY 2; SELECT '' AS three, f1, f2 FROM SUBSELECT_TBL WHERE (f1, f2) NOT IN (SELECT f2, CAST(f3 AS int4) FROM SUBSELECT_TBL - WHERE f3 IS NOT NULL); + WHERE f3 IS NOT NULL) + ORDER BY f1, f2; -- Correlated subselects SELECT '' AS six, f1 AS "Correlated Field", f2 AS "Second Field" FROM SUBSELECT_TBL upper - WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL WHERE f1 = upper.f1); + WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL WHERE f1 = upper.f1) + ORDER BY f1, f2; SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field" FROM SUBSELECT_TBL upper WHERE f1 IN - (SELECT f2 FROM SUBSELECT_TBL WHERE CAST(upper.f2 AS float) = f3); + (SELECT f2 FROM SUBSELECT_TBL WHERE CAST(upper.f2 AS float) = f3) + ORDER BY 2, 3; SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field" FROM SUBSELECT_TBL upper WHERE f3 IN (SELECT upper.f1 + f2 FROM SUBSELECT_TBL - WHERE f2 = CAST(f3 AS integer)); + WHERE f2 = CAST(f3 AS integer)) + ORDER BY 2, 3; SELECT '' AS five, f1 AS "Correlated Field" FROM SUBSELECT_TBL WHERE (f1, f2) IN (SELECT f2, CAST(f3 AS int4) FROM SUBSELECT_TBL - WHERE f3 IS NOT NULL); + WHERE f3 IS NOT NULL) + ORDER BY 2; -- -- Use some existing tables in the regression test @@ -72,7 +79,8 @@ SELECT '' AS five, f1 AS "Correlated Field" SELECT '' AS eight, ss.f1 AS "Correlated Field", ss.f3 AS "Second Field" FROM SUBSELECT_TBL ss WHERE f1 NOT IN (SELECT f1+1 FROM INT4_TBL - WHERE f1 != ss.f1 AND f1 < 2147483647); + WHERE f1 != ss.f1 AND f1 < 2147483647) + ORDER BY 2, 3; select q1, float8(count(*)) / (select count(*) from int8_tbl) from int8_tbl group by q1 order by q1; @@ -188,7 +196,8 @@ END) AS "Status", END) AS "Status_OK" FROM orderstest ord; -SELECT * FROM orders_view; +SELECT * FROM orders_view +ORDER BY approver_ref, po_ref, ordercancelled; DROP TABLE orderstest cascade; @@ -235,7 +244,8 @@ select * from shipped_view; select f1, ss1 as relabel from (select *, (select sum(f1) from int4_tbl b where f1 >= a.f1) as ss1 - from int4_tbl a) ss; + from int4_tbl a) ss + ORDER BY f1, relabel; -- -- Test cases involving PARAM_EXEC parameters and min/max index optimizations. @@ -268,10 +278,12 @@ create temp table float_table (float_col float8); insert into float_table values (1), (2), (3); select * from float_table - where float_col in (select num_col from numeric_table); + where float_col in (select num_col from numeric_table) + ORDER BY float_col; select * from numeric_table - where num_col in (select float_col from float_table); + where num_col in (select float_col from float_table) + ORDER BY num_col; -- -- Test case for bug #4290: bogus calculation of subplan param sets @@ -297,7 +309,8 @@ insert into tc values(2,2); select ( select min(tb.id) from tb where tb.aval = (select ta.val from ta where ta.id = tc.aid) ) as min_tb_id -from tc; +from tc +ORDER BY min_tb_id; -- -- Test case for 8.3 "failed to locate grouping columns" bug diff --git a/src/test/regress/sql/tablespace.sql b/src/test/regress/sql/tablespace.sql new file mode 100644 index 0000000000..09682d7346 --- /dev/null +++ b/src/test/regress/sql/tablespace.sql @@ -0,0 +1,54 @@ +-- create a tablespace we can use +CREATE TABLESPACE testspace LOCATION '/Users/masonsharp/dev/pgxc/postgres-xc/src/test/regress/testtablespace'; + +-- create a schema we can use +CREATE SCHEMA testschema; + +-- try a table +CREATE TABLE testschema.foo (i int) TABLESPACE testspace; +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'foo'; + +INSERT INTO testschema.foo VALUES(1); +INSERT INTO testschema.foo VALUES(2); + +-- tables from dynamic sources +CREATE TABLE testschema.asselect TABLESPACE testspace AS SELECT 1; +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'asselect'; + +PREPARE selectsource(int) AS SELECT $1; +CREATE TABLE testschema.asexecute TABLESPACE testspace + AS EXECUTE selectsource(2); +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'asexecute'; + +-- index +CREATE INDEX foo_idx on testschema.foo(i) TABLESPACE testspace; +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'foo_idx'; + +-- let's try moving a table from one place to another +CREATE TABLE testschema.atable AS VALUES (1), (2); +CREATE UNIQUE INDEX anindex ON testschema.atable(column1); + +ALTER TABLE testschema.atable SET TABLESPACE testspace; +ALTER INDEX testschema.anindex SET TABLESPACE testspace; + +INSERT INTO testschema.atable VALUES(3); -- ok +INSERT INTO testschema.atable VALUES(1); -- fail (checks index) +SELECT COUNT(*) FROM testschema.atable; -- checks heap + +-- Will fail with bad path +CREATE TABLESPACE badspace LOCATION '/no/such/location'; + +-- No such tablespace +CREATE TABLE bar (i int) TABLESPACE nosuchspace; + +-- Fail, not empty +DROP TABLESPACE testspace; + +DROP SCHEMA testschema CASCADE; + +-- Should succeed +DROP TABLESPACE testspace; diff --git a/src/test/regress/sql/temp.sql b/src/test/regress/sql/temp.sql index 5183c727f5..aed4be86cf 100644 --- a/src/test/regress/sql/temp.sql +++ b/src/test/regress/sql/temp.sql @@ -59,7 +59,7 @@ BEGIN; INSERT INTO temptest VALUES (1); INSERT INTO temptest VALUES (2); -SELECT * FROM temptest; +SELECT * FROM temptest ORDER BY 1; COMMIT; SELECT * FROM temptest; @@ -85,7 +85,7 @@ CREATE TEMP TABLE temptest(col int) ON COMMIT DROP; INSERT INTO temptest VALUES (1); INSERT INTO temptest VALUES (2); -SELECT * FROM temptest; +SELECT * FROM temptest ORDER BY 1; COMMIT; SELECT * FROM temptest; diff --git a/src/test/regress/sql/text.sql b/src/test/regress/sql/text.sql index b739e56e2d..bc7a7774d1 100644 --- a/src/test/regress/sql/text.sql +++ b/src/test/regress/sql/text.sql @@ -11,7 +11,7 @@ CREATE TABLE TEXT_TBL (f1 text); INSERT INTO TEXT_TBL VALUES ('doh!'); INSERT INTO TEXT_TBL VALUES ('hi de ho neighbor'); -SELECT '' AS two, * FROM TEXT_TBL; +SELECT '' AS two, * FROM TEXT_TBL ORDER BY f1; -- As of 8.3 we have removed most implicit casts to text, so that for example -- this no longer works: diff --git a/src/test/regress/sql/time.sql b/src/test/regress/sql/time.sql index 99a1562ed2..67a92091d6 100644 --- a/src/test/regress/sql/time.sql +++ b/src/test/regress/sql/time.sql @@ -20,15 +20,15 @@ INSERT INTO TIME_TBL VALUES ('2003-07-07 15:36:39 America/New_York'); INSERT INTO TIME_TBL VALUES ('15:36:39 America/New_York'); -SELECT f1 AS "Time" FROM TIME_TBL; +SELECT f1 AS "Time" FROM TIME_TBL ORDER BY f1; -SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07'; +SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07' ORDER BY f1; -SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07'; +SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07' ORDER BY f1; -SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00'; +SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00' ORDER BY f1; -SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00'; +SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00' ORDER BY f1; -- -- TIME simple math @@ -39,4 +39,4 @@ SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00'; -- and do the rest of the testing in horology.sql -- where we do mixed-type arithmetic. - thomas 2000-12-02 -SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL; +SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL ORDER BY f1; diff --git a/src/test/regress/sql/timestamp.sql b/src/test/regress/sql/timestamp.sql index 790ade3137..acd2812daa 100644 --- a/src/test/regress/sql/timestamp.sql +++ b/src/test/regress/sql/timestamp.sql @@ -141,29 +141,29 @@ INSERT INTO TIMESTAMP_TBL VALUES ('Jan 01 17:32:01 2001'); INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 -0097'); INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 5097 BC'); -SELECT '' AS "64", d1 FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 FROM TIMESTAMP_TBL ORDER BY d1; -- Demonstrate functions and operators SELECT '' AS "48", d1 FROM TIMESTAMP_TBL - WHERE d1 > timestamp without time zone '1997-01-02'; + WHERE d1 > timestamp without time zone '1997-01-02' ORDER BY d1; SELECT '' AS "15", d1 FROM TIMESTAMP_TBL WHERE d1 < timestamp without time zone '1997-01-02'; SELECT '' AS one, d1 FROM TIMESTAMP_TBL - WHERE d1 = timestamp without time zone '1997-01-02'; + WHERE d1 = timestamp without time zone '1997-01-02' ORDER BY d1; SELECT '' AS "63", d1 FROM TIMESTAMP_TBL - WHERE d1 != timestamp without time zone '1997-01-02'; + WHERE d1 != timestamp without time zone '1997-01-02' ORDER BY d1; SELECT '' AS "16", d1 FROM TIMESTAMP_TBL - WHERE d1 <= timestamp without time zone '1997-01-02'; + WHERE d1 <= timestamp without time zone '1997-01-02' ORDER BY d1; SELECT '' AS "49", d1 FROM TIMESTAMP_TBL - WHERE d1 >= timestamp without time zone '1997-01-02'; + WHERE d1 >= timestamp without time zone '1997-01-02' ORDER BY d1; SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff - FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp '2004-02-29 15:44:17.71393' ) AS week_trunc; @@ -171,54 +171,54 @@ SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp '2004-02-29 15:44:17 SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff FROM TIMESTAMP_TBL WHERE d1 BETWEEN timestamp without time zone '1902-01-01' - AND timestamp without time zone '2038-01-01'; + AND timestamp without time zone '2038-01-01' ORDER BY d1; SELECT '' AS "54", d1 as "timestamp", date_part( 'year', d1) AS year, date_part( 'month', d1) AS month, date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour, date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second - FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; SELECT '' AS "54", d1 as "timestamp", date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec, date_part( 'usec', d1) AS usec - FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; SELECT '' AS "54", d1 as "timestamp", date_part( 'isoyear', d1) AS isoyear, date_part( 'week', d1) AS week, date_part( 'dow', d1) AS dow - FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; -- TO_CHAR() SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth FMRM') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM FMWW FMDDD FMDD FMD FMJ') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between quote marks\\""') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_9, to_char(d1, 'YYYY A.D. YYYY a.d. YYYY bc HH:MI:SS P.M. HH:MI:SS p.m. HH:MI:SS pm') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') - FROM TIMESTAMP_TBL; + FROM TIMESTAMP_TBL ORDER BY d1; diff --git a/src/test/regress/sql/timestamptz.sql b/src/test/regress/sql/timestamptz.sql index e74691cc04..3fdaa7cb00 100644 --- a/src/test/regress/sql/timestamptz.sql +++ b/src/test/regress/sql/timestamptz.sql @@ -164,79 +164,79 @@ SELECT '' AS "64", d1 FROM TIMESTAMPTZ_TBL; -- Demonstrate functions and operators SELECT '' AS "48", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 > timestamp with time zone '1997-01-02'; + WHERE d1 > timestamp with time zone '1997-01-02' ORDER BY d1; SELECT '' AS "15", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 < timestamp with time zone '1997-01-02'; + WHERE d1 < timestamp with time zone '1997-01-02' ORDER BY d1; SELECT '' AS one, d1 FROM TIMESTAMPTZ_TBL - WHERE d1 = timestamp with time zone '1997-01-02'; + WHERE d1 = timestamp with time zone '1997-01-02' ORDER BY d1; SELECT '' AS "63", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 != timestamp with time zone '1997-01-02'; + WHERE d1 != timestamp with time zone '1997-01-02' ORDER BY d1; SELECT '' AS "16", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 <= timestamp with time zone '1997-01-02'; + WHERE d1 <= timestamp with time zone '1997-01-02' ORDER BY d1; SELECT '' AS "49", d1 FROM TIMESTAMPTZ_TBL - WHERE d1 >= timestamp with time zone '1997-01-02'; + WHERE d1 >= timestamp with time zone '1997-01-02' ORDER BY d1; SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff - FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp with time zone '2004-02-29 15:44:17.71393' ) AS week_trunc; -- Test casting within a BETWEEN qualifier SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff FROM TIMESTAMPTZ_TBL - WHERE d1 BETWEEN timestamp with time zone '1902-01-01' AND timestamp with time zone '2038-01-01'; + WHERE d1 BETWEEN timestamp with time zone '1902-01-01' AND timestamp with time zone '2038-01-01' ORDER BY d1; SELECT '' AS "54", d1 as timestamptz, date_part( 'year', d1) AS year, date_part( 'month', d1) AS month, date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour, date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second - FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; SELECT '' AS "54", d1 as timestamptz, date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec, date_part( 'usec', d1) AS usec - FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; SELECT '' AS "54", d1 as timestamptz, date_part( 'isoyear', d1) AS isoyear, date_part( 'week', d1) AS week, date_part( 'dow', d1) AS dow - FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01' ORDER BY d1; -- TO_CHAR() SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth FMRM') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM FMWW FMDDD FMDD FMD FMJ') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between quote marks\\""') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_9, to_char(d1, 'YYYY A.D. YYYY a.d. YYYY bc HH:MI:SS P.M. HH:MI:SS p.m. HH:MI:SS pm') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') - FROM TIMESTAMPTZ_TBL; + FROM TIMESTAMPTZ_TBL ORDER BY d1; diff --git a/src/test/regress/sql/timetz.sql b/src/test/regress/sql/timetz.sql index c41686a5e2..1dde3acce9 100644 --- a/src/test/regress/sql/timetz.sql +++ b/src/test/regress/sql/timetz.sql @@ -20,15 +20,15 @@ INSERT INTO TIMETZ_TBL VALUES ('2003-07-07 15:36:39 America/New_York'); -- this should fail (the timezone offset is not known) INSERT INTO TIMETZ_TBL VALUES ('15:36:39 America/New_York'); -SELECT f1 AS "Time TZ" FROM TIMETZ_TBL; +SELECT f1 AS "Time TZ" FROM TIMETZ_TBL ORDER BY f1; -SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07'; +SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07' ORDER BY f1; -SELECT f1 AS "Seven" FROM TIMETZ_TBL WHERE f1 > '05:06:07-07'; +SELECT f1 AS "Seven" FROM TIMETZ_TBL WHERE f1 > '05:06:07-07' ORDER BY f1; -SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07'; +SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07' ORDER BY f1; -SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; +SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07' ORDER BY f1; -- -- TIME simple math @@ -39,4 +39,4 @@ SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; -- and do the rest of the testing in horology.sql -- where we do mixed-type arithmetic. - thomas 2000-12-02 -SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL; +SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL ORDER BY f1; diff --git a/src/test/regress/sql/tinterval.sql b/src/test/regress/sql/tinterval.sql index 5abdb6d106..37de949341 100644 --- a/src/test/regress/sql/tinterval.sql +++ b/src/test/regress/sql/tinterval.sql @@ -32,43 +32,43 @@ INSERT INTO TINTERVAL_TBL (f1) -- test tinterval operators -SELECT '' AS five, * FROM TINTERVAL_TBL; +SELECT '' AS five, * FROM TINTERVAL_TBL ORDER BY f1; -- length == SELECT '' AS one, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #= '@ 1 months'; + WHERE t.f1 #= '@ 1 months' ORDER BY f1; -- length <> SELECT '' AS three, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #<> '@ 1 months'; + WHERE t.f1 #<> '@ 1 months' ORDER BY f1; -- length < SELECT '' AS zero, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #< '@ 1 month'; + WHERE t.f1 #< '@ 1 month' ORDER BY f1; -- length <= SELECT '' AS one, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #<= '@ 1 month'; + WHERE t.f1 #<= '@ 1 month' ORDER BY f1; -- length > SELECT '' AS three, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #> '@ 1 year'; + WHERE t.f1 #> '@ 1 year' ORDER BY f1; -- length >= SELECT '' AS three, t.* FROM TINTERVAL_TBL t - WHERE t.f1 #>= '@ 3 years'; + WHERE t.f1 #>= '@ 3 years' ORDER BY f1; -- overlaps SELECT '' AS three, t1.* FROM TINTERVAL_TBL t1 WHERE t1.f1 && - tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]'; + tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]' ORDER BY f1; SELECT '' AS five, t1.f1, t2.f1 FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2 diff --git a/src/test/regress/sql/transactions.sql b/src/test/regress/sql/transactions.sql index c670ae18d0..4a1b368ebd 100644 --- a/src/test/regress/sql/transactions.sql +++ b/src/test/regress/sql/transactions.sql @@ -31,7 +31,7 @@ ABORT; SELECT oid FROM pg_class WHERE relname = 'disappear'; -- should have members again -SELECT * FROM aggtest; +SELECT * FROM aggtest order by a, b; -- Read-only tests @@ -96,8 +96,8 @@ BEGIN; RELEASE SAVEPOINT three; INSERT INTO foo VALUES (3); COMMIT; -SELECT * FROM foo; -- should have 1 and 3 -SELECT * FROM barbaz; -- should have 1 +SELECT * FROM foo ORDER BY a; -- should have 1 and 3 +SELECT * FROM barbaz ORDER BY a; -- should have 1 -- test whole-tree commit BEGIN; @@ -116,7 +116,7 @@ BEGIN; ROLLBACK TO SAVEPOINT five; COMMIT; COMMIT; -- should not be in a transaction block -SELECT * FROM savepoints; +SELECT * FROM savepoints ORDER BY 1; -- test whole-tree rollback BEGIN; @@ -130,7 +130,7 @@ BEGIN; ROLLBACK; COMMIT; -- should not be in a transaction block -SELECT * FROM savepoints; +SELECT * FROM savepoints ORDER BY 1; -- test whole-tree commit on an aborted subtransaction BEGIN; @@ -139,7 +139,7 @@ BEGIN; INSERT INTO savepoints VALUES (5); SELECT foo; COMMIT; -SELECT * FROM savepoints; +SELECT * FROM savepoints ORDER BY a; BEGIN; INSERT INTO savepoints VALUES (6); @@ -160,7 +160,7 @@ BEGIN; ROLLBACK TO SAVEPOINT one; INSERT INTO savepoints VALUES (11); COMMIT; -SELECT a FROM savepoints WHERE a in (9, 10, 11); +SELECT a FROM savepoints WHERE a in (9, 10, 11) ORDER BY a; -- rows 9 and 11 should have been created by different xacts SELECT a.xmin = b.xmin FROM savepoints a, savepoints b WHERE a.a=9 AND b.a=11; @@ -177,7 +177,7 @@ BEGIN; SAVEPOINT three; INSERT INTO savepoints VALUES (17); COMMIT; -SELECT a FROM savepoints WHERE a BETWEEN 12 AND 17; +SELECT a FROM savepoints WHERE a BETWEEN 12 AND 17 ORDER BY a; BEGIN; INSERT INTO savepoints VALUES (18); @@ -190,7 +190,7 @@ BEGIN; ROLLBACK TO SAVEPOINT one; INSERT INTO savepoints VALUES (22); COMMIT; -SELECT a FROM savepoints WHERE a BETWEEN 18 AND 22; +SELECT a FROM savepoints WHERE a BETWEEN 18 AND 22 ORDER BY a; DROP TABLE savepoints; @@ -237,14 +237,14 @@ COMMIT; -- also check that they don't see commits of concurrent transactions, but -- that's a mite hard to do within the limitations of pg_regress.) -- -select * from xacttest; +select * from xacttest order by a, b; create or replace function max_xacttest() returns smallint language sql as 'select max(a) from xacttest' stable; begin; update xacttest set a = max_xacttest() + 10 where a > 0; -select * from xacttest; +select * from xacttest order by a, b; rollback; -- But a volatile function can see the partial results of the calling query @@ -253,7 +253,7 @@ create or replace function max_xacttest() returns smallint language sql as begin; update xacttest set a = max_xacttest() + 10 where a > 0; -select * from xacttest; +select * from xacttest order by a, b; rollback; -- Now the same test with plpgsql (since it depends on SPI which is different) @@ -262,7 +262,7 @@ create or replace function max_xacttest() returns smallint language plpgsql as begin; update xacttest set a = max_xacttest() + 10 where a > 0; -select * from xacttest; +select * from xacttest order by a, b; rollback; create or replace function max_xacttest() returns smallint language plpgsql as @@ -270,7 +270,7 @@ create or replace function max_xacttest() returns smallint language plpgsql as begin; update xacttest set a = max_xacttest() + 10 where a > 0; -select * from xacttest; +select * from xacttest order by a, b; rollback; diff --git a/src/test/regress/sql/triggers.sql b/src/test/regress/sql/triggers.sql index 8530030ef8..3d66a421a2 100644 --- a/src/test/regress/sql/triggers.sql +++ b/src/test/regress/sql/triggers.sql @@ -156,32 +156,32 @@ insert into tttest values (1, 1, null); insert into tttest values (2, 2, null); insert into tttest values (3, 3, 0); -select * from tttest; +select * from tttest order by 1,2,3,4; delete from tttest where price_id = 2; -select * from tttest; +select * from tttest order by 1,2,3,4; -- what do we see ? -- get current prices -select * from tttest where price_off = 999999; +select * from tttest where price_off = 999999 order by 1,2,3,4; -- change price for price_id == 3 update tttest set price_val = 30 where price_id = 3; -select * from tttest; +select * from tttest order by 1,2,3,4; -- now we want to change pric_id in ALL tuples -- this gets us not what we need update tttest set price_id = 5 where price_id = 3; -select * from tttest; +select * from tttest order by 1,2,3,4; -- restore data as before last update: select set_ttdummy(0); delete from tttest where price_id = 5; update tttest set price_off = 999999 where price_val = 30; -select * from tttest; +select * from tttest order by 1,2,3,4; -- and try change price_id now! update tttest set price_id = 5 where price_id = 3; -select * from tttest; +select * from tttest order by 1,2,3,4; -- isn't it what we need ? select set_ttdummy(1); @@ -193,11 +193,11 @@ update tttest set price_on = -1 where price_id = 1; -- try in this way select set_ttdummy(0); update tttest set price_on = -1 where price_id = 1; -select * from tttest; +select * from tttest order by 1,2,3,4; -- isn't it what we need ? -- get price for price_id == 5 as it was @ "date" 35 -select * from tttest where price_on <= 35 and price_off > 35 and price_id = 5; +select * from tttest where price_on <= 35 and price_off > 35 and price_id = 5 order by 1,2,3,4; drop table tttest; drop sequence ttdummy_seq; @@ -285,13 +285,13 @@ insert into trigtest default values; insert into trigtest2 values(1); insert into trigtest2 values(2); delete from trigtest where i=2; -select * from trigtest2; +select * from trigtest2 order by 1; alter table trigtest disable trigger all; delete from trigtest where i=1; -select * from trigtest2; +select * from trigtest2 order by 1; -- ensure we still insert, even when all triggers are disabled insert into trigtest default values; -select * from trigtest; +select * from trigtest order by 1; drop table trigtest2; drop table trigtest; @@ -457,9 +457,9 @@ UPDATE min_updates_test_oids SET f3 = 2 WHERE f3 is null; \set QUIET true -SELECT * FROM min_updates_test; +SELECT * FROM min_updates_test ORDER BY 1,2,3; -SELECT * FROM min_updates_test_oids; +SELECT * FROM min_updates_test_oids ORDER BY 1,2,3; DROP TABLE min_updates_test; diff --git a/src/test/regress/sql/truncate.sql b/src/test/regress/sql/truncate.sql index b348e94c48..8f24756bae 100644 --- a/src/test/regress/sql/truncate.sql +++ b/src/test/regress/sql/truncate.sql @@ -2,17 +2,17 @@ CREATE TABLE truncate_a (col1 integer primary key); INSERT INTO truncate_a VALUES (1); INSERT INTO truncate_a VALUES (2); -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY 1; -- Roll truncate back BEGIN; TRUNCATE truncate_a; ROLLBACK; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY 1; -- Commit the truncate this time BEGIN; TRUNCATE truncate_a; COMMIT; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY 1; -- Test foreign-key checks CREATE TABLE trunc_b (a int REFERENCES truncate_a); @@ -94,35 +94,35 @@ CREATE TABLE trunc_faa (col3 text) INHERITS (trunc_fa); INSERT INTO trunc_faa VALUES (5, 'five', 'FIVE'); BEGIN; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; TRUNCATE trunc_f; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; ROLLBACK; BEGIN; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; TRUNCATE ONLY trunc_f; -SELECT * FROM trunc_f; +SELECT * FROM trunc_f ORDER BY 1; ROLLBACK; BEGIN; -SELECT * FROM trunc_f; -SELECT * FROM trunc_fa; -SELECT * FROM trunc_faa; +SELECT * FROM trunc_f ORDER BY 1; +SELECT * FROM trunc_fa ORDER BY 1, 2; +SELECT * FROM trunc_faa ORDER BY 1, 2; TRUNCATE ONLY trunc_fb, ONLY trunc_fa; -SELECT * FROM trunc_f; -SELECT * FROM trunc_fa; -SELECT * FROM trunc_faa; +SELECT * FROM trunc_f ORDER BY 1; +SELECT * FROM trunc_fa ORDER BY 1, 2; +SELECT * FROM trunc_faa ORDER BY 1, 2; ROLLBACK; BEGIN; -SELECT * FROM trunc_f; -SELECT * FROM trunc_fa; -SELECT * FROM trunc_faa; +SELECT * FROM trunc_f ORDER BY 1; +SELECT * FROM trunc_fa ORDER BY 1, 2; +SELECT * FROM trunc_faa ORDER BY 1, 2; TRUNCATE ONLY trunc_fb, trunc_fa; -SELECT * FROM trunc_f; -SELECT * FROM trunc_fa; -SELECT * FROM trunc_faa; +SELECT * FROM trunc_f ORDER BY 1; +SELECT * FROM trunc_fa ORDER BY 1, 2; +SELECT * FROM trunc_faa ORDER BY 1, 2; ROLLBACK; DROP TABLE trunc_f CASCADE; @@ -188,19 +188,19 @@ ALTER SEQUENCE truncate_a_id1 OWNED BY truncate_a.id1; INSERT INTO truncate_a DEFAULT VALUES; INSERT INTO truncate_a DEFAULT VALUES; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY id; TRUNCATE truncate_a; INSERT INTO truncate_a DEFAULT VALUES; INSERT INTO truncate_a DEFAULT VALUES; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY id; TRUNCATE truncate_a RESTART IDENTITY; INSERT INTO truncate_a DEFAULT VALUES; INSERT INTO truncate_a DEFAULT VALUES; -SELECT * FROM truncate_a; +SELECT * FROM truncate_a ORDER BY id; DROP TABLE truncate_a; diff --git a/src/test/regress/sql/tsearch.sql b/src/test/regress/sql/tsearch.sql index 3467b1f6de..1aea2b7baa 100644 --- a/src/test/regress/sql/tsearch.sql +++ b/src/test/regress/sql/tsearch.sql @@ -87,11 +87,11 @@ SELECT * FROM ts_stat('SELECT a FROM test_tsvector', 'AB') ORDER BY ndoc DESC, n SELECT ts_lexize('english_stem', 'skies'); SELECT ts_lexize('english_stem', 'identity'); -SELECT * FROM ts_token_type('default'); +SELECT * FROM ts_token_type('default') ORDER BY tokid; SELECT * FROM ts_parse('default', '345 [email protected] '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 [email protected] qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>"> /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 -<i <b> wow < jqw <> qwerty'); +<i <b> wow < jqw <> qwerty') ORDER BY tokid,token; SELECT to_tsvector('english', '345 [email protected] '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 [email protected] qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>"> /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 @@ -103,7 +103,7 @@ SELECT length(to_tsvector('english', '345 [email protected] '' http://www.com/ http://ae -- ts_debug -SELECT * from ts_debug('english', '<myns:foo-bar_baz.blurfl>abc&nm1;def©ghiõjkl</myns:foo-bar_baz.blurfl>'); +SELECT * from ts_debug('english', '<myns:foo-bar_baz.blurfl>abc&nm1;def©ghiõjkl</myns:foo-bar_baz.blurfl>') ORDER BY alias, description, token; -- to_tsquery @@ -369,6 +369,6 @@ insert into pendtest values (to_tsvector('Lore ipsam')); insert into pendtest values (to_tsvector('Lore ipsum')); select * from pendtest where 'ipsu:*'::tsquery @@ ts; select * from pendtest where 'ipsa:*'::tsquery @@ ts; -select * from pendtest where 'ips:*'::tsquery @@ ts; +select * from pendtest where 'ips:*'::tsquery @@ ts ORDER BY 1; select * from pendtest where 'ipt:*'::tsquery @@ ts; select * from pendtest where 'ipi:*'::tsquery @@ ts; diff --git a/src/test/regress/sql/union.sql b/src/test/regress/sql/union.sql index 81e19d165c..dfca25fdfd 100644 --- a/src/test/regress/sql/union.sql +++ b/src/test/regress/sql/union.sql @@ -4,41 +4,41 @@ -- Simple UNION constructs -SELECT 1 AS two UNION SELECT 2; +SELECT 1 AS two UNION SELECT 2 ORDER BY 1; -SELECT 1 AS one UNION SELECT 1; +SELECT 1 AS one UNION SELECT 1 ORDER BY 1; -SELECT 1 AS two UNION ALL SELECT 2; +SELECT 1 AS two UNION ALL SELECT 2 ORDER BY 1; -SELECT 1 AS two UNION ALL SELECT 1; +SELECT 1 AS two UNION ALL SELECT 1 ORDER BY 1; -SELECT 1 AS three UNION SELECT 2 UNION SELECT 3; +SELECT 1 AS three UNION SELECT 2 UNION SELECT 3 ORDER BY 1; -SELECT 1 AS two UNION SELECT 2 UNION SELECT 2; +SELECT 1 AS two UNION SELECT 2 UNION SELECT 2 ORDER BY 1; -SELECT 1 AS three UNION SELECT 2 UNION ALL SELECT 2; +SELECT 1 AS three UNION SELECT 2 UNION ALL SELECT 2 ORDER BY 1; -SELECT 1.1 AS two UNION SELECT 2.2; +SELECT 1.1 AS two UNION SELECT 2.2 ORDER BY 1; -- Mixed types -SELECT 1.1 AS two UNION SELECT 2; +SELECT 1.1 AS two UNION SELECT 2 ORDER BY 1; -SELECT 1 AS two UNION SELECT 2.2; +SELECT 1 AS two UNION SELECT 2.2 ORDER BY 1; -SELECT 1 AS one UNION SELECT 1.0::float8; +SELECT 1 AS one UNION SELECT 1.0::float8 ORDER BY 1; -SELECT 1.1 AS two UNION ALL SELECT 2; +SELECT 1.1 AS two UNION ALL SELECT 2 ORDER BY 1; -SELECT 1.0::float8 AS two UNION ALL SELECT 1; +SELECT 1.0::float8 AS two UNION ALL SELECT 1 ORDER BY 1; -SELECT 1.1 AS three UNION SELECT 2 UNION SELECT 3; +SELECT 1.1 AS three UNION SELECT 2 UNION SELECT 3 ORDER BY 1; SELECT 1.1::float8 AS two UNION SELECT 2 UNION SELECT 2.0::float8 ORDER BY 1; -SELECT 1.1 AS three UNION SELECT 2 UNION ALL SELECT 2; +SELECT 1.1 AS three UNION SELECT 2 UNION ALL SELECT 2 ORDER BY 1; -SELECT 1.1 AS two UNION (SELECT 2 UNION ALL SELECT 2); +SELECT 1.1 AS two UNION (SELECT 2 UNION ALL SELECT 2) ORDER BY 1; -- -- Try testing from tables... @@ -51,7 +51,8 @@ ORDER BY 1; SELECT f1 AS ten FROM FLOAT8_TBL UNION ALL -SELECT f1 FROM FLOAT8_TBL; +SELECT f1 FROM FLOAT8_TBL +ORDER BY 1; SELECT f1 AS nine FROM FLOAT8_TBL UNION @@ -60,13 +61,15 @@ ORDER BY 1; SELECT f1 AS ten FROM FLOAT8_TBL UNION ALL -SELECT f1 FROM INT4_TBL; +SELECT f1 FROM INT4_TBL +ORDER BY 1; SELECT f1 AS five FROM FLOAT8_TBL WHERE f1 BETWEEN -1e6 AND 1e6 UNION SELECT f1 FROM INT4_TBL - WHERE f1 BETWEEN 0 AND 1000000; + WHERE f1 BETWEEN 0 AND 1000000 + ORDER BY 1; SELECT CAST(f1 AS char(4)) AS three FROM VARCHAR_TBL UNION @@ -80,7 +83,8 @@ ORDER BY 1; SELECT f1 AS eight FROM VARCHAR_TBL UNION ALL -SELECT f1 FROM CHAR_TBL; +SELECT f1 FROM CHAR_TBL +ORDER BY 1; SELECT f1 AS five FROM TEXT_TBL UNION @@ -93,9 +97,9 @@ ORDER BY 1; -- INTERSECT and EXCEPT -- -SELECT q2 FROM int8_tbl INTERSECT SELECT q1 FROM int8_tbl; +SELECT q2 FROM int8_tbl INTERSECT SELECT q1 FROM int8_tbl ORDER BY 1; -SELECT q2 FROM int8_tbl INTERSECT ALL SELECT q1 FROM int8_tbl; +SELECT q2 FROM int8_tbl INTERSECT ALL SELECT q1 FROM int8_tbl ORDER BY 1; SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; @@ -103,17 +107,17 @@ SELECT q2 FROM int8_tbl EXCEPT ALL SELECT q1 FROM int8_tbl ORDER BY 1; SELECT q2 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q1 FROM int8_tbl ORDER BY 1; -SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl; +SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY 1; -SELECT q1 FROM int8_tbl EXCEPT ALL SELECT q2 FROM int8_tbl; +SELECT q1 FROM int8_tbl EXCEPT ALL SELECT q2 FROM int8_tbl ORDER BY 1; -SELECT q1 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q2 FROM int8_tbl; +SELECT q1 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q2 FROM int8_tbl ORDER BY 1; -- -- Mixed types -- -SELECT f1 FROM float8_tbl INTERSECT SELECT f1 FROM int4_tbl; +SELECT f1 FROM float8_tbl INTERSECT SELECT f1 FROM int4_tbl ORDER BY 1; SELECT f1 FROM float8_tbl EXCEPT SELECT f1 FROM int4_tbl ORDER BY 1; @@ -121,15 +125,15 @@ SELECT f1 FROM float8_tbl EXCEPT SELECT f1 FROM int4_tbl ORDER BY 1; -- Operator precedence and (((((extra))))) parentheses -- -SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl; +SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl ORDER BY 1; -SELECT q1 FROM int8_tbl INTERSECT (((SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))); +SELECT q1 FROM int8_tbl INTERSECT (((SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) ORDER BY 1; -(((SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl))) UNION ALL SELECT q2 FROM int8_tbl; +(((SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl))) UNION ALL SELECT q2 FROM int8_tbl ORDER BY 1; SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; -SELECT q1 FROM int8_tbl UNION ALL (((SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1))); +SELECT q1 FROM int8_tbl UNION ALL (((SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1))) ORDER BY 1; (((SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; @@ -151,6 +155,6 @@ SELECT q1 FROM int8_tbl EXCEPT (((SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1))) -- New syntaxes (7.1) permit new tests -- -(((((select * from int8_tbl))))); +(((((select * from int8_tbl ORDER BY q1, q2))))); diff --git a/src/test/regress/sql/update.sql b/src/test/regress/sql/update.sql index 2df2995810..5acf60e33b 100644 --- a/src/test/regress/sql/update.sql +++ b/src/test/regress/sql/update.sql @@ -11,20 +11,20 @@ CREATE TABLE update_test ( INSERT INTO update_test VALUES (5, 10, 'foo'); INSERT INTO update_test(b, a) VALUES (15, 10); -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; UPDATE update_test SET a = DEFAULT, b = DEFAULT; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; -- aliases for the UPDATE target table UPDATE update_test AS t SET b = 10 WHERE t.a = 10; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; UPDATE update_test t SET b = t.b + 10 WHERE t.a = 10; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; -- -- Test VALUES in FROM @@ -33,16 +33,16 @@ SELECT * FROM update_test; UPDATE update_test SET a=v.i FROM (VALUES(100, 20)) AS v(i, j) WHERE update_test.b = v.j; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; -- -- Test multiple-set-clause syntax -- UPDATE update_test SET (c,b,a) = ('bugle', b+11, DEFAULT) WHERE c = 'foo'; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; UPDATE update_test SET (c,b) = ('car', a+b), a = a + 1 WHERE a = 10; -SELECT * FROM update_test; +SELECT * FROM update_test ORDER BY a, b, c; -- fail, multi assignment to same column: UPDATE update_test SET (c,b) = ('car', a+b), b = a + 1 WHERE a = 10; diff --git a/src/test/regress/sql/uuid.sql b/src/test/regress/sql/uuid.sql index 48fe7e7110..c181adcea8 100644 --- a/src/test/regress/sql/uuid.sql +++ b/src/test/regress/sql/uuid.sql @@ -29,7 +29,7 @@ INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222}'); INSERT INTO guid1(guid_field) VALUES('3f3e3c3b3a3039383736353433a2313e'); -- retrieving the inserted data -SELECT guid_field FROM guid1; +SELECT guid_field FROM guid1 ORDER BY guid_field; -- ordering test SELECT guid_field FROM guid1 ORDER BY guid_field ASC; diff --git a/src/test/regress/sql/varchar.sql b/src/test/regress/sql/varchar.sql index 414c585d9a..af5797eddb 100644 --- a/src/test/regress/sql/varchar.sql +++ b/src/test/regress/sql/varchar.sql @@ -23,11 +23,11 @@ INSERT INTO VARCHAR_TBL (f1) VALUES ('cd'); INSERT INTO VARCHAR_TBL (f1) VALUES ('c '); -SELECT '' AS seven, * FROM VARCHAR_TBL; +SELECT '' AS seven, * FROM VARCHAR_TBL ORDER BY f1; SELECT '' AS six, c.* FROM VARCHAR_TBL c - WHERE c.f1 <> 'a'; + WHERE c.f1 <> 'a' ORDER BY f1; SELECT '' AS one, c.* FROM VARCHAR_TBL c @@ -35,11 +35,11 @@ SELECT '' AS one, c.* SELECT '' AS five, c.* FROM VARCHAR_TBL c - WHERE c.f1 < 'a'; + WHERE c.f1 < 'a' ORDER BY f1; SELECT '' AS six, c.* FROM VARCHAR_TBL c - WHERE c.f1 <= 'a'; + WHERE c.f1 <= 'a' ORDER BY f1; SELECT '' AS one, c.* FROM VARCHAR_TBL c @@ -47,7 +47,7 @@ SELECT '' AS one, c.* SELECT '' AS two, c.* FROM VARCHAR_TBL c - WHERE c.f1 >= 'a'; + WHERE c.f1 >= 'a' ORDER BY f1; DROP TABLE VARCHAR_TBL; @@ -63,4 +63,4 @@ INSERT INTO VARCHAR_TBL (f1) VALUES ('abcd'); INSERT INTO VARCHAR_TBL (f1) VALUES ('abcde'); INSERT INTO VARCHAR_TBL (f1) VALUES ('abcd '); -SELECT '' AS four, * FROM VARCHAR_TBL; +SELECT '' AS four, * FROM VARCHAR_TBL ORDER BY f1; diff --git a/src/test/regress/sql/window.sql b/src/test/regress/sql/window.sql index 5ecb3e3e65..eee533a6e9 100644 --- a/src/test/regress/sql/window.sql +++ b/src/test/regress/sql/window.sql @@ -23,73 +23,75 @@ INSERT INTO empsalary VALUES SELECT depname, empno, salary, sum(salary) OVER (PARTITION BY depname) FROM empsalary ORDER BY depname, salary; -SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary) FROM empsalary; +SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary) FROM empsalary ORDER BY empno,salary; -- with GROUP BY SELECT four, ten, SUM(SUM(four)) OVER (PARTITION BY four), AVG(ten) FROM tenk1 GROUP BY four, ten ORDER BY four, ten; -SELECT depname, empno, salary, sum(salary) OVER w FROM empsalary WINDOW w AS (PARTITION BY depname); +SELECT depname, empno, salary, sum(salary) OVER w FROM empsalary WINDOW w AS (PARTITION BY depname) ORDER BY empno,salary; -SELECT depname, empno, salary, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary) ORDER BY rank() OVER w; +SELECT depname, empno, salary, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary) ORDER BY rank() OVER w,empno; -- empty window specification -SELECT COUNT(*) OVER () FROM tenk1 WHERE unique2 < 10; +SELECT COUNT(*) OVER () FROM tenk1 WHERE unique2 < 10 ORDER BY 1; -SELECT COUNT(*) OVER w FROM tenk1 WHERE unique2 < 10 WINDOW w AS (); +SELECT COUNT(*) OVER w FROM tenk1 WHERE unique2 < 10 WINDOW w AS () ORDER BY 1; -- no window operation SELECT four FROM tenk1 WHERE FALSE WINDOW w AS (PARTITION BY ten); -- cumulative aggregate -SELECT sum(four) OVER (PARTITION BY ten ORDER BY unique2) AS sum_1, ten, four FROM tenk1 WHERE unique2 < 10; +SELECT sum(four) OVER (PARTITION BY ten ORDER BY unique2) AS sum_1, ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT row_number() OVER (ORDER BY unique2) FROM tenk1 WHERE unique2 < 10; +SELECT row_number() OVER (ORDER BY unique2) FROM tenk1 WHERE unique2 < 10 ORDER BY 1; -SELECT rank() OVER (PARTITION BY four ORDER BY ten) AS rank_1, ten, four FROM tenk1 WHERE unique2 < 10; +SELECT rank() OVER (PARTITION BY four ORDER BY ten) AS rank_1, ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT dense_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT dense_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT percent_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT percent_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT cume_dist() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT cume_dist() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT ntile(3) OVER (ORDER BY ten, four), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT ntile(3) OVER (ORDER BY ten, four), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; SELECT ntile(NULL) OVER (ORDER BY ten, four), ten, four FROM tenk1 LIMIT 2; -SELECT lag(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lag(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT lag(ten, four) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lag(ten, four) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT lag(ten, four, 0) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lag(ten, four, 0) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT lead(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lead(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT lead(ten * 2, 1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lead(ten * 2, 1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT lead(ten * 2, 1, -1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT lead(ten * 2, 1, -1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -SELECT first_value(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT first_value(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; -- last_value returns the last row of the frame, which is CURRENT ROW in ORDER BY window. -SELECT last_value(four) OVER (ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; +SELECT last_value(four) OVER (ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10 ORDER BY 1, 2, 3; SELECT last_value(ten) OVER (PARTITION BY four), ten, four FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s ORDER BY four, ten; SELECT nth_value(ten, four + 1) OVER (PARTITION BY four), ten, four - FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s; + FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s + ORDER BY four, ten; SELECT ten, two, sum(hundred) AS gsum, sum(sum(hundred)) OVER (PARTITION BY two ORDER BY ten) AS wsum -FROM tenk1 GROUP BY ten, two; +FROM tenk1 GROUP BY ten, two +ORDER BY ten, two; -SELECT count(*) OVER (PARTITION BY four), four FROM (SELECT * FROM tenk1 WHERE two = 1)s WHERE unique2 < 10; +SELECT count(*) OVER (PARTITION BY four), four FROM (SELECT * FROM tenk1 WHERE two = 1)s WHERE unique2 < 10 ORDER BY 1, 2; SELECT (count(*) OVER (PARTITION BY four ORDER BY ten) + sum(hundred) OVER (PARTITION BY four ORDER BY ten))::varchar AS cntsum - FROM tenk1 WHERE unique2 < 10; + FROM tenk1 WHERE unique2 < 10 ORDER BY 1; -- opexpr with different windows evaluation. SELECT * FROM( @@ -101,10 +103,10 @@ SELECT * FROM( )sub WHERE total <> fourcount + twosum; -SELECT avg(four) OVER (PARTITION BY four ORDER BY thousand / 100) FROM tenk1 WHERE unique2 < 10; +SELECT avg(four) OVER (PARTITION BY four ORDER BY thousand / 100) FROM tenk1 WHERE unique2 < 10 ORDER BY 1; SELECT ten, two, sum(hundred) AS gsum, sum(sum(hundred)) OVER win AS wsum -FROM tenk1 GROUP BY ten, two WINDOW win AS (PARTITION BY two ORDER BY ten); +FROM tenk1 GROUP BY ten, two WINDOW win AS (PARTITION BY two ORDER BY ten) ORDER BY 1, 2, 3, 4; -- more than one window with GROUP BY SELECT sum(salary), @@ -114,17 +116,17 @@ FROM empsalary GROUP BY depname; -- identical windows with different names SELECT sum(salary) OVER w1, count(*) OVER w2 -FROM empsalary WINDOW w1 AS (ORDER BY salary), w2 AS (ORDER BY salary); +FROM empsalary WINDOW w1 AS (ORDER BY salary), w2 AS (ORDER BY salary) ORDER BY 1, 2; -- subplan SELECT lead(ten, (SELECT two FROM tenk1 WHERE s.unique2 = unique2)) OVER (PARTITION BY four ORDER BY ten) -FROM tenk1 s WHERE unique2 < 10; +FROM tenk1 s WHERE unique2 < 10 ORDER BY 1; -- empty table SELECT count(*) OVER (PARTITION BY four) FROM (SELECT * FROM tenk1 WHERE FALSE)s; -- mixture of agg/wfunc in the same window -SELECT sum(salary) OVER w, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary DESC); +SELECT sum(salary) OVER w, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary DESC) ORDER BY 1, 2; -- strict aggs SELECT empno, depname, salary, bonus, depadj, MIN(bonus) OVER (ORDER BY empno), MAX(depadj) OVER () FROM( @@ -133,33 +135,33 @@ SELECT empno, depname, salary, bonus, depadj, MIN(bonus) OVER (ORDER BY empno), CASE WHEN AVG(salary) OVER (PARTITION BY depname) < salary THEN 200 END AS depadj FROM empsalary -)s; +)s ORDER BY empno; -- test non-default frame specifications SELECT four, ten, sum(ten) over (partition by four order by ten), last_value(ten) over (partition by four order by ten) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; SELECT four, ten, sum(ten) over (partition by four order by ten range between unbounded preceding and current row), last_value(ten) over (partition by four order by ten range between unbounded preceding and current row) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; SELECT four, ten, sum(ten) over (partition by four order by ten range between unbounded preceding and unbounded following), last_value(ten) over (partition by four order by ten range between unbounded preceding and unbounded following) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; SELECT four, ten/4 as two, sum(ten/4) over (partition by four order by ten/4 range between unbounded preceding and current row), last_value(ten/4) over (partition by four order by ten/4 range between unbounded preceding and current row) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; SELECT four, ten/4 as two, sum(ten/4) over (partition by four order by ten/4 rows between unbounded preceding and current row), last_value(ten/4) over (partition by four order by ten/4 rows between unbounded preceding and current row) -FROM (select distinct ten, four from tenk1) ss; +FROM (select distinct ten, four from tenk1) ss ORDER BY 1, 2, 3, 4; -- with UNION SELECT count(*) OVER (PARTITION BY four) FROM (SELECT * FROM tenk1 UNION ALL SELECT * FROM tenk2)s LIMIT 0; diff --git a/src/test/regress/sql/with.sql b/src/test/regress/sql/with.sql index c736441f53..b5a12b2efd 100644 --- a/src/test/regress/sql/with.sql +++ b/src/test/regress/sql/with.sql @@ -29,28 +29,28 @@ WITH RECURSIVE t(n) AS ( UNION ALL SELECT n+1 FROM t WHERE n < 5 ) -SELECT * FROM t; +SELECT * FROM t ORDER BY n; -- This is an infinite loop with UNION ALL, but not with UNION WITH RECURSIVE t(n) AS ( SELECT 1 UNION SELECT 10-n FROM t) -SELECT * FROM t; +SELECT * FROM t ORDER BY n; -- This'd be an infinite loop, but outside query reads only as much as needed WITH RECURSIVE t(n) AS ( VALUES (1) UNION ALL SELECT n+1 FROM t) -SELECT * FROM t LIMIT 10; +SELECT * FROM t LIMIT 10 ; -- UNION case should have same property WITH RECURSIVE t(n) AS ( SELECT 1 UNION SELECT n+1 FROM t) -SELECT * FROM t LIMIT 10; +SELECT * FROM t LIMIT 10; -- Test behavior with an unknown-type literal in the WITH WITH q AS (SELECT 'foo' AS x) @@ -61,7 +61,7 @@ WITH RECURSIVE t(n) AS ( UNION ALL SELECT n || ' bar' FROM t WHERE length(n) < 20 ) -SELECT n, n IS OF (text) as is_text FROM t; +SELECT n, n IS OF (text) as is_text FROM t ORDER BY n; -- -- Some examples with a tree @@ -180,7 +180,7 @@ SELECT pg_get_viewdef('vsubdepartment'::regclass, true); -- corner case in which sub-WITH gets initialized first with recursive q as ( - select * from department + (select * from department order by id) union all (with x as (select * from q) select * from x) @@ -188,7 +188,7 @@ with recursive q as ( select * from q limit 24; with recursive q as ( - select * from department + (select * from department order by id) union all (with recursive x as ( select * from department @@ -207,7 +207,7 @@ WITH RECURSIVE t(i,j) AS ( (SELECT 2 AS i UNION ALL SELECT 3 AS i) AS t2 JOIN t ON (t2.i = t.i+1)) - SELECT * FROM t; + SELECT * FROM t order by i; -- -- different tree example @@ -258,7 +258,7 @@ UNION ALL FROM tree JOIN t ON (tree.parent_id = t.id) ) SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON -(t1.id=t2.id); +(t1.id=t2.id) ORDER BY id; -- -- test cycle detection @@ -280,7 +280,7 @@ with recursive search_graph(f, t, label, path, cycle) as ( from graph g, search_graph sg where g.f = sg.t and not cycle ) -select * from search_graph; +select * from search_graph order by path; -- ordering by the path column has same effect as SEARCH DEPTH FIRST with recursive search_graph(f, t, label, path, cycle) as ( @@ -298,27 +298,27 @@ select * from search_graph order by path; WITH RECURSIVE y (id) AS (VALUES (1)), x (id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM x WHERE id < 5) -SELECT * FROM x; +SELECT * FROM x ORDER BY id; -- forward reference OK WITH RECURSIVE x(id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM x WHERE id < 5), y(id) AS (values (1)) - SELECT * FROM x; + SELECT * FROM x ORDER BY id; WITH RECURSIVE x(id) AS (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 5), y(id) AS (VALUES (1) UNION ALL SELECT id+1 FROM y WHERE id < 10) - SELECT y.*, x.* FROM y LEFT JOIN x USING (id); + SELECT y.*, x.* FROM y LEFT JOIN x USING (id) ORDER BY 1; WITH RECURSIVE x(id) AS (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 5), y(id) AS (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 10) - SELECT y.*, x.* FROM y LEFT JOIN x USING (id); + SELECT y.*, x.* FROM y LEFT JOIN x USING (id) ORDER BY 1; WITH RECURSIVE x(id) AS @@ -327,7 +327,7 @@ WITH RECURSIVE (SELECT * FROM x UNION ALL SELECT * FROM x), z(id) AS (SELECT * FROM x UNION ALL SELECT id+1 FROM z WHERE id < 10) - SELECT * FROM z; + SELECT * FROM z ORDER BY id; WITH RECURSIVE x(id) AS @@ -336,7 +336,7 @@ WITH RECURSIVE (SELECT * FROM x UNION ALL SELECT * FROM x), z(id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM z WHERE id < 10) - SELECT * FROM z; + SELECT * FROM z ORDER BY id; -- -- error cases diff --git a/src/test/regress/sql/xc-window.sql b/src/test/regress/sql/xc-window.sql new file mode 100644 index 0000000000..b74f138b72 --- /dev/null +++ b/src/test/regress/sql/xc-window.sql @@ -0,0 +1,199 @@ +-- +-- WINDOW FUNCTIONS +-- + +CREATE TABLE empsalary ( + depname varchar, + empno bigint, + salary int, + enroll_date date +); + +INSERT INTO empsalary VALUES +('develop', 10, 5200, '2007-08-01'), +('sales', 1, 5000, '2006-10-01'), +('personnel', 5, 3500, '2007-12-10'), +('sales', 4, 4800, '2007-08-08'), +('personnel', 2, 3900, '2006-12-23'), +('develop', 7, 4200, '2008-01-01'), +('develop', 9, 4500, '2008-01-01'), +('sales', 3, 4800, '2007-08-01'), +('develop', 8, 6000, '2006-10-01'), +('develop', 11, 5200, '2007-08-15'); + +SELECT depname, empno, salary, sum(salary) OVER (PARTITION BY depname) FROM empsalary ORDER BY depname, salary; + +SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary) FROM empsalary; + +-- with GROUP BY +SELECT four, ten, SUM(SUM(four)) OVER (PARTITION BY four), AVG(ten) FROM tenk1 +GROUP BY four, ten ORDER BY four, ten; + +SELECT depname, empno, salary, sum(salary) OVER w FROM empsalary WINDOW w AS (PARTITION BY depname); + +SELECT depname, empno, salary, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary) ORDER BY rank() OVER w; + +-- empty window specification +SELECT COUNT(*) OVER () FROM tenk1 WHERE unique2 < 10; + +SELECT COUNT(*) OVER w FROM tenk1 WHERE unique2 < 10 WINDOW w AS (); + +-- no window operation +SELECT four FROM tenk1 WHERE FALSE WINDOW w AS (PARTITION BY ten); + +-- cumulative aggregate +SELECT sum(four) OVER (PARTITION BY ten ORDER BY unique2) AS sum_1, ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT row_number() OVER (ORDER BY unique2) FROM tenk1 WHERE unique2 < 10; + +SELECT rank() OVER (PARTITION BY four ORDER BY ten) AS rank_1, ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT dense_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT percent_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT cume_dist() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT ntile(3) OVER (ORDER BY ten, four), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT ntile(NULL) OVER (ORDER BY ten, four), ten, four FROM tenk1 LIMIT 2; + +SELECT lag(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lag(ten, four) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lag(ten, four, 0) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lead(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lead(ten * 2, 1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lead(ten * 2, 1, -1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT first_value(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +-- last_value returns the last row of the frame, which is CURRENT ROW in ORDER BY window. +SELECT last_value(four) OVER (ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT last_value(ten) OVER (PARTITION BY four), ten, four FROM + (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s + ORDER BY four, ten; + +SELECT nth_value(ten, four + 1) OVER (PARTITION BY four), ten, four + FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s; + +SELECT ten, two, sum(hundred) AS gsum, sum(sum(hundred)) OVER (PARTITION BY two ORDER BY ten) AS wsum +FROM tenk1 GROUP BY ten, two; + +SELECT count(*) OVER (PARTITION BY four), four FROM (SELECT * FROM tenk1 WHERE two = 1)s WHERE unique2 < 10; + +SELECT (count(*) OVER (PARTITION BY four ORDER BY ten) + + sum(hundred) OVER (PARTITION BY four ORDER BY ten))::varchar AS cntsum + FROM tenk1 WHERE unique2 < 10; + +-- opexpr with different windows evaluation. +SELECT * FROM( + SELECT count(*) OVER (PARTITION BY four ORDER BY ten) + + sum(hundred) OVER (PARTITION BY two ORDER BY ten) AS total, + count(*) OVER (PARTITION BY four ORDER BY ten) AS fourcount, + sum(hundred) OVER (PARTITION BY two ORDER BY ten) AS twosum + FROM tenk1 +)sub +WHERE total <> fourcount + twosum; + +SELECT avg(four) OVER (PARTITION BY four ORDER BY thousand / 100) FROM tenk1 WHERE unique2 < 10; + +SELECT ten, two, sum(hundred) AS gsum, sum(sum(hundred)) OVER win AS wsum +FROM tenk1 GROUP BY ten, two WINDOW win AS (PARTITION BY two ORDER BY ten); + +-- more than one window with GROUP BY +SELECT sum(salary), + row_number() OVER (ORDER BY depname), + sum(sum(salary)) OVER (ORDER BY depname DESC) +FROM empsalary GROUP BY depname; + +-- identical windows with different names +SELECT sum(salary) OVER w1, count(*) OVER w2 +FROM empsalary WINDOW w1 AS (ORDER BY salary), w2 AS (ORDER BY salary); + +-- subplan +SELECT lead(ten, (SELECT two FROM tenk1 WHERE s.unique2 = unique2)) OVER (PARTITION BY four ORDER BY ten) +FROM tenk1 s WHERE unique2 < 10; + +-- empty table +SELECT count(*) OVER (PARTITION BY four) FROM (SELECT * FROM tenk1 WHERE FALSE)s; + +-- mixture of agg/wfunc in the same window +SELECT sum(salary) OVER w, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary DESC); + +-- strict aggs +SELECT empno, depname, salary, bonus, depadj, MIN(bonus) OVER (ORDER BY empno), MAX(depadj) OVER () FROM( + SELECT *, + CASE WHEN enroll_date < '2008-01-01' THEN 2008 - extract(YEAR FROM enroll_date) END * 500 AS bonus, + CASE WHEN + AVG(salary) OVER (PARTITION BY depname) < salary + THEN 200 END AS depadj FROM empsalary +)s; + +-- test non-default frame specifications +SELECT four, ten, + sum(ten) over (partition by four order by ten), + last_value(ten) over (partition by four order by ten) +FROM (select distinct ten, four from tenk1) ss; + +SELECT four, ten, + sum(ten) over (partition by four order by ten range between unbounded preceding and current row), + last_value(ten) over (partition by four order by ten range between unbounded preceding and current row) +FROM (select distinct ten, four from tenk1) ss; + +SELECT four, ten, + sum(ten) over (partition by four order by ten range between unbounded preceding and unbounded following), + last_value(ten) over (partition by four order by ten range between unbounded preceding and unbounded following) +FROM (select distinct ten, four from tenk1) ss; + +SELECT four, ten/4 as two, + sum(ten/4) over (partition by four order by ten/4 range between unbounded preceding and current row), + last_value(ten/4) over (partition by four order by ten/4 range between unbounded preceding and current row) +FROM (select distinct ten, four from tenk1) ss; + +SELECT four, ten/4 as two, + sum(ten/4) over (partition by four order by ten/4 rows between unbounded preceding and current row), + last_value(ten/4) over (partition by four order by ten/4 rows between unbounded preceding and current row) +FROM (select distinct ten, four from tenk1) ss; + +-- with UNION +SELECT count(*) OVER (PARTITION BY four) FROM (SELECT * FROM tenk1 UNION ALL SELECT * FROM tenk2)s LIMIT 0; + +-- ordering by a non-integer constant is allowed +SELECT rank() OVER (ORDER BY length('abc')); + +-- can't order by another window function +SELECT rank() OVER (ORDER BY rank() OVER (ORDER BY random())); + +-- some other errors +SELECT * FROM empsalary WHERE row_number() OVER (ORDER BY salary) < 10; + +SELECT * FROM empsalary INNER JOIN tenk1 ON row_number() OVER (ORDER BY salary) < 10; + +SELECT rank() OVER (ORDER BY 1), count(*) FROM empsalary GROUP BY 1; + +SELECT * FROM rank() OVER (ORDER BY random()); + +DELETE FROM empsalary WHERE (rank() OVER (ORDER BY random())) > 10; + +DELETE FROM empsalary RETURNING rank() OVER (ORDER BY random()); + +SELECT count(*) OVER w FROM tenk1 WINDOW w AS (ORDER BY unique1), w AS (ORDER BY unique1); + +SELECT rank() OVER (PARTITION BY four, ORDER BY ten) FROM tenk1; + +SELECT count() OVER () FROM tenk1; + +SELECT generate_series(1, 100) OVER () FROM empsalary; + +SELECT ntile(0) OVER (ORDER BY ten), ten, four FROM tenk1; + +SELECT nth_value(four, 0) OVER (ORDER BY ten), ten, four FROM tenk1; + +-- cleanup +DROP TABLE empsalary; |