Commit d8310553 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Verified output from new psql.

Include a few new tests for datetime/timespan arithmetic.
parent 24e8ca6e
QUERY: CREATE TABLE ABSTIME_TBL (f1 abstime); --
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('Jan 14, 1973 03:14:21'); -- ABSTIME
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('Mon May 1 00:30:30 1995'::abstime); -- testing built-in time type abstime
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('epoch'::abstime); -- uses reltime and tinterval
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('current'::abstime); --
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('infinity'::abstime); --
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('-infinity'::abstime); -- timezones may vary based not only on location but the operating
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('May 10, 1947 23:59:12'); -- system. the main correctness issue is that the OS may not get
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00'); -- daylight savings time right for times prior to Unix epoch (jan 1 1970).
--
CREATE TABLE ABSTIME_TBL (f1 abstime);
INSERT INTO ABSTIME_TBL (f1) VALUES ('Jan 14, 1973 03:14:21');
-- was INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now'):
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'Mon May 1 00:30:30 1995');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'epoch');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'current');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'infinity');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime '-infinity');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12');
-- what happens if we specify slightly misformatted abstime?
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00');
ERROR: Bad abstime external representation 'Feb 35, 1946 10:00:00' ERROR: Bad abstime external representation 'Feb 35, 1946 10:00:00'
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10'); INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10');
ERROR: Bad abstime external representation 'Feb 28, 1984 25:08:10' ERROR: Bad abstime external representation 'Feb 28, 1984 25:08:10'
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format'); -- badly formatted abstimes: these should result in invalid abstimes
INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format');
ERROR: Bad abstime external representation 'bad date format' ERROR: Bad abstime external representation 'bad date format'
QUERY: INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843'); INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843');
QUERY: SELECT '' AS eight, ABSTIME_TBL.*; -- test abstime operators
eight|f1 SELECT '' AS eight, ABSTIME_TBL.*;
-----+---------------------------- eight | f1
|Sun Jan 14 03:14:21 1973 PST -------+------------------------------
|Mon May 01 00:30:30 1995 PDT | Sun Jan 14 03:14:21 1973 PST
|epoch | Mon May 01 00:30:30 1995 PDT
|current | epoch
|infinity | current
|-infinity | infinity
|Sat May 10 23:59:12 1947 PST | -infinity
|invalid | Sat May 10 23:59:12 1947 PST
| invalid
(8 rows) (8 rows)
QUERY: SELECT '' AS six, ABSTIME_TBL.* SELECT '' AS six, ABSTIME_TBL.*
WHERE ABSTIME_TBL.f1 < 'Jun 30, 2001'::abstime; WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001';
six|f1 six | f1
---+---------------------------- -----+------------------------------
|Sun Jan 14 03:14:21 1973 PST | Sun Jan 14 03:14:21 1973 PST
|Mon May 01 00:30:30 1995 PDT | Mon May 01 00:30:30 1995 PDT
|epoch | epoch
|current | current
|-infinity | -infinity
|Sat May 10 23:59:12 1947 PST | Sat May 10 23:59:12 1947 PST
(6 rows) (6 rows)
QUERY: SELECT '' AS six, ABSTIME_TBL.* SELECT '' AS six, ABSTIME_TBL.*
WHERE ABSTIME_TBL.f1 > '-infinity'::abstime; WHERE ABSTIME_TBL.f1 > abstime '-infinity';
six|f1 six | f1
---+---------------------------- -----+------------------------------
|Sun Jan 14 03:14:21 1973 PST | Sun Jan 14 03:14:21 1973 PST
|Mon May 01 00:30:30 1995 PDT | Mon May 01 00:30:30 1995 PDT
|epoch | epoch
|current | current
|infinity | infinity
|Sat May 10 23:59:12 1947 PST | Sat May 10 23:59:12 1947 PST
(6 rows) (6 rows)
QUERY: SELECT '' AS six, ABSTIME_TBL.* SELECT '' AS six, ABSTIME_TBL.*
WHERE 'May 10, 1947 23:59:12'::abstime <> ABSTIME_TBL.f1; WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1;
six|f1 six | f1
---+---------------------------- -----+------------------------------
|Sun Jan 14 03:14:21 1973 PST | Sun Jan 14 03:14:21 1973 PST
|Mon May 01 00:30:30 1995 PDT | Mon May 01 00:30:30 1995 PDT
|epoch | epoch
|current | current
|infinity | infinity
|-infinity | -infinity
(6 rows) (6 rows)
QUERY: SELECT '' AS one, ABSTIME_TBL.* SELECT '' AS one, ABSTIME_TBL.*
WHERE 'current'::abstime = ABSTIME_TBL.f1; WHERE abstime 'current' = ABSTIME_TBL.f1;
one|f1 one | f1
---+------- -----+---------
|current | current
(1 row) (1 row)
QUERY: SELECT '' AS three, ABSTIME_TBL.* SELECT '' AS three, ABSTIME_TBL.*
WHERE 'epoch'::abstime >= ABSTIME_TBL.f1; WHERE abstime 'epoch' >= ABSTIME_TBL.f1;
three|f1 three | f1
-----+---------------------------- -------+------------------------------
|epoch | epoch
|-infinity | -infinity
|Sat May 10 23:59:12 1947 PST | Sat May 10 23:59:12 1947 PST
(3 rows) (3 rows)
QUERY: SELECT '' AS four, ABSTIME_TBL.* SELECT '' AS four, ABSTIME_TBL.*
WHERE ABSTIME_TBL.f1 <= 'Jan 14, 1973 03:14:21'::abstime; WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21';
four|f1 four | f1
----+---------------------------- ------+------------------------------
|Sun Jan 14 03:14:21 1973 PST | Sun Jan 14 03:14:21 1973 PST
|epoch | epoch
|-infinity | -infinity
|Sat May 10 23:59:12 1947 PST | Sat May 10 23:59:12 1947 PST
(4 rows) (4 rows)
QUERY: SELECT '' AS four, ABSTIME_TBL.* SELECT '' AS four, ABSTIME_TBL.*
WHERE ABSTIME_TBL.f1 <?> WHERE ABSTIME_TBL.f1 <?>
'["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]'::tinterval; tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]';
four|f1 four | f1
----+---------------------------- ------+------------------------------
|Sun Jan 14 03:14:21 1973 PST | Sun Jan 14 03:14:21 1973 PST
|Mon May 01 00:30:30 1995 PDT | Mon May 01 00:30:30 1995 PDT
|epoch | epoch
|current (3 rows)
(4 rows)
QUERY: SELECT '' AS three, ABSTIME_TBL.* -- these four queries should return the same answer
WHERE (ABSTIME_TBL.f1 + '@ 3 year'::reltime) -- the "infinity" and "-infinity" tuples in ABSTIME_TBL cannot be added and
< 'Jan 14 14:00:00 1977'::abstime; -- therefore, should not show up in the results.
three|f1 SELECT '' AS three, ABSTIME_TBL.*
-----+---------------------------- WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years
|Sun Jan 14 03:14:21 1973 PST < abstime 'Jan 14 14:00:00 1977';
|epoch three | f1
|Sat May 10 23:59:12 1947 PST -------+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| epoch
| Sat May 10 23:59:12 1947 PST
(3 rows) (3 rows)
QUERY: SELECT '' AS three, ABSTIME_TBL.* SELECT '' AS three, ABSTIME_TBL.*
WHERE (ABSTIME_TBL.f1 + '@ 3 year ago'::reltime) WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years
< 'Jan 14 14:00:00 1971'::abstime; < abstime 'Jan 14 14:00:00 1971';
three|f1 three | f1
-----+---------------------------- -------+------------------------------
|Sun Jan 14 03:14:21 1973 PST | Sun Jan 14 03:14:21 1973 PST
|epoch | epoch
|Sat May 10 23:59:12 1947 PST | Sat May 10 23:59:12 1947 PST
(3 rows) (3 rows)
QUERY: SELECT '' AS three, ABSTIME_TBL.* SELECT '' AS three, ABSTIME_TBL.*
WHERE (ABSTIME_TBL.f1 - '@ 3 year'::reltime) WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years
< 'Jan 14 14:00:00 1971'::abstime; < abstime 'Jan 14 14:00:00 1971';
three|f1 three | f1
-----+---------------------------- -------+------------------------------
|Sun Jan 14 03:14:21 1973 PST | Sun Jan 14 03:14:21 1973 PST
|epoch | epoch
|Sat May 10 23:59:12 1947 PST | Sat May 10 23:59:12 1947 PST
(3 rows) (3 rows)
QUERY: SELECT '' AS three, ABSTIME_TBL.* SELECT '' AS three, ABSTIME_TBL.*
WHERE (ABSTIME_TBL.f1 - '@ 3 year ago'::reltime) WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years
< 'Jan 14 14:00:00 1977'::abstime; < abstime 'Jan 14 14:00:00 1977';
three|f1 three | f1
-----+---------------------------- -------+------------------------------
|Sun Jan 14 03:14:21 1973 PST | Sun Jan 14 03:14:21 1973 PST
|epoch | epoch
|Sat May 10 23:59:12 1947 PST | Sat May 10 23:59:12 1947 PST
(3 rows) (3 rows)
QUERY: SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime
WHERE (ABSTIME_TBL.f1 + RELTIME_TBL.f1) WHERE (ABSTIME_TBL.f1 + RELTIME_TBL.f1)
< 'Jan 14 14:00:00 1971'::abstime < abstime 'Jan 14 14:00:00 1971'
ORDER BY abstime, reltime; ORDER BY abstime, reltime;
ten|abstime |reltime ten | abstime | reltime
---+----------------------------+------------- -----+------------------------------+---------------
|Sat May 10 23:59:12 1947 PST|@ 14 secs ago | Sat May 10 23:59:12 1947 PST | @ 14 secs ago
|Sat May 10 23:59:12 1947 PST|@ 1 min | Sat May 10 23:59:12 1947 PST | @ 1 min
|Sat May 10 23:59:12 1947 PST|@ 5 hours | Sat May 10 23:59:12 1947 PST | @ 5 hours
|Sat May 10 23:59:12 1947 PST|@ 10 days | Sat May 10 23:59:12 1947 PST | @ 10 days
|Sat May 10 23:59:12 1947 PST|@ 3 mons | Sat May 10 23:59:12 1947 PST | @ 3 mons
|epoch |@ 14 secs ago | epoch | @ 14 secs ago
|epoch |@ 1 min | epoch | @ 1 min
|epoch |@ 5 hours | epoch | @ 5 hours
|epoch |@ 10 days | epoch | @ 10 days
|epoch |@ 3 mons | epoch | @ 3 mons
(10 rows) (10 rows)
QUERY: CREATE TABLE BOX_TBL (f1 box); --
QUERY: INSERT INTO BOX_TBL (f1) VALUES ('(2.0,2.0,0.0,0.0)'); -- BOX
QUERY: INSERT INTO BOX_TBL (f1) VALUES ('(1.0,1.0,3.0,3.0)'); --
QUERY: INSERT INTO BOX_TBL (f1) VALUES ('(2.5, 2.5, 2.5,3.5)'); --
QUERY: INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)'); -- box logic
QUERY: INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)'); -- o
-- 3 o--|X
-- | o|
-- 2 +-+-+ |
-- | | | |
-- 1 | o-+-o
-- | |
-- 0 +---+
--
-- 0 1 2 3
--
-- boxes are specified by two points, given by four floats x1,y1,x2,y2
CREATE TABLE BOX_TBL (f1 box);
INSERT INTO BOX_TBL (f1) VALUES ('(2.0,2.0,0.0,0.0)');
INSERT INTO BOX_TBL (f1) VALUES ('(1.0,1.0,3.0,3.0)');
-- degenerate cases where the box is a line or a point
-- note that lines and points boxes all have zero area
INSERT INTO BOX_TBL (f1) VALUES ('(2.5, 2.5, 2.5,3.5)');
INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)');
-- badly formatted box inputs
INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)');
ERROR: Bad box external representation '(2.3, 4.5)' ERROR: Bad box external representation '(2.3, 4.5)'
QUERY: INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad'); INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
ERROR: Bad box external representation 'asdfasdf(ad' ERROR: Bad box external representation 'asdfasdf(ad'
QUERY: SELECT '' AS four, BOX_TBL.*; SELECT '' AS four, BOX_TBL.*;
four|f1 four | f1
----+------------------- ------+---------------------
|(2,2),(0,0) | (2,2),(0,0)
|(3,3),(1,1) | (3,3),(1,1)
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
|(3,3),(3,3) | (3,3),(3,3)
(4 rows) (4 rows)
QUERY: SELECT '' AS four, b.*, box_area(b.f1) as barea SELECT '' AS four, b.*, box_area(b.f1) as barea
FROM BOX_TBL b; FROM BOX_TBL b;
four|f1 |barea four | f1 | barea
----+-------------------+----- ------+---------------------+-------
|(2,2),(0,0) | 4 | (2,2),(0,0) | 4
|(3,3),(1,1) | 4 | (3,3),(1,1) | 4
|(2.5,3.5),(2.5,2.5)| 0 | (2.5,3.5),(2.5,2.5) | 0
|(3,3),(3,3) | 0 | (3,3),(3,3) | 0
(4 rows) (4 rows)
QUERY: SELECT '' AS three, b.f1 -- overlap
FROM BOX_TBL b SELECT '' AS three, b.f1
WHERE b.f1 && '(2.5,2.5,1.0,1.0)'::box; FROM BOX_TBL b
three|f1 WHERE b.f1 && box '(2.5,2.5,1.0,1.0)';
-----+------------------- three | f1
|(2,2),(0,0) -------+---------------------
|(3,3),(1,1) | (2,2),(0,0)
|(2.5,3.5),(2.5,2.5) | (3,3),(1,1)
| (2.5,3.5),(2.5,2.5)
(3 rows) (3 rows)
QUERY: SELECT '' AS two, b1.* -- left-or-overlap (x only)
SELECT '' AS two, b1.*
FROM BOX_TBL b1 FROM BOX_TBL b1
WHERE b1.f1 &< '(2.0,2.0,2.5,2.5)'::box; WHERE b1.f1 &< box '(2.0,2.0,2.5,2.5)';
two|f1 two | f1
---+------------------- -----+---------------------
|(2,2),(0,0) | (2,2),(0,0)
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
(2 rows) (2 rows)
QUERY: SELECT '' AS two, b1.* -- right-or-overlap (x only)
SELECT '' AS two, b1.*
FROM BOX_TBL b1 FROM BOX_TBL b1
WHERE b1.f1 &> '(2.0,2.0,2.5,2.5)'::box; WHERE b1.f1 &> box '(2.0,2.0,2.5,2.5)';
two|f1 two | f1
---+------------------- -----+---------------------
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
|(3,3),(3,3) | (3,3),(3,3)
(2 rows) (2 rows)
QUERY: SELECT '' AS two, b.f1 -- left of
SELECT '' AS two, b.f1
FROM BOX_TBL b FROM BOX_TBL b
WHERE b.f1 << '(3.0,3.0,5.0,5.0)'::box; WHERE b.f1 << box '(3.0,3.0,5.0,5.0)';
two|f1 two | f1
---+------------------- -----+---------------------
|(2,2),(0,0) | (2,2),(0,0)
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
(2 rows) (2 rows)
QUERY: SELECT '' AS four, b.f1 -- area <=
SELECT '' AS four, b.f1
FROM BOX_TBL b FROM BOX_TBL b
WHERE b.f1 <= '(3.0,3.0,5.0,5.0)'::box; WHERE b.f1 <= box '(3.0,3.0,5.0,5.0)';
four|f1 four | f1
----+------------------- ------+---------------------
|(2,2),(0,0) | (2,2),(0,0)
|(3,3),(1,1) | (3,3),(1,1)
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
|(3,3),(3,3) | (3,3),(3,3)
(4 rows) (4 rows)
QUERY: SELECT '' AS two, b.f1 -- area <
SELECT '' AS two, b.f1
FROM BOX_TBL b FROM BOX_TBL b
WHERE b.f1 < '(3.0,3.0,5.0,5.0)'::box; WHERE b.f1 < box '(3.0,3.0,5.0,5.0)';
two|f1 two | f1
---+------------------- -----+---------------------
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
|(3,3),(3,3) | (3,3),(3,3)
(2 rows) (2 rows)
QUERY: SELECT '' AS two, b.f1 -- area =
SELECT '' AS two, b.f1
FROM BOX_TBL b FROM BOX_TBL b
WHERE b.f1 = '(3.0,3.0,5.0,5.0)'::box; WHERE b.f1 = box '(3.0,3.0,5.0,5.0)';
two|f1 two | f1
---+----------- -----+-------------
|(2,2),(0,0) | (2,2),(0,0)
|(3,3),(1,1) | (3,3),(1,1)
(2 rows) (2 rows)
QUERY: SELECT '' AS two, b.f1 -- area >
FROM BOX_TBL b SELECT '' AS two, b.f1
WHERE b.f1 > '(3.5,3.0,4.5,3.0)'::box; FROM BOX_TBL b -- zero area
two|f1 WHERE b.f1 > box '(3.5,3.0,4.5,3.0)';
---+----------- two | f1
|(2,2),(0,0) -----+-------------
|(3,3),(1,1) | (2,2),(0,0)
| (3,3),(1,1)
(2 rows) (2 rows)
QUERY: SELECT '' AS four, b.f1 -- area >=
FROM BOX_TBL b SELECT '' AS four, b.f1
WHERE b.f1 >= '(3.5,3.0,4.5,3.0)'::box; FROM BOX_TBL b -- zero area
four|f1 WHERE b.f1 >= box '(3.5,3.0,4.5,3.0)';
----+------------------- four | f1
|(2,2),(0,0) ------+---------------------
|(3,3),(1,1) | (2,2),(0,0)
|(2.5,3.5),(2.5,2.5) | (3,3),(1,1)
|(3,3),(3,3) | (2.5,3.5),(2.5,2.5)
| (3,3),(3,3)
(4 rows) (4 rows)
QUERY: SELECT '' AS two, b.f1 -- right of
SELECT '' AS two, b.f1
FROM BOX_TBL b FROM BOX_TBL b
WHERE '(3.0,3.0,5.0,5.0)'::box >> b.f1; WHERE box '(3.0,3.0,5.0,5.0)' >> b.f1;
two|f1 two | f1
---+------------------- -----+---------------------
|(2,2),(0,0) | (2,2),(0,0)
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
(2 rows) (2 rows)
QUERY: SELECT '' AS three, b.f1 -- contained in
SELECT '' AS three, b.f1
FROM BOX_TBL b FROM BOX_TBL b
WHERE b.f1 @ '(0,0,3,3)'::box; WHERE b.f1 @ box '(0,0,3,3)';
three|f1 three | f1
-----+----------- -------+-------------
|(2,2),(0,0) | (2,2),(0,0)
|(3,3),(1,1) | (3,3),(1,1)
|(3,3),(3,3) | (3,3),(3,3)
(3 rows) (3 rows)
QUERY: SELECT '' AS three, b.f1 -- contains
SELECT '' AS three, b.f1
FROM BOX_TBL b FROM BOX_TBL b
WHERE '(0,0,3,3)'::box ~ b.f1; WHERE box '(0,0,3,3)' ~ b.f1;
three|f1 three | f1
-----+----------- -------+-------------
|(2,2),(0,0) | (2,2),(0,0)
|(3,3),(1,1) | (3,3),(1,1)
|(3,3),(3,3) | (3,3),(3,3)
(3 rows) (3 rows)
QUERY: SELECT '' AS one, b.f1 -- box equality
SELECT '' AS one, b.f1
FROM BOX_TBL b FROM BOX_TBL b
WHERE '(1,1,3,3)'::box ~= b.f1; WHERE box '(1,1,3,3)' ~= b.f1;
one|f1 one | f1
---+----------- -----+-------------
|(3,3),(1,1) | (3,3),(1,1)
(1 row) (1 row)
QUERY: SELECT '' AS four, @@(b1.f1) AS p -- center of box, left unary operator
SELECT '' AS four, @@(b1.f1) AS p
FROM BOX_TBL b1; FROM BOX_TBL b1;
four|p four | p
----+------- ------+---------
|(1,1) | (1,1)
|(2,2) | (2,2)
|(2.5,3) | (2.5,3)
|(3,3) | (3,3)
(4 rows) (4 rows)
QUERY: SELECT '' AS one, b1.*, b2.* -- wholly-contained
FROM BOX_TBL b1, BOX_TBL b2 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;
one|f1 |f1 one | f1 | f1
---+-----------+----------- -----+-------------+-------------
|(3,3),(1,1)|(3,3),(3,3) | (3,3),(1,1) | (3,3),(3,3)
(1 row) (1 row)
QUERY: SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL; SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL;
four|height|width four | height | width
----+------+----- ------+--------+-------
| 2| 2 | 2 | 2
| 2| 2 | 2 | 2
| 1| 0 | 1 | 0
| 0| 0 | 0 | 0
(4 rows) (4 rows)
QUERY: CREATE TABLE CIRCLE_TBL (f1 circle); --
QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(0,0),3>'); -- CIRCLE
QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(1,2),100>'); --
QUERY: INSERT INTO CIRCLE_TBL VALUES ('1,3,5'); CREATE TABLE CIRCLE_TBL (f1 circle);
QUERY: INSERT INTO CIRCLE_TBL VALUES ('((1,2),3)'); INSERT INTO CIRCLE_TBL VALUES ('<(0,0),3>');
QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10>'); INSERT INTO CIRCLE_TBL VALUES ('<(1,2),100>');
QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(100,0),100>'); INSERT INTO CIRCLE_TBL VALUES ('1,3,5');
QUERY: INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>'); INSERT INTO CIRCLE_TBL VALUES ('((1,2),3)');
INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10>');
INSERT INTO CIRCLE_TBL VALUES ('<(100,0),100>');
-- bad values
INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
ERROR: Bad circle external representation '<(-100,0),-100>' ERROR: Bad circle external representation '<(-100,0),-100>'
QUERY: INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5'); INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
ERROR: Bad circle external representation '1abc,3,5' ERROR: Bad circle external representation '1abc,3,5'
QUERY: INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)'); INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
ERROR: Bad circle external representation '(3,(1,2),3)' ERROR: Bad circle external representation '(3,(1,2),3)'
QUERY: SELECT * FROM CIRCLE_TBL; SELECT * FROM CIRCLE_TBL;
f1 f1
-------------- ----------------
<(0,0),3> <(0,0),3>
<(1,2),100> <(1,2),100>
<(1,3),5> <(1,3),5>
<(1,2),3> <(1,2),3>
<(100,200),10> <(100,200),10>
<(100,0),100> <(100,0),100>
(6 rows) (6 rows)
QUERY: SELECT '' AS six, center(f1) AS center SELECT '' AS six, center(f1) AS center
FROM CIRCLE_TBL; FROM CIRCLE_TBL;
six|center six | center
---+--------- -----+-----------
|(0,0) | (0,0)
|(1,2) | (1,2)
|(1,3) | (1,3)
|(1,2) | (1,2)
|(100,200) | (100,200)
|(100,0) | (100,0)
(6 rows) (6 rows)
QUERY: SELECT '' AS six, radius(f1) AS radius SELECT '' AS six, radius(f1) AS radius
FROM CIRCLE_TBL; FROM CIRCLE_TBL;
six|radius six | radius
---+------ -----+--------
| 3 | 3
| 100 | 100
| 5 | 5
| 3 | 3
| 10 | 10
| 100 | 100
(6 rows) (6 rows)
QUERY: SELECT '' AS six, diameter(f1) AS diameter SELECT '' AS six, diameter(f1) AS diameter
FROM CIRCLE_TBL; FROM CIRCLE_TBL;
six|diameter six | diameter
---+-------- -----+----------
| 6 | 6
| 200 | 200
| 10 | 10
| 6 | 6
| 20 | 20
| 200 | 200
(6 rows) (6 rows)
QUERY: SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5; SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5;
two|f1 two | f1
---+--------- -----+-----------
|<(0,0),3> | <(0,0),3>
|<(1,2),3> | <(1,2),3>
(2 rows) (2 rows)
QUERY: SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10; SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10;
four|f1 four | f1
----+-------------- ------+----------------
|<(1,2),100> | <(1,2),100>
|<(1,3),5> | <(1,3),5>
|<(100,200),10> | <(100,200),10>
|<(100,0),100> | <(100,0),100>
(4 rows) (4 rows)
QUERY: SELECT '' as five, c1.f1 AS one, c2.f1 AS two, (c1.f1 <-> c2.f1) AS distance SELECT '' as five, c1.f1 AS one, c2.f1 AS two, (c1.f1 <-> c2.f1) AS distance
FROM CIRCLE_TBL c1, CIRCLE_TBL c2 FROM CIRCLE_TBL c1, CIRCLE_TBL c2
WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0) WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0)
ORDER BY distance, one, two; ORDER BY distance, one, two;
five|one |two | distance five | one | two | distance
----+--------------+--------------+---------------- ------+----------------+----------------+------------------
|<(100,200),10>|<(100,0),100> | 90 | <(100,200),10> | <(100,0),100> | 90
|<(100,200),10>|<(1,2),100> |111.370729772479 | <(100,200),10> | <(1,2),100> | 111.370729772479
|<(1,3),5> |<(100,200),10>|205.476756144497 | <(1,3),5> | <(100,200),10> | 205.476756144497
|<(1,2),3> |<(100,200),10>|208.370729772479 | <(1,2),3> | <(100,200),10> | 208.370729772479
|<(0,0),3> |<(100,200),10>|210.606797749979 | <(0,0),3> | <(100,200),10> | 210.606797749979
(5 rows) (5 rows)
QUERY: SELECT 'trailing' AS first; --
first -- COMMENTS
-------- --
trailing SELECT 'trailing' AS first; -- trailing single line
first
----------
trailing
(1 row) (1 row)
QUERY:
SELECT /* embedded single line */ 'embedded' AS second; SELECT /* embedded single line */ 'embedded' AS second;
second second
-------- ----------
embedded embedded
(1 row) (1 row)
QUERY: SELECT /* both embedded and trailing single line */ 'both' AS third; SELECT /* both embedded and trailing single line */ 'both' AS third; -- trailing single line
third third
----- -------
both both
(1 row) (1 row)
QUERY:
SELECT 'before multi-line' AS fourth; SELECT 'before multi-line' AS fourth;
fourth fourth
----------------- -------------------
before multi-line before multi-line
(1 row) (1 row)
QUERY: /* This is an example of SQL which should not execute: /* This is an example of SQL which should not execute:
* select 'multi-line'; * select 'multi-line';
*/ */
SELECT 'after multi-line' AS fifth; SELECT 'after multi-line' AS fifth;
fifth fifth
---------------- ------------------
after multi-line after multi-line
(1 row) (1 row)
/* and this is the end of the file */
QUERY: SELECT ('today'::datetime = ('yesterday'::datetime + '1 day'::timespan)) as "True"; --
True -- DATETIME
---- --
t -- Shorthand values
-- Not directly usable for regression testing since these are not constants.
-- So, just try to test parser and hope for the best - tgl 97/04/26
SELECT (datetime 'today' = (datetime 'yesterday' + timespan '1 day')) as "True";
True
------
t
(1 row) (1 row)
QUERY: SELECT ('today'::datetime = ('tomorrow'::datetime - '1 day'::timespan)) as "True"; SELECT (datetime 'today' = (datetime 'tomorrow' - timespan '1 day')) as "True";
True True
---- ------
t t
(1 row) (1 row)
QUERY: SELECT ('tomorrow'::datetime = ('yesterday'::datetime + '2 days'::timespan)) as "True"; SELECT (datetime 'tomorrow' = (datetime 'yesterday' + timespan '2 days')) as "True";
True True
---- ------
t t
(1 row) (1 row)
QUERY: SELECT ('current'::datetime = 'now'::datetime) as "True"; SELECT (datetime 'current' = 'now') as "True";
True True
---- ------
t t
(1 row) (1 row)
QUERY: SELECT ('now'::datetime - 'current'::datetime) AS "ZeroSecs"; SELECT (datetime 'now' - 'current') AS "ZeroSecs";
ZeroSecs ZeroSecs
-------- ----------
@ 0 @ 0
(1 row) (1 row)
QUERY: SET DateStyle = 'Postgres,noneuropean'; SET DateStyle = 'Postgres,noneuropean';
QUERY: SELECT datetime('1994-01-01', '11:00') AS "Jan_01_1994_11am"; SELECT datetime('1994-01-01', '11:00') AS "Jan_01_1994_11am";
Jan_01_1994_11am Jan_01_1994_11am
---------------------------- ------------------------------
Sat Jan 01 11:00:00 1994 PST Sat Jan 01 11:00:00 1994 PST
(1 row) (1 row)
QUERY: CREATE TABLE DATETIME_TBL( d1 datetime); CREATE TABLE DATETIME_TBL( d1 datetime);
QUERY: INSERT INTO DATETIME_TBL VALUES ('current'); INSERT INTO DATETIME_TBL VALUES ('current');
QUERY: INSERT INTO DATETIME_TBL VALUES ('today'); INSERT INTO DATETIME_TBL VALUES ('today');
QUERY: INSERT INTO DATETIME_TBL VALUES ('yesterday'); INSERT INTO DATETIME_TBL VALUES ('yesterday');
QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow'); INSERT INTO DATETIME_TBL VALUES ('tomorrow');
QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow EST'); INSERT INTO DATETIME_TBL VALUES ('tomorrow EST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow zulu'); INSERT INTO DATETIME_TBL VALUES ('tomorrow zulu');
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'today'::datetime; SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = datetime 'today';
one one
--- -----
1 1
(1 row) (1 row)
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'tomorrow'::datetime; SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = datetime 'tomorrow';
one one
--- -----
1 1
(1 row) (1 row)
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'yesterday'::datetime; SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = datetime 'yesterday';
one one
--- -----
1 1
(1 row) (1 row)
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'today'::datetime + '1 day'::timespan; SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = datetime 'today' + timespan '1 day';
one one
--- -----
1 1
(1 row) (1 row)
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'today'::datetime - '1 day'::timespan; SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = datetime 'today' - timespan '1 day';
one one
--- -----
1 1
(1 row) (1 row)
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime; SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = datetime 'now';
one one
--- -----
1 1
(1 row) (1 row)
QUERY: DELETE FROM DATETIME_TBL; DELETE FROM DATETIME_TBL;
QUERY: INSERT INTO DATETIME_TBL VALUES ('current'); -- verify uniform transaction time within transaction block
QUERY: BEGIN; INSERT INTO DATETIME_TBL VALUES ('current');
QUERY: INSERT INTO DATETIME_TBL VALUES ('now'); BEGIN;
QUERY: SELECT count(*) AS two FROM DATETIME_TBL WHERE d1 = 'now'::datetime; INSERT INTO DATETIME_TBL VALUES ('now');
two SELECT count(*) AS two FROM DATETIME_TBL WHERE d1 = datetime 'now';
--- two
2 -----
2
(1 row) (1 row)
QUERY: END; END;
QUERY: DELETE FROM DATETIME_TBL; DELETE FROM DATETIME_TBL;
QUERY: INSERT INTO DATETIME_TBL VALUES ('invalid'); -- Special values
QUERY: INSERT INTO DATETIME_TBL VALUES ('-infinity'); INSERT INTO DATETIME_TBL VALUES ('invalid');
QUERY: INSERT INTO DATETIME_TBL VALUES ('infinity'); INSERT INTO DATETIME_TBL VALUES ('-infinity');
QUERY: INSERT INTO DATETIME_TBL VALUES ('epoch'); INSERT INTO DATETIME_TBL VALUES ('infinity');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST'); INSERT INTO DATETIME_TBL VALUES ('epoch');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Invalid Abstime'); -- Postgres v6.0 standard output format
QUERY: INSERT INTO DATETIME_TBL VALUES ('Undefined Abstime'); INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.000001 1997 PST'); INSERT INTO DATETIME_TBL VALUES ('Invalid Abstime');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.999999 1997 PST'); INSERT INTO DATETIME_TBL VALUES ('Undefined Abstime');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.4 1997 PST'); -- Variations on Postgres v6.1 standard output format
QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.5 1997 PST'); INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.000001 1997 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.6 1997 PST'); INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.999999 1997 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-01-02'); INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.4 1997 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-01-02 03:04:05'); INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.5 1997 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01-08'); INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.6 1997 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01-0800'); -- ISO 8601 format
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01 -08:00'); INSERT INTO DATETIME_TBL VALUES ('1997-01-02');
QUERY: INSERT INTO DATETIME_TBL VALUES ('19970210 173201 -0800'); INSERT INTO DATETIME_TBL VALUES ('1997-01-02 03:04:05');
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-06-10 17:32:01 -07:00'); INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01-08');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997 -0800'); INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01-0800');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01 -08:00');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 10 5:32PM 1997'); INSERT INTO DATETIME_TBL VALUES ('19970210 173201 -0800');
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997/02/10 17:32:01-0800'); INSERT INTO DATETIME_TBL VALUES ('1997-06-10 17:32:01 -07:00');
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01 PST'); -- Variations for acceptable input formats
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb-10-1997 17:32:01 PST'); INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997 -0800');
QUERY: INSERT INTO DATETIME_TBL VALUES ('02-10-1997 17:32:01 PST'); INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('19970210 173201 PST'); INSERT INTO DATETIME_TBL VALUES ('Feb 10 5:32PM 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('97FEB10 5:32:01PM UTC'); INSERT INTO DATETIME_TBL VALUES ('1997/02/10 17:32:01-0800');
QUERY: INSERT INTO DATETIME_TBL VALUES ('97/02/10 17:32:01 UTC'); INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('97.041 17:32:01 UTC'); INSERT INTO DATETIME_TBL VALUES ('Feb-10-1997 17:32:01 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-06-10 18:32:01 PDT'); INSERT INTO DATETIME_TBL VALUES ('02-10-1997 17:32:01 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('19970210 173201 PST');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 11 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('97FEB10 5:32:01PM UTC');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 12 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('97/02/10 17:32:01 UTC');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 13 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('97.041 17:32:01 UTC');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 14 17:32:01 1997'); -- Check date conversion and date arithmetic
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 15 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('1997-06-10 18:32:01 PDT');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0097 BC'); INSERT INTO DATETIME_TBL VALUES ('Feb 11 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0097'); INSERT INTO DATETIME_TBL VALUES ('Feb 12 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0597'); INSERT INTO DATETIME_TBL VALUES ('Feb 13 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1097'); INSERT INTO DATETIME_TBL VALUES ('Feb 14 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1697'); INSERT INTO DATETIME_TBL VALUES ('Feb 15 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1797'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1897'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0097 BC');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0097');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 2097'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0597');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 28 17:32:01 1996'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1097');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 29 17:32:01 1996'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1697');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Mar 01 17:32:01 1996'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1797');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 30 17:32:01 1996'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1897');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1996'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 2097');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 28 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('Feb 28 17:32:01 1996');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 29 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('Feb 29 17:32:01 1996');
INSERT INTO DATETIME_TBL VALUES ('Mar 01 17:32:01 1996');
INSERT INTO DATETIME_TBL VALUES ('Dec 30 17:32:01 1996');
INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1996');
INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 1997');
INSERT INTO DATETIME_TBL VALUES ('Feb 28 17:32:01 1997');
INSERT INTO DATETIME_TBL VALUES ('Feb 29 17:32:01 1997');
ERROR: Bad datetime external representation 'Feb 29 17:32:01 1997' ERROR: Bad datetime external representation 'Feb 29 17:32:01 1997'
QUERY: INSERT INTO DATETIME_TBL VALUES ('Mar 01 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('Mar 01 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 30 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('Dec 30 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1997'); INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1997');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1999'); INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1999');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 2000'); INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 2000');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 2000'); INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 2000');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 2001'); INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 2001');
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 -0097'); -- Currently unsupported syntax and ranges
INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 -0097');
ERROR: Bad datetime external representation 'Feb 16 17:32:01 -0097' ERROR: Bad datetime external representation 'Feb 16 17:32:01 -0097'
QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 5097 BC'); INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 5097 BC');
ERROR: Datetime out of range 'Feb 16 17:32:01 5097 BC' ERROR: Datetime out of range 'Feb 16 17:32:01 5097 BC'
QUERY: SELECT '' AS sixtythree, d1 FROM DATETIME_TBL; SELECT '' AS sixtythree, d1 FROM DATETIME_TBL;
sixtythree|d1 sixtythree | d1
----------+------------------------------- ------------+---------------------------------
|invalid | invalid
|-infinity | -infinity
|infinity | infinity
|epoch | epoch
|Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST
|invalid | invalid
|invalid | invalid
|Mon Feb 10 17:32:01.00 1997 PST | Mon Feb 10 17:32:01.00 1997 PST
|Mon Feb 10 17:32:02.00 1997 PST | Mon Feb 10 17:32:02.00 1997 PST
|Mon Feb 10 17:32:01.40 1997 PST | Mon Feb 10 17:32:01.40 1997 PST
|Mon Feb 10 17:32:01.50 1997 PST | Mon Feb 10 17:32:01.50 1997 PST
|Mon Feb 10 17:32:01.60 1997 PST | Mon Feb 10 17:32:01.60 1997 PST
|Thu Jan 02 00:00:00 1997 PST | Thu Jan 02 00:00:00 1997 PST
|Thu Jan 02 03:04:05 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
|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 | Tue Jun 10 17: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 1997 PST
|Mon Feb 10 17:32:00 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 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 09:32:01 1997 PST
|Mon Feb 10 09:32:01 1997 PST | Mon Feb 10 09:32:01 1997 PST
|Tue Jun 10 18: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
|Tue Feb 11 17:32:01 1997 PST | Tue Feb 11 17:32:01 1997 PST
|Wed Feb 12 17:32:01 1997 PST | Wed Feb 12 17:32:01 1997 PST
|Thu Feb 13 17:32:01 1997 PST | Thu Feb 13 17:32:01 1997 PST
|Fri Feb 14 17:32:01 1997 PST | Fri Feb 14 17:32:01 1997 PST
|Sat Feb 15 17:32:01 1997 PST | Sat Feb 15 17:32:01 1997 PST
|Sun Feb 16 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST
|Tue Feb 16 17:32 0097 BC | Tue Feb 16 17:32 0097 BC
|Sat Feb 16 17:32:01 0097 | Sat Feb 16 17:32:01 0097
|Thu Feb 16 17:32:01 0597 | Thu Feb 16 17:32:01 0597
|Tue Feb 16 17:32:01 1097 | Tue Feb 16 17:32:01 1097
|Sat Feb 16 17:32:01 1697 | Sat Feb 16 17:32:01 1697
|Thu Feb 16 17:32:01 1797 | Thu Feb 16 17:32:01 1797
|Tue Feb 16 17:32:01 1897 | Tue Feb 16 17:32:01 1897
|Sun Feb 16 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST
|Sat Feb 16 17:32:01 2097 | Sat Feb 16 17:32:01 2097
|Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST
|Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST
|Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST
|Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST
|Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST
|Wed Jan 01 17:32:01 1997 PST | Wed Jan 01 17:32:01 1997 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 | Sat Mar 01 17:32:01 1997 PST
|Tue Dec 30 17:32:01 1997 PST | Tue Dec 30 17:32:01 1997 PST
|Wed Dec 31 17:32:01 1997 PST | Wed Dec 31 17:32:01 1997 PST
|Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST
|Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST
|Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST
|Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST
(61 rows) (61 rows)
QUERY: SELECT '' AS fortythree, d1 FROM DATETIME_TBL -- Demonstrate functions and operators
WHERE d1 > '1997-01-02'::datetime and d1 != 'current'::datetime; SELECT '' AS fortythree, d1 FROM DATETIME_TBL
fortythree|d1 WHERE d1 > datetime '1997-01-02' and d1 != datetime 'current';
----------+------------------------------- fortythree | d1
|infinity ------------+---------------------------------
|Mon Feb 10 17:32:01 1997 PST | infinity
|Mon Feb 10 17:32:01.00 1997 PST | Mon Feb 10 17:32:01 1997 PST
|Mon Feb 10 17:32:02.00 1997 PST | Mon Feb 10 17:32:01.00 1997 PST
|Mon Feb 10 17:32:01.40 1997 PST | Mon Feb 10 17:32:02.00 1997 PST
|Mon Feb 10 17:32:01.50 1997 PST | Mon Feb 10 17:32:01.40 1997 PST
|Mon Feb 10 17:32:01.60 1997 PST | Mon Feb 10 17:32:01.50 1997 PST
|Thu Jan 02 03:04:05 1997 PST | Mon Feb 10 17:32:01.60 1997 PST
|Mon Feb 10 17:32:01 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
|Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST
|Tue Jun 10 17:32:01 1997 PDT | Mon Feb 10 17:32:01 1997 PST
|Mon Feb 10 17:32:01 1997 PST | Tue Jun 10 17: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:00 1997 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 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 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 09:32:01 1997 PST
|Tue Jun 10 18:32:01 1997 PDT | Mon Feb 10 09:32:01 1997 PST
|Mon Feb 10 17:32:01 1997 PST | Tue Jun 10 18:32:01 1997 PDT
|Tue Feb 11 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST
|Wed Feb 12 17:32:01 1997 PST | Tue Feb 11 17:32:01 1997 PST
|Thu Feb 13 17:32:01 1997 PST | Wed Feb 12 17:32:01 1997 PST
|Fri Feb 14 17:32:01 1997 PST | Thu Feb 13 17:32:01 1997 PST
|Sat Feb 15 17:32:01 1997 PST | Fri Feb 14 17:32:01 1997 PST
|Sun Feb 16 17:32:01 1997 PST | 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 | Sun Feb 16 17:32:01 1997 PST
|Fri Feb 28 17:32:01 1997 PST | Sat Feb 16 17:32:01 2097
|Sat Mar 01 17:32:01 1997 PST | Fri Feb 28 17:32:01 1997 PST
|Tue Dec 30 17:32:01 1997 PST | Sat Mar 01 17:32:01 1997 PST
|Wed Dec 31 17:32:01 1997 PST | Tue Dec 30 17:32:01 1997 PST
|Fri Dec 31 17:32:01 1999 PST | Wed Dec 31 17:32:01 1997 PST
|Sat Jan 01 17:32:01 2000 PST | Fri Dec 31 17:32:01 1999 PST
|Sun Dec 31 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST
|Mon Jan 01 17:32:01 2001 PST | Sun Dec 31 17:32:01 2000 PST
| Mon Jan 01 17:32:01 2001 PST
(42 rows) (42 rows)
QUERY: SELECT '' AS fifteen, d1 FROM DATETIME_TBL SELECT '' AS fifteen, d1 FROM DATETIME_TBL
WHERE d1 < '1997-01-02'::datetime and d1 != 'current'::datetime; WHERE d1 < datetime '1997-01-02' and d1 != datetime 'current';
fifteen|d1 fifteen | d1
-------+---------------------------- ---------+------------------------------
|-infinity | -infinity
|epoch | epoch
|Tue Feb 16 17:32 0097 BC | Tue Feb 16 17:32 0097 BC
|Sat Feb 16 17:32:01 0097 | Sat Feb 16 17:32:01 0097
|Thu Feb 16 17:32:01 0597 | Thu Feb 16 17:32:01 0597
|Tue Feb 16 17:32:01 1097 | Tue Feb 16 17:32:01 1097
|Sat Feb 16 17:32:01 1697 | Sat Feb 16 17:32:01 1697
|Thu Feb 16 17:32:01 1797 | Thu Feb 16 17:32:01 1797
|Tue Feb 16 17:32:01 1897 | Tue Feb 16 17:32:01 1897
|Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST
|Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST
|Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST
|Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST
|Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST
|Wed Jan 01 17:32:01 1997 PST | Wed Jan 01 17:32:01 1997 PST
(15 rows) (15 rows)
QUERY: SELECT '' AS one, d1 FROM DATETIME_TBL SELECT '' AS one, d1 FROM DATETIME_TBL
WHERE d1 = '1997-01-02'::datetime and d1 != 'current'::datetime; WHERE d1 = datetime '1997-01-02' and d1 != datetime 'current';
one|d1 one | d1
---+---------------------------- -----+------------------------------
|Thu Jan 02 00:00:00 1997 PST | Thu Jan 02 00:00:00 1997 PST
(1 row) (1 row)
QUERY: SELECT '' AS fiftyeight, d1 FROM DATETIME_TBL SELECT '' AS fiftyeight, d1 FROM DATETIME_TBL
WHERE d1 != '1997-01-02'::datetime and d1 != 'current'::datetime; WHERE d1 != datetime '1997-01-02' and d1 != datetime 'current';
fiftyeight|d1 fiftyeight | d1
----------+------------------------------- ------------+---------------------------------
|-infinity | -infinity
|infinity | infinity
|epoch | epoch
|Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST
|Mon Feb 10 17:32:01.00 1997 PST | Mon Feb 10 17:32:01.00 1997 PST
|Mon Feb 10 17:32:02.00 1997 PST | Mon Feb 10 17:32:02.00 1997 PST
|Mon Feb 10 17:32:01.40 1997 PST | Mon Feb 10 17:32:01.40 1997 PST
|Mon Feb 10 17:32:01.50 1997 PST | Mon Feb 10 17:32:01.50 1997 PST
|Mon Feb 10 17:32:01.60 1997 PST | Mon Feb 10 17:32:01.60 1997 PST
|Thu Jan 02 03:04:05 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
|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 | Tue Jun 10 17: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 1997 PST
|Mon Feb 10 17:32:00 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 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 09:32:01 1997 PST
|Mon Feb 10 09:32:01 1997 PST | Mon Feb 10 09:32:01 1997 PST
|Tue Jun 10 18: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
|Tue Feb 11 17:32:01 1997 PST | Tue Feb 11 17:32:01 1997 PST
|Wed Feb 12 17:32:01 1997 PST | Wed Feb 12 17:32:01 1997 PST
|Thu Feb 13 17:32:01 1997 PST | Thu Feb 13 17:32:01 1997 PST
|Fri Feb 14 17:32:01 1997 PST | Fri Feb 14 17:32:01 1997 PST
|Sat Feb 15 17:32:01 1997 PST | Sat Feb 15 17:32:01 1997 PST
|Sun Feb 16 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST
|Tue Feb 16 17:32 0097 BC | Tue Feb 16 17:32 0097 BC
|Sat Feb 16 17:32:01 0097 | Sat Feb 16 17:32:01 0097
|Thu Feb 16 17:32:01 0597 | Thu Feb 16 17:32:01 0597
|Tue Feb 16 17:32:01 1097 | Tue Feb 16 17:32:01 1097
|Sat Feb 16 17:32:01 1697 | Sat Feb 16 17:32:01 1697
|Thu Feb 16 17:32:01 1797 | Thu Feb 16 17:32:01 1797
|Tue Feb 16 17:32:01 1897 | Tue Feb 16 17:32:01 1897
|Sun Feb 16 17:32:01 1997 PST | Sun Feb 16 17:32:01 1997 PST
|Sat Feb 16 17:32:01 2097 | Sat Feb 16 17:32:01 2097
|Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST
|Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST
|Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST
|Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST
|Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST
|Wed Jan 01 17:32:01 1997 PST | Wed Jan 01 17:32:01 1997 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 | Sat Mar 01 17:32:01 1997 PST
|Tue Dec 30 17:32:01 1997 PST | Tue Dec 30 17:32:01 1997 PST
|Wed Dec 31 17:32:01 1997 PST | Wed Dec 31 17:32:01 1997 PST
|Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST
|Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST
|Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST
|Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST
(57 rows) (57 rows)
QUERY: SELECT '' AS sixteen, d1 FROM DATETIME_TBL SELECT '' AS sixteen, d1 FROM DATETIME_TBL
WHERE d1 <= '1997-01-02'::datetime and d1 != 'current'::datetime; WHERE d1 <= datetime '1997-01-02' and d1 != datetime 'current';
sixteen|d1 sixteen | d1
-------+---------------------------- ---------+------------------------------
|-infinity | -infinity
|epoch | epoch
|Thu Jan 02 00:00:00 1997 PST | Thu Jan 02 00:00:00 1997 PST
|Tue Feb 16 17:32 0097 BC | Tue Feb 16 17:32 0097 BC
|Sat Feb 16 17:32:01 0097 | Sat Feb 16 17:32:01 0097
|Thu Feb 16 17:32:01 0597 | Thu Feb 16 17:32:01 0597
|Tue Feb 16 17:32:01 1097 | Tue Feb 16 17:32:01 1097
|Sat Feb 16 17:32:01 1697 | Sat Feb 16 17:32:01 1697
|Thu Feb 16 17:32:01 1797 | Thu Feb 16 17:32:01 1797
|Tue Feb 16 17:32:01 1897 | Tue Feb 16 17:32:01 1897
|Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST
|Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST
|Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST
|Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST
|Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST
|Wed Jan 01 17:32:01 1997 PST | Wed Jan 01 17:32:01 1997 PST
(16 rows) (16 rows)
QUERY: SELECT '' AS fortyfour, d1 FROM DATETIME_TBL SELECT '' AS fortyfour, d1 FROM DATETIME_TBL
WHERE d1 >= '1997-01-02'::datetime and d1 != 'current'::datetime; WHERE d1 >= datetime '1997-01-02' and d1 != datetime 'current';
fortyfour|d1 fortyfour | d1
---------+------------------------------- -----------+---------------------------------
|infinity | infinity
|Mon Feb 10 17:32:01 1997 PST | Mon Feb 10 17:32:01 1997 PST
|Mon Feb 10 17:32:01.00 1997 PST | Mon Feb 10 17:32:01.00 1997 PST
|Mon Feb 10 17:32:02.00 1997 PST | Mon Feb 10 17:32:02.00 1997 PST
|Mon Feb 10 17:32:01.40 1997 PST | Mon Feb 10 17:32:01.40 1997 PST
|Mon Feb 10 17:32:01.50 1997 PST | Mon Feb 10 17:32:01.50 1997 PST
|Mon Feb 10 17:32:01.60 1997 PST | Mon Feb 10 17:32:01.60 1997 PST
|Thu Jan 02 00:00:00 1997 PST | Thu Jan 02 00:00:00 1997 PST
|Thu Jan 02 03:04:05 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
|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 | Tue Jun 10 17: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 1997 PST
|Mon Feb 10 17:32:00 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 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 09:32:01 1997 PST
|Mon Feb 10 09:32:01 1997 PST | Mon Feb 10 09:32:01 1997 PST
|Tue Jun 10 18: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
|Tue Feb 11 17:32:01 1997 PST | Tue Feb 11 17:32:01 1997 PST
|Wed Feb 12 17:32:01 1997 PST | Wed Feb 12 17:32:01 1997 PST
|Thu Feb 13 17:32:01 1997 PST | Thu Feb 13 17:32:01 1997 PST
|Fri Feb 14 17:32:01 1997 PST | Fri Feb 14 17:32:01 1997 PST
|Sat Feb 15 17:32:01 1997 PST | Sat Feb 15 17:32:01 1997 PST
|Sun Feb 16 17:32:01 1997 PST | Sun Feb 16 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 | Sat Feb 16 17:32:01 2097
|Fri Feb 28 17:32:01 1997 PST | Fri Feb 28 17:32:01 1997 PST
|Sat Mar 01 17:32:01 1997 PST | Sat Mar 01 17:32:01 1997 PST
|Tue Dec 30 17:32:01 1997 PST | Tue Dec 30 17:32:01 1997 PST
|Wed Dec 31 17:32:01 1997 PST | Wed Dec 31 17:32:01 1997 PST
|Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST
|Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST
|Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST
|Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST
(43 rows) (43 rows)
QUERY: SELECT '' AS sixtythree, d1 + '1 year'::timespan AS one_year FROM DATETIME_TBL; SELECT '' AS sixtythree, d1 + timespan '1 year' AS one_year FROM DATETIME_TBL;
sixtythree|one_year sixtythree | one_year
----------+------------------------------- ------------+---------------------------------
|invalid | invalid
|-infinity | -infinity
|infinity | infinity
|Thu Dec 31 16:00:00 1970 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
|invalid | invalid
|invalid | invalid
|Tue Feb 10 17:32:01.00 1998 PST | Tue Feb 10 17:32:01.00 1998 PST
|Tue Feb 10 17:32:02.00 1998 PST | Tue Feb 10 17:32:02.00 1998 PST
|Tue Feb 10 17:32:01.40 1998 PST | Tue Feb 10 17:32:01.40 1998 PST
|Tue Feb 10 17:32:01.50 1998 PST | Tue Feb 10 17:32:01.50 1998 PST
|Tue Feb 10 17:32:01.60 1998 PST | Tue Feb 10 17:32:01.60 1998 PST
|Fri Jan 02 00:00:00 1998 PST | Fri Jan 02 00:00:00 1998 PST
|Fri Jan 02 03:04:05 1998 PST | Fri Jan 02 03:04:05 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
|Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST
|Wed Jun 10 17:32:01 1998 PDT | Wed Jun 10 17:32:01 1998 PDT
|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:00 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
|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 09:32:01 1998 PST
|Tue Feb 10 09:32:01 1998 PST | Tue Feb 10 09:32:01 1998 PST
|Wed Jun 10 18: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 1998 PST
|Wed Feb 11 17:32:01 1998 PST | Wed Feb 11 17:32:01 1998 PST
|Thu Feb 12 17:32:01 1998 PST | Thu Feb 12 17:32:01 1998 PST
|Fri Feb 13 17:32:01 1998 PST | Fri Feb 13 17:32:01 1998 PST
|Sat Feb 14 17:32:01 1998 PST | Sat Feb 14 17:32:01 1998 PST
|Sun Feb 15 17:32:01 1998 PST | Sun Feb 15 17:32:01 1998 PST
|Mon Feb 16 17:32:01 1998 PST | Mon Feb 16 17:32:01 1998 PST
|Thu Feb 16 17:32 0096 BC | Thu Feb 16 17:32 0096 BC
|Sun Feb 16 17:32:01 0098 | Sun Feb 16 17:32:01 0098
|Fri Feb 16 17:32:01 0598 | Fri Feb 16 17:32:01 0598
|Wed Feb 16 17:32:01 1098 | Wed Feb 16 17:32:01 1098
|Sun Feb 16 17:32:01 1698 | Sun Feb 16 17:32:01 1698
|Fri Feb 16 17:32:01 1798 | Fri Feb 16 17:32:01 1798
|Wed Feb 16 17:32:01 1898 | Wed Feb 16 17:32:01 1898
|Mon Feb 16 17:32:01 1998 PST | Mon Feb 16 17:32:01 1998 PST
|Sun Feb 16 17:32:01 2098 | Sun Feb 16 17:32:01 2098
|Fri Feb 28 17:32:01 1997 PST | Fri Feb 28 17:32:01 1997 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 | Sat Mar 01 17:32:01 1997 PST
|Tue Dec 30 17:32:01 1997 PST | Tue Dec 30 17:32:01 1997 PST
|Wed Dec 31 17:32:01 1997 PST | Wed Dec 31 17:32:01 1997 PST
|Thu Jan 01 17:32:01 1998 PST | Thu Jan 01 17:32:01 1998 PST
|Sat Feb 28 17:32:01 1998 PST | Sat Feb 28 17:32:01 1998 PST
|Sun Mar 01 17:32:01 1998 PST | Sun Mar 01 17:32:01 1998 PST
|Wed Dec 30 17:32:01 1998 PST | Wed Dec 30 17:32:01 1998 PST
|Thu Dec 31 17:32:01 1998 PST | Thu Dec 31 17:32:01 1998 PST
|Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST
|Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST
|Mon Dec 31 17:32:01 2001 PST | Mon Dec 31 17:32:01 2001 PST
|Tue Jan 01 17:32:01 2002 PST | Tue Jan 01 17:32:01 2002 PST
(61 rows) (61 rows)
QUERY: SELECT '' AS sixtythree, d1 - '1 year'::timespan AS one_year FROM DATETIME_TBL; SELECT '' AS sixtythree, d1 - timespan '1 year' AS one_year FROM DATETIME_TBL;
sixtythree|one_year sixtythree | one_year
----------+------------------------------- ------------+---------------------------------
|invalid | invalid
|-infinity | -infinity
|infinity | infinity
|Tue Dec 31 16:00:00 1968 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
|invalid | invalid
|invalid | invalid
|Sat Feb 10 17:32:01.00 1996 PST | Sat Feb 10 17:32:01.00 1996 PST
|Sat Feb 10 17:32:02.00 1996 PST | Sat Feb 10 17:32:02.00 1996 PST
|Sat Feb 10 17:32:01.40 1996 PST | Sat Feb 10 17:32:01.40 1996 PST
|Sat Feb 10 17:32:01.50 1996 PST | Sat Feb 10 17:32:01.50 1996 PST
|Sat Feb 10 17:32:01.60 1996 PST | Sat Feb 10 17:32:01.60 1996 PST
|Tue Jan 02 00:00:00 1996 PST | Tue Jan 02 00:00:00 1996 PST
|Tue Jan 02 03:04:05 1996 PST | Tue Jan 02 03:04:05 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 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 | Mon Jun 10 17: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 1996 PST | Sat Feb 10 17:32:01 1996 PST
|Sat Feb 10 17:32:00 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 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 09:32:01 1996 PST
|Sat Feb 10 09:32:01 1996 PST | Sat Feb 10 09:32:01 1996 PST
|Mon Jun 10 18: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
|Sun Feb 11 17:32:01 1996 PST | Sun Feb 11 17:32:01 1996 PST
|Mon Feb 12 17:32:01 1996 PST | Mon Feb 12 17:32:01 1996 PST
|Tue Feb 13 17:32:01 1996 PST | Tue Feb 13 17:32:01 1996 PST
|Wed Feb 14 17:32:01 1996 PST | Wed Feb 14 17:32:01 1996 PST
|Thu Feb 15 17:32:01 1996 PST | Thu Feb 15 17:32:01 1996 PST
|Fri Feb 16 17:32:01 1996 PST | Fri Feb 16 17:32:01 1996 PST
|Mon Feb 16 17:32 0098 BC | Mon Feb 16 17:32 0098 BC
|Thu Feb 16 17:32:01 0096 | Thu Feb 16 17:32:01 0096
|Tue Feb 16 17:32:01 0596 | Tue Feb 16 17:32:01 0596
|Sun Feb 16 17:32:01 1096 | Sun Feb 16 17:32:01 1096
|Thu Feb 16 17:32:01 1696 | Thu Feb 16 17:32:01 1696
|Tue Feb 16 17:32:01 1796 | Tue Feb 16 17:32:01 1796
|Sun Feb 16 17:32:01 1896 | Sun Feb 16 17:32:01 1896
|Fri Feb 16 17:32:01 1996 PST | Fri Feb 16 17:32:01 1996 PST
|Thu Feb 16 17:32:01 2096 | Thu Feb 16 17:32:01 2096
|Tue Feb 28 17:32:01 1995 PST | Tue Feb 28 17:32:01 1995 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 | Wed Mar 01 17:32:01 1995 PST
|Sat Dec 30 17:32:01 1995 PST | Sat Dec 30 17:32:01 1995 PST
|Sun Dec 31 17:32:01 1995 PST | Sun Dec 31 17:32:01 1995 PST
|Mon Jan 01 17:32:01 1996 PST | Mon Jan 01 17:32:01 1996 PST
|Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST
|Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST
|Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST
|Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST
|Thu Dec 31 17:32:01 1998 PST | Thu Dec 31 17:32:01 1998 PST
|Fri Jan 01 17:32:01 1999 PST | Fri Jan 01 17:32:01 1999 PST
|Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST
|Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST
(61 rows) (61 rows)
QUERY: SELECT '' AS fifty, d1 - '1997-01-02'::datetime AS diff -- Casting within a BETWEEN qualifier should probably be allowed by the parser. - tgl 97/04/26
--SELECT '' AS fifty, d1 - datetime '1997-01-02' AS diff
-- FROM DATETIME_TBL WHERE d1 BETWEEN datetime '1902-01-01' AND datetime '2038-01-01';
SELECT '' AS fifty, d1 - datetime '1997-01-02' AS diff
FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
fifty|diff fifty | diff
-----+-------------------------------------- -------+----------------------------------------
|@ 9863 days 8 hours ago | @ 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 1.00 secs | @ 39 days 17 hours 32 mins 1.00 secs
|@ 39 days 17 hours 32 mins 2.00 secs | @ 39 days 17 hours 32 mins 2.00 secs
|@ 39 days 17 hours 32 mins 1.40 secs | @ 39 days 17 hours 32 mins 1.40 secs
|@ 39 days 17 hours 32 mins 1.50 secs | @ 39 days 17 hours 32 mins 1.50 secs
|@ 39 days 17 hours 32 mins 1.60 secs | @ 39 days 17 hours 32 mins 1.60 secs
|@ 0 | @ 0
|@ 3 hours 4 mins 5 secs | @ 3 hours 4 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 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 16 hours 32 mins 1 sec | @ 159 days 16 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 | @ 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
|@ 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 9 hours 32 mins 1 sec
|@ 39 days 9 hours 32 mins 1 sec | @ 39 days 9 hours 32 mins 1 sec
|@ 159 days 17 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
|@ 40 days 17 hours 32 mins 1 sec | @ 40 days 17 hours 32 mins 1 sec
|@ 41 days 17 hours 32 mins 1 sec | @ 41 days 17 hours 32 mins 1 sec
|@ 42 days 17 hours 32 mins 1 sec | @ 42 days 17 hours 32 mins 1 sec
|@ 43 days 17 hours 32 mins 1 sec | @ 43 days 17 hours 32 mins 1 sec
|@ 44 days 17 hours 32 mins 1 sec | @ 44 days 17 hours 32 mins 1 sec
|@ 45 days 17 hours 32 mins 1 sec | @ 45 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 | @ 308 days 6 hours 27 mins 59 secs ago
|@ 307 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 | @ 306 days 6 hours 27 mins 59 secs ago
|@ 2 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 | @ 1 day 6 hours 27 mins 59 secs ago
|@ 6 hours 27 mins 59 secs ago | @ 6 hours 27 mins 59 secs ago
|@ 57 days 17 hours 32 mins 1 sec | @ 57 days 17 hours 32 mins 1 sec
|@ 58 days 17 hours 32 mins 1 sec | @ 58 days 17 hours 32 mins 1 sec
|@ 362 days 17 hours 32 mins 1 sec | @ 362 days 17 hours 32 mins 1 sec
|@ 363 days 17 hours 32 mins 1 sec | @ 363 days 17 hours 32 mins 1 sec
|@ 1093 days 17 hours 32 mins 1 sec | @ 1093 days 17 hours 32 mins 1 sec
|@ 1094 days 17 hours 32 mins 1 sec | @ 1094 days 17 hours 32 mins 1 sec
|@ 1459 days 17 hours 32 mins 1 sec | @ 1459 days 17 hours 32 mins 1 sec
|@ 1460 days 17 hours 32 mins 1 sec | @ 1460 days 17 hours 32 mins 1 sec
(48 rows) (48 rows)
QUERY: SELECT '' AS fortynine, date_part( 'year', d1) AS year, date_part( 'month', d1) AS month, SELECT '' AS fortynine, 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( 'day', d1) AS day, date_part( 'hour', d1) AS hour,
date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second
FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
fortynine|year|month|day|hour|minute| second fortynine | year | month | day | hour | minute | second
---------+----+-----+---+----+------+-------- -----------+------+-------+-----+------+--------+----------
|1969| 12| 31| 16| 0| 0 | 1969 | 12 | 31 | 16 | 0 | 0
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32|1.000001 | 1997 | 2 | 10 | 17 | 32 | 1.000001
|1997| 2| 10| 17| 32|1.999999 | 1997 | 2 | 10 | 17 | 32 | 1.999999
|1997| 2| 10| 17| 32| 1.4 | 1997 | 2 | 10 | 17 | 32 | 1.4
|1997| 2| 10| 17| 32| 1.5 | 1997 | 2 | 10 | 17 | 32 | 1.5
|1997| 2| 10| 17| 32| 1.6 | 1997 | 2 | 10 | 17 | 32 | 1.6
|1997| 1| 2| 0| 0| 0 | 1997 | 1 | 2 | 0 | 0 | 0
|1997| 1| 2| 3| 4| 5 | 1997 | 1 | 2 | 3 | 4 | 5
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 6| 10| 17| 32| 1 | 1997 | 6 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 0 | 1997 | 2 | 10 | 17 | 32 | 0
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 10| 9| 32| 1 | 1997 | 2 | 10 | 9 | 32 | 1
|1997| 2| 10| 9| 32| 1 | 1997 | 2 | 10 | 9 | 32 | 1
|1997| 2| 10| 9| 32| 1 | 1997 | 2 | 10 | 9 | 32 | 1
|1997| 6| 10| 18| 32| 1 | 1997 | 6 | 10 | 18 | 32 | 1
|1997| 2| 10| 17| 32| 1 | 1997 | 2 | 10 | 17 | 32 | 1
|1997| 2| 11| 17| 32| 1 | 1997 | 2 | 11 | 17 | 32 | 1
|1997| 2| 12| 17| 32| 1 | 1997 | 2 | 12 | 17 | 32 | 1
|1997| 2| 13| 17| 32| 1 | 1997 | 2 | 13 | 17 | 32 | 1
|1997| 2| 14| 17| 32| 1 | 1997 | 2 | 14 | 17 | 32 | 1
|1997| 2| 15| 17| 32| 1 | 1997 | 2 | 15 | 17 | 32 | 1
|1997| 2| 16| 17| 32| 1 | 1997 | 2 | 16 | 17 | 32 | 1
|1997| 2| 16| 17| 32| 1 | 1997 | 2 | 16 | 17 | 32 | 1
|1996| 2| 28| 17| 32| 1 | 1996 | 2 | 28 | 17 | 32 | 1
|1996| 2| 29| 17| 32| 1 | 1996 | 2 | 29 | 17 | 32 | 1
|1996| 3| 1| 17| 32| 1 | 1996 | 3 | 1 | 17 | 32 | 1
|1996| 12| 30| 17| 32| 1 | 1996 | 12 | 30 | 17 | 32 | 1
|1996| 12| 31| 17| 32| 1 | 1996 | 12 | 31 | 17 | 32 | 1
|1997| 1| 1| 17| 32| 1 | 1997 | 1 | 1 | 17 | 32 | 1
|1997| 2| 28| 17| 32| 1 | 1997 | 2 | 28 | 17 | 32 | 1
|1997| 3| 1| 17| 32| 1 | 1997 | 3 | 1 | 17 | 32 | 1
|1997| 12| 30| 17| 32| 1 | 1997 | 12 | 30 | 17 | 32 | 1
|1997| 12| 31| 17| 32| 1 | 1997 | 12 | 31 | 17 | 32 | 1
|1999| 12| 31| 17| 32| 1 | 1999 | 12 | 31 | 17 | 32 | 1
|2000| 1| 1| 17| 32| 1 | 2000 | 1 | 1 | 17 | 32 | 1
|2000| 12| 31| 17| 32| 1 | 2000 | 12 | 31 | 17 | 32 | 1
|2001| 1| 1| 17| 32| 1 | 2001 | 1 | 1 | 17 | 32 | 1
(48 rows) (48 rows)
QUERY: SELECT '' AS fortynine, date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec, SELECT '' AS fortynine, date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec,
date_part( 'usec', d1) AS usec date_part( 'usec', d1) AS usec
FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
fortynine|quarter| msec| usec fortynine | quarter | msec | usec
---------+-------+--------------------+----------------- -----------+---------+----------------------+-------------------
| 4| 0| 0 | 4 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1|0.000999999999917733|0.999999999917733 | 1 | 0.000999999999917733 | 0.999999999917733
| 1| 999.999| 999999 | 1 | 999.999 | 999999
| 1| 400| 400000 | 1 | 400 | 400000
| 1| 500| 500000 | 1 | 500 | 500000
| 1| 600| 600000 | 1 | 600 | 600000
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 2| 0| 0 | 2 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 2| 0| 0 | 2 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 4| 0| 0 | 4 | 0 | 0
| 4| 0| 0 | 4 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 4| 0| 0 | 4 | 0 | 0
| 4| 0| 0 | 4 | 0 | 0
| 4| 0| 0 | 4 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
| 4| 0| 0 | 4 | 0 | 0
| 1| 0| 0 | 1 | 0 | 0
(48 rows) (48 rows)
QUERY: SELECT '' AS four, center(f1) AS center --
-- GEOMETRY
--
--
-- Points
--
SELECT '' AS four, center(f1) AS center
FROM BOX_TBL; FROM BOX_TBL;
four|center four | center
----+------- ------+---------
|(1,1) | (1,1)
|(2,2) | (2,2)
|(2.5,3) | (2.5,3)
|(3,3) | (3,3)
(4 rows) (4 rows)
QUERY: SELECT '' AS four, (@@ f1) AS center SELECT '' AS four, (@@ f1) AS center
FROM BOX_TBL; FROM BOX_TBL;
four|center four | center
----+------- ------+---------
|(1,1) | (1,1)
|(2,2) | (2,2)
|(2.5,3) | (2.5,3)
|(3,3) | (3,3)
(4 rows) (4 rows)
QUERY: SELECT '' AS six, point(f1) AS center SELECT '' AS six, point(f1) AS center
FROM CIRCLE_TBL; FROM CIRCLE_TBL;
six|center six | center
---+--------- -----+-----------
|(0,0) | (0,0)
|(1,2) | (1,2)
|(1,3) | (1,3)
|(1,2) | (1,2)
|(100,200) | (100,200)
|(100,0) | (100,0)
(6 rows) (6 rows)
QUERY: SELECT '' AS six, (@@ f1) AS center SELECT '' AS six, (@@ f1) AS center
FROM CIRCLE_TBL; FROM CIRCLE_TBL;
six|center six | center
---+--------- -----+-----------
|(0,0) | (0,0)
|(1,2) | (1,2)
|(1,3) | (1,3)
|(1,2) | (1,2)
|(100,200) | (100,200)
|(100,0) | (100,0)
(6 rows) (6 rows)
QUERY: SELECT '' AS two, (@@ f1) AS center SELECT '' AS two, (@@ f1) AS center
FROM POLYGON_TBL FROM POLYGON_TBL
WHERE (# f1) > 2; WHERE (# f1) > 2;
two|center two | center
---+----------------------------------- -----+-------------------------------------
|(1.33333333333333,1.33333333333333) | (1.33333333333333,1.33333333333333)
|(2.33333333333333,1.33333333333333) | (2.33333333333333,1.33333333333333)
(2 rows) (2 rows)
QUERY: SELECT '' AS two, p1.f1 -- "is horizontal" function
SELECT '' AS two, p1.f1
FROM POINT_TBL p1 FROM POINT_TBL p1
WHERE ishorizontal(p1.f1, '(0,0)'::point); WHERE ishorizontal(p1.f1, point '(0,0)');
two|f1 two | f1
---+------- -----+---------
|(0,0) | (0,0)
|(-10,0) | (-10,0)
(2 rows) (2 rows)
QUERY: SELECT '' AS two, p1.f1 -- "is horizontal" operator
SELECT '' AS two, p1.f1
FROM POINT_TBL p1 FROM POINT_TBL p1
WHERE p1.f1 ?- '(0,0)'::point; WHERE p1.f1 ?- point '(0,0)';
two|f1 two | f1
---+------- -----+---------
|(0,0) | (0,0)
|(-10,0) | (-10,0)
(2 rows) (2 rows)
QUERY: SELECT '' AS one, p1.f1 -- "is vertical" function
SELECT '' AS one, p1.f1
FROM POINT_TBL p1 FROM POINT_TBL p1
WHERE isvertical(p1.f1, '(5.1,34.5)'::point); WHERE isvertical(p1.f1, point '(5.1,34.5)');
one|f1 one | f1
---+---------- -----+------------
|(5.1,34.5) | (5.1,34.5)
(1 row) (1 row)
QUERY: SELECT '' AS one, p1.f1 -- "is vertical" operator
SELECT '' AS one, p1.f1
FROM POINT_TBL p1 FROM POINT_TBL p1
WHERE p1.f1 ?| '(5.1,34.5)'::point; WHERE p1.f1 ?| point '(5.1,34.5)';
one|f1 one | f1
---+---------- -----+------------
|(5.1,34.5) | (5.1,34.5)
(1 row) (1 row)
QUERY: SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection --
-- Line segments
--
-- 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;
ERROR: Unable to identify an operator '#' for types 'lseg' and 'point' ERROR: Unable to identify an operator '#' for types 'lseg' and 'point'
You will have to retype this query using an explicit cast You will have to retype this query using an explicit cast
QUERY: SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest -- 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;
thirty|f1 |s |closest thirty | f1 | s | closest
------+----------+-----------------------------+------------------------------------- --------+------------+-------------------------------+---------------------------------------
|(0,0) |[(1,2),(3,4)] |(1,2) | (0,0) | [(1,2),(3,4)] | (1,2)
|(-10,0) |[(1,2),(3,4)] |(1,2) | (-10,0) | [(1,2),(3,4)] | (1,2)
|(-3,4) |[(1,2),(3,4)] |(1,2) | (-3,4) | [(1,2),(3,4)] | (1,2)
|(5.1,34.5)|[(1,2),(3,4)] |(3,4) | (5.1,34.5) | [(1,2),(3,4)] | (3,4)
|(-5,-12) |[(1,2),(3,4)] |(1,2) | (-5,-12) | [(1,2),(3,4)] | (1,2)
|(10,10) |[(1,2),(3,4)] |(3,4) | (10,10) | [(1,2),(3,4)] | (3,4)
|(0,0) |[(0,0),(6,6)] |(-0,0) | (0,0) | [(0,0),(6,6)] | (-0,0)
|(-10,0) |[(0,0),(6,6)] |(0,0) | (-10,0) | [(0,0),(6,6)] | (0,0)
|(-3,4) |[(0,0),(6,6)] |(0.5,0.5) | (-3,4) | [(0,0),(6,6)] | (0.5,0.5)
|(5.1,34.5)|[(0,0),(6,6)] |(6,6) | (5.1,34.5) | [(0,0),(6,6)] | (6,6)
|(-5,-12) |[(0,0),(6,6)] |(0,0) | (-5,-12) | [(0,0),(6,6)] | (0,0)
|(10,10) |[(0,0),(6,6)] |(6,6) | (10,10) | [(0,0),(6,6)] | (6,6)
|(0,0) |[(10,-10),(-3,-4)] |(-2.04878048780488,-4.4390243902439) | (0,0) | [(10,-10),(-3,-4)] | (-2.04878048780488,-4.4390243902439)
|(-10,0) |[(10,-10),(-3,-4)] |(-3,-4) | (-10,0) | [(10,-10),(-3,-4)] | (-3,-4)
|(-3,4) |[(10,-10),(-3,-4)] |(-3,-4) | (-3,4) | [(10,-10),(-3,-4)] | (-3,-4)
|(5.1,34.5)|[(10,-10),(-3,-4)] |(-3,-4) | (5.1,34.5) | [(10,-10),(-3,-4)] | (-3,-4)
|(-5,-12) |[(10,-10),(-3,-4)] |(-1.60487804878049,-4.64390243902439) | (-5,-12) | [(10,-10),(-3,-4)] | (-1.60487804878049,-4.64390243902439)
|(10,10) |[(10,-10),(-3,-4)] |(2.39024390243902,-6.48780487804878) | (10,10) | [(10,-10),(-3,-4)] | (2.39024390243902,-6.48780487804878)
|(0,0) |[(-1000000,200),(300000,-40)]|(0.0028402365895872,15.384614860264) | (0,0) | [(-1000000,200),(300000,-40)] | (0.0028402365895872,15.384614860264)
|(-10,0) |[(-1000000,200),(300000,-40)]|(-9.99715942258202,15.3864610140473) | (-10,0) | [(-1000000,200),(300000,-40)] | (-9.99715942258202,15.3864610140473)
|(-3,4) |[(-1000000,200),(300000,-40)]|(-2.99789812267519,15.3851688427303) | (-3,4) | [(-1000000,200),(300000,-40)] | (-2.99789812267519,15.3851688427303)
|(5.1,34.5)|[(-1000000,200),(300000,-40)]|(5.09647083221496,15.3836744976925) | (5.1,34.5) | [(-1000000,200),(300000,-40)] | (5.09647083221496,15.3836744976925)
|(-5,-12) |[(-1000000,200),(300000,-40)]|(-4.99494420845634,15.3855375281616) | (-5,-12) | [(-1000000,200),(300000,-40)] | (-4.99494420845634,15.3855375281616)
|(10,10) |[(-1000000,200),(300000,-40)]|(10.000993741978,15.3827690473092) | (10,10) | [(-1000000,200),(300000,-40)] | (10.000993741978,15.3827690473092)
|(0,0) |[(11,22),(33,44)] |(11,22) | (0,0) | [(11,22),(33,44)] | (11,22)
|(-10,0) |[(11,22),(33,44)] |(11,22) | (-10,0) | [(11,22),(33,44)] | (11,22)
|(-3,4) |[(11,22),(33,44)] |(11,22) | (-3,4) | [(11,22),(33,44)] | (11,22)
|(5.1,34.5)|[(11,22),(33,44)] |(14.3,25.3) | (5.1,34.5) | [(11,22),(33,44)] | (14.3,25.3)
|(-5,-12) |[(11,22),(33,44)] |(11,22) | (-5,-12) | [(11,22),(33,44)] | (11,22)
|(10,10) |[(11,22),(33,44)] |(11,22) | (10,10) | [(11,22),(33,44)] | (11,22)
(30 rows) (30 rows)
QUERY: SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL; --
six|box -- Lines
---+-------------------------------------------------------------------------- --
|(2.12132034355964,2.12132034355964),(-2.12132034355964,-2.12132034355964) --
|(71.7106781186548,72.7106781186548),(-69.7106781186548,-68.7106781186548) -- Boxes
|(4.53553390593274,6.53553390593274),(-2.53553390593274,-0.535533905932738) --
|(3.12132034355964,4.12132034355964),(-1.12132034355964,-0.121320343559643) SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;
|(107.071067811865,207.071067811865),(92.9289321881345,192.928932188135) six | box
|(170.710678118655,70.7106781186548),(29.2893218813452,-70.7106781186548) -----+----------------------------------------------------------------------------
| (2.12132034355964,2.12132034355964),(-2.12132034355964,-2.12132034355964)
| (71.7106781186547,72.7106781186547),(-69.7106781186547,-68.7106781186547)
| (4.53553390593274,6.53553390593274),(-2.53553390593274,-0.535533905932737)
| (3.12132034355964,4.12132034355964),(-1.12132034355964,-0.121320343559642)
| (107.071067811865,207.071067811865),(92.9289321881345,192.928932188135)
| (170.710678118655,70.7106781186547),(29.2893218813453,-70.7106781186547)
(6 rows) (6 rows)
QUERY: SELECT '' AS twentyfour, b.f1 + p.f1 AS translation -- translation
SELECT '' AS twentyfour, b.f1 + p.f1 AS translation
FROM BOX_TBL b, POINT_TBL p; FROM BOX_TBL b, POINT_TBL p;
twentyfour|translation twentyfour | translation
----------+----------------------- ------------+-------------------------
|(2,2),(0,0) | (2,2),(0,0)
|(3,3),(1,1) | (3,3),(1,1)
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
|(3,3),(3,3) | (3,3),(3,3)
|(-8,2),(-10,0) | (-8,2),(-10,0)
|(-7,3),(-9,1) | (-7,3),(-9,1)
|(-7.5,3.5),(-7.5,2.5) | (-7.5,3.5),(-7.5,2.5)
|(-7,3),(-7,3) | (-7,3),(-7,3)
|(-1,6),(-3,4) | (-1,6),(-3,4)
|(0,7),(-2,5) | (0,7),(-2,5)
|(-0.5,7.5),(-0.5,6.5) | (-0.5,7.5),(-0.5,6.5)
|(0,7),(0,7) | (0,7),(0,7)
|(7.1,36.5),(5.1,34.5) | (7.1,36.5),(5.1,34.5)
|(8.1,37.5),(6.1,35.5) | (8.1,37.5),(6.1,35.5)
|(7.6,38),(7.6,37) | (7.6,38),(7.6,37)
|(8.1,37.5),(8.1,37.5) | (8.1,37.5),(8.1,37.5)
|(-3,-10),(-5,-12) | (-3,-10),(-5,-12)
|(-2,-9),(-4,-11) | (-2,-9),(-4,-11)
|(-2.5,-8.5),(-2.5,-9.5) | (-2.5,-8.5),(-2.5,-9.5)
|(-2,-9),(-2,-9) | (-2,-9),(-2,-9)
|(12,12),(10,10) | (12,12),(10,10)
|(13,13),(11,11) | (13,13),(11,11)
|(12.5,13.5),(12.5,12.5) | (12.5,13.5),(12.5,12.5)
|(13,13),(13,13) | (13,13),(13,13)
(24 rows) (24 rows)
QUERY: SELECT '' AS twentyfour, b.f1 - p.f1 AS translation SELECT '' AS twentyfour, b.f1 - p.f1 AS translation
FROM BOX_TBL b, POINT_TBL p; FROM BOX_TBL b, POINT_TBL p;
twentyfour|translation twentyfour | translation
----------+------------------------- ------------+---------------------------
|(2,2),(0,0) | (2,2),(0,0)
|(3,3),(1,1) | (3,3),(1,1)
|(2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
|(3,3),(3,3) | (3,3),(3,3)
|(12,2),(10,0) | (12,2),(10,0)
|(13,3),(11,1) | (13,3),(11,1)
|(12.5,3.5),(12.5,2.5) | (12.5,3.5),(12.5,2.5)
|(13,3),(13,3) | (13,3),(13,3)
|(5,-2),(3,-4) | (5,-2),(3,-4)
|(6,-1),(4,-3) | (6,-1),(4,-3)
|(5.5,-0.5),(5.5,-1.5) | (5.5,-0.5),(5.5,-1.5)
|(6,-1),(6,-1) | (6,-1),(6,-1)
|(-3.1,-32.5),(-5.1,-34.5) | (-3.1,-32.5),(-5.1,-34.5)
|(-2.1,-31.5),(-4.1,-33.5) | (-2.1,-31.5),(-4.1,-33.5)
|(-2.6,-31),(-2.6,-32) | (-2.6,-31),(-2.6,-32)
|(-2.1,-31.5),(-2.1,-31.5) | (-2.1,-31.5),(-2.1,-31.5)
|(7,14),(5,12) | (7,14),(5,12)
|(8,15),(6,13) | (8,15),(6,13)
|(7.5,15.5),(7.5,14.5) | (7.5,15.5),(7.5,14.5)
|(8,15),(8,15) | (8,15),(8,15)
|(-8,-8),(-10,-10) | (-8,-8),(-10,-10)
|(-7,-7),(-9,-9) | (-7,-7),(-9,-9)
|(-7.5,-6.5),(-7.5,-7.5) | (-7.5,-6.5),(-7.5,-7.5)
|(-7,-7),(-7,-7) | (-7,-7),(-7,-7)
(24 rows) (24 rows)
QUERY: SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation -- 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;
twentyfour|rotation twentyfour | rotation
----------+--------------------------- ------------+-----------------------------
|(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),(-20,-20) | (-0,0),(-20,-20)
|(-10,-10),(-30,-30) | (-10,-10),(-30,-30)
|(-25,-25),(-25,-35) | (-25,-25),(-25,-35)
|(-30,-30),(-30,-30) | (-30,-30),(-30,-30)
|(-0,2),(-14,0) | (-0,2),(-14,0)
|(-7,3),(-21,1) | (-7,3),(-21,1)
|(-17.5,2.5),(-21.5,-0.5) | (-17.5,2.5),(-21.5,-0.5)
|(-21,3),(-21,3) | (-21,3),(-21,3)
|(0,79.2),(-58.8,0) | (0,79.2),(-58.8,0)
|(-29.4,118.8),(-88.2,39.6) | (-29.4,118.8),(-88.2,39.6)
|(-73.5,104.1),(-108,99) | (-73.5,104.1),(-108,99)
|(-88.2,118.8),(-88.2,118.8) | (-88.2,118.8),(-88.2,118.8)
|(14,-0),(0,-34) | (14,-0),(0,-34)
|(21,-17),(7,-51) | (21,-17),(7,-51)
|(29.5,-42.5),(17.5,-47.5) | (29.5,-42.5),(17.5,-47.5)
|(21,-51),(21,-51) | (21,-51),(21,-51)
|(0,40),(0,0) | (0,40),(0,0)
|(0,60),(0,20) | (0,60),(0,20)
|(0,60),(-10,50) | (0,60),(-10,50)
|(0,60),(0,60) | (0,60),(0,60)
(24 rows) (24 rows)
QUERY: SELECT '' AS twenty, b.f1 / p.f1 AS rotation SELECT '' AS twenty, b.f1 / p.f1 AS rotation
FROM BOX_TBL b, POINT_TBL p FROM BOX_TBL b, POINT_TBL p
WHERE (p.f1 <-> '(0,0)'::point) >= 1; WHERE (p.f1 <-> point '(0,0)') >= 1;
twenty|rotation twenty | rotation
------+--------------------------------------------------------------------------------- --------+-----------------------------------------------------------------------------------
|(0,-0),(-0.2,-0.2) | (0,-0),(-0.2,-0.2)
|(-0.1,-0.1),(-0.3,-0.3) | (-0.1,-0.1),(-0.3,-0.3)
|(-0.25,-0.25),(-0.25,-0.35) | (-0.25,-0.25),(-0.25,-0.35)
|(-0.3,-0.3),(-0.3,-0.3) | (-0.3,-0.3),(-0.3,-0.3)
|(0.08,-0),(0,-0.56) | (0.08,-0),(0,-0.56)
|(0.12,-0.28),(0.04,-0.84) | (0.12,-0.28),(0.04,-0.84)
|(0.26,-0.7),(0.1,-0.82) | (0.26,-0.7),(0.1,-0.82)
|(0.12,-0.84),(0.12,-0.84) | (0.12,-0.84),(0.12,-0.84)
|(0.0651176557643925,0),(0,-0.0483449262493217) | (0.0651176557643925,0),(0,-0.0483449262493217)
|(0.0976764836465887,-0.0241724631246608),(0.0325588278821962,-0.0725173893739825) | (0.0976764836465887,-0.0241724631246608),(0.0325588278821962,-0.0725173893739825)
|(0.109762715208919,-0.0562379754328844),(0.0813970697054906,-0.0604311578116521) | (0.109762715208919,-0.0562379754328844),(0.0813970697054906,-0.0604311578116521)
|(0.0976764836465887,-0.0725173893739825),(0.0976764836465887,-0.0725173893739825) | (0.0976764836465887,-0.0725173893739825),(0.0976764836465887,-0.0725173893739825)
|(-0,0.0828402366863905),(-0.201183431952663,0) | (-0,0.0828402366863905),(-0.201183431952663,0)
|(-0.100591715976331,0.124260355029586),(-0.301775147928994,0.0414201183431953) | (-0.100591715976331,0.124260355029586),(-0.301775147928994,0.0414201183431953)
|(-0.251479289940828,0.103550295857988),(-0.322485207100592,0.0739644970414201) | (-0.251479289940828,0.103550295857988),(-0.322485207100592,0.0739644970414201)
|(-0.301775147928994,0.124260355029586),(-0.301775147928994,0.124260355029586) | (-0.301775147928994,0.124260355029586),(-0.301775147928994,0.124260355029586)
|(0.2,0),(0,0) | (0.2,0),(0,0)
|(0.3,0),(0.1,0) | (0.3,0),(0.1,0)
|(0.3,0.05),(0.25,0) | (0.3,0.05),(0.25,0)
|(0.3,0),(0.3,0) | (0.3,0),(0.3,0)
(20 rows) (20 rows)
QUERY: SET geqo TO 'off'; --
QUERY: SELECT '' AS eight, points(f1) AS npoints, f1 AS path FROM PATH_TBL; -- Paths
eight|npoints|path --
-----+-------+------------------------- SET geqo TO 'off';
| 2|[(1,2),(3,4)] SELECT '' AS eight, points(f1) AS npoints, f1 AS path FROM PATH_TBL;
| 2|((1,2),(3,4)) eight | npoints | path
| 4|[(0,0),(3,0),(4,5),(1,6)] -------+---------+---------------------------
| 2|((1,2),(3,4)) | 2 | [(1,2),(3,4)]
| 2|((1,2),(3,4)) | 2 | ((1,2),(3,4))
| 2|[(1,2),(3,4)] | 4 | [(0,0),(3,0),(4,5),(1,6)]
| 2|[(11,12),(13,14)] | 2 | ((1,2),(3,4))
| 2|((11,12),(13,14)) | 2 | ((1,2),(3,4))
| 2 | [(1,2),(3,4)]
| 2 | [(11,12),(13,14)]
| 2 | ((11,12),(13,14))
(8 rows) (8 rows)
QUERY: SELECT '' AS four, path(f1) FROM POLYGON_TBL; SELECT '' AS four, path(f1) FROM POLYGON_TBL;
four|path four | path
----+------------------- ------+---------------------
|((2,0),(2,4),(0,0)) | ((2,0),(2,4),(0,0))
|((3,1),(3,3),(1,0)) | ((3,1),(3,3),(1,0))
|((0,0)) | ((0,0))
|((0,1),(0,1)) | ((0,1),(0,1))
(4 rows) (4 rows)
QUERY: SELECT '' AS eight, p1.f1 + '(10,10)'::point AS dist_add -- translation
SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add
FROM PATH_TBL p1; FROM PATH_TBL p1;
eight|dist_add eight | dist_add
-----+--------------------------------- -------+-----------------------------------
|[(11,12),(13,14)] | [(11,12),(13,14)]
|((11,12),(13,14)) | ((11,12),(13,14))
|[(10,10),(13,10),(14,15),(11,16)] | [(10,10),(13,10),(14,15),(11,16)]
|((11,12),(13,14)) | ((11,12),(13,14))
|((11,12),(13,14)) | ((11,12),(13,14))
|[(11,12),(13,14)] | [(11,12),(13,14)]
|[(21,22),(23,24)] | [(21,22),(23,24)]
|((21,22),(23,24)) | ((21,22),(23,24))
(8 rows) (8 rows)
QUERY: SELECT '' AS eight, p1.f1 * '(2,-1)'::point AS dist_mul -- scaling and rotation
SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul
FROM PATH_TBL p1; FROM PATH_TBL p1;
eight|dist_mul eight | dist_mul
-----+---------------------------- -------+------------------------------
|[(4,3),(10,5)] | [(4,3),(10,5)]
|((4,3),(10,5)) | ((4,3),(10,5))
|[(0,0),(6,-3),(13,6),(8,11)] | [(0,0),(6,-3),(13,6),(8,11)]
|((4,3),(10,5)) | ((4,3),(10,5))
|((4,3),(10,5)) | ((4,3),(10,5))
|[(4,3),(10,5)] | [(4,3),(10,5)]
|[(34,13),(40,15)] | [(34,13),(40,15)]
|((34,13),(40,15)) | ((34,13),(40,15))
(8 rows) (8 rows)
QUERY: RESET geqo; RESET geqo;
QUERY: SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 ~ p.f1 AS contains --
-- Polygons
--
-- 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;
twentyfour|f1 |f1 |contains twentyfour | f1 | f1 | contains
----------+----------+-------------------+-------- ------------+------------+---------------------+----------
|(0,0) |((2,0),(2,4),(0,0))|t | (0,0) | ((2,0),(2,4),(0,0)) | t
|(-10,0) |((2,0),(2,4),(0,0))|f | (-10,0) | ((2,0),(2,4),(0,0)) | f
|(-3,4) |((2,0),(2,4),(0,0))|f | (-3,4) | ((2,0),(2,4),(0,0)) | f
|(5.1,34.5)|((2,0),(2,4),(0,0))|f | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
|(-5,-12) |((2,0),(2,4),(0,0))|f | (-5,-12) | ((2,0),(2,4),(0,0)) | f
|(10,10) |((2,0),(2,4),(0,0))|f | (10,10) | ((2,0),(2,4),(0,0)) | f
|(0,0) |((3,1),(3,3),(1,0))|f | (0,0) | ((3,1),(3,3),(1,0)) | f
|(-10,0) |((3,1),(3,3),(1,0))|f | (-10,0) | ((3,1),(3,3),(1,0)) | f
|(-3,4) |((3,1),(3,3),(1,0))|f | (-3,4) | ((3,1),(3,3),(1,0)) | f
|(5.1,34.5)|((3,1),(3,3),(1,0))|f | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
|(-5,-12) |((3,1),(3,3),(1,0))|f | (-5,-12) | ((3,1),(3,3),(1,0)) | f
|(10,10) |((3,1),(3,3),(1,0))|f | (10,10) | ((3,1),(3,3),(1,0)) | f
|(0,0) |((0,0)) |t | (0,0) | ((0,0)) | t
|(-10,0) |((0,0)) |f | (-10,0) | ((0,0)) | f
|(-3,4) |((0,0)) |f | (-3,4) | ((0,0)) | f
|(5.1,34.5)|((0,0)) |f | (5.1,34.5) | ((0,0)) | f
|(-5,-12) |((0,0)) |f | (-5,-12) | ((0,0)) | f
|(10,10) |((0,0)) |f | (10,10) | ((0,0)) | f
|(0,0) |((0,1),(0,1)) |f | (0,0) | ((0,1),(0,1)) | f
|(-10,0) |((0,1),(0,1)) |f | (-10,0) | ((0,1),(0,1)) | f
|(-3,4) |((0,1),(0,1)) |f | (-3,4) | ((0,1),(0,1)) | f
|(5.1,34.5)|((0,1),(0,1)) |f | (5.1,34.5) | ((0,1),(0,1)) | f
|(-5,-12) |((0,1),(0,1)) |f | (-5,-12) | ((0,1),(0,1)) | f
|(10,10) |((0,1),(0,1)) |f | (10,10) | ((0,1),(0,1)) | f
(24 rows) (24 rows)
QUERY: SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 @ poly.f1 AS contained 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;
twentyfour|f1 |f1 |contained twentyfour | f1 | f1 | contained
----------+----------+-------------------+--------- ------------+------------+---------------------+-----------
|(0,0) |((2,0),(2,4),(0,0))|t | (0,0) | ((2,0),(2,4),(0,0)) | t
|(-10,0) |((2,0),(2,4),(0,0))|f | (-10,0) | ((2,0),(2,4),(0,0)) | f
|(-3,4) |((2,0),(2,4),(0,0))|f | (-3,4) | ((2,0),(2,4),(0,0)) | f
|(5.1,34.5)|((2,0),(2,4),(0,0))|f | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
|(-5,-12) |((2,0),(2,4),(0,0))|f | (-5,-12) | ((2,0),(2,4),(0,0)) | f
|(10,10) |((2,0),(2,4),(0,0))|f | (10,10) | ((2,0),(2,4),(0,0)) | f
|(0,0) |((3,1),(3,3),(1,0))|f | (0,0) | ((3,1),(3,3),(1,0)) | f
|(-10,0) |((3,1),(3,3),(1,0))|f | (-10,0) | ((3,1),(3,3),(1,0)) | f
|(-3,4) |((3,1),(3,3),(1,0))|f | (-3,4) | ((3,1),(3,3),(1,0)) | f
|(5.1,34.5)|((3,1),(3,3),(1,0))|f | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
|(-5,-12) |((3,1),(3,3),(1,0))|f | (-5,-12) | ((3,1),(3,3),(1,0)) | f
|(10,10) |((3,1),(3,3),(1,0))|f | (10,10) | ((3,1),(3,3),(1,0)) | f
|(0,0) |((0,0)) |t | (0,0) | ((0,0)) | t
|(-10,0) |((0,0)) |f | (-10,0) | ((0,0)) | f
|(-3,4) |((0,0)) |f | (-3,4) | ((0,0)) | f
|(5.1,34.5)|((0,0)) |f | (5.1,34.5) | ((0,0)) | f
|(-5,-12) |((0,0)) |f | (-5,-12) | ((0,0)) | f
|(10,10) |((0,0)) |f | (10,10) | ((0,0)) | f
|(0,0) |((0,1),(0,1)) |f | (0,0) | ((0,1),(0,1)) | f
|(-10,0) |((0,1),(0,1)) |f | (-10,0) | ((0,1),(0,1)) | f
|(-3,4) |((0,1),(0,1)) |f | (-3,4) | ((0,1),(0,1)) | f
|(5.1,34.5)|((0,1),(0,1)) |f | (5.1,34.5) | ((0,1),(0,1)) | f
|(-5,-12) |((0,1),(0,1)) |f | (-5,-12) | ((0,1),(0,1)) | f
|(10,10) |((0,1),(0,1)) |f | (10,10) | ((0,1),(0,1)) | f
(24 rows) (24 rows)
QUERY: SELECT '' AS four, points(f1) AS npoints, f1 AS polygon SELECT '' AS four, points(f1) AS npoints, f1 AS polygon
FROM POLYGON_TBL; FROM POLYGON_TBL;
four|npoints|polygon four | npoints | polygon
----+-------+------------------- ------+---------+---------------------
| 3|((2,0),(2,4),(0,0)) | 3 | ((2,0),(2,4),(0,0))
| 3|((3,1),(3,3),(1,0)) | 3 | ((3,1),(3,3),(1,0))
| 1|((0,0)) | 1 | ((0,0))
| 2|((0,1),(0,1)) | 2 | ((0,1),(0,1))
(4 rows) (4 rows)
QUERY: SELECT '' AS four, polygon(f1) SELECT '' AS four, polygon(f1)
FROM BOX_TBL; FROM BOX_TBL;
four|polygon four | polygon
----+----------------------------------------- ------+-------------------------------------------
|((0,0),(0,2),(2,2),(2,0)) | ((0,0),(0,2),(2,2),(2,0))
|((1,1),(1,3),(3,3),(3,1)) | ((1,1),(1,3),(3,3),(3,1))
|((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5)) | ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5))
|((3,3),(3,3),(3,3),(3,3)) | ((3,3),(3,3),(3,3),(3,3))
(4 rows) (4 rows)
QUERY: SELECT '' AS four, polygon(f1) SELECT '' AS four, polygon(f1)
FROM PATH_TBL WHERE isclosed(f1); FROM PATH_TBL WHERE isclosed(f1);
four|polygon four | polygon
----+----------------- ------+-------------------
|((1,2),(3,4)) | ((1,2),(3,4))
|((1,2),(3,4)) | ((1,2),(3,4))
|((1,2),(3,4)) | ((1,2),(3,4))
|((11,12),(13,14)) | ((11,12),(13,14))
(4 rows) (4 rows)
QUERY: SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon
FROM PATH_TBL FROM PATH_TBL
WHERE isopen(f1); WHERE isopen(f1);
four|open_path |polygon four | open_path | polygon
----+-------------------------+------------------------- ------+---------------------------+---------------------------
|[(1,2),(3,4)] |((1,2),(3,4)) | [(1,2),(3,4)] | ((1,2),(3,4))
|[(0,0),(3,0),(4,5),(1,6)]|((0,0),(3,0),(4,5),(1,6)) | [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6))
|[(1,2),(3,4)] |((1,2),(3,4)) | [(1,2),(3,4)] | ((1,2),(3,4))
|[(11,12),(13,14)] |((11,12),(13,14)) | [(11,12),(13,14)] | ((11,12),(13,14))
(4 rows) (4 rows)
QUERY: SELECT '' AS six, polygon(f1) -- convert circles to polygons using the default number of points
SELECT '' AS six, polygon(f1)
FROM CIRCLE_TBL; FROM CIRCLE_TBL;
six|polygon six | polygon
---+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|((-3,0),(-2.59807621135332,1.5),(-1.5,2.59807621135332),(-1.83690953073357e-16,3),(1.5,2.59807621135332),(2.59807621135332,1.5),(3,3.67381906146713e-16),(2.59807621135332,-1.5),(1.5,-2.59807621135332),(5.5107285922007e-16,-3),(-1.5,-2.59807621135332),(-2.59807621135332,-1.5)) | ((-3,0),(-2.59807621135076,1.50000000000442),(-1.49999999999116,2.59807621135842),(1.53102359078377e-11,3),(1.50000000001768,2.59807621134311),(2.59807621136607,1.4999999999779),(3,-3.06204718156754e-11),(2.59807621133545,-1.50000000003094),(1.49999999996464,-2.59807621137373),(-4.59307077235131e-11,-3),(-1.5000000000442,-2.5980762113278),(-2.59807621138138,-1.49999999995138))
|((-99,2),(-85.6025403784439,52),(-49,88.6025403784439),(0.999999999999994,102),(51,88.6025403784439),(87.6025403784439,52),(101,2.00000000000001),(87.6025403784439,-48),(51,-84.6025403784438),(1.00000000000002,-98),(-49,-84.6025403784439),(-85.6025403784438,-48)) | ((-99,2),(-85.6025403783588,52.0000000001473),(-48.9999999997054,88.602540378614),(1.00000000051034,102),(51.0000000005893,88.6025403781036),(87.6025403788692,51.9999999992634),(101,1.99999999897932),(87.6025403778485,-48.0000000010313),(50.9999999988214,-84.6025403791243),(0.999999998468976,-98),(-49.0000000014732,-84.6025403775933),(-85.6025403793795,-47.9999999983795))
|((-4,3),(-3.33012701892219,5.5),(-1.5,7.33012701892219),(1,8),(3.5,7.33012701892219),(5.33012701892219,5.5),(6,3),(5.33012701892219,0.500000000000001),(3.5,-1.33012701892219),(1,-2),(-1.5,-1.33012701892219),(-3.33012701892219,0.499999999999998)) | ((-4,3),(-3.33012701891794,5.50000000000737),(-1.49999999998527,7.3301270189307),(1.00000000002552,8),(3.50000000002946,7.33012701890518),(5.33012701894346,5.49999999996317),(6,2.99999999994897),(5.33012701889242,0.499999999948437),(3.49999999994107,-1.33012701895622),(0.999999999923449,-2),(-1.50000000007366,-1.33012701887966),(-3.33012701896897,0.500000000081028))
|((-2,2),(-1.59807621135332,3.5),(-0.5,4.59807621135332),(1,5),(2.5,4.59807621135332),(3.59807621135332,3.5),(4,2),(3.59807621135332,0.500000000000001),(2.5,-0.598076211353315),(1,-1),(-0.5,-0.598076211353316),(-1.59807621135332,0.499999999999999)) | ((-2,2),(-1.59807621135076,3.50000000000442),(-0.499999999991161,4.59807621135842),(1.00000000001531,5),(2.50000000001768,4.59807621134311),(3.59807621136607,3.4999999999779),(4,1.99999999996938),(3.59807621133545,0.499999999969062),(2.49999999996464,-0.59807621137373),(0.999999999954069,-1),(-0.500000000044197,-0.598076211327799),(-1.59807621138138,0.500000000048617))
|((90,200),(91.3397459621556,205),(95,208.660254037844),(100,210),(105,208.660254037844),(108.660254037844,205),(110,200),(108.660254037844,195),(105,191.339745962156),(100,190),(95,191.339745962156),(91.3397459621556,195)) | ((90,200),(91.3397459621641,205.000000000015),(95.0000000000295,208.660254037861),(100.000000000051,210),(105.000000000059,208.66025403781),(108.660254037887,204.999999999926),(110,199.999999999898),(108.660254037785,194.999999999897),(104.999999999882,191.339745962088),(99.9999999998469,190),(94.9999999998527,191.339745962241),(91.3397459620621,195.000000000162))
|((0,0),(13.3974596215561,50),(50,86.6025403784439),(100,100),(150,86.6025403784439),(186.602540378444,50),(200,1.22460635382238e-14),(186.602540378444,-50),(150,-86.6025403784438),(100,-100),(50,-86.6025403784439),(13.3974596215562,-50)) | ((0,0),(13.3974596216412,50.0000000001473),(50.0000000002946,86.602540378614),(100.00000000051,100),(150.000000000589,86.6025403781036),(186.602540378869,49.9999999992634),(200,-1.02068239385585e-09),(186.602540377848,-50.0000000010313),(149.999999998821,-86.6025403791243),(99.999999998469,-100),(49.9999999985268,-86.6025403775933),(13.3974596206205,-49.9999999983795))
(6 rows) (6 rows)
QUERY: SELECT '' AS six, polygon(8, f1) -- convert the circle to an 8-point polygon
SELECT '' AS six, polygon(8, f1)
FROM CIRCLE_TBL; FROM CIRCLE_TBL;
six|polygon six | polygon
---+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -----+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|((-3,0),(-2.12132034355964,2.12132034355964),(-1.83690953073357e-16,3),(2.12132034355964,2.12132034355964),(3,3.67381906146713e-16),(2.12132034355964,-2.12132034355964),(5.5107285922007e-16,-3),(-2.12132034355964,-2.12132034355964)) | ((-3,0),(-2.12132034355423,2.12132034356506),(1.53102359078377e-11,3),(2.12132034357588,2.1213203435434),(3,-3.06204718156754e-11),(2.12132034353258,-2.12132034358671),(-4.59307077235131e-11,-3),(-2.12132034359753,-2.12132034352175))
|((-99,2),(-69.7106781186548,72.7106781186548),(0.999999999999994,102),(71.7106781186547,72.7106781186548),(101,2.00000000000001),(71.7106781186548,-68.7106781186547),(1.00000000000002,-98),(-69.7106781186547,-68.7106781186548)) | ((-99,2),(-69.7106781184743,72.7106781188352),(1.00000000051034,102),(71.710678119196,72.7106781181134),(101,1.99999999897932),(71.7106781177526,-68.7106781195569),(0.999999998468976,-98),(-69.7106781199178,-68.7106781173917))
|((-4,3),(-2.53553390593274,6.53553390593274),(1,8),(4.53553390593274,6.53553390593274),(6,3),(4.53553390593274,-0.535533905932737),(1,-2),(-2.53553390593274,-0.535533905932738)) | ((-4,3),(-2.53553390592372,6.53553390594176),(1.00000000002552,8),(4.5355339059598,6.53553390590567),(6,2.99999999994897),(4.53553390588763,-0.535533905977846),(0.999999999923449,-2),(-2.53553390599589,-0.535533905869586))
|((-2,2),(-1.12132034355964,4.12132034355964),(1,5),(3.12132034355964,4.12132034355964),(4,2),(3.12132034355964,-0.121320343559642),(1,-1),(-1.12132034355964,-0.121320343559643)) | ((-2,2),(-1.12132034355423,4.12132034356506),(1.00000000001531,5),(3.12132034357588,4.1213203435434),(4,1.99999999996938),(3.12132034353258,-0.121320343586707),(0.999999999954069,-1),(-1.12132034359753,-0.121320343521752))
|((90,200),(92.9289321881345,207.071067811865),(100,210),(107.071067811865,207.071067811865),(110,200),(107.071067811865,192.928932188135),(100,190),(92.9289321881345,192.928932188135)) | ((90,200),(92.9289321881526,207.071067811884),(100.000000000051,210),(107.07106781192,207.071067811811),(110,199.999999999898),(107.071067811775,192.928932188044),(99.9999999998469,190),(92.9289321880082,192.928932188261))
|((0,0),(29.2893218813452,70.7106781186548),(100,100),(170.710678118655,70.7106781186548),(200,1.22460635382238e-14),(170.710678118655,-70.7106781186547),(100,-100),(29.2893218813453,-70.7106781186548)) | ((0,0),(29.2893218815257,70.7106781188352),(100.00000000051,100),(170.710678119196,70.7106781181134),(200,-1.02068239385585e-09),(170.710678117753,-70.7106781195569),(99.999999998469,-100),(29.2893218800822,-70.7106781173917))
(6 rows) (6 rows)
QUERY: SELECT '' AS six, circle(f1, 50.0) --
-- Circles
--
SELECT '' AS six, circle(f1, 50.0)
FROM POINT_TBL; FROM POINT_TBL;
six|circle six | circle
---+--------------- -----+-----------------
|<(0,0),50> | <(0,0),50>
|<(-10,0),50> | <(-10,0),50>
|<(-3,4),50> | <(-3,4),50>
|<(5.1,34.5),50> | <(5.1,34.5),50>
|<(-5,-12),50> | <(-5,-12),50>
|<(10,10),50> | <(10,10),50>
(6 rows) (6 rows)
QUERY: SELECT '' AS four, circle(f1) SELECT '' AS four, circle(f1)
FROM BOX_TBL; FROM BOX_TBL;
four|circle four | circle
----+----------------------- ------+-------------------------
|<(1,1),1.4142135623731> | <(1,1),1.4142135623731>
|<(2,2),1.4142135623731> | <(2,2),1.4142135623731>
|<(2.5,3),0.5> | <(2.5,3),0.5>
|<(3,3),0> | <(3,3),0>
(4 rows) (4 rows)
QUERY: SELECT '' AS two, circle(f1) SELECT '' AS two, circle(f1)
FROM POLYGON_TBL FROM POLYGON_TBL
WHERE (# f1) >= 3; WHERE (# f1) >= 3;
two|circle two | circle
---+------------------------------------------------------ -----+--------------------------------------------------------
|<(1.33333333333333,1.33333333333333),2.04168905063636> | <(1.33333333333333,1.33333333333333),2.04168905063636>
|<(2.33333333333333,1.33333333333333),1.47534300379185> | <(2.33333333333333,1.33333333333333),1.47534300379185>
(2 rows) (2 rows)
QUERY: SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
FROM CIRCLE_TBL c1, POINT_TBL p1 FROM CIRCLE_TBL c1, POINT_TBL p1
WHERE (p1.f1 <-> c1.f1) > 0 WHERE (p1.f1 <-> c1.f1) > 0
ORDER BY distance, circle, point using <<; ORDER BY distance, circle, point using <<;
twentyfour|circle |point | distance twentyfour | circle | point | distance
----------+--------------+----------+----------------- ------------+----------------+------------+------------------
|<(100,0),100> |(5.1,34.5)|0.976531926977964 | <(100,0),100> | (5.1,34.5) | 0.97653192697797
|<(1,2),3> |(-3,4) | 1.47213595499958 | <(1,2),3> | (-3,4) | 1.47213595499958
|<(0,0),3> |(-3,4) | 2 | <(0,0),3> | (-3,4) | 2
|<(100,0),100> |(-3,4) | 3.07764064044151 | <(100,0),100> | (-3,4) | 3.07764064044152
|<(100,0),100> |(-5,-12) | 5.68348972285122 | <(100,0),100> | (-5,-12) | 5.68348972285122
|<(1,3),5> |(-10,0) | 6.40175425099138 | <(1,3),5> | (-10,0) | 6.40175425099138
|<(1,3),5> |(10,10) | 6.40175425099138 | <(1,3),5> | (10,10) | 6.40175425099138
|<(0,0),3> |(-10,0) | 7 | <(0,0),3> | (-10,0) | 7
|<(1,2),3> |(-10,0) | 8.18033988749895 | <(1,2),3> | (-10,0) | 8.18033988749895
|<(1,2),3> |(10,10) | 9.0415945787923 | <(1,2),3> | (10,10) | 9.0415945787923
|<(0,0),3> |(-5,-12) | 10 | <(0,0),3> | (-5,-12) | 10
|<(100,0),100> |(-10,0) | 10 | <(100,0),100> | (-10,0) | 10
|<(0,0),3> |(10,10) | 11.142135623731 | <(0,0),3> | (10,10) | 11.142135623731
|<(1,3),5> |(-5,-12) | 11.1554944214035 | <(1,3),5> | (-5,-12) | 11.1554944214035
|<(1,2),3> |(-5,-12) | 12.2315462117278 | <(1,2),3> | (-5,-12) | 12.2315462117278
|<(1,3),5> |(5.1,34.5)| 26.7657047773224 | <(1,3),5> | (5.1,34.5) | 26.7657047773223
|<(1,2),3> |(5.1,34.5)| 29.757594539282 | <(1,2),3> | (5.1,34.5) | 29.757594539282
|<(0,0),3> |(5.1,34.5)| 31.8749193547455 | <(0,0),3> | (5.1,34.5) | 31.8749193547455
|<(100,200),10>|(5.1,34.5)| 180.778038568384 | <(100,200),10> | (5.1,34.5) | 180.778038568384
|<(100,200),10>|(10,10) | 200.237960416286 | <(100,200),10> | (10,10) | 200.237960416286
|<(100,200),10>|(-3,4) | 211.415898254845 | <(100,200),10> | (-3,4) | 211.415898254845
|<(100,200),10>|(0,0) | 213.606797749979 | <(100,200),10> | (0,0) | 213.606797749979
|<(100,200),10>|(-10,0) | 218.254244210267 | <(100,200),10> | (-10,0) | 218.254244210267
|<(100,200),10>|(-5,-12) | 226.577682802077 | <(100,200),10> | (-5,-12) | 226.577682802077
(24 rows) (24 rows)
This source diff could not be displayed because it is too large. You can view the blob instead.
QUERY: DROP TABLE INET_TBL; --
-- INET
--
-- prepare the table...
DROP TABLE INET_TBL;
ERROR: Relation 'inet_tbl' does not exist ERROR: Relation 'inet_tbl' does not exist
QUERY: CREATE TABLE INET_TBL (c cidr, i inet); CREATE TABLE INET_TBL (c cidr, i inet);
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24'); INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226'); INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8'); INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.0.0.0', '10.1.2.3/8'); INSERT INTO INET_TBL (c, i) VALUES ('10.0.0.0', '10.1.2.3/8');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32'); INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24'); INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16'); INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8'); INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '11.1.2.3/8'); INSERT INTO INET_TBL (c, i) VALUES ('10', '11.1.2.3/8');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '9.1.2.3/8'); INSERT INTO INET_TBL (c, i) VALUES ('10', '9.1.2.3/8');
QUERY: SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL; SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL;
ten|cidr |inet ten | cidr | inet
---+------------+---------------- -----+--------------+------------------
|192.168.1/24|192.168.1.226/24 | 192.168.1/24 | 192.168.1.226/24
|192.168.1/24|192.168.1.226 | 192.168.1/24 | 192.168.1.226
|10/8 |10.1.2.3/8 | 10/8 | 10.1.2.3/8
|10.0.0.0/32 |10.1.2.3/8 | 10.0.0.0/32 | 10.1.2.3/8
|10.1.2.3/32 |10.1.2.3 | 10.1.2.3/32 | 10.1.2.3
|10.1.2/24 |10.1.2.3/24 | 10.1.2/24 | 10.1.2.3/24
|10.1/16 |10.1.2.3/16 | 10.1/16 | 10.1.2.3/16
|10/8 |10.1.2.3/8 | 10/8 | 10.1.2.3/8
|10/8 |11.1.2.3/8 | 10/8 | 11.1.2.3/8
|10/8 |9.1.2.3/8 | 10/8 | 9.1.2.3/8
(10 rows) (10 rows)
QUERY: SELECT '' AS ten, i AS inet, host(i) FROM INET_TBL; -- now test some support functions
ten|inet | host SELECT '' AS ten, i AS inet, host(i) FROM INET_TBL;
---+----------------+------------- ten | inet | host
|192.168.1.226/24|192.168.1.226 -----+------------------+---------------
|192.168.1.226 |192.168.1.226 | 192.168.1.226/24 | 192.168.1.226
|10.1.2.3/8 | 10.1.2.3 | 192.168.1.226 | 192.168.1.226
|10.1.2.3/8 | 10.1.2.3 | 10.1.2.3/8 | 10.1.2.3
|10.1.2.3 | 10.1.2.3 | 10.1.2.3/8 | 10.1.2.3
|10.1.2.3/24 | 10.1.2.3 | 10.1.2.3 | 10.1.2.3
|10.1.2.3/16 | 10.1.2.3 | 10.1.2.3/24 | 10.1.2.3
|10.1.2.3/8 | 10.1.2.3 | 10.1.2.3/16 | 10.1.2.3
|11.1.2.3/8 | 11.1.2.3 | 10.1.2.3/8 | 10.1.2.3
|9.1.2.3/8 | 9.1.2.3 | 11.1.2.3/8 | 11.1.2.3
| 9.1.2.3/8 | 9.1.2.3
(10 rows) (10 rows)
QUERY: SELECT '' AS ten, c AS cidr, broadcast(c), SELECT '' AS ten, c AS cidr, broadcast(c),
i AS inet, broadcast(i) FROM INET_TBL; i AS inet, broadcast(i) FROM INET_TBL;
ten|cidr | broadcast|inet | broadcast ten | cidr | broadcast | inet | broadcast
---+------------+---------------+----------------+--------------- -----+--------------+-----------------+------------------+-----------------
|192.168.1/24| 192.168.1.255|192.168.1.226/24| 192.168.1.255 | 192.168.1/24 | 192.168.1.255 | 192.168.1.226/24 | 192.168.1.255
|192.168.1/24| 192.168.1.255|192.168.1.226 |255.255.255.255 | 192.168.1/24 | 192.168.1.255 | 192.168.1.226 | 255.255.255.255
|10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255 | 10/8 | 10.255.255.255 | 10.1.2.3/8 | 10.255.255.255
|10.0.0.0/32 |255.255.255.255|10.1.2.3/8 | 10.255.255.255 | 10.0.0.0/32 | 255.255.255.255 | 10.1.2.3/8 | 10.255.255.255
|10.1.2.3/32 |255.255.255.255|10.1.2.3 |255.255.255.255 | 10.1.2.3/32 | 255.255.255.255 | 10.1.2.3 | 255.255.255.255
|10.1.2/24 | 10.1.2.255|10.1.2.3/24 | 10.1.2.255 | 10.1.2/24 | 10.1.2.255 | 10.1.2.3/24 | 10.1.2.255
|10.1/16 | 10.1.255.255|10.1.2.3/16 | 10.1.255.255 | 10.1/16 | 10.1.255.255 | 10.1.2.3/16 | 10.1.255.255
|10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255 | 10/8 | 10.255.255.255 | 10.1.2.3/8 | 10.255.255.255
|10/8 | 10.255.255.255|11.1.2.3/8 | 11.255.255.255 | 10/8 | 10.255.255.255 | 11.1.2.3/8 | 11.255.255.255
|10/8 | 10.255.255.255|9.1.2.3/8 | 9.255.255.255 | 10/8 | 10.255.255.255 | 9.1.2.3/8 | 9.255.255.255
(10 rows) (10 rows)
QUERY: SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)", 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;
ten|cidr |network(cidr)|inet |network(inet) ten | cidr | network(cidr) | inet | network(inet)
---+------------+-------------+----------------+---------------- -----+--------------+---------------+------------------+------------------
|192.168.1/24|192.168.1/24 |192.168.1.226/24|192.168.1/24 | 192.168.1/24 | 192.168.1/24 | 192.168.1.226/24 | 192.168.1/24
|192.168.1/24|192.168.1/24 |192.168.1.226 |192.168.1.226/32 | 192.168.1/24 | 192.168.1/24 | 192.168.1.226 | 192.168.1.226/32
|10/8 |10/8 |10.1.2.3/8 |10/8 | 10/8 | 10/8 | 10.1.2.3/8 | 10/8
|10.0.0.0/32 |10.0.0.0/32 |10.1.2.3/8 |10/8 | 10.0.0.0/32 | 10.0.0.0/32 | 10.1.2.3/8 | 10/8
|10.1.2.3/32 |10.1.2.3/32 |10.1.2.3 |10.1.2.3/32 | 10.1.2.3/32 | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3/32
|10.1.2/24 |10.1.2/24 |10.1.2.3/24 |10.1.2/24 | 10.1.2/24 | 10.1.2/24 | 10.1.2.3/24 | 10.1.2/24
|10.1/16 |10.1/16 |10.1.2.3/16 |10.1/16 | 10.1/16 | 10.1/16 | 10.1.2.3/16 | 10.1/16
|10/8 |10/8 |10.1.2.3/8 |10/8 | 10/8 | 10/8 | 10.1.2.3/8 | 10/8
|10/8 |10/8 |11.1.2.3/8 |11/8 | 10/8 | 10/8 | 11.1.2.3/8 | 11/8
|10/8 |10/8 |9.1.2.3/8 |9/8 | 10/8 | 10/8 | 9.1.2.3/8 | 9/8
(10 rows) (10 rows)
QUERY: SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)", 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;
ten|cidr |masklen(cidr)|inet |masklen(inet) ten | cidr | masklen(cidr) | inet | masklen(inet)
---+------------+-------------+----------------+------------- -----+--------------+---------------+------------------+---------------
|192.168.1/24| 24|192.168.1.226/24| 24 | 192.168.1/24 | 24 | 192.168.1.226/24 | 24
|192.168.1/24| 24|192.168.1.226 | 32 | 192.168.1/24 | 24 | 192.168.1.226 | 32
|10/8 | 8|10.1.2.3/8 | 8 | 10/8 | 8 | 10.1.2.3/8 | 8
|10.0.0.0/32 | 32|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.3/32 | 32 | 10.1.2.3 | 32
|10.1.2/24 | 24|10.1.2.3/24 | 24 | 10.1.2/24 | 24 | 10.1.2.3/24 | 24
|10.1/16 | 16|10.1.2.3/16 | 16 | 10.1/16 | 16 | 10.1.2.3/16 | 16
|10/8 | 8|10.1.2.3/8 | 8 | 10/8 | 8 | 10.1.2.3/8 | 8
|10/8 | 8|11.1.2.3/8 | 8 | 10/8 | 8 | 11.1.2.3/8 | 8
|10/8 | 8|9.1.2.3/8 | 8 | 10/8 | 8 | 9.1.2.3/8 | 8
(10 rows) (10 rows)
QUERY: SELECT '' AS four, c AS cidr, masklen(c) AS "masklen(cidr)", SELECT '' AS four, 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
WHERE masklen(c) <= 8; WHERE masklen(c) <= 8;
four|cidr|masklen(cidr)|inet |masklen(inet) four | cidr | masklen(cidr) | inet | masklen(inet)
----+----+-------------+----------+------------- ------+------+---------------+------------+---------------
|10/8| 8|10.1.2.3/8| 8 | 10/8 | 8 | 10.1.2.3/8 | 8
|10/8| 8|10.1.2.3/8| 8 | 10/8 | 8 | 10.1.2.3/8 | 8
|10/8| 8|11.1.2.3/8| 8 | 10/8 | 8 | 11.1.2.3/8 | 8
|10/8| 8|9.1.2.3/8 | 8 | 10/8 | 8 | 9.1.2.3/8 | 8
(4 rows) (4 rows)
QUERY: SELECT '' AS six, c AS cidr, i AS inet FROM INET_TBL SELECT '' AS six, c AS cidr, i AS inet FROM INET_TBL
WHERE c = i; WHERE c = i;
six|cidr |inet six | cidr | inet
---+------------+---------------- -----+--------------+------------------
|192.168.1/24|192.168.1.226/24 | 192.168.1/24 | 192.168.1.226/24
|10/8 |10.1.2.3/8 | 10/8 | 10.1.2.3/8
|10.1.2.3/32 |10.1.2.3 | 10.1.2.3/32 | 10.1.2.3
|10.1.2/24 |10.1.2.3/24 | 10.1.2/24 | 10.1.2.3/24
|10.1/16 |10.1.2.3/16 | 10.1/16 | 10.1.2.3/16
|10/8 |10.1.2.3/8 | 10/8 | 10.1.2.3/8
(6 rows) (6 rows)
QUERY: SELECT '' AS ten, i, c, SELECT '' AS ten, i, c,
i < c AS lt, i <= c AS le, i = c AS eq, 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 ge, i > c AS gt, i <> c AS ne,
i << c AS sb, i <<= c AS sbe, i << c AS sb, i <<= c AS sbe,
i >> c AS sup, i >>= c AS spe i >> c AS sup, i >>= c AS spe
FROM INET_TBL; FROM INET_TBL;
ten|i |c |lt|le|eq|ge|gt|ne|sb|sbe|sup|spe ten | i | c | lt | le | eq | ge | gt | ne | sb | sbe | sup | spe
---+----------------+------------+--+--+--+--+--+--+--+---+---+--- -----+------------------+--------------+----+----+----+----+----+----+----+-----+-----+-----
|192.168.1.226/24|192.168.1/24|f |t |t |t |f |f |f |t |f |t | 192.168.1.226/24 | 192.168.1/24 | f | t | t | t | f | f | f | t | f | t
|192.168.1.226 |192.168.1/24|f |f |f |t |t |t |t |t |f |f | 192.168.1.226 | 192.168.1/24 | f | f | f | t | t | t | t | t | f | f
|10.1.2.3/8 |10/8 |f |t |t |t |f |f |f |t |f |t | 10.1.2.3/8 | 10/8 | f | t | t | t | f | f | f | t | f | t
|10.1.2.3/8 |10.0.0.0/32 |f |f |f |t |t |t |f |f |t |t | 10.1.2.3/8 | 10.0.0.0/32 | f | f | f | t | t | 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 | 10.1.2.3/32 | f | t | t | t | f | f | f | t | f | t
|10.1.2.3/24 |10.1.2/24 |f |t |t |t |f |f |f |t |f |t | 10.1.2.3/24 | 10.1.2/24 | f | t | t | t | f | f | f | t | f | t
|10.1.2.3/16 |10.1/16 |f |t |t |t |f |f |f |t |f |t | 10.1.2.3/16 | 10.1/16 | f | t | t | t | f | f | f | t | f | t
|10.1.2.3/8 |10/8 |f |t |t |t |f |f |f |t |f |t | 10.1.2.3/8 | 10/8 | f | t | t | t | f | f | f | t | f | t
|11.1.2.3/8 |10/8 |f |f |f |t |t |t |f |f |f |f | 11.1.2.3/8 | 10/8 | f | f | f | t | t | t | f | f | f | f
|9.1.2.3/8 |10/8 |t |t |f |f |f |t |f |f |f |f | 9.1.2.3/8 | 10/8 | t | t | f | f | f | t | f | f | f | f
(10 rows) (10 rows)
QUERY: CREATE TABLE LSEG_TBL (s lseg); --
QUERY: INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)]'); -- LSEG
QUERY: INSERT INTO LSEG_TBL VALUES ('(0,0),(6,6)'); -- Line segments
QUERY: INSERT INTO LSEG_TBL VALUES ('10,-10 ,-3,-4'); --
QUERY: INSERT INTO LSEG_TBL VALUES ('[-1e6,2e2,3e5, -4e1]'); --DROP TABLE LSEG_TBL;
QUERY: INSERT INTO LSEG_TBL VALUES ('(11,22,33,44)'); CREATE TABLE LSEG_TBL (s lseg);
QUERY: INSERT INTO LSEG_TBL VALUES ('(3asdf,2 ,3,4r2)'); INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)]');
INSERT INTO LSEG_TBL VALUES ('(0,0),(6,6)');
INSERT INTO LSEG_TBL VALUES ('10,-10 ,-3,-4');
INSERT INTO LSEG_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
INSERT INTO LSEG_TBL VALUES ('(11,22,33,44)');
-- bad values for parser testing
INSERT INTO LSEG_TBL VALUES ('(3asdf,2 ,3,4r2)');
ERROR: Bad lseg external representation '(3asdf,2 ,3,4r2)' ERROR: Bad lseg external representation '(3asdf,2 ,3,4r2)'
QUERY: INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4'); INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4');
ERROR: Bad lseg external representation '[1,2,3, 4' ERROR: Bad lseg external representation '[1,2,3, 4'
QUERY: INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]'); INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]');
ERROR: Bad lseg external representation '[(,2),(3,4)]' ERROR: Bad lseg external representation '[(,2),(3,4)]'
QUERY: INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)'); INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)');
ERROR: Bad lseg external representation '[(1,2),(3,4)' ERROR: Bad lseg external representation '[(1,2),(3,4)'
QUERY: select * from LSEG_TBL; select * from LSEG_TBL;
s s
----------------------------- -------------------------------
[(1,2),(3,4)] [(1,2),(3,4)]
[(0,0),(6,6)] [(0,0),(6,6)]
[(10,-10),(-3,-4)] [(10,-10),(-3,-4)]
[(-1000000,200),(300000,-40)] [(-1000000,200),(300000,-40)]
[(11,22),(33,44)] [(11,22),(33,44)]
(5 rows) (5 rows)
QUERY: SELECT * FROM LSEG_TBL WHERE s <= '[(1,2),(3,4)]'::lseg; SELECT * FROM LSEG_TBL WHERE s <= lseg '[(1,2),(3,4)]';
s s
------------- ---------------
[(1,2),(3,4)] [(1,2),(3,4)]
(1 row) (1 row)
QUERY: SELECT * FROM LSEG_TBL WHERE (s <-> '[(1,2),(3,4)]'::lseg) < 10; SELECT * FROM LSEG_TBL WHERE (s <-> lseg '[(1,2),(3,4)]') < 10;
s s
------------------ --------------------
[(1,2),(3,4)] [(1,2),(3,4)]
[(0,0),(6,6)] [(0,0),(6,6)]
[(10,-10),(-3,-4)] [(10,-10),(-3,-4)]
(3 rows) (3 rows)
QUERY: CREATE TABLE num_data (id int4, val numeric(210,10)); --
QUERY: CREATE TABLE num_exp_add (id1 int4, id2 int4, expected numeric(210,10)); -- NUMERIC
QUERY: CREATE TABLE num_exp_sub (id1 int4, id2 int4, expected numeric(210,10)); --
QUERY: CREATE TABLE num_exp_div (id1 int4, id2 int4, expected numeric(210,10)); CREATE TABLE num_data (id int4, val numeric(210,10));
QUERY: CREATE TABLE num_exp_mul (id1 int4, id2 int4, expected numeric(210,10)); CREATE TABLE num_exp_add (id1 int4, id2 int4, expected numeric(210,10));
QUERY: CREATE TABLE num_exp_sqrt (id int4, expected numeric(210,10)); CREATE TABLE num_exp_sub (id1 int4, id2 int4, expected numeric(210,10));
QUERY: CREATE TABLE num_exp_ln (id int4, expected numeric(210,10)); CREATE TABLE num_exp_div (id1 int4, id2 int4, expected numeric(210,10));
QUERY: CREATE TABLE num_exp_log10 (id int4, expected numeric(210,10)); CREATE TABLE num_exp_mul (id1 int4, id2 int4, expected numeric(210,10));
QUERY: CREATE TABLE num_exp_power_10_ln (id int4, expected numeric(210,10)); CREATE TABLE num_exp_sqrt (id int4, expected numeric(210,10));
QUERY: CREATE TABLE num_result (id1 int4, id2 int4, result numeric(210,10)); CREATE TABLE num_exp_ln (id int4, expected numeric(210,10));
QUERY: BEGIN TRANSACTION; CREATE TABLE num_exp_log10 (id int4, expected numeric(210,10));
QUERY: INSERT INTO num_exp_add VALUES (0,0,'0'); CREATE TABLE num_exp_power_10_ln (id int4, expected numeric(210,10));
QUERY: INSERT INTO num_exp_sub VALUES (0,0,'0'); CREATE TABLE num_result (id1 int4, id2 int4, result numeric(210,10));
QUERY: INSERT INTO num_exp_mul VALUES (0,0,'0'); -- ******************************
QUERY: INSERT INTO num_exp_div VALUES (0,0,'NaN'); -- * The following EXPECTED results are computed by bc(1)
QUERY: INSERT INTO num_exp_add VALUES (0,1,'0'); -- * with a scale of 200
QUERY: INSERT INTO num_exp_sub VALUES (0,1,'0'); -- ******************************
QUERY: INSERT INTO num_exp_mul VALUES (0,1,'0'); BEGIN TRANSACTION;
QUERY: INSERT INTO num_exp_div VALUES (0,1,'NaN'); INSERT INTO num_exp_add VALUES (0,0,'0');
QUERY: INSERT INTO num_exp_add VALUES (0,2,'-34338492.215397047'); INSERT INTO num_exp_sub VALUES (0,0,'0');
QUERY: INSERT INTO num_exp_sub VALUES (0,2,'34338492.215397047'); INSERT INTO num_exp_mul VALUES (0,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (0,2,'0'); INSERT INTO num_exp_div VALUES (0,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (0,2,'0'); INSERT INTO num_exp_add VALUES (0,1,'0');
QUERY: INSERT INTO num_exp_add VALUES (0,3,'4.31'); INSERT INTO num_exp_sub VALUES (0,1,'0');
QUERY: INSERT INTO num_exp_sub VALUES (0,3,'-4.31'); INSERT INTO num_exp_mul VALUES (0,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (0,3,'0'); INSERT INTO num_exp_div VALUES (0,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (0,3,'0'); INSERT INTO num_exp_add VALUES (0,2,'-34338492.215397047');
QUERY: INSERT INTO num_exp_add VALUES (0,4,'7799461.4119'); INSERT INTO num_exp_sub VALUES (0,2,'34338492.215397047');
QUERY: INSERT INTO num_exp_sub VALUES (0,4,'-7799461.4119'); INSERT INTO num_exp_mul VALUES (0,2,'0');
QUERY: INSERT INTO num_exp_mul VALUES (0,4,'0'); INSERT INTO num_exp_div VALUES (0,2,'0');
QUERY: INSERT INTO num_exp_div VALUES (0,4,'0'); INSERT INTO num_exp_add VALUES (0,3,'4.31');
QUERY: INSERT INTO num_exp_add VALUES (0,5,'16397.038491'); INSERT INTO num_exp_sub VALUES (0,3,'-4.31');
QUERY: INSERT INTO num_exp_sub VALUES (0,5,'-16397.038491'); INSERT INTO num_exp_mul VALUES (0,3,'0');
QUERY: INSERT INTO num_exp_mul VALUES (0,5,'0'); INSERT INTO num_exp_div VALUES (0,3,'0');
QUERY: INSERT INTO num_exp_div VALUES (0,5,'0'); INSERT INTO num_exp_add VALUES (0,4,'7799461.4119');
QUERY: INSERT INTO num_exp_add VALUES (0,6,'93901.57763026'); INSERT INTO num_exp_sub VALUES (0,4,'-7799461.4119');
QUERY: INSERT INTO num_exp_sub VALUES (0,6,'-93901.57763026'); INSERT INTO num_exp_mul VALUES (0,4,'0');
QUERY: INSERT INTO num_exp_mul VALUES (0,6,'0'); INSERT INTO num_exp_div VALUES (0,4,'0');
QUERY: INSERT INTO num_exp_div VALUES (0,6,'0'); INSERT INTO num_exp_add VALUES (0,5,'16397.038491');
QUERY: INSERT INTO num_exp_add VALUES (0,7,'-83028485'); INSERT INTO num_exp_sub VALUES (0,5,'-16397.038491');
QUERY: INSERT INTO num_exp_sub VALUES (0,7,'83028485'); INSERT INTO num_exp_mul VALUES (0,5,'0');
QUERY: INSERT INTO num_exp_mul VALUES (0,7,'0'); INSERT INTO num_exp_div VALUES (0,5,'0');
QUERY: INSERT INTO num_exp_div VALUES (0,7,'0'); INSERT INTO num_exp_add VALUES (0,6,'93901.57763026');
QUERY: INSERT INTO num_exp_add VALUES (0,8,'74881'); INSERT INTO num_exp_sub VALUES (0,6,'-93901.57763026');
QUERY: INSERT INTO num_exp_sub VALUES (0,8,'-74881'); INSERT INTO num_exp_mul VALUES (0,6,'0');
QUERY: INSERT INTO num_exp_mul VALUES (0,8,'0'); INSERT INTO num_exp_div VALUES (0,6,'0');
QUERY: INSERT INTO num_exp_div VALUES (0,8,'0'); INSERT INTO num_exp_add VALUES (0,7,'-83028485');
QUERY: INSERT INTO num_exp_add VALUES (0,9,'-24926804.045047420'); INSERT INTO num_exp_sub VALUES (0,7,'83028485');
QUERY: INSERT INTO num_exp_sub VALUES (0,9,'24926804.045047420'); INSERT INTO num_exp_mul VALUES (0,7,'0');
QUERY: INSERT INTO num_exp_mul VALUES (0,9,'0'); INSERT INTO num_exp_div VALUES (0,7,'0');
QUERY: INSERT INTO num_exp_div VALUES (0,9,'0'); INSERT INTO num_exp_add VALUES (0,8,'74881');
QUERY: INSERT INTO num_exp_add VALUES (1,0,'0'); INSERT INTO num_exp_sub VALUES (0,8,'-74881');
QUERY: INSERT INTO num_exp_sub VALUES (1,0,'0'); INSERT INTO num_exp_mul VALUES (0,8,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,0,'0'); INSERT INTO num_exp_div VALUES (0,8,'0');
QUERY: INSERT INTO num_exp_div VALUES (1,0,'NaN'); INSERT INTO num_exp_add VALUES (0,9,'-24926804.045047420');
QUERY: INSERT INTO num_exp_add VALUES (1,1,'0'); INSERT INTO num_exp_sub VALUES (0,9,'24926804.045047420');
QUERY: INSERT INTO num_exp_sub VALUES (1,1,'0'); INSERT INTO num_exp_mul VALUES (0,9,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,1,'0'); INSERT INTO num_exp_div VALUES (0,9,'0');
QUERY: INSERT INTO num_exp_div VALUES (1,1,'NaN'); INSERT INTO num_exp_add VALUES (1,0,'0');
QUERY: INSERT INTO num_exp_add VALUES (1,2,'-34338492.215397047'); INSERT INTO num_exp_sub VALUES (1,0,'0');
QUERY: INSERT INTO num_exp_sub VALUES (1,2,'34338492.215397047'); INSERT INTO num_exp_mul VALUES (1,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,2,'0'); INSERT INTO num_exp_div VALUES (1,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (1,2,'0'); INSERT INTO num_exp_add VALUES (1,1,'0');
QUERY: INSERT INTO num_exp_add VALUES (1,3,'4.31'); INSERT INTO num_exp_sub VALUES (1,1,'0');
QUERY: INSERT INTO num_exp_sub VALUES (1,3,'-4.31'); INSERT INTO num_exp_mul VALUES (1,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,3,'0'); INSERT INTO num_exp_div VALUES (1,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (1,3,'0'); INSERT INTO num_exp_add VALUES (1,2,'-34338492.215397047');
QUERY: INSERT INTO num_exp_add VALUES (1,4,'7799461.4119'); INSERT INTO num_exp_sub VALUES (1,2,'34338492.215397047');
QUERY: INSERT INTO num_exp_sub VALUES (1,4,'-7799461.4119'); INSERT INTO num_exp_mul VALUES (1,2,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,4,'0'); INSERT INTO num_exp_div VALUES (1,2,'0');
QUERY: INSERT INTO num_exp_div VALUES (1,4,'0'); INSERT INTO num_exp_add VALUES (1,3,'4.31');
QUERY: INSERT INTO num_exp_add VALUES (1,5,'16397.038491'); INSERT INTO num_exp_sub VALUES (1,3,'-4.31');
QUERY: INSERT INTO num_exp_sub VALUES (1,5,'-16397.038491'); INSERT INTO num_exp_mul VALUES (1,3,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,5,'0'); INSERT INTO num_exp_div VALUES (1,3,'0');
QUERY: INSERT INTO num_exp_div VALUES (1,5,'0'); INSERT INTO num_exp_add VALUES (1,4,'7799461.4119');
QUERY: INSERT INTO num_exp_add VALUES (1,6,'93901.57763026'); INSERT INTO num_exp_sub VALUES (1,4,'-7799461.4119');
QUERY: INSERT INTO num_exp_sub VALUES (1,6,'-93901.57763026'); INSERT INTO num_exp_mul VALUES (1,4,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,6,'0'); INSERT INTO num_exp_div VALUES (1,4,'0');
QUERY: INSERT INTO num_exp_div VALUES (1,6,'0'); INSERT INTO num_exp_add VALUES (1,5,'16397.038491');
QUERY: INSERT INTO num_exp_add VALUES (1,7,'-83028485'); INSERT INTO num_exp_sub VALUES (1,5,'-16397.038491');
QUERY: INSERT INTO num_exp_sub VALUES (1,7,'83028485'); INSERT INTO num_exp_mul VALUES (1,5,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,7,'0'); INSERT INTO num_exp_div VALUES (1,5,'0');
QUERY: INSERT INTO num_exp_div VALUES (1,7,'0'); INSERT INTO num_exp_add VALUES (1,6,'93901.57763026');
QUERY: INSERT INTO num_exp_add VALUES (1,8,'74881'); INSERT INTO num_exp_sub VALUES (1,6,'-93901.57763026');
QUERY: INSERT INTO num_exp_sub VALUES (1,8,'-74881'); INSERT INTO num_exp_mul VALUES (1,6,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,8,'0'); INSERT INTO num_exp_div VALUES (1,6,'0');
QUERY: INSERT INTO num_exp_div VALUES (1,8,'0'); INSERT INTO num_exp_add VALUES (1,7,'-83028485');
QUERY: INSERT INTO num_exp_add VALUES (1,9,'-24926804.045047420'); INSERT INTO num_exp_sub VALUES (1,7,'83028485');
QUERY: INSERT INTO num_exp_sub VALUES (1,9,'24926804.045047420'); INSERT INTO num_exp_mul VALUES (1,7,'0');
QUERY: INSERT INTO num_exp_mul VALUES (1,9,'0'); INSERT INTO num_exp_div VALUES (1,7,'0');
QUERY: INSERT INTO num_exp_div VALUES (1,9,'0'); INSERT INTO num_exp_add VALUES (1,8,'74881');
QUERY: INSERT INTO num_exp_add VALUES (2,0,'-34338492.215397047'); INSERT INTO num_exp_sub VALUES (1,8,'-74881');
QUERY: INSERT INTO num_exp_sub VALUES (2,0,'-34338492.215397047'); INSERT INTO num_exp_mul VALUES (1,8,'0');
QUERY: INSERT INTO num_exp_mul VALUES (2,0,'0'); INSERT INTO num_exp_div VALUES (1,8,'0');
QUERY: INSERT INTO num_exp_div VALUES (2,0,'NaN'); INSERT INTO num_exp_add VALUES (1,9,'-24926804.045047420');
QUERY: INSERT INTO num_exp_add VALUES (2,1,'-34338492.215397047'); INSERT INTO num_exp_sub VALUES (1,9,'24926804.045047420');
QUERY: INSERT INTO num_exp_sub VALUES (2,1,'-34338492.215397047'); INSERT INTO num_exp_mul VALUES (1,9,'0');
QUERY: INSERT INTO num_exp_mul VALUES (2,1,'0'); INSERT INTO num_exp_div VALUES (1,9,'0');
QUERY: INSERT INTO num_exp_div VALUES (2,1,'NaN'); INSERT INTO num_exp_add VALUES (2,0,'-34338492.215397047');
QUERY: INSERT INTO num_exp_add VALUES (2,2,'-68676984.430794094'); INSERT INTO num_exp_sub VALUES (2,0,'-34338492.215397047');
QUERY: INSERT INTO num_exp_sub VALUES (2,2,'0'); INSERT INTO num_exp_mul VALUES (2,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (2,2,'1179132047626883.596862135856320209'); INSERT INTO num_exp_div VALUES (2,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (2,2,'1.00000000000000000000'); INSERT INTO num_exp_add VALUES (2,1,'-34338492.215397047');
QUERY: INSERT INTO num_exp_add VALUES (2,3,'-34338487.905397047'); INSERT INTO num_exp_sub VALUES (2,1,'-34338492.215397047');
QUERY: INSERT INTO num_exp_sub VALUES (2,3,'-34338496.525397047'); INSERT INTO num_exp_mul VALUES (2,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (2,3,'-147998901.44836127257'); INSERT INTO num_exp_div VALUES (2,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (2,3,'-7967167.56737750510440835266'); INSERT INTO num_exp_add VALUES (2,2,'-68676984.430794094');
QUERY: INSERT INTO num_exp_add VALUES (2,4,'-26539030.803497047'); INSERT INTO num_exp_sub VALUES (2,2,'0');
QUERY: INSERT INTO num_exp_sub VALUES (2,4,'-42137953.627297047'); INSERT INTO num_exp_mul VALUES (2,2,'1179132047626883.596862135856320209');
QUERY: INSERT INTO num_exp_mul VALUES (2,4,'-267821744976817.8111137106593'); INSERT INTO num_exp_div VALUES (2,2,'1.00000000000000000000');
QUERY: INSERT INTO num_exp_div VALUES (2,4,'-4.40267480046830116685'); INSERT INTO num_exp_add VALUES (2,3,'-34338487.905397047');
QUERY: INSERT INTO num_exp_add VALUES (2,5,'-34322095.176906047'); INSERT INTO num_exp_sub VALUES (2,3,'-34338496.525397047');
QUERY: INSERT INTO num_exp_sub VALUES (2,5,'-34354889.253888047'); INSERT INTO num_exp_mul VALUES (2,3,'-147998901.44836127257');
QUERY: INSERT INTO num_exp_mul VALUES (2,5,'-563049578578.769242506736077'); INSERT INTO num_exp_div VALUES (2,3,'-7967167.56737750510440835266');
QUERY: INSERT INTO num_exp_div VALUES (2,5,'-2094.18866914563535496429'); INSERT INTO num_exp_add VALUES (2,4,'-26539030.803497047');
QUERY: INSERT INTO num_exp_add VALUES (2,6,'-34244590.637766787'); INSERT INTO num_exp_sub VALUES (2,4,'-42137953.627297047');
QUERY: INSERT INTO num_exp_sub VALUES (2,6,'-34432393.793027307'); INSERT INTO num_exp_mul VALUES (2,4,'-267821744976817.8111137106593');
QUERY: INSERT INTO num_exp_mul VALUES (2,6,'-3224438592470.18449811926184222'); INSERT INTO num_exp_div VALUES (2,4,'-4.40267480046830116685');
QUERY: INSERT INTO num_exp_div VALUES (2,6,'-365.68599891479766440940'); INSERT INTO num_exp_add VALUES (2,5,'-34322095.176906047');
QUERY: INSERT INTO num_exp_add VALUES (2,7,'-117366977.215397047'); INSERT INTO num_exp_sub VALUES (2,5,'-34354889.253888047');
QUERY: INSERT INTO num_exp_sub VALUES (2,7,'48689992.784602953'); INSERT INTO num_exp_mul VALUES (2,5,'-563049578578.769242506736077');
QUERY: INSERT INTO num_exp_mul VALUES (2,7,'2851072985828710.485883795'); INSERT INTO num_exp_div VALUES (2,5,'-2094.18866914563535496429');
QUERY: INSERT INTO num_exp_div VALUES (2,7,'.41357483778485235518'); INSERT INTO num_exp_add VALUES (2,6,'-34244590.637766787');
QUERY: INSERT INTO num_exp_add VALUES (2,8,'-34263611.215397047'); INSERT INTO num_exp_sub VALUES (2,6,'-34432393.793027307');
QUERY: INSERT INTO num_exp_sub VALUES (2,8,'-34413373.215397047'); INSERT INTO num_exp_mul VALUES (2,6,'-3224438592470.18449811926184222');
QUERY: INSERT INTO num_exp_mul VALUES (2,8,'-2571300635581.146276407'); INSERT INTO num_exp_div VALUES (2,6,'-365.68599891479766440940');
QUERY: INSERT INTO num_exp_div VALUES (2,8,'-458.57416721727870888476'); INSERT INTO num_exp_add VALUES (2,7,'-117366977.215397047');
QUERY: INSERT INTO num_exp_add VALUES (2,9,'-59265296.260444467'); INSERT INTO num_exp_sub VALUES (2,7,'48689992.784602953');
QUERY: INSERT INTO num_exp_sub VALUES (2,9,'-9411688.170349627'); INSERT INTO num_exp_mul VALUES (2,7,'2851072985828710.485883795');
QUERY: INSERT INTO num_exp_mul VALUES (2,9,'855948866655588.453741509242968740'); INSERT INTO num_exp_div VALUES (2,7,'.41357483778485235518');
QUERY: INSERT INTO num_exp_div VALUES (2,9,'1.37757299946438931811'); INSERT INTO num_exp_add VALUES (2,8,'-34263611.215397047');
QUERY: INSERT INTO num_exp_add VALUES (3,0,'4.31'); INSERT INTO num_exp_sub VALUES (2,8,'-34413373.215397047');
QUERY: INSERT INTO num_exp_sub VALUES (3,0,'4.31'); INSERT INTO num_exp_mul VALUES (2,8,'-2571300635581.146276407');
QUERY: INSERT INTO num_exp_mul VALUES (3,0,'0'); INSERT INTO num_exp_div VALUES (2,8,'-458.57416721727870888476');
QUERY: INSERT INTO num_exp_div VALUES (3,0,'NaN'); INSERT INTO num_exp_add VALUES (2,9,'-59265296.260444467');
QUERY: INSERT INTO num_exp_add VALUES (3,1,'4.31'); INSERT INTO num_exp_sub VALUES (2,9,'-9411688.170349627');
QUERY: INSERT INTO num_exp_sub VALUES (3,1,'4.31'); INSERT INTO num_exp_mul VALUES (2,9,'855948866655588.453741509242968740');
QUERY: INSERT INTO num_exp_mul VALUES (3,1,'0'); INSERT INTO num_exp_div VALUES (2,9,'1.37757299946438931811');
QUERY: INSERT INTO num_exp_div VALUES (3,1,'NaN'); INSERT INTO num_exp_add VALUES (3,0,'4.31');
QUERY: INSERT INTO num_exp_add VALUES (3,2,'-34338487.905397047'); INSERT INTO num_exp_sub VALUES (3,0,'4.31');
QUERY: INSERT INTO num_exp_sub VALUES (3,2,'34338496.525397047'); INSERT INTO num_exp_mul VALUES (3,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (3,2,'-147998901.44836127257'); INSERT INTO num_exp_div VALUES (3,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (3,2,'-.00000012551512084352'); INSERT INTO num_exp_add VALUES (3,1,'4.31');
QUERY: INSERT INTO num_exp_add VALUES (3,3,'8.62'); INSERT INTO num_exp_sub VALUES (3,1,'4.31');
QUERY: INSERT INTO num_exp_sub VALUES (3,3,'0'); INSERT INTO num_exp_mul VALUES (3,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (3,3,'18.5761'); INSERT INTO num_exp_div VALUES (3,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (3,3,'1.00000000000000000000'); INSERT INTO num_exp_add VALUES (3,2,'-34338487.905397047');
QUERY: INSERT INTO num_exp_add VALUES (3,4,'7799465.7219'); INSERT INTO num_exp_sub VALUES (3,2,'34338496.525397047');
QUERY: INSERT INTO num_exp_sub VALUES (3,4,'-7799457.1019'); INSERT INTO num_exp_mul VALUES (3,2,'-147998901.44836127257');
QUERY: INSERT INTO num_exp_mul VALUES (3,4,'33615678.685289'); INSERT INTO num_exp_div VALUES (3,2,'-.00000012551512084352');
QUERY: INSERT INTO num_exp_div VALUES (3,4,'.00000055260225961552'); INSERT INTO num_exp_add VALUES (3,3,'8.62');
QUERY: INSERT INTO num_exp_add VALUES (3,5,'16401.348491'); INSERT INTO num_exp_sub VALUES (3,3,'0');
QUERY: INSERT INTO num_exp_sub VALUES (3,5,'-16392.728491'); INSERT INTO num_exp_mul VALUES (3,3,'18.5761');
QUERY: INSERT INTO num_exp_mul VALUES (3,5,'70671.23589621'); INSERT INTO num_exp_div VALUES (3,3,'1.00000000000000000000');
QUERY: INSERT INTO num_exp_div VALUES (3,5,'.00026285234387695504'); INSERT INTO num_exp_add VALUES (3,4,'7799465.7219');
QUERY: INSERT INTO num_exp_add VALUES (3,6,'93905.88763026'); INSERT INTO num_exp_sub VALUES (3,4,'-7799457.1019');
QUERY: INSERT INTO num_exp_sub VALUES (3,6,'-93897.26763026'); INSERT INTO num_exp_mul VALUES (3,4,'33615678.685289');
QUERY: INSERT INTO num_exp_mul VALUES (3,6,'404715.7995864206'); INSERT INTO num_exp_div VALUES (3,4,'.00000055260225961552');
QUERY: INSERT INTO num_exp_div VALUES (3,6,'.00004589912234457595'); INSERT INTO num_exp_add VALUES (3,5,'16401.348491');
QUERY: INSERT INTO num_exp_add VALUES (3,7,'-83028480.69'); INSERT INTO num_exp_sub VALUES (3,5,'-16392.728491');
QUERY: INSERT INTO num_exp_sub VALUES (3,7,'83028489.31'); INSERT INTO num_exp_mul VALUES (3,5,'70671.23589621');
QUERY: INSERT INTO num_exp_mul VALUES (3,7,'-357852770.35'); INSERT INTO num_exp_div VALUES (3,5,'.00026285234387695504');
QUERY: INSERT INTO num_exp_div VALUES (3,7,'-.00000005190989574240'); INSERT INTO num_exp_add VALUES (3,6,'93905.88763026');
QUERY: INSERT INTO num_exp_add VALUES (3,8,'74885.31'); INSERT INTO num_exp_sub VALUES (3,6,'-93897.26763026');
QUERY: INSERT INTO num_exp_sub VALUES (3,8,'-74876.69'); INSERT INTO num_exp_mul VALUES (3,6,'404715.7995864206');
QUERY: INSERT INTO num_exp_mul VALUES (3,8,'322737.11'); INSERT INTO num_exp_div VALUES (3,6,'.00004589912234457595');
QUERY: INSERT INTO num_exp_div VALUES (3,8,'.00005755799201399553'); INSERT INTO num_exp_add VALUES (3,7,'-83028480.69');
QUERY: INSERT INTO num_exp_add VALUES (3,9,'-24926799.735047420'); INSERT INTO num_exp_sub VALUES (3,7,'83028489.31');
QUERY: INSERT INTO num_exp_sub VALUES (3,9,'24926808.355047420'); INSERT INTO num_exp_mul VALUES (3,7,'-357852770.35');
QUERY: INSERT INTO num_exp_mul VALUES (3,9,'-107434525.43415438020'); INSERT INTO num_exp_div VALUES (3,7,'-.00000005190989574240');
QUERY: INSERT INTO num_exp_div VALUES (3,9,'-.00000017290624149854'); INSERT INTO num_exp_add VALUES (3,8,'74885.31');
QUERY: INSERT INTO num_exp_add VALUES (4,0,'7799461.4119'); INSERT INTO num_exp_sub VALUES (3,8,'-74876.69');
QUERY: INSERT INTO num_exp_sub VALUES (4,0,'7799461.4119'); INSERT INTO num_exp_mul VALUES (3,8,'322737.11');
QUERY: INSERT INTO num_exp_mul VALUES (4,0,'0'); INSERT INTO num_exp_div VALUES (3,8,'.00005755799201399553');
QUERY: INSERT INTO num_exp_div VALUES (4,0,'NaN'); INSERT INTO num_exp_add VALUES (3,9,'-24926799.735047420');
QUERY: INSERT INTO num_exp_add VALUES (4,1,'7799461.4119'); INSERT INTO num_exp_sub VALUES (3,9,'24926808.355047420');
QUERY: INSERT INTO num_exp_sub VALUES (4,1,'7799461.4119'); INSERT INTO num_exp_mul VALUES (3,9,'-107434525.43415438020');
QUERY: INSERT INTO num_exp_mul VALUES (4,1,'0'); INSERT INTO num_exp_div VALUES (3,9,'-.00000017290624149854');
QUERY: INSERT INTO num_exp_div VALUES (4,1,'NaN'); INSERT INTO num_exp_add VALUES (4,0,'7799461.4119');
QUERY: INSERT INTO num_exp_add VALUES (4,2,'-26539030.803497047'); INSERT INTO num_exp_sub VALUES (4,0,'7799461.4119');
QUERY: INSERT INTO num_exp_sub VALUES (4,2,'42137953.627297047'); INSERT INTO num_exp_mul VALUES (4,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (4,2,'-267821744976817.8111137106593'); INSERT INTO num_exp_div VALUES (4,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (4,2,'-.22713465002993920385'); INSERT INTO num_exp_add VALUES (4,1,'7799461.4119');
QUERY: INSERT INTO num_exp_add VALUES (4,3,'7799465.7219'); INSERT INTO num_exp_sub VALUES (4,1,'7799461.4119');
QUERY: INSERT INTO num_exp_sub VALUES (4,3,'7799457.1019'); INSERT INTO num_exp_mul VALUES (4,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (4,3,'33615678.685289'); INSERT INTO num_exp_div VALUES (4,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (4,3,'1809619.81714617169373549883'); INSERT INTO num_exp_add VALUES (4,2,'-26539030.803497047');
QUERY: INSERT INTO num_exp_add VALUES (4,4,'15598922.8238'); INSERT INTO num_exp_sub VALUES (4,2,'42137953.627297047');
QUERY: INSERT INTO num_exp_sub VALUES (4,4,'0'); INSERT INTO num_exp_mul VALUES (4,2,'-267821744976817.8111137106593');
QUERY: INSERT INTO num_exp_mul VALUES (4,4,'60831598315717.14146161'); INSERT INTO num_exp_div VALUES (4,2,'-.22713465002993920385');
QUERY: INSERT INTO num_exp_div VALUES (4,4,'1.00000000000000000000'); INSERT INTO num_exp_add VALUES (4,3,'7799465.7219');
QUERY: INSERT INTO num_exp_add VALUES (4,5,'7815858.450391'); INSERT INTO num_exp_sub VALUES (4,3,'7799457.1019');
QUERY: INSERT INTO num_exp_sub VALUES (4,5,'7783064.373409'); INSERT INTO num_exp_mul VALUES (4,3,'33615678.685289');
QUERY: INSERT INTO num_exp_mul VALUES (4,5,'127888068979.9935054429'); INSERT INTO num_exp_div VALUES (4,3,'1809619.81714617169373549883');
QUERY: INSERT INTO num_exp_div VALUES (4,5,'475.66281046305802686061'); INSERT INTO num_exp_add VALUES (4,4,'15598922.8238');
QUERY: INSERT INTO num_exp_add VALUES (4,6,'7893362.98953026'); INSERT INTO num_exp_sub VALUES (4,4,'0');
QUERY: INSERT INTO num_exp_sub VALUES (4,6,'7705559.83426974'); INSERT INTO num_exp_mul VALUES (4,4,'60831598315717.14146161');
QUERY: INSERT INTO num_exp_mul VALUES (4,6,'732381731243.745115764094'); INSERT INTO num_exp_div VALUES (4,4,'1.00000000000000000000');
QUERY: INSERT INTO num_exp_div VALUES (4,6,'83.05996138436129499606'); INSERT INTO num_exp_add VALUES (4,5,'7815858.450391');
QUERY: INSERT INTO num_exp_add VALUES (4,7,'-75229023.5881'); INSERT INTO num_exp_sub VALUES (4,5,'7783064.373409');
QUERY: INSERT INTO num_exp_sub VALUES (4,7,'90827946.4119'); INSERT INTO num_exp_mul VALUES (4,5,'127888068979.9935054429');
QUERY: INSERT INTO num_exp_mul VALUES (4,7,'-647577464846017.9715'); INSERT INTO num_exp_div VALUES (4,5,'475.66281046305802686061');
QUERY: INSERT INTO num_exp_div VALUES (4,7,'-.09393717604145131637'); INSERT INTO num_exp_add VALUES (4,6,'7893362.98953026');
QUERY: INSERT INTO num_exp_add VALUES (4,8,'7874342.4119'); INSERT INTO num_exp_sub VALUES (4,6,'7705559.83426974');
QUERY: INSERT INTO num_exp_sub VALUES (4,8,'7724580.4119'); INSERT INTO num_exp_mul VALUES (4,6,'732381731243.745115764094');
QUERY: INSERT INTO num_exp_mul VALUES (4,8,'584031469984.4839'); INSERT INTO num_exp_div VALUES (4,6,'83.05996138436129499606');
QUERY: INSERT INTO num_exp_div VALUES (4,8,'104.15808298366741897143'); INSERT INTO num_exp_add VALUES (4,7,'-75229023.5881');
QUERY: INSERT INTO num_exp_add VALUES (4,9,'-17127342.633147420'); INSERT INTO num_exp_sub VALUES (4,7,'90827946.4119');
QUERY: INSERT INTO num_exp_sub VALUES (4,9,'32726265.456947420'); INSERT INTO num_exp_mul VALUES (4,7,'-647577464846017.9715');
QUERY: INSERT INTO num_exp_mul VALUES (4,9,'-194415646271340.1815956522980'); INSERT INTO num_exp_div VALUES (4,7,'-.09393717604145131637');
QUERY: INSERT INTO num_exp_div VALUES (4,9,'-.31289456112403769409'); INSERT INTO num_exp_add VALUES (4,8,'7874342.4119');
QUERY: INSERT INTO num_exp_add VALUES (5,0,'16397.038491'); INSERT INTO num_exp_sub VALUES (4,8,'7724580.4119');
QUERY: INSERT INTO num_exp_sub VALUES (5,0,'16397.038491'); INSERT INTO num_exp_mul VALUES (4,8,'584031469984.4839');
QUERY: INSERT INTO num_exp_mul VALUES (5,0,'0'); INSERT INTO num_exp_div VALUES (4,8,'104.15808298366741897143');
QUERY: INSERT INTO num_exp_div VALUES (5,0,'NaN'); INSERT INTO num_exp_add VALUES (4,9,'-17127342.633147420');
QUERY: INSERT INTO num_exp_add VALUES (5,1,'16397.038491'); INSERT INTO num_exp_sub VALUES (4,9,'32726265.456947420');
QUERY: INSERT INTO num_exp_sub VALUES (5,1,'16397.038491'); INSERT INTO num_exp_mul VALUES (4,9,'-194415646271340.1815956522980');
QUERY: INSERT INTO num_exp_mul VALUES (5,1,'0'); INSERT INTO num_exp_div VALUES (4,9,'-.31289456112403769409');
QUERY: INSERT INTO num_exp_div VALUES (5,1,'NaN'); INSERT INTO num_exp_add VALUES (5,0,'16397.038491');
QUERY: INSERT INTO num_exp_add VALUES (5,2,'-34322095.176906047'); INSERT INTO num_exp_sub VALUES (5,0,'16397.038491');
QUERY: INSERT INTO num_exp_sub VALUES (5,2,'34354889.253888047'); INSERT INTO num_exp_mul VALUES (5,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (5,2,'-563049578578.769242506736077'); INSERT INTO num_exp_div VALUES (5,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (5,2,'-.00047751189505192446'); INSERT INTO num_exp_add VALUES (5,1,'16397.038491');
QUERY: INSERT INTO num_exp_add VALUES (5,3,'16401.348491'); INSERT INTO num_exp_sub VALUES (5,1,'16397.038491');
QUERY: INSERT INTO num_exp_sub VALUES (5,3,'16392.728491'); INSERT INTO num_exp_mul VALUES (5,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (5,3,'70671.23589621'); INSERT INTO num_exp_div VALUES (5,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (5,3,'3804.41728329466357308584'); INSERT INTO num_exp_add VALUES (5,2,'-34322095.176906047');
QUERY: INSERT INTO num_exp_add VALUES (5,4,'7815858.450391'); INSERT INTO num_exp_sub VALUES (5,2,'34354889.253888047');
QUERY: INSERT INTO num_exp_sub VALUES (5,4,'-7783064.373409'); INSERT INTO num_exp_mul VALUES (5,2,'-563049578578.769242506736077');
QUERY: INSERT INTO num_exp_mul VALUES (5,4,'127888068979.9935054429'); INSERT INTO num_exp_div VALUES (5,2,'-.00047751189505192446');
QUERY: INSERT INTO num_exp_div VALUES (5,4,'.00210232958726897192'); INSERT INTO num_exp_add VALUES (5,3,'16401.348491');
QUERY: INSERT INTO num_exp_add VALUES (5,5,'32794.076982'); INSERT INTO num_exp_sub VALUES (5,3,'16392.728491');
QUERY: INSERT INTO num_exp_sub VALUES (5,5,'0'); INSERT INTO num_exp_mul VALUES (5,3,'70671.23589621');
QUERY: INSERT INTO num_exp_mul VALUES (5,5,'268862871.275335557081'); INSERT INTO num_exp_div VALUES (5,3,'3804.41728329466357308584');
QUERY: INSERT INTO num_exp_div VALUES (5,5,'1.00000000000000000000'); INSERT INTO num_exp_add VALUES (5,4,'7815858.450391');
QUERY: INSERT INTO num_exp_add VALUES (5,6,'110298.61612126'); INSERT INTO num_exp_sub VALUES (5,4,'-7783064.373409');
QUERY: INSERT INTO num_exp_sub VALUES (5,6,'-77504.53913926'); INSERT INTO num_exp_mul VALUES (5,4,'127888068979.9935054429');
QUERY: INSERT INTO num_exp_mul VALUES (5,6,'1539707782.76899778633766'); INSERT INTO num_exp_div VALUES (5,4,'.00210232958726897192');
QUERY: INSERT INTO num_exp_div VALUES (5,6,'.17461941433576102689'); INSERT INTO num_exp_add VALUES (5,5,'32794.076982');
QUERY: INSERT INTO num_exp_add VALUES (5,7,'-83012087.961509'); INSERT INTO num_exp_sub VALUES (5,5,'0');
QUERY: INSERT INTO num_exp_sub VALUES (5,7,'83044882.038491'); INSERT INTO num_exp_mul VALUES (5,5,'268862871.275335557081');
QUERY: INSERT INTO num_exp_mul VALUES (5,7,'-1361421264394.416135'); INSERT INTO num_exp_div VALUES (5,5,'1.00000000000000000000');
QUERY: INSERT INTO num_exp_div VALUES (5,7,'-.00019748690453643710'); INSERT INTO num_exp_add VALUES (5,6,'110298.61612126');
QUERY: INSERT INTO num_exp_add VALUES (5,8,'91278.038491'); INSERT INTO num_exp_sub VALUES (5,6,'-77504.53913926');
QUERY: INSERT INTO num_exp_sub VALUES (5,8,'-58483.961509'); INSERT INTO num_exp_mul VALUES (5,6,'1539707782.76899778633766');
QUERY: INSERT INTO num_exp_mul VALUES (5,8,'1227826639.244571'); INSERT INTO num_exp_div VALUES (5,6,'.17461941433576102689');
QUERY: INSERT INTO num_exp_div VALUES (5,8,'.21897461960978085228'); INSERT INTO num_exp_add VALUES (5,7,'-83012087.961509');
QUERY: INSERT INTO num_exp_add VALUES (5,9,'-24910407.006556420'); INSERT INTO num_exp_sub VALUES (5,7,'83044882.038491');
QUERY: INSERT INTO num_exp_sub VALUES (5,9,'24943201.083538420'); INSERT INTO num_exp_mul VALUES (5,7,'-1361421264394.416135');
QUERY: INSERT INTO num_exp_mul VALUES (5,9,'-408725765384.257043660243220'); INSERT INTO num_exp_div VALUES (5,7,'-.00019748690453643710');
QUERY: INSERT INTO num_exp_div VALUES (5,9,'-.00065780749354660427'); INSERT INTO num_exp_add VALUES (5,8,'91278.038491');
QUERY: INSERT INTO num_exp_add VALUES (6,0,'93901.57763026'); INSERT INTO num_exp_sub VALUES (5,8,'-58483.961509');
QUERY: INSERT INTO num_exp_sub VALUES (6,0,'93901.57763026'); INSERT INTO num_exp_mul VALUES (5,8,'1227826639.244571');
QUERY: INSERT INTO num_exp_mul VALUES (6,0,'0'); INSERT INTO num_exp_div VALUES (5,8,'.21897461960978085228');
QUERY: INSERT INTO num_exp_div VALUES (6,0,'NaN'); INSERT INTO num_exp_add VALUES (5,9,'-24910407.006556420');
QUERY: INSERT INTO num_exp_add VALUES (6,1,'93901.57763026'); INSERT INTO num_exp_sub VALUES (5,9,'24943201.083538420');
QUERY: INSERT INTO num_exp_sub VALUES (6,1,'93901.57763026'); INSERT INTO num_exp_mul VALUES (5,9,'-408725765384.257043660243220');
QUERY: INSERT INTO num_exp_mul VALUES (6,1,'0'); INSERT INTO num_exp_div VALUES (5,9,'-.00065780749354660427');
QUERY: INSERT INTO num_exp_div VALUES (6,1,'NaN'); INSERT INTO num_exp_add VALUES (6,0,'93901.57763026');
QUERY: INSERT INTO num_exp_add VALUES (6,2,'-34244590.637766787'); INSERT INTO num_exp_sub VALUES (6,0,'93901.57763026');
QUERY: INSERT INTO num_exp_sub VALUES (6,2,'34432393.793027307'); INSERT INTO num_exp_mul VALUES (6,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (6,2,'-3224438592470.18449811926184222'); INSERT INTO num_exp_div VALUES (6,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (6,2,'-.00273458651128995823'); INSERT INTO num_exp_add VALUES (6,1,'93901.57763026');
QUERY: INSERT INTO num_exp_add VALUES (6,3,'93905.88763026'); INSERT INTO num_exp_sub VALUES (6,1,'93901.57763026');
QUERY: INSERT INTO num_exp_sub VALUES (6,3,'93897.26763026'); INSERT INTO num_exp_mul VALUES (6,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (6,3,'404715.7995864206'); INSERT INTO num_exp_div VALUES (6,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (6,3,'21786.90896293735498839907'); INSERT INTO num_exp_add VALUES (6,2,'-34244590.637766787');
QUERY: INSERT INTO num_exp_add VALUES (6,4,'7893362.98953026'); INSERT INTO num_exp_sub VALUES (6,2,'34432393.793027307');
QUERY: INSERT INTO num_exp_sub VALUES (6,4,'-7705559.83426974'); INSERT INTO num_exp_mul VALUES (6,2,'-3224438592470.18449811926184222');
QUERY: INSERT INTO num_exp_mul VALUES (6,4,'732381731243.745115764094'); INSERT INTO num_exp_div VALUES (6,2,'-.00273458651128995823');
QUERY: INSERT INTO num_exp_div VALUES (6,4,'.01203949512295682469'); INSERT INTO num_exp_add VALUES (6,3,'93905.88763026');
QUERY: INSERT INTO num_exp_add VALUES (6,5,'110298.61612126'); INSERT INTO num_exp_sub VALUES (6,3,'93897.26763026');
QUERY: INSERT INTO num_exp_sub VALUES (6,5,'77504.53913926'); INSERT INTO num_exp_mul VALUES (6,3,'404715.7995864206');
QUERY: INSERT INTO num_exp_mul VALUES (6,5,'1539707782.76899778633766'); INSERT INTO num_exp_div VALUES (6,3,'21786.90896293735498839907');
QUERY: INSERT INTO num_exp_div VALUES (6,5,'5.72674008674192359679'); INSERT INTO num_exp_add VALUES (6,4,'7893362.98953026');
QUERY: INSERT INTO num_exp_add VALUES (6,6,'187803.15526052'); INSERT INTO num_exp_sub VALUES (6,4,'-7705559.83426974');
QUERY: INSERT INTO num_exp_sub VALUES (6,6,'0'); INSERT INTO num_exp_mul VALUES (6,4,'732381731243.745115764094');
QUERY: INSERT INTO num_exp_mul VALUES (6,6,'8817506281.4517452372676676'); INSERT INTO num_exp_div VALUES (6,4,'.01203949512295682469');
QUERY: INSERT INTO num_exp_div VALUES (6,6,'1.00000000000000000000'); INSERT INTO num_exp_add VALUES (6,5,'110298.61612126');
QUERY: INSERT INTO num_exp_add VALUES (6,7,'-82934583.42236974'); INSERT INTO num_exp_sub VALUES (6,5,'77504.53913926');
QUERY: INSERT INTO num_exp_sub VALUES (6,7,'83122386.57763026'); INSERT INTO num_exp_mul VALUES (6,5,'1539707782.76899778633766');
QUERY: INSERT INTO num_exp_mul VALUES (6,7,'-7796505729750.37795610'); INSERT INTO num_exp_div VALUES (6,5,'5.72674008674192359679');
QUERY: INSERT INTO num_exp_div VALUES (6,7,'-.00113095617281538980'); INSERT INTO num_exp_add VALUES (6,6,'187803.15526052');
QUERY: INSERT INTO num_exp_add VALUES (6,8,'168782.57763026'); INSERT INTO num_exp_sub VALUES (6,6,'0');
QUERY: INSERT INTO num_exp_sub VALUES (6,8,'19020.57763026'); INSERT INTO num_exp_mul VALUES (6,6,'8817506281.4517452372676676');
QUERY: INSERT INTO num_exp_mul VALUES (6,8,'7031444034.53149906'); INSERT INTO num_exp_div VALUES (6,6,'1.00000000000000000000');
QUERY: INSERT INTO num_exp_div VALUES (6,8,'1.25401073209839612184'); INSERT INTO num_exp_add VALUES (6,7,'-82934583.42236974');
QUERY: INSERT INTO num_exp_add VALUES (6,9,'-24832902.467417160'); INSERT INTO num_exp_sub VALUES (6,7,'83122386.57763026');
QUERY: INSERT INTO num_exp_sub VALUES (6,9,'25020705.622677680'); INSERT INTO num_exp_mul VALUES (6,7,'-7796505729750.37795610');
QUERY: INSERT INTO num_exp_mul VALUES (6,9,'-2340666225110.29929521292692920'); INSERT INTO num_exp_div VALUES (6,7,'-.00113095617281538980');
QUERY: INSERT INTO num_exp_div VALUES (6,9,'-.00376709254265256789'); INSERT INTO num_exp_add VALUES (6,8,'168782.57763026');
QUERY: INSERT INTO num_exp_add VALUES (7,0,'-83028485'); INSERT INTO num_exp_sub VALUES (6,8,'19020.57763026');
QUERY: INSERT INTO num_exp_sub VALUES (7,0,'-83028485'); INSERT INTO num_exp_mul VALUES (6,8,'7031444034.53149906');
QUERY: INSERT INTO num_exp_mul VALUES (7,0,'0'); INSERT INTO num_exp_div VALUES (6,8,'1.25401073209839612184');
QUERY: INSERT INTO num_exp_div VALUES (7,0,'NaN'); INSERT INTO num_exp_add VALUES (6,9,'-24832902.467417160');
QUERY: INSERT INTO num_exp_add VALUES (7,1,'-83028485'); INSERT INTO num_exp_sub VALUES (6,9,'25020705.622677680');
QUERY: INSERT INTO num_exp_sub VALUES (7,1,'-83028485'); INSERT INTO num_exp_mul VALUES (6,9,'-2340666225110.29929521292692920');
QUERY: INSERT INTO num_exp_mul VALUES (7,1,'0'); INSERT INTO num_exp_div VALUES (6,9,'-.00376709254265256789');
QUERY: INSERT INTO num_exp_div VALUES (7,1,'NaN'); INSERT INTO num_exp_add VALUES (7,0,'-83028485');
QUERY: INSERT INTO num_exp_add VALUES (7,2,'-117366977.215397047'); INSERT INTO num_exp_sub VALUES (7,0,'-83028485');
QUERY: INSERT INTO num_exp_sub VALUES (7,2,'-48689992.784602953'); INSERT INTO num_exp_mul VALUES (7,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (7,2,'2851072985828710.485883795'); INSERT INTO num_exp_div VALUES (7,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (7,2,'2.41794207151503385700'); INSERT INTO num_exp_add VALUES (7,1,'-83028485');
QUERY: INSERT INTO num_exp_add VALUES (7,3,'-83028480.69'); INSERT INTO num_exp_sub VALUES (7,1,'-83028485');
QUERY: INSERT INTO num_exp_sub VALUES (7,3,'-83028489.31'); INSERT INTO num_exp_mul VALUES (7,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (7,3,'-357852770.35'); INSERT INTO num_exp_div VALUES (7,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (7,3,'-19264149.65197215777262180974'); INSERT INTO num_exp_add VALUES (7,2,'-117366977.215397047');
QUERY: INSERT INTO num_exp_add VALUES (7,4,'-75229023.5881'); INSERT INTO num_exp_sub VALUES (7,2,'-48689992.784602953');
QUERY: INSERT INTO num_exp_sub VALUES (7,4,'-90827946.4119'); INSERT INTO num_exp_mul VALUES (7,2,'2851072985828710.485883795');
QUERY: INSERT INTO num_exp_mul VALUES (7,4,'-647577464846017.9715'); INSERT INTO num_exp_div VALUES (7,2,'2.41794207151503385700');
QUERY: INSERT INTO num_exp_div VALUES (7,4,'-10.64541262725136247686'); INSERT INTO num_exp_add VALUES (7,3,'-83028480.69');
QUERY: INSERT INTO num_exp_add VALUES (7,5,'-83012087.961509'); INSERT INTO num_exp_sub VALUES (7,3,'-83028489.31');
QUERY: INSERT INTO num_exp_sub VALUES (7,5,'-83044882.038491'); INSERT INTO num_exp_mul VALUES (7,3,'-357852770.35');
QUERY: INSERT INTO num_exp_mul VALUES (7,5,'-1361421264394.416135'); INSERT INTO num_exp_div VALUES (7,3,'-19264149.65197215777262180974');
QUERY: INSERT INTO num_exp_div VALUES (7,5,'-5063.62688881730941836574'); INSERT INTO num_exp_add VALUES (7,4,'-75229023.5881');
QUERY: INSERT INTO num_exp_add VALUES (7,6,'-82934583.42236974'); INSERT INTO num_exp_sub VALUES (7,4,'-90827946.4119');
QUERY: INSERT INTO num_exp_sub VALUES (7,6,'-83122386.57763026'); INSERT INTO num_exp_mul VALUES (7,4,'-647577464846017.9715');
QUERY: INSERT INTO num_exp_mul VALUES (7,6,'-7796505729750.37795610'); INSERT INTO num_exp_div VALUES (7,4,'-10.64541262725136247686');
QUERY: INSERT INTO num_exp_div VALUES (7,6,'-884.20756174009028770294'); INSERT INTO num_exp_add VALUES (7,5,'-83012087.961509');
QUERY: INSERT INTO num_exp_add VALUES (7,7,'-166056970'); INSERT INTO num_exp_sub VALUES (7,5,'-83044882.038491');
QUERY: INSERT INTO num_exp_sub VALUES (7,7,'0'); INSERT INTO num_exp_mul VALUES (7,5,'-1361421264394.416135');
QUERY: INSERT INTO num_exp_mul VALUES (7,7,'6893729321395225'); INSERT INTO num_exp_div VALUES (7,5,'-5063.62688881730941836574');
QUERY: INSERT INTO num_exp_div VALUES (7,7,'1.00000000000000000000'); INSERT INTO num_exp_add VALUES (7,6,'-82934583.42236974');
QUERY: INSERT INTO num_exp_add VALUES (7,8,'-82953604'); INSERT INTO num_exp_sub VALUES (7,6,'-83122386.57763026');
QUERY: INSERT INTO num_exp_sub VALUES (7,8,'-83103366'); INSERT INTO num_exp_mul VALUES (7,6,'-7796505729750.37795610');
QUERY: INSERT INTO num_exp_mul VALUES (7,8,'-6217255985285'); INSERT INTO num_exp_div VALUES (7,6,'-884.20756174009028770294');
QUERY: INSERT INTO num_exp_div VALUES (7,8,'-1108.80577182462841041118'); INSERT INTO num_exp_add VALUES (7,7,'-166056970');
QUERY: INSERT INTO num_exp_add VALUES (7,9,'-107955289.045047420'); INSERT INTO num_exp_sub VALUES (7,7,'0');
QUERY: INSERT INTO num_exp_sub VALUES (7,9,'-58101680.954952580'); INSERT INTO num_exp_mul VALUES (7,7,'6893729321395225');
QUERY: INSERT INTO num_exp_mul VALUES (7,9,'2069634775752159.035758700'); INSERT INTO num_exp_div VALUES (7,7,'1.00000000000000000000');
QUERY: INSERT INTO num_exp_div VALUES (7,9,'3.33089171198810413382'); INSERT INTO num_exp_add VALUES (7,8,'-82953604');
QUERY: INSERT INTO num_exp_add VALUES (8,0,'74881'); INSERT INTO num_exp_sub VALUES (7,8,'-83103366');
QUERY: INSERT INTO num_exp_sub VALUES (8,0,'74881'); INSERT INTO num_exp_mul VALUES (7,8,'-6217255985285');
QUERY: INSERT INTO num_exp_mul VALUES (8,0,'0'); INSERT INTO num_exp_div VALUES (7,8,'-1108.80577182462841041118');
QUERY: INSERT INTO num_exp_div VALUES (8,0,'NaN'); INSERT INTO num_exp_add VALUES (7,9,'-107955289.045047420');
QUERY: INSERT INTO num_exp_add VALUES (8,1,'74881'); INSERT INTO num_exp_sub VALUES (7,9,'-58101680.954952580');
QUERY: INSERT INTO num_exp_sub VALUES (8,1,'74881'); INSERT INTO num_exp_mul VALUES (7,9,'2069634775752159.035758700');
QUERY: INSERT INTO num_exp_mul VALUES (8,1,'0'); INSERT INTO num_exp_div VALUES (7,9,'3.33089171198810413382');
QUERY: INSERT INTO num_exp_div VALUES (8,1,'NaN'); INSERT INTO num_exp_add VALUES (8,0,'74881');
QUERY: INSERT INTO num_exp_add VALUES (8,2,'-34263611.215397047'); INSERT INTO num_exp_sub VALUES (8,0,'74881');
QUERY: INSERT INTO num_exp_sub VALUES (8,2,'34413373.215397047'); INSERT INTO num_exp_mul VALUES (8,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (8,2,'-2571300635581.146276407'); INSERT INTO num_exp_div VALUES (8,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (8,2,'-.00218067233500788615'); INSERT INTO num_exp_add VALUES (8,1,'74881');
QUERY: INSERT INTO num_exp_add VALUES (8,3,'74885.31'); INSERT INTO num_exp_sub VALUES (8,1,'74881');
QUERY: INSERT INTO num_exp_sub VALUES (8,3,'74876.69'); INSERT INTO num_exp_mul VALUES (8,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (8,3,'322737.11'); INSERT INTO num_exp_div VALUES (8,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (8,3,'17373.78190255220417633410'); INSERT INTO num_exp_add VALUES (8,2,'-34263611.215397047');
QUERY: INSERT INTO num_exp_add VALUES (8,4,'7874342.4119'); INSERT INTO num_exp_sub VALUES (8,2,'34413373.215397047');
QUERY: INSERT INTO num_exp_sub VALUES (8,4,'-7724580.4119'); INSERT INTO num_exp_mul VALUES (8,2,'-2571300635581.146276407');
QUERY: INSERT INTO num_exp_mul VALUES (8,4,'584031469984.4839'); INSERT INTO num_exp_div VALUES (8,2,'-.00218067233500788615');
QUERY: INSERT INTO num_exp_div VALUES (8,4,'.00960079113741758956'); INSERT INTO num_exp_add VALUES (8,3,'74885.31');
QUERY: INSERT INTO num_exp_add VALUES (8,5,'91278.038491'); INSERT INTO num_exp_sub VALUES (8,3,'74876.69');
QUERY: INSERT INTO num_exp_sub VALUES (8,5,'58483.961509'); INSERT INTO num_exp_mul VALUES (8,3,'322737.11');
QUERY: INSERT INTO num_exp_mul VALUES (8,5,'1227826639.244571'); INSERT INTO num_exp_div VALUES (8,3,'17373.78190255220417633410');
QUERY: INSERT INTO num_exp_div VALUES (8,5,'4.56673929509287019456'); INSERT INTO num_exp_add VALUES (8,4,'7874342.4119');
QUERY: INSERT INTO num_exp_add VALUES (8,6,'168782.57763026'); INSERT INTO num_exp_sub VALUES (8,4,'-7724580.4119');
QUERY: INSERT INTO num_exp_sub VALUES (8,6,'-19020.57763026'); INSERT INTO num_exp_mul VALUES (8,4,'584031469984.4839');
QUERY: INSERT INTO num_exp_mul VALUES (8,6,'7031444034.53149906'); INSERT INTO num_exp_div VALUES (8,4,'.00960079113741758956');
QUERY: INSERT INTO num_exp_div VALUES (8,6,'.79744134113322314424'); INSERT INTO num_exp_add VALUES (8,5,'91278.038491');
QUERY: INSERT INTO num_exp_add VALUES (8,7,'-82953604'); INSERT INTO num_exp_sub VALUES (8,5,'58483.961509');
QUERY: INSERT INTO num_exp_sub VALUES (8,7,'83103366'); INSERT INTO num_exp_mul VALUES (8,5,'1227826639.244571');
QUERY: INSERT INTO num_exp_mul VALUES (8,7,'-6217255985285'); INSERT INTO num_exp_div VALUES (8,5,'4.56673929509287019456');
QUERY: INSERT INTO num_exp_div VALUES (8,7,'-.00090187120721280172'); INSERT INTO num_exp_add VALUES (8,6,'168782.57763026');
QUERY: INSERT INTO num_exp_add VALUES (8,8,'149762'); INSERT INTO num_exp_sub VALUES (8,6,'-19020.57763026');
QUERY: INSERT INTO num_exp_sub VALUES (8,8,'0'); INSERT INTO num_exp_mul VALUES (8,6,'7031444034.53149906');
QUERY: INSERT INTO num_exp_mul VALUES (8,8,'5607164161'); INSERT INTO num_exp_div VALUES (8,6,'.79744134113322314424');
QUERY: INSERT INTO num_exp_div VALUES (8,8,'1.00000000000000000000'); INSERT INTO num_exp_add VALUES (8,7,'-82953604');
QUERY: INSERT INTO num_exp_add VALUES (8,9,'-24851923.045047420'); INSERT INTO num_exp_sub VALUES (8,7,'83103366');
QUERY: INSERT INTO num_exp_sub VALUES (8,9,'25001685.045047420'); INSERT INTO num_exp_mul VALUES (8,7,'-6217255985285');
QUERY: INSERT INTO num_exp_mul VALUES (8,9,'-1866544013697.195857020'); INSERT INTO num_exp_div VALUES (8,7,'-.00090187120721280172');
QUERY: INSERT INTO num_exp_div VALUES (8,9,'-.00300403532938582735'); INSERT INTO num_exp_add VALUES (8,8,'149762');
QUERY: INSERT INTO num_exp_add VALUES (9,0,'-24926804.045047420'); INSERT INTO num_exp_sub VALUES (8,8,'0');
QUERY: INSERT INTO num_exp_sub VALUES (9,0,'-24926804.045047420'); INSERT INTO num_exp_mul VALUES (8,8,'5607164161');
QUERY: INSERT INTO num_exp_mul VALUES (9,0,'0'); INSERT INTO num_exp_div VALUES (8,8,'1.00000000000000000000');
QUERY: INSERT INTO num_exp_div VALUES (9,0,'NaN'); INSERT INTO num_exp_add VALUES (8,9,'-24851923.045047420');
QUERY: INSERT INTO num_exp_add VALUES (9,1,'-24926804.045047420'); INSERT INTO num_exp_sub VALUES (8,9,'25001685.045047420');
QUERY: INSERT INTO num_exp_sub VALUES (9,1,'-24926804.045047420'); INSERT INTO num_exp_mul VALUES (8,9,'-1866544013697.195857020');
QUERY: INSERT INTO num_exp_mul VALUES (9,1,'0'); INSERT INTO num_exp_div VALUES (8,9,'-.00300403532938582735');
QUERY: INSERT INTO num_exp_div VALUES (9,1,'NaN'); INSERT INTO num_exp_add VALUES (9,0,'-24926804.045047420');
QUERY: INSERT INTO num_exp_add VALUES (9,2,'-59265296.260444467'); INSERT INTO num_exp_sub VALUES (9,0,'-24926804.045047420');
QUERY: INSERT INTO num_exp_sub VALUES (9,2,'9411688.170349627'); INSERT INTO num_exp_mul VALUES (9,0,'0');
QUERY: INSERT INTO num_exp_mul VALUES (9,2,'855948866655588.453741509242968740'); INSERT INTO num_exp_div VALUES (9,0,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (9,2,'.72591434384152961526'); INSERT INTO num_exp_add VALUES (9,1,'-24926804.045047420');
QUERY: INSERT INTO num_exp_add VALUES (9,3,'-24926799.735047420'); INSERT INTO num_exp_sub VALUES (9,1,'-24926804.045047420');
QUERY: INSERT INTO num_exp_sub VALUES (9,3,'-24926808.355047420'); INSERT INTO num_exp_mul VALUES (9,1,'0');
QUERY: INSERT INTO num_exp_mul VALUES (9,3,'-107434525.43415438020'); INSERT INTO num_exp_div VALUES (9,1,'NaN');
QUERY: INSERT INTO num_exp_div VALUES (9,3,'-5783481.21694835730858468677'); INSERT INTO num_exp_add VALUES (9,2,'-59265296.260444467');
QUERY: INSERT INTO num_exp_add VALUES (9,4,'-17127342.633147420'); INSERT INTO num_exp_sub VALUES (9,2,'9411688.170349627');
QUERY: INSERT INTO num_exp_sub VALUES (9,4,'-32726265.456947420'); INSERT INTO num_exp_mul VALUES (9,2,'855948866655588.453741509242968740');
QUERY: INSERT INTO num_exp_mul VALUES (9,4,'-194415646271340.1815956522980'); INSERT INTO num_exp_div VALUES (9,2,'.72591434384152961526');
QUERY: INSERT INTO num_exp_div VALUES (9,4,'-3.19596478892958416484'); INSERT INTO num_exp_add VALUES (9,3,'-24926799.735047420');
QUERY: INSERT INTO num_exp_add VALUES (9,5,'-24910407.006556420'); INSERT INTO num_exp_sub VALUES (9,3,'-24926808.355047420');
QUERY: INSERT INTO num_exp_sub VALUES (9,5,'-24943201.083538420'); INSERT INTO num_exp_mul VALUES (9,3,'-107434525.43415438020');
QUERY: INSERT INTO num_exp_mul VALUES (9,5,'-408725765384.257043660243220'); INSERT INTO num_exp_div VALUES (9,3,'-5783481.21694835730858468677');
QUERY: INSERT INTO num_exp_div VALUES (9,5,'-1520.20159364322004505807'); INSERT INTO num_exp_add VALUES (9,4,'-17127342.633147420');
QUERY: INSERT INTO num_exp_add VALUES (9,6,'-24832902.467417160'); INSERT INTO num_exp_sub VALUES (9,4,'-32726265.456947420');
QUERY: INSERT INTO num_exp_sub VALUES (9,6,'-25020705.622677680'); INSERT INTO num_exp_mul VALUES (9,4,'-194415646271340.1815956522980');
QUERY: INSERT INTO num_exp_mul VALUES (9,6,'-2340666225110.29929521292692920'); INSERT INTO num_exp_div VALUES (9,4,'-3.19596478892958416484');
QUERY: INSERT INTO num_exp_div VALUES (9,6,'-265.45671195426965751280'); INSERT INTO num_exp_add VALUES (9,5,'-24910407.006556420');
QUERY: INSERT INTO num_exp_add VALUES (9,7,'-107955289.045047420'); INSERT INTO num_exp_sub VALUES (9,5,'-24943201.083538420');
QUERY: INSERT INTO num_exp_sub VALUES (9,7,'58101680.954952580'); INSERT INTO num_exp_mul VALUES (9,5,'-408725765384.257043660243220');
QUERY: INSERT INTO num_exp_mul VALUES (9,7,'2069634775752159.035758700'); INSERT INTO num_exp_div VALUES (9,5,'-1520.20159364322004505807');
QUERY: INSERT INTO num_exp_div VALUES (9,7,'.30021990699995814689'); INSERT INTO num_exp_add VALUES (9,6,'-24832902.467417160');
QUERY: INSERT INTO num_exp_add VALUES (9,8,'-24851923.045047420'); INSERT INTO num_exp_sub VALUES (9,6,'-25020705.622677680');
QUERY: INSERT INTO num_exp_sub VALUES (9,8,'-25001685.045047420'); INSERT INTO num_exp_mul VALUES (9,6,'-2340666225110.29929521292692920');
QUERY: INSERT INTO num_exp_mul VALUES (9,8,'-1866544013697.195857020'); INSERT INTO num_exp_div VALUES (9,6,'-265.45671195426965751280');
QUERY: INSERT INTO num_exp_div VALUES (9,8,'-332.88556569820675471748'); INSERT INTO num_exp_add VALUES (9,7,'-107955289.045047420');
QUERY: INSERT INTO num_exp_add VALUES (9,9,'-49853608.090094840'); INSERT INTO num_exp_sub VALUES (9,7,'58101680.954952580');
QUERY: INSERT INTO num_exp_sub VALUES (9,9,'0'); INSERT INTO num_exp_mul VALUES (9,7,'2069634775752159.035758700');
QUERY: INSERT INTO num_exp_mul VALUES (9,9,'621345559900192.420120630048656400'); INSERT INTO num_exp_div VALUES (9,7,'.30021990699995814689');
QUERY: INSERT INTO num_exp_div VALUES (9,9,'1.00000000000000000000'); INSERT INTO num_exp_add VALUES (9,8,'-24851923.045047420');
QUERY: COMMIT TRANSACTION; INSERT INTO num_exp_sub VALUES (9,8,'-25001685.045047420');
QUERY: BEGIN TRANSACTION; INSERT INTO num_exp_mul VALUES (9,8,'-1866544013697.195857020');
QUERY: INSERT INTO num_exp_sqrt VALUES (0,'0'); INSERT INTO num_exp_div VALUES (9,8,'-332.88556569820675471748');
QUERY: INSERT INTO num_exp_sqrt VALUES (1,'0'); INSERT INTO num_exp_add VALUES (9,9,'-49853608.090094840');
QUERY: INSERT INTO num_exp_sqrt VALUES (2,'5859.90547836712524903505'); INSERT INTO num_exp_sub VALUES (9,9,'0');
QUERY: INSERT INTO num_exp_sqrt VALUES (3,'2.07605394920266944396'); INSERT INTO num_exp_mul VALUES (9,9,'621345559900192.420120630048656400');
QUERY: INSERT INTO num_exp_sqrt VALUES (4,'2792.75158435189147418923'); INSERT INTO num_exp_div VALUES (9,9,'1.00000000000000000000');
QUERY: INSERT INTO num_exp_sqrt VALUES (5,'128.05092147657509145473'); COMMIT TRANSACTION;
QUERY: INSERT INTO num_exp_sqrt VALUES (6,'306.43364311096782703406'); BEGIN TRANSACTION;
QUERY: INSERT INTO num_exp_sqrt VALUES (7,'9111.99676251039939975230'); INSERT INTO num_exp_sqrt VALUES (0,'0');
QUERY: INSERT INTO num_exp_sqrt VALUES (8,'273.64392922189960397542'); INSERT INTO num_exp_sqrt VALUES (1,'0');
QUERY: INSERT INTO num_exp_sqrt VALUES (9,'4992.67503899937593364766'); INSERT INTO num_exp_sqrt VALUES (2,'5859.90547836712524903505');
QUERY: COMMIT TRANSACTION; INSERT INTO num_exp_sqrt VALUES (3,'2.07605394920266944396');
QUERY: BEGIN TRANSACTION; INSERT INTO num_exp_sqrt VALUES (4,'2792.75158435189147418923');
QUERY: INSERT INTO num_exp_ln VALUES (0,'NaN'); INSERT INTO num_exp_sqrt VALUES (5,'128.05092147657509145473');
QUERY: INSERT INTO num_exp_ln VALUES (1,'NaN'); INSERT INTO num_exp_sqrt VALUES (6,'306.43364311096782703406');
QUERY: INSERT INTO num_exp_ln VALUES (2,'17.35177750493897715514'); INSERT INTO num_exp_sqrt VALUES (7,'9111.99676251039939975230');
QUERY: INSERT INTO num_exp_ln VALUES (3,'1.46093790411565641971'); INSERT INTO num_exp_sqrt VALUES (8,'273.64392922189960397542');
QUERY: INSERT INTO num_exp_ln VALUES (4,'15.86956523951936572464'); INSERT INTO num_exp_sqrt VALUES (9,'4992.67503899937593364766');
QUERY: INSERT INTO num_exp_ln VALUES (5,'9.70485601768871834038'); COMMIT TRANSACTION;
QUERY: INSERT INTO num_exp_ln VALUES (6,'11.45000246622944403127'); BEGIN TRANSACTION;
QUERY: INSERT INTO num_exp_ln VALUES (7,'18.23469429965478772991'); INSERT INTO num_exp_ln VALUES (0,'NaN');
QUERY: INSERT INTO num_exp_ln VALUES (8,'11.22365546576315513668'); INSERT INTO num_exp_ln VALUES (1,'NaN');
QUERY: INSERT INTO num_exp_ln VALUES (9,'17.03145425013166006962'); INSERT INTO num_exp_ln VALUES (2,'17.35177750493897715514');
QUERY: COMMIT TRANSACTION; INSERT INTO num_exp_ln VALUES (3,'1.46093790411565641971');
QUERY: BEGIN TRANSACTION; INSERT INTO num_exp_ln VALUES (4,'15.86956523951936572464');
QUERY: INSERT INTO num_exp_log10 VALUES (0,'NaN'); INSERT INTO num_exp_ln VALUES (5,'9.70485601768871834038');
QUERY: INSERT INTO num_exp_log10 VALUES (1,'NaN'); INSERT INTO num_exp_ln VALUES (6,'11.45000246622944403127');
QUERY: INSERT INTO num_exp_log10 VALUES (2,'7.53578122160797276459'); INSERT INTO num_exp_ln VALUES (7,'18.23469429965478772991');
QUERY: INSERT INTO num_exp_log10 VALUES (3,'.63447727016073160075'); INSERT INTO num_exp_ln VALUES (8,'11.22365546576315513668');
QUERY: INSERT INTO num_exp_log10 VALUES (4,'6.89206461372691743345'); INSERT INTO num_exp_ln VALUES (9,'17.03145425013166006962');
QUERY: INSERT INTO num_exp_log10 VALUES (5,'4.21476541614777768626'); COMMIT TRANSACTION;
QUERY: INSERT INTO num_exp_log10 VALUES (6,'4.97267288886207207671'); BEGIN TRANSACTION;
QUERY: INSERT INTO num_exp_log10 VALUES (7,'7.91922711353275546914'); INSERT INTO num_exp_log10 VALUES (0,'NaN');
QUERY: INSERT INTO num_exp_log10 VALUES (8,'4.87437163556421004138'); INSERT INTO num_exp_log10 VALUES (1,'NaN');
QUERY: INSERT INTO num_exp_log10 VALUES (9,'7.39666659961986567059'); INSERT INTO num_exp_log10 VALUES (2,'7.53578122160797276459');
QUERY: COMMIT TRANSACTION; INSERT INTO num_exp_log10 VALUES (3,'.63447727016073160075');
QUERY: BEGIN TRANSACTION; INSERT INTO num_exp_log10 VALUES (4,'6.89206461372691743345');
QUERY: INSERT INTO num_exp_power_10_ln VALUES (0,'NaN'); INSERT INTO num_exp_log10 VALUES (5,'4.21476541614777768626');
QUERY: INSERT INTO num_exp_power_10_ln VALUES (1,'NaN'); INSERT INTO num_exp_log10 VALUES (6,'4.97267288886207207671');
QUERY: INSERT INTO num_exp_power_10_ln VALUES (2,'224790267919917955.13261618583642653184'); INSERT INTO num_exp_log10 VALUES (7,'7.91922711353275546914');
QUERY: INSERT INTO num_exp_power_10_ln VALUES (3,'28.90266599445155957393'); INSERT INTO num_exp_log10 VALUES (8,'4.87437163556421004138');
QUERY: INSERT INTO num_exp_power_10_ln VALUES (4,'7405685069594999.07733999469386277636'); INSERT INTO num_exp_log10 VALUES (9,'7.39666659961986567059');
QUERY: INSERT INTO num_exp_power_10_ln VALUES (5,'5068226527.32127265408584640098'); COMMIT TRANSACTION;
QUERY: INSERT INTO num_exp_power_10_ln VALUES (6,'281839893606.99372343357047819067'); BEGIN TRANSACTION;
QUERY: INSERT INTO num_exp_power_10_ln VALUES (7,'1716699575118597095.42330819910640247627'); INSERT INTO num_exp_power_10_ln VALUES (0,'NaN');
QUERY: INSERT INTO num_exp_power_10_ln VALUES (8,'167361463828.07491320069016125952'); INSERT INTO num_exp_power_10_ln VALUES (1,'NaN');
QUERY: INSERT INTO num_exp_power_10_ln VALUES (9,'107511333880052007.04141124673540337457'); INSERT INTO num_exp_power_10_ln VALUES (2,'224790267919917955.13261618583642653184');
QUERY: COMMIT TRANSACTION; INSERT INTO num_exp_power_10_ln VALUES (3,'28.90266599445155957393');
QUERY: BEGIN TRANSACTION; INSERT INTO num_exp_power_10_ln VALUES (4,'7405685069594999.07733999469386277636');
QUERY: INSERT INTO num_data VALUES (0, '0'); INSERT INTO num_exp_power_10_ln VALUES (5,'5068226527.32127265408584640098');
QUERY: INSERT INTO num_data VALUES (1, '0'); INSERT INTO num_exp_power_10_ln VALUES (6,'281839893606.99372343357047819067');
QUERY: INSERT INTO num_data VALUES (2, '-34338492.215397047'); INSERT INTO num_exp_power_10_ln VALUES (7,'1716699575118597095.42330819910640247627');
QUERY: INSERT INTO num_data VALUES (3, '4.31'); INSERT INTO num_exp_power_10_ln VALUES (8,'167361463828.07491320069016125952');
QUERY: INSERT INTO num_data VALUES (4, '7799461.4119'); INSERT INTO num_exp_power_10_ln VALUES (9,'107511333880052007.04141124673540337457');
QUERY: INSERT INTO num_data VALUES (5, '16397.038491'); COMMIT TRANSACTION;
QUERY: INSERT INTO num_data VALUES (6, '93901.57763026'); BEGIN TRANSACTION;
QUERY: INSERT INTO num_data VALUES (7, '-83028485'); INSERT INTO num_data VALUES (0, '0');
QUERY: INSERT INTO num_data VALUES (8, '74881'); INSERT INTO num_data VALUES (1, '0');
QUERY: INSERT INTO num_data VALUES (9, '-24926804.045047420'); INSERT INTO num_data VALUES (2, '-34338492.215397047');
QUERY: COMMIT TRANSACTION; INSERT INTO num_data VALUES (3, '4.31');
QUERY: CREATE UNIQUE INDEX num_exp_add_idx ON num_exp_add (id1, id2); INSERT INTO num_data VALUES (4, '7799461.4119');
QUERY: CREATE UNIQUE INDEX num_exp_sub_idx ON num_exp_sub (id1, id2); INSERT INTO num_data VALUES (5, '16397.038491');
QUERY: CREATE UNIQUE INDEX num_exp_div_idx ON num_exp_div (id1, id2); INSERT INTO num_data VALUES (6, '93901.57763026');
QUERY: CREATE UNIQUE INDEX num_exp_mul_idx ON num_exp_mul (id1, id2); INSERT INTO num_data VALUES (7, '-83028485');
QUERY: CREATE UNIQUE INDEX num_exp_sqrt_idx ON num_exp_sqrt (id); INSERT INTO num_data VALUES (8, '74881');
QUERY: CREATE UNIQUE INDEX num_exp_ln_idx ON num_exp_ln (id); INSERT INTO num_data VALUES (9, '-24926804.045047420');
QUERY: CREATE UNIQUE INDEX num_exp_log10_idx ON num_exp_log10 (id); COMMIT TRANSACTION;
QUERY: CREATE UNIQUE INDEX num_exp_power_10_ln_idx ON num_exp_power_10_ln (id); -- ******************************
QUERY: VACUUM ANALYZE num_exp_add; -- * Create indices for faster checks
QUERY: VACUUM ANALYZE num_exp_sub; -- ******************************
QUERY: VACUUM ANALYZE num_exp_div; CREATE UNIQUE INDEX num_exp_add_idx ON num_exp_add (id1, id2);
QUERY: VACUUM ANALYZE num_exp_mul; CREATE UNIQUE INDEX num_exp_sub_idx ON num_exp_sub (id1, id2);
QUERY: VACUUM ANALYZE num_exp_sqrt; CREATE UNIQUE INDEX num_exp_div_idx ON num_exp_div (id1, id2);
QUERY: VACUUM ANALYZE num_exp_ln; CREATE UNIQUE INDEX num_exp_mul_idx ON num_exp_mul (id1, id2);
QUERY: VACUUM ANALYZE num_exp_log10; CREATE UNIQUE INDEX num_exp_sqrt_idx ON num_exp_sqrt (id);
QUERY: VACUUM ANALYZE num_exp_power_10_ln; CREATE UNIQUE INDEX num_exp_ln_idx ON num_exp_ln (id);
QUERY: DELETE FROM num_result; CREATE UNIQUE INDEX num_exp_log10_idx ON num_exp_log10 (id);
QUERY: INSERT INTO num_result SELECT t1.id, t2.id, t1.val + t2.val CREATE UNIQUE INDEX num_exp_power_10_ln_idx ON num_exp_power_10_ln (id);
VACUUM ANALYZE num_exp_add;
VACUUM ANALYZE num_exp_sub;
VACUUM ANALYZE num_exp_div;
VACUUM ANALYZE num_exp_mul;
VACUUM ANALYZE num_exp_sqrt;
VACUUM ANALYZE num_exp_ln;
VACUUM ANALYZE num_exp_log10;
VACUUM ANALYZE num_exp_power_10_ln;
-- ******************************
-- * Now check the behaviour of the NUMERIC type
-- ******************************
-- ******************************
-- * Addition check
-- ******************************
DELETE FROM num_result;
INSERT INTO num_result SELECT t1.id, t2.id, t1.val + t2.val
FROM num_data t1, num_data t2; FROM num_data t1, num_data t2;
QUERY: SELECT t1.id1, t1.id2, t1.result, t2.expected SELECT t1.id1, t1.id2, t1.result, t2.expected
FROM num_result t1, num_exp_add t2 FROM num_result t1, num_exp_add t2
WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2
AND t1.result != t2.expected; AND t1.result != t2.expected;
id1|id2|result|expected id1 | id2 | result | expected
---+---+------+-------- -----+-----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; DELETE FROM num_result;
QUERY: INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val + t2.val, 10) INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val + t2.val, 10)
FROM num_data t1, num_data t2; FROM num_data t1, num_data t2;
QUERY: SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 10) as expected SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 10) as expected
FROM num_result t1, num_exp_add t2 FROM num_result t1, num_exp_add t2
WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2
AND t1.result != round(t2.expected, 10); AND t1.result != round(t2.expected, 10);
id1|id2|result|expected id1 | id2 | result | expected
---+---+------+-------- -----+-----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; -- ******************************
QUERY: INSERT INTO num_result SELECT t1.id, t2.id, t1.val - t2.val -- * Subtraction check
-- ******************************
DELETE FROM num_result;
INSERT INTO num_result SELECT t1.id, t2.id, t1.val - t2.val
FROM num_data t1, num_data t2; FROM num_data t1, num_data t2;
QUERY: SELECT t1.id1, t1.id2, t1.result, t2.expected SELECT t1.id1, t1.id2, t1.result, t2.expected
FROM num_result t1, num_exp_sub t2 FROM num_result t1, num_exp_sub t2
WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2
AND t1.result != t2.expected; AND t1.result != t2.expected;
id1|id2|result|expected id1 | id2 | result | expected
---+---+------+-------- -----+-----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; DELETE FROM num_result;
QUERY: INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val - t2.val, 40) INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val - t2.val, 40)
FROM num_data t1, num_data t2; FROM num_data t1, num_data t2;
QUERY: SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 40) SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 40)
FROM num_result t1, num_exp_sub t2 FROM num_result t1, num_exp_sub t2
WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2
AND t1.result != round(t2.expected, 40); AND t1.result != round(t2.expected, 40);
id1|id2|result|round id1 | id2 | result | round
---+---+------+----- -----+-----+--------+-------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; -- ******************************
QUERY: INSERT INTO num_result SELECT t1.id, t2.id, t1.val * t2.val -- * Multiply check
-- ******************************
DELETE FROM num_result;
INSERT INTO num_result SELECT t1.id, t2.id, t1.val * t2.val
FROM num_data t1, num_data t2; FROM num_data t1, num_data t2;
QUERY: SELECT t1.id1, t1.id2, t1.result, t2.expected SELECT t1.id1, t1.id2, t1.result, t2.expected
FROM num_result t1, num_exp_mul t2 FROM num_result t1, num_exp_mul t2
WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2
AND t1.result != t2.expected; AND t1.result != t2.expected;
id1|id2|result|expected id1 | id2 | result | expected
---+---+------+-------- -----+-----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; DELETE FROM num_result;
QUERY: INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val * t2.val, 30) INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val * t2.val, 30)
FROM num_data t1, num_data t2; FROM num_data t1, num_data t2;
QUERY: SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 30) as expected SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 30) as expected
FROM num_result t1, num_exp_mul t2 FROM num_result t1, num_exp_mul t2
WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2
AND t1.result != round(t2.expected, 30); AND t1.result != round(t2.expected, 30);
id1|id2|result|expected id1 | id2 | result | expected
---+---+------+-------- -----+-----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; -- ******************************
QUERY: INSERT INTO num_result SELECT t1.id, t2.id, t1.val / t2.val -- * Division check
-- ******************************
DELETE FROM num_result;
INSERT INTO num_result SELECT t1.id, t2.id, t1.val / t2.val
FROM num_data t1, num_data t2 FROM num_data t1, num_data t2
WHERE t2.val != '0.0'; WHERE t2.val != '0.0';
QUERY: SELECT t1.id1, t1.id2, t1.result, t2.expected SELECT t1.id1, t1.id2, t1.result, t2.expected
FROM num_result t1, num_exp_div t2 FROM num_result t1, num_exp_div t2
WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2
AND t1.result != t2.expected; AND t1.result != t2.expected;
id1|id2|result|expected id1 | id2 | result | expected
---+---+------+-------- -----+-----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; DELETE FROM num_result;
QUERY: INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val / t2.val, 80) INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val / t2.val, 80)
FROM num_data t1, num_data t2 FROM num_data t1, num_data t2
WHERE t2.val != '0.0'; WHERE t2.val != '0.0';
QUERY: SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 80) as expected SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 80) as expected
FROM num_result t1, num_exp_div t2 FROM num_result t1, num_exp_div t2
WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2
AND t1.result != round(t2.expected, 80); AND t1.result != round(t2.expected, 80);
id1|id2|result|expected id1 | id2 | result | expected
---+---+------+-------- -----+-----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; -- ******************************
QUERY: INSERT INTO num_result SELECT id, 0, SQRT(ABS(val)) -- * Square root check
-- ******************************
DELETE FROM num_result;
INSERT INTO num_result SELECT id, 0, SQRT(ABS(val))
FROM num_data; FROM num_data;
QUERY: SELECT t1.id1, t1.result, t2.expected SELECT t1.id1, t1.result, t2.expected
FROM num_result t1, num_exp_sqrt t2 FROM num_result t1, num_exp_sqrt t2
WHERE t1.id1 = t2.id WHERE t1.id1 = t2.id
AND t1.result != t2.expected; AND t1.result != t2.expected;
id1|result|expected id1 | result | expected
---+------+-------- -----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; -- ******************************
QUERY: INSERT INTO num_result SELECT id, 0, LN(ABS(val)) -- * Natural logarithm check
-- ******************************
DELETE FROM num_result;
INSERT INTO num_result SELECT id, 0, LN(ABS(val))
FROM num_data FROM num_data
WHERE val != '0.0'; WHERE val != '0.0';
QUERY: SELECT t1.id1, t1.result, t2.expected SELECT t1.id1, t1.result, t2.expected
FROM num_result t1, num_exp_ln t2 FROM num_result t1, num_exp_ln t2
WHERE t1.id1 = t2.id WHERE t1.id1 = t2.id
AND t1.result != t2.expected; AND t1.result != t2.expected;
id1|result|expected id1 | result | expected
---+------+-------- -----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; -- ******************************
QUERY: INSERT INTO num_result SELECT id, 0, LOG('10'::numeric, ABS(val)) -- * Logarithm base 10 check
-- ******************************
DELETE FROM num_result;
INSERT INTO num_result SELECT id, 0, LOG(numeric '10', ABS(val))
FROM num_data FROM num_data
WHERE val != '0.0'; WHERE val != '0.0';
QUERY: SELECT t1.id1, t1.result, t2.expected SELECT t1.id1, t1.result, t2.expected
FROM num_result t1, num_exp_log10 t2 FROM num_result t1, num_exp_log10 t2
WHERE t1.id1 = t2.id WHERE t1.id1 = t2.id
AND t1.result != t2.expected; AND t1.result != t2.expected;
id1|result|expected id1 | result | expected
---+------+-------- -----+--------+----------
(0 rows) (0 rows)
QUERY: DELETE FROM num_result; -- ******************************
QUERY: INSERT INTO num_result SELECT id, 0, POWER('10'::numeric, LN(ABS(round(val,200)))) -- * POWER(10, LN(value)) check
-- ******************************
DELETE FROM num_result;
INSERT INTO num_result SELECT id, 0, POWER(numeric '10', LN(ABS(round(val,200))))
FROM num_data FROM num_data
WHERE val != '0.0'; WHERE val != '0.0';
QUERY: SELECT t1.id1, t1.result, t2.expected SELECT t1.id1, t1.result, t2.expected
FROM num_result t1, num_exp_power_10_ln t2 FROM num_result t1, num_exp_power_10_ln t2
WHERE t1.id1 = t2.id WHERE t1.id1 = t2.id
AND t1.result != t2.expected; AND t1.result != t2.expected;
id1|result|expected id1 | result | expected
---+------+-------- -----+--------+----------
(0 rows) (0 rows)
QUERY: CREATE TABLE TEMP_FLOAT (f1 FLOAT8); --
QUERY: INSERT INTO TEMP_FLOAT (f1) -- NUMEROLOGY
-- Test various combinations of numeric types and functions.
--
--
-- Test implicit type conversions
-- This fails for Postgres v6.1 (and earlier?)
-- so let's try explicit conversions for now - tgl 97/05/07
--
CREATE TABLE TEMP_FLOAT (f1 FLOAT8);
INSERT INTO TEMP_FLOAT (f1)
SELECT float8(f1) FROM INT4_TBL; SELECT float8(f1) FROM INT4_TBL;
QUERY: INSERT INTO TEMP_FLOAT (f1) INSERT INTO TEMP_FLOAT (f1)
SELECT float8(f1) FROM INT2_TBL; SELECT float8(f1) FROM INT2_TBL;
QUERY: SELECT '' AS ten, f1 FROM TEMP_FLOAT SELECT '' AS ten, f1 FROM TEMP_FLOAT
ORDER BY f1; ORDER BY f1;
ten| f1 ten | f1
---+----------- -----+-------------
|-2147483647 | -2147483647
| -123456 | -123456
| -32767 | -32767
| -1234 | -1234
| 0 | 0
| 0 | 0
| 1234 | 1234
| 32767 | 32767
| 123456 | 123456
| 2147483647 | 2147483647
(10 rows) (10 rows)
QUERY: CREATE TABLE TEMP_INT4 (f1 INT4); -- int4
QUERY: INSERT INTO TEMP_INT4 (f1) CREATE TABLE TEMP_INT4 (f1 INT4);
INSERT INTO TEMP_INT4 (f1)
SELECT int4(f1) FROM FLOAT8_TBL SELECT int4(f1) FROM FLOAT8_TBL
WHERE (f1 > -2147483647) AND (f1 < 2147483647); WHERE (f1 > -2147483647) AND (f1 < 2147483647);
QUERY: INSERT INTO TEMP_INT4 (f1) INSERT INTO TEMP_INT4 (f1)
SELECT int4(f1) FROM INT2_TBL; SELECT int4(f1) FROM INT2_TBL;
QUERY: SELECT '' AS nine, f1 FROM TEMP_INT4 SELECT '' AS nine, f1 FROM TEMP_INT4
ORDER BY f1; ORDER BY f1;
nine| f1 nine | f1
----+------ ------+--------
|-32767 | -32767
| -1234 | -1234
| -1004 | -1004
| -35 | -35
| 0 | 0
| 0 | 0
| 0 | 0
| 1234 | 1234
| 32767 | 32767
(9 rows) (9 rows)
QUERY: CREATE TABLE TEMP_INT2 (f1 INT2); -- int2
QUERY: INSERT INTO TEMP_INT2 (f1) CREATE TABLE TEMP_INT2 (f1 INT2);
INSERT INTO TEMP_INT2 (f1)
SELECT int2(f1) FROM FLOAT8_TBL SELECT int2(f1) FROM FLOAT8_TBL
WHERE (f1 >= -32767) AND (f1 <= 32767); WHERE (f1 >= -32767) AND (f1 <= 32767);
QUERY: INSERT INTO TEMP_INT2 (f1) INSERT INTO TEMP_INT2 (f1)
SELECT int2(f1) FROM INT4_TBL SELECT int2(f1) FROM INT4_TBL
WHERE (f1 >= -32767) AND (f1 <= 32767); WHERE (f1 >= -32767) AND (f1 <= 32767);
QUERY: SELECT '' AS five, f1 FROM TEMP_INT2 SELECT '' AS five, f1 FROM TEMP_INT2
ORDER BY f1; ORDER BY f1;
five| f1 five | f1
----+----- ------+-------
|-1004 | -1004
| -35 | -35
| 0 | 0
| 0 | 0
| 0 | 0
(5 rows) (5 rows)
QUERY: CREATE TABLE TEMP_GROUP (f1 INT4, f2 INT4, f3 FLOAT8); --
QUERY: INSERT INTO TEMP_GROUP -- Group-by combinations
--
CREATE TABLE TEMP_GROUP (f1 INT4, f2 INT4, f3 FLOAT8);
INSERT INTO TEMP_GROUP
SELECT 1, (- i.f1), (- f.f1) SELECT 1, (- i.f1), (- f.f1)
FROM INT4_TBL i, FLOAT8_TBL f; FROM INT4_TBL i, FLOAT8_TBL f;
QUERY: INSERT INTO TEMP_GROUP INSERT INTO TEMP_GROUP
SELECT 2, i.f1, f.f1 SELECT 2, i.f1, f.f1
FROM INT4_TBL i, FLOAT8_TBL f; FROM INT4_TBL i, FLOAT8_TBL f;
QUERY: SELECT DISTINCT f1 AS two FROM TEMP_GROUP; SELECT DISTINCT f1 AS two FROM TEMP_GROUP;
two two
--- -----
1 1
2 2
(2 rows) (2 rows)
QUERY: SELECT f1 AS two, max(f3) AS max_float, min(f3) as min_float SELECT f1 AS two, max(f3) AS max_float, min(f3) as min_float
FROM TEMP_GROUP FROM TEMP_GROUP
GROUP BY two GROUP BY two
ORDER BY two, max_float, min_float; ORDER BY two, max_float, min_float;
two|max_float |min_float two | max_float | min_float
---+--------------------+--------------------- -----+----------------------+-----------------------
1|1.2345678901234e+200|0 1 | 1.2345678901234e+200 | 0
2|0 |-1.2345678901234e+200 2 | 0 | -1.2345678901234e+200
(2 rows) (2 rows)
QUERY: SELECT f1 AS two, max(f3) AS max_float, min(f3) AS min_float SELECT f1 AS two, max(f3) AS max_float, min(f3) AS min_float
FROM TEMP_GROUP FROM TEMP_GROUP
GROUP BY two GROUP BY two
ORDER BY two, max_float, min_float; ORDER BY two, max_float, min_float;
two|max_float |min_float two | max_float | min_float
---+--------------------+--------------------- -----+----------------------+-----------------------
1|1.2345678901234e+200|0 1 | 1.2345678901234e+200 | 0
2|0 |-1.2345678901234e+200 2 | 0 | -1.2345678901234e+200
(2 rows) (2 rows)
QUERY: SELECT f1 AS two, (max(f3) + 1) AS max_plus_1, (min(f3) - 1) AS min_minus_1 SELECT f1 AS two, (max(f3) + 1) AS max_plus_1, (min(f3) - 1) AS min_minus_1
FROM TEMP_GROUP FROM TEMP_GROUP
GROUP BY two GROUP BY two
ORDER BY two, min_minus_1; ORDER BY two, min_minus_1;
two|max_plus_1 |min_minus_1 two | max_plus_1 | min_minus_1
---+--------------------+--------------------- -----+----------------------+-----------------------
1|1.2345678901234e+200|-1 1 | 1.2345678901234e+200 | -1
2|1 |-1.2345678901234e+200 2 | 1 | -1.2345678901234e+200
(2 rows) (2 rows)
QUERY: SELECT f1 AS two, (max(f3) + 1) AS max_plus_1, (min(f3) - 1) AS min_minus_1 SELECT f1 AS two, (max(f3) + 1) AS max_plus_1, (min(f3) - 1) AS min_minus_1
FROM TEMP_GROUP FROM TEMP_GROUP
GROUP BY two GROUP BY two
ORDER BY two, min_minus_1; ORDER BY two, min_minus_1;
two|max_plus_1 |min_minus_1 two | max_plus_1 | min_minus_1
---+--------------------+--------------------- -----+----------------------+-----------------------
1|1.2345678901234e+200|-1 1 | 1.2345678901234e+200 | -1
2|1 |-1.2345678901234e+200 2 | 1 | -1.2345678901234e+200
(2 rows) (2 rows)
QUERY: DROP TABLE TEMP_INT2; DROP TABLE TEMP_INT2;
QUERY: DROP TABLE TEMP_INT4; DROP TABLE TEMP_INT4;
QUERY: DROP TABLE TEMP_FLOAT; DROP TABLE TEMP_FLOAT;
QUERY: DROP TABLE TEMP_GROUP; DROP TABLE TEMP_GROUP;
QUERY: SELECT oid, pg_aggregate.aggtransfn1 --
FROM pg_aggregate -- OIDJOIN
WHERE pg_aggregate.aggtransfn1 != 0 AND -- This is created by pgsql/contrib/findoidjoins/make_oidjoin_check
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_aggregate.aggtransfn1); --
oid|aggtransfn1 SELECT oid, pg_aggregate.aggtransfn1
---+----------- FROM pg_aggregate
(0 rows) WHERE pg_aggregate.aggtransfn1 != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_aggregate.aggtransfn1);
QUERY: SELECT oid, pg_aggregate.aggtransfn2 oid | aggtransfn1
FROM pg_aggregate -----+-------------
WHERE pg_aggregate.aggtransfn2 != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_aggregate.aggtransfn2);
oid|aggtransfn2 SELECT oid, pg_aggregate.aggtransfn2
---+----------- FROM pg_aggregate
(0 rows) WHERE pg_aggregate.aggtransfn2 != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_aggregate.aggtransfn2);
QUERY: SELECT oid, pg_aggregate.aggfinalfn oid | aggtransfn2
FROM pg_aggregate -----+-------------
WHERE pg_aggregate.aggfinalfn != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_aggregate.aggfinalfn);
oid|aggfinalfn SELECT oid, pg_aggregate.aggfinalfn
---+---------- FROM pg_aggregate
(0 rows) WHERE pg_aggregate.aggfinalfn != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_aggregate.aggfinalfn);
QUERY: SELECT oid, pg_aggregate.aggbasetype oid | aggfinalfn
FROM pg_aggregate -----+------------
WHERE pg_aggregate.aggbasetype != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_aggregate.aggbasetype);
oid|aggbasetype SELECT oid, pg_aggregate.aggbasetype
---+----------- FROM pg_aggregate
(0 rows) WHERE pg_aggregate.aggbasetype != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_aggregate.aggbasetype);
QUERY: SELECT oid, pg_aggregate.aggtranstype1 oid | aggbasetype
FROM pg_aggregate -----+-------------
WHERE pg_aggregate.aggtranstype1 != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_aggregate.aggtranstype1);
oid|aggtranstype1 SELECT oid, pg_aggregate.aggtranstype1
---+------------- FROM pg_aggregate
(0 rows) WHERE pg_aggregate.aggtranstype1 != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_aggregate.aggtranstype1);
QUERY: SELECT oid, pg_aggregate.aggtranstype2 oid | aggtranstype1
FROM pg_aggregate -----+---------------
WHERE pg_aggregate.aggtranstype2 != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_aggregate.aggtranstype2);
oid|aggtranstype2 SELECT oid, pg_aggregate.aggtranstype2
---+------------- FROM pg_aggregate
(0 rows) WHERE pg_aggregate.aggtranstype2 != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_aggregate.aggtranstype2);
QUERY: SELECT oid, pg_aggregate.aggfinaltype oid | aggtranstype2
FROM pg_aggregate -----+---------------
WHERE pg_aggregate.aggfinaltype != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_aggregate.aggfinaltype);
oid|aggfinaltype SELECT oid, pg_aggregate.aggfinaltype
---+------------ FROM pg_aggregate
(0 rows) WHERE pg_aggregate.aggfinaltype != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_aggregate.aggfinaltype);
QUERY: SELECT oid, pg_am.amgettuple oid | aggfinaltype
FROM pg_am -----+--------------
WHERE pg_am.amgettuple != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amgettuple);
oid|amgettuple SELECT oid, pg_am.amgettuple
---+---------- FROM pg_am
(0 rows) WHERE pg_am.amgettuple != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amgettuple);
QUERY: SELECT oid, pg_am.aminsert oid | amgettuple
FROM pg_am -----+------------
WHERE pg_am.aminsert != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.aminsert);
oid|aminsert SELECT oid, pg_am.aminsert
---+-------- FROM pg_am
(0 rows) WHERE pg_am.aminsert != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.aminsert);
QUERY: SELECT oid, pg_am.amdelete oid | aminsert
FROM pg_am -----+----------
WHERE pg_am.amdelete != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amdelete);
oid|amdelete SELECT oid, pg_am.amdelete
---+-------- FROM pg_am
(0 rows) WHERE pg_am.amdelete != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amdelete);
QUERY: SELECT oid, pg_am.ambeginscan oid | amdelete
FROM pg_am -----+----------
WHERE pg_am.ambeginscan != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.ambeginscan);
oid|ambeginscan SELECT oid, pg_am.ambeginscan
---+----------- FROM pg_am
(0 rows) WHERE pg_am.ambeginscan != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.ambeginscan);
QUERY: SELECT oid, pg_am.amrescan oid | ambeginscan
FROM pg_am -----+-------------
WHERE pg_am.amrescan != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amrescan);
oid|amrescan SELECT oid, pg_am.amrescan
---+-------- FROM pg_am
(0 rows) WHERE pg_am.amrescan != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amrescan);
QUERY: SELECT oid, pg_am.amendscan oid | amrescan
FROM pg_am -----+----------
WHERE pg_am.amendscan != 0 AND (0 rows)
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amendscan);
oid|amendscan SELECT oid, pg_am.amendscan
---+--------- FROM pg_am
WHERE pg_am.amendscan != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amendscan);
oid | amendscan
-----+-----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_am.ammarkpos SELECT oid, pg_am.ammarkpos
FROM pg_am FROM pg_am
WHERE pg_am.ammarkpos != 0 AND WHERE pg_am.ammarkpos != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.ammarkpos); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.ammarkpos);
oid|ammarkpos oid | ammarkpos
---+--------- -----+-----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_am.amrestrpos SELECT oid, pg_am.amrestrpos
FROM pg_am FROM pg_am
WHERE pg_am.amrestrpos != 0 AND WHERE pg_am.amrestrpos != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amrestrpos); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.amrestrpos);
oid|amrestrpos oid | amrestrpos
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_am.ambuild SELECT oid, pg_am.ambuild
FROM pg_am FROM pg_am
WHERE pg_am.ambuild != 0 AND WHERE pg_am.ambuild != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.ambuild); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_am.ambuild);
oid|ambuild oid | ambuild
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_amop.amopid SELECT oid, pg_amop.amopid
FROM pg_amop FROM pg_amop
WHERE pg_amop.amopid != 0 AND WHERE pg_amop.amopid != 0 AND
NOT EXISTS(SELECT * FROM pg_am AS t1 WHERE t1.oid = pg_amop.amopid); NOT EXISTS(SELECT * FROM pg_am AS t1 WHERE t1.oid = pg_amop.amopid);
oid|amopid oid | amopid
---+------ -----+--------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_amop.amopclaid SELECT oid, pg_amop.amopclaid
FROM pg_amop FROM pg_amop
WHERE pg_amop.amopclaid != 0 AND WHERE pg_amop.amopclaid != 0 AND
NOT EXISTS(SELECT * FROM pg_opclass AS t1 WHERE t1.oid = pg_amop.amopclaid); NOT EXISTS(SELECT * FROM pg_opclass AS t1 WHERE t1.oid = pg_amop.amopclaid);
oid|amopclaid oid | amopclaid
---+--------- -----+-----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_amop.amopopr SELECT oid, pg_amop.amopopr
FROM pg_amop FROM pg_amop
WHERE pg_amop.amopopr != 0 AND WHERE pg_amop.amopopr != 0 AND
NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_amop.amopopr); NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_amop.amopopr);
oid|amopopr oid | amopopr
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_amop.amopselect SELECT oid, pg_amop.amopselect
FROM pg_amop FROM pg_amop
WHERE pg_amop.amopselect != 0 AND WHERE pg_amop.amopselect != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_amop.amopselect); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_amop.amopselect);
oid|amopselect oid | amopselect
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_amop.amopnpages SELECT oid, pg_amop.amopnpages
FROM pg_amop FROM pg_amop
WHERE pg_amop.amopnpages != 0 AND WHERE pg_amop.amopnpages != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_amop.amopnpages); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_amop.amopnpages);
oid|amopnpages oid | amopnpages
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_amproc.amid SELECT oid, pg_amproc.amid
FROM pg_amproc FROM pg_amproc
WHERE pg_amproc.amid != 0 AND WHERE pg_amproc.amid != 0 AND
NOT EXISTS(SELECT * FROM pg_am AS t1 WHERE t1.oid = pg_amproc.amid); NOT EXISTS(SELECT * FROM pg_am AS t1 WHERE t1.oid = pg_amproc.amid);
oid|amid oid | amid
---+---- -----+------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_amproc.amopclaid SELECT oid, pg_amproc.amopclaid
FROM pg_amproc FROM pg_amproc
WHERE pg_amproc.amopclaid != 0 AND WHERE pg_amproc.amopclaid != 0 AND
NOT EXISTS(SELECT * FROM pg_opclass AS t1 WHERE t1.oid = pg_amproc.amopclaid); NOT EXISTS(SELECT * FROM pg_opclass AS t1 WHERE t1.oid = pg_amproc.amopclaid);
oid|amopclaid oid | amopclaid
---+--------- -----+-----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_amproc.amproc SELECT oid, pg_amproc.amproc
FROM pg_amproc FROM pg_amproc
WHERE pg_amproc.amproc != 0 AND WHERE pg_amproc.amproc != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_amproc.amproc); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_amproc.amproc);
oid|amproc oid | amproc
---+------ -----+--------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_attribute.attrelid SELECT oid, pg_attribute.attrelid
FROM pg_attribute FROM pg_attribute
WHERE pg_attribute.attrelid != 0 AND WHERE pg_attribute.attrelid != 0 AND
NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_attribute.attrelid); NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_attribute.attrelid);
oid|attrelid oid | attrelid
---+-------- -----+----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_attribute.atttypid SELECT oid, pg_attribute.atttypid
FROM pg_attribute FROM pg_attribute
WHERE pg_attribute.atttypid != 0 AND WHERE pg_attribute.atttypid != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_attribute.atttypid); NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_attribute.atttypid);
oid|atttypid oid | atttypid
---+-------- -----+----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_class.reltype SELECT oid, pg_class.reltype
FROM pg_class FROM pg_class
WHERE pg_class.reltype != 0 AND WHERE pg_class.reltype != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_class.reltype); NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_class.reltype);
oid|reltype oid | reltype
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_class.relam SELECT oid, pg_class.relam
FROM pg_class FROM pg_class
WHERE pg_class.relam != 0 AND WHERE pg_class.relam != 0 AND
NOT EXISTS(SELECT * FROM pg_am AS t1 WHERE t1.oid = pg_class.relam); NOT EXISTS(SELECT * FROM pg_am AS t1 WHERE t1.oid = pg_class.relam);
oid|relam oid | relam
---+----- -----+-------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_index.indexrelid SELECT oid, pg_index.indexrelid
FROM pg_index FROM pg_index
WHERE pg_index.indexrelid != 0 AND WHERE pg_index.indexrelid != 0 AND
NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_index.indexrelid); NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_index.indexrelid);
oid|indexrelid oid | indexrelid
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_index.indrelid SELECT oid, pg_index.indrelid
FROM pg_index FROM pg_index
WHERE pg_index.indrelid != 0 AND WHERE pg_index.indrelid != 0 AND
NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_index.indrelid); NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_index.indrelid);
oid|indrelid oid | indrelid
---+-------- -----+----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_opclass.opcdeftype SELECT oid, pg_opclass.opcdeftype
FROM pg_opclass FROM pg_opclass
WHERE pg_opclass.opcdeftype != 0 AND WHERE pg_opclass.opcdeftype != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_opclass.opcdeftype); NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_opclass.opcdeftype);
oid|opcdeftype oid | opcdeftype
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprleft SELECT oid, pg_operator.oprleft
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprleft != 0 AND WHERE pg_operator.oprleft != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_operator.oprleft); NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_operator.oprleft);
oid|oprleft oid | oprleft
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprright SELECT oid, pg_operator.oprright
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprright != 0 AND WHERE pg_operator.oprright != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_operator.oprright); NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_operator.oprright);
oid|oprright oid | oprright
---+-------- -----+----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprresult SELECT oid, pg_operator.oprresult
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprresult != 0 AND WHERE pg_operator.oprresult != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_operator.oprresult); NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_operator.oprresult);
oid|oprresult oid | oprresult
---+--------- -----+-----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprcom SELECT oid, pg_operator.oprcom
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprcom != 0 AND WHERE pg_operator.oprcom != 0 AND
NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_operator.oprcom); NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_operator.oprcom);
oid|oprcom oid | oprcom
---+------ -----+--------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprnegate SELECT oid, pg_operator.oprnegate
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprnegate != 0 AND WHERE pg_operator.oprnegate != 0 AND
NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_operator.oprnegate); NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_operator.oprnegate);
oid|oprnegate oid | oprnegate
---+--------- -----+-----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprlsortop SELECT oid, pg_operator.oprlsortop
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprlsortop != 0 AND WHERE pg_operator.oprlsortop != 0 AND
NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_operator.oprlsortop); NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_operator.oprlsortop);
oid|oprlsortop oid | oprlsortop
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprrsortop SELECT oid, pg_operator.oprrsortop
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprrsortop != 0 AND WHERE pg_operator.oprrsortop != 0 AND
NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_operator.oprrsortop); NOT EXISTS(SELECT * FROM pg_operator AS t1 WHERE t1.oid = pg_operator.oprrsortop);
oid|oprrsortop oid | oprrsortop
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprcode SELECT oid, pg_operator.oprcode
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprcode != 0 AND WHERE pg_operator.oprcode != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_operator.oprcode); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_operator.oprcode);
oid|oprcode oid | oprcode
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprrest SELECT oid, pg_operator.oprrest
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprrest != 0 AND WHERE pg_operator.oprrest != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_operator.oprrest); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_operator.oprrest);
oid|oprrest oid | oprrest
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_operator.oprjoin SELECT oid, pg_operator.oprjoin
FROM pg_operator FROM pg_operator
WHERE pg_operator.oprjoin != 0 AND WHERE pg_operator.oprjoin != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_operator.oprjoin); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_operator.oprjoin);
oid|oprjoin oid | oprjoin
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_proc.prolang SELECT oid, pg_proc.prolang
FROM pg_proc FROM pg_proc
WHERE pg_proc.prolang != 0 AND WHERE pg_proc.prolang != 0 AND
NOT EXISTS(SELECT * FROM pg_language AS t1 WHERE t1.oid = pg_proc.prolang); NOT EXISTS(SELECT * FROM pg_language AS t1 WHERE t1.oid = pg_proc.prolang);
oid|prolang oid | prolang
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_proc.prorettype SELECT oid, pg_proc.prorettype
FROM pg_proc FROM pg_proc
WHERE pg_proc.prorettype != 0 AND WHERE pg_proc.prorettype != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_proc.prorettype); NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_proc.prorettype);
oid|prorettype oid | prorettype
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_rewrite.ev_class SELECT oid, pg_rewrite.ev_class
FROM pg_rewrite FROM pg_rewrite
WHERE pg_rewrite.ev_class != 0 AND WHERE pg_rewrite.ev_class != 0 AND
NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_rewrite.ev_class); NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_rewrite.ev_class);
oid|ev_class oid | ev_class
---+-------- -----+----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_type.typrelid SELECT oid, pg_type.typrelid
FROM pg_type FROM pg_type
WHERE pg_type.typrelid != 0 AND WHERE pg_type.typrelid != 0 AND
NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_type.typrelid); NOT EXISTS(SELECT * FROM pg_class AS t1 WHERE t1.oid = pg_type.typrelid);
oid|typrelid oid | typrelid
---+-------- -----+----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_type.typelem SELECT oid, pg_type.typelem
FROM pg_type FROM pg_type
WHERE pg_type.typelem != 0 AND WHERE pg_type.typelem != 0 AND
NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_type.typelem); NOT EXISTS(SELECT * FROM pg_type AS t1 WHERE t1.oid = pg_type.typelem);
oid|typelem oid | typelem
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_type.typinput SELECT oid, pg_type.typinput
FROM pg_type FROM pg_type
WHERE pg_type.typinput != 0 AND WHERE pg_type.typinput != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_type.typinput); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_type.typinput);
oid|typinput oid | typinput
---+-------- -----+----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_type.typoutput SELECT oid, pg_type.typoutput
FROM pg_type FROM pg_type
WHERE pg_type.typoutput != 0 AND WHERE pg_type.typoutput != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_type.typoutput); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_type.typoutput);
oid|typoutput oid | typoutput
---+--------- -----+-----------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_type.typreceive SELECT oid, pg_type.typreceive
FROM pg_type FROM pg_type
WHERE pg_type.typreceive != 0 AND WHERE pg_type.typreceive != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_type.typreceive); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_type.typreceive);
oid|typreceive oid | typreceive
---+---------- -----+------------
(0 rows) (0 rows)
QUERY: SELECT oid, pg_type.typsend SELECT oid, pg_type.typsend
FROM pg_type FROM pg_type
WHERE pg_type.typsend != 0 AND WHERE pg_type.typsend != 0 AND
NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_type.typsend); NOT EXISTS(SELECT * FROM pg_proc AS t1 WHERE t1.oid = pg_type.typsend);
oid|typsend oid | typsend
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.proname --
-- OPR_SANITY
-- Sanity checks for common errors in making operator/procedure system tables:
-- pg_operator, pg_proc, pg_aggregate, pg_am, pg_amop, pg_amproc, pg_opclass.
--
-- None of the SELECTs here should ever find any matching entries,
-- so the expected output is easy to maintain ;-).
-- A test failure indicates someone messed up an entry in the system tables.
--
-- NB: we assume the oidjoins test will have caught any dangling links,
-- that is OID or REGPROC fields that are not zero and do not match some
-- row in the linked-to table. However, if we want to enforce that a link
-- field can't be 0, we have to check it here.
--
-- NB: run this test earlier than the create_operator test, because
-- that test creates some bogus operators...
--
-- NOTE hardwired assumptions about standard types:
-- type bool has OID 16
-- type float8 has OID 701
--
-- **************** pg_proc ****************
-- Look for illegal values in pg_proc fields.
SELECT p1.oid, p1.proname
FROM pg_proc as p1 FROM pg_proc as p1
WHERE (p1.prolang = 0 OR p1.prorettype = 0 OR WHERE (p1.prolang = 0 OR p1.prorettype = 0 OR
p1.pronargs < 0 OR p1.pronargs > 9) p1.pronargs < 0 OR p1.pronargs > 9)
AND p1.proname !~ '^pl[^_]+_call_handler$' AND p1.proname !~ '^pl[^_]+_call_handler$'
AND p1.proname !~ '^RI_FKey_' AND p1.proname !~ '^RI_FKey_'
AND p1.proname != 'update_pg_pwd'; AND p1.proname != 'update_pg_pwd';
oid|proname oid | proname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.proname, p2.oid, p2.proname -- Look for conflicting proc definitions (same names and input datatypes).
SELECT p1.oid, p1.proname, p2.oid, p2.proname
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.proname = p2.proname AND p1.proname = p2.proname AND
p1.pronargs = p2.pronargs AND p1.pronargs = p2.pronargs AND
p1.proargtypes = p2.proargtypes; p1.proargtypes = p2.proargtypes;
oid|proname|oid|proname oid | proname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.proname, p2.oid, p2.proname -- Considering only built-in procs (prolang = 11), look for multiple uses
-- of the same internal function (ie, matching prosrc fields). It's OK to
-- have several entries with different pronames for the same internal function,
-- but conflicts in the number of arguments and other critical items should
-- be complained of.
SELECT p1.oid, p1.proname, p2.oid, p2.proname
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
...@@ -28,125 +57,139 @@ WHERE p1.oid != p2.oid AND ...@@ -28,125 +57,139 @@ WHERE p1.oid != p2.oid AND
p1.proiscachable != p2.proiscachable OR p1.proiscachable != p2.proiscachable OR
p1.pronargs != p2.pronargs OR p1.pronargs != p2.pronargs OR
p1.proretset != p2.proretset); p1.proretset != p2.proretset);
oid|proname|oid|proname oid | proname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT DISTINCT p1.prorettype, p2.prorettype -- Look for uses of different type OIDs in the argument/result type fields
-- for different aliases of the same built-in function.
-- This indicates that the types are being presumed to be binary-equivalent.
-- That's not wrong, necessarily, but we make lists of all the types being
-- so treated. Note that the expected output of this part of the test will
-- need to be modified whenever new pairs of types are made binary-equivalent!
SELECT DISTINCT p1.prorettype, p2.prorettype
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.prorettype < p2.prorettype); (p1.prorettype < p2.prorettype);
prorettype|prorettype prorettype | prorettype
----------+---------- ------------+------------
18| 25 18 | 25
25| 1043 25 | 1043
(2 rows) (2 rows)
QUERY: SELECT DISTINCT p1.proargtypes[0], p2.proargtypes[0] SELECT DISTINCT p1.proargtypes[0], p2.proargtypes[0]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.proargtypes[0] < p2.proargtypes[0]); (p1.proargtypes[0] < p2.proargtypes[0]);
proargtypes|proargtypes proargtypes | proargtypes
-----------+----------- -------------+-------------
25| 1043 25 | 1043
1042| 1043 1042 | 1043
(2 rows) (2 rows)
QUERY: SELECT DISTINCT p1.proargtypes[1], p2.proargtypes[1] SELECT DISTINCT p1.proargtypes[1], p2.proargtypes[1]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.proargtypes[1] < p2.proargtypes[1]); (p1.proargtypes[1] < p2.proargtypes[1]);
proargtypes|proargtypes proargtypes | proargtypes
-----------+----------- -------------+-------------
(0 rows) (0 rows)
QUERY: SELECT DISTINCT p1.proargtypes[2], p2.proargtypes[2] SELECT DISTINCT p1.proargtypes[2], p2.proargtypes[2]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.proargtypes[2] < p2.proargtypes[2]); (p1.proargtypes[2] < p2.proargtypes[2]);
proargtypes|proargtypes proargtypes | proargtypes
-----------+----------- -------------+-------------
(0 rows) (0 rows)
QUERY: SELECT DISTINCT p1.proargtypes[3], p2.proargtypes[3] SELECT DISTINCT p1.proargtypes[3], p2.proargtypes[3]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.proargtypes[3] < p2.proargtypes[3]); (p1.proargtypes[3] < p2.proargtypes[3]);
proargtypes|proargtypes proargtypes | proargtypes
-----------+----------- -------------+-------------
(0 rows) (0 rows)
QUERY: SELECT DISTINCT p1.proargtypes[4], p2.proargtypes[4] SELECT DISTINCT p1.proargtypes[4], p2.proargtypes[4]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.proargtypes[4] < p2.proargtypes[4]); (p1.proargtypes[4] < p2.proargtypes[4]);
proargtypes|proargtypes proargtypes | proargtypes
-----------+----------- -------------+-------------
(0 rows) (0 rows)
QUERY: SELECT DISTINCT p1.proargtypes[5], p2.proargtypes[5] SELECT DISTINCT p1.proargtypes[5], p2.proargtypes[5]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.proargtypes[5] < p2.proargtypes[5]); (p1.proargtypes[5] < p2.proargtypes[5]);
proargtypes|proargtypes proargtypes | proargtypes
-----------+----------- -------------+-------------
(0 rows) (0 rows)
QUERY: SELECT DISTINCT p1.proargtypes[6], p2.proargtypes[6] SELECT DISTINCT p1.proargtypes[6], p2.proargtypes[6]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.proargtypes[6] < p2.proargtypes[6]); (p1.proargtypes[6] < p2.proargtypes[6]);
proargtypes|proargtypes proargtypes | proargtypes
-----------+----------- -------------+-------------
(0 rows) (0 rows)
QUERY: SELECT DISTINCT p1.proargtypes[7], p2.proargtypes[7] SELECT DISTINCT p1.proargtypes[7], p2.proargtypes[7]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND p1.prosrc = p2.prosrc AND p1.prolang = 11 AND p2.prolang = 11 AND
(p1.proargtypes[7] < p2.proargtypes[7]); (p1.proargtypes[7] < p2.proargtypes[7]);
proargtypes|proargtypes proargtypes | proargtypes
-----------+----------- -------------+-------------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname -- **************** pg_operator ****************
-- Look for illegal values in pg_operator fields.
SELECT p1.oid, p1.oprname
FROM pg_operator as p1 FROM pg_operator as p1
WHERE (p1.oprkind != 'b' AND p1.oprkind != 'l' AND p1.oprkind != 'r') OR WHERE (p1.oprkind != 'b' AND p1.oprkind != 'l' AND p1.oprkind != 'r') OR
p1.oprresult = 0 OR p1.oprcode = 0; p1.oprresult = 0 OR p1.oprcode = 0;
oid|oprname oid | oprname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname -- Look for missing or unwanted operand types
SELECT p1.oid, p1.oprname
FROM pg_operator as p1 FROM pg_operator as p1
WHERE (p1.oprleft = 0 and p1.oprkind != 'l') OR WHERE (p1.oprleft = 0 and p1.oprkind != 'l') OR
(p1.oprleft != 0 and p1.oprkind = 'l') OR (p1.oprleft != 0 and p1.oprkind = 'l') OR
(p1.oprright = 0 and p1.oprkind != 'r') OR (p1.oprright = 0 and p1.oprkind != 'r') OR
(p1.oprright != 0 and p1.oprkind = 'r'); (p1.oprright != 0 and p1.oprkind = 'r');
oid|oprname oid | oprname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode -- Look for conflicting operator definitions (same names and input datatypes).
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
FROM pg_operator AS p1, pg_operator AS p2 FROM pg_operator AS p1, pg_operator AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.oprname = p2.oprname AND p1.oprname = p2.oprname AND
p1.oprkind = p2.oprkind AND p1.oprkind = p2.oprkind AND
p1.oprleft = p2.oprleft AND p1.oprleft = p2.oprleft AND
p1.oprright = p2.oprright; p1.oprright = p2.oprright;
oid|oprcode|oid|oprcode oid | oprcode | oid | oprcode
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode -- Look for commutative operators that don't commute.
-- DEFINITIONAL NOTE: If A.oprcom = B, then x A y has the same result as y B x.
-- We expect that B will always say that B.oprcom = A as well; that's not
-- inherently essential, but it would be inefficient not to mark it so.
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
FROM pg_operator AS p1, pg_operator AS p2 FROM pg_operator AS p1, pg_operator AS p2
WHERE p1.oprcom = p2.oid AND WHERE p1.oprcom = p2.oid AND
(p1.oprkind != 'b' OR (p1.oprkind != 'b' OR
...@@ -154,11 +197,17 @@ WHERE p1.oprcom = p2.oid AND ...@@ -154,11 +197,17 @@ WHERE p1.oprcom = p2.oid AND
p1.oprright != p2.oprleft OR p1.oprright != p2.oprleft OR
p1.oprresult != p2.oprresult OR p1.oprresult != p2.oprresult OR
p1.oid != p2.oprcom); p1.oid != p2.oprcom);
oid|oprcode|oid|oprcode oid | oprcode | oid | oprcode
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode -- Look for negatory operators that don't agree.
-- DEFINITIONAL NOTE: If A.oprnegate = B, then both A and B must yield
-- boolean results, and (x A y) == ! (x B y), or the equivalent for
-- single-operand operators.
-- We expect that B will always say that B.oprnegate = A as well; that's not
-- inherently essential, but it would be inefficient not to mark it so.
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
FROM pg_operator AS p1, pg_operator AS p2 FROM pg_operator AS p1, pg_operator AS p2
WHERE p1.oprnegate = p2.oid AND WHERE p1.oprnegate = p2.oid AND
(p1.oprkind != p2.oprkind OR (p1.oprkind != p2.oprkind OR
...@@ -167,11 +216,15 @@ WHERE p1.oprnegate = p2.oid AND ...@@ -167,11 +216,15 @@ WHERE p1.oprnegate = p2.oid AND
p1.oprresult != 16 OR p1.oprresult != 16 OR
p2.oprresult != 16 OR p2.oprresult != 16 OR
p1.oid != p2.oprnegate); p1.oid != p2.oprnegate);
oid|oprcode|oid|oprcode oid | oprcode | oid | oprcode
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode -- Look for mergejoin operators that don't match their links.
-- A mergejoin link leads from an '=' operator to the
-- sort operator ('<' operator) that's appropriate for
-- its left-side or right-side data type.
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
FROM pg_operator AS p1, pg_operator AS p2 FROM pg_operator AS p1, pg_operator AS p2
WHERE p1.oprlsortop = p2.oid AND WHERE p1.oprlsortop = p2.oid AND
(p1.oprname != '=' OR p2.oprname != '<' OR (p1.oprname != '=' OR p2.oprname != '<' OR
...@@ -181,11 +234,11 @@ WHERE p1.oprlsortop = p2.oid AND ...@@ -181,11 +234,11 @@ WHERE p1.oprlsortop = p2.oid AND
p1.oprresult != 16 OR p1.oprresult != 16 OR
p2.oprresult != 16 OR p2.oprresult != 16 OR
p1.oprrsortop = 0); p1.oprrsortop = 0);
oid|oprcode|oid|oprcode oid | oprcode | oid | oprcode
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
FROM pg_operator AS p1, pg_operator AS p2 FROM pg_operator AS p1, pg_operator AS p2
WHERE p1.oprrsortop = p2.oid AND WHERE p1.oprrsortop = p2.oid AND
(p1.oprname != '=' OR p2.oprname != '<' OR (p1.oprname != '=' OR p2.oprname != '<' OR
...@@ -195,68 +248,107 @@ WHERE p1.oprrsortop = p2.oid AND ...@@ -195,68 +248,107 @@ WHERE p1.oprrsortop = p2.oid AND
p1.oprresult != 16 OR p1.oprresult != 16 OR
p2.oprresult != 16 OR p2.oprresult != 16 OR
p1.oprlsortop = 0); p1.oprlsortop = 0);
oid|oprcode|oid|oprcode oid | oprcode | oid | oprcode
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname FROM pg_operator AS p1 -- A mergejoinable = operator must have a commutator (usually itself)
-- as well as corresponding < and > operators. Note that the "corresponding"
-- operators have the same L and R input datatypes as the = operator,
-- whereas the operators linked to by oprlsortop and oprrsortop have input
-- datatypes L,L and R,R respectively.
SELECT p1.oid, p1.oprname FROM pg_operator AS p1
WHERE p1.oprlsortop != 0 AND WHERE p1.oprlsortop != 0 AND
p1.oprcom = 0; p1.oprcom = 0;
oid|oprname oid | oprname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname FROM pg_operator AS p1 SELECT p1.oid, p1.oprname FROM pg_operator AS p1
WHERE p1.oprlsortop != 0 AND NOT WHERE p1.oprlsortop != 0 AND NOT
EXISTS(SELECT * FROM pg_operator AS p2 WHERE EXISTS(SELECT * FROM pg_operator AS p2 WHERE
p2.oprname = '<' AND p2.oprname = '<' AND
p2.oprleft = p1.oprleft AND p2.oprleft = p1.oprleft AND
p2.oprright = p1.oprright AND p2.oprright = p1.oprright AND
p2.oprkind = 'b'); p2.oprkind = 'b');
oid|oprname oid | oprname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname FROM pg_operator AS p1 SELECT p1.oid, p1.oprname FROM pg_operator AS p1
WHERE p1.oprlsortop != 0 AND NOT WHERE p1.oprlsortop != 0 AND NOT
EXISTS(SELECT * FROM pg_operator AS p2 WHERE EXISTS(SELECT * FROM pg_operator AS p2 WHERE
p2.oprname = '>' AND p2.oprname = '>' AND
p2.oprleft = p1.oprleft AND p2.oprleft = p1.oprleft AND
p2.oprright = p1.oprright AND p2.oprright = p1.oprright AND
p2.oprkind = 'b'); p2.oprkind = 'b');
oid|oprname oid | oprname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname -- Hashing only works on simple equality operators "type = sametype",
-- since the hash itself depends on the bitwise representation of the type.
-- Check that allegedly hashable operators look like they might be "=".
-- NOTE: in 6.5, this search finds int4eqoid and oideqint4. Until we have
-- some cleaner way of dealing with binary-equivalent types, just leave
-- those two tuples in the expected output.
SELECT p1.oid, p1.oprname
FROM pg_operator AS p1 FROM pg_operator AS p1
WHERE p1.oprcanhash AND NOT WHERE p1.oprcanhash AND NOT
(p1.oprkind = 'b' AND p1.oprresult = 16 AND p1.oprleft = p1.oprright AND (p1.oprkind = 'b' AND p1.oprresult = 16 AND p1.oprleft = p1.oprright AND
p1.oprname = '=' AND p1.oprcom = p1.oid); p1.oprname = '=' AND p1.oprcom = p1.oid);
oid|oprname oid | oprname
----+------- ------+---------
1136|= 1136 | =
1137|= 1137 | =
(2 rows) (2 rows)
QUERY: SELECT p1.oid, p1.oprname -- In 6.5 we accepted hashable array equality operators when the array element
-- type is hashable. However, what we actually need to make hashjoin work on
-- an array is a hashable element type *and* no padding between elements in
-- the array storage (or, perhaps, guaranteed-zero padding). Currently,
-- since the padding code in arrayfuncs.c is pretty bogus, it seems safest
-- to just forbid hashjoin on array equality ops.
-- This should be reconsidered someday.
-- -- Look for array equality operators that are hashable when the underlying
-- -- type is not, or vice versa. This is presumably bogus.
--
-- SELECT p1.oid, p1.oprcanhash, p2.oid, p2.oprcanhash, t1.typname, t2.typname
-- FROM pg_operator AS p1, pg_operator AS p2, pg_type AS t1, pg_type AS t2
-- WHERE p1.oprname = '=' AND p1.oprleft = p1.oprright AND
-- p2.oprname = '=' AND p2.oprleft = p2.oprright AND
-- p1.oprleft = t1.oid AND p2.oprleft = t2.oid AND t1.typelem = t2.oid AND
-- p1.oprcanhash != p2.oprcanhash;
-- Substitute check: forbid hashable array ops, period.
SELECT p1.oid, p1.oprname
FROM pg_operator AS p1, pg_proc AS p2 FROM pg_operator AS p1, pg_proc AS p2
WHERE p1.oprcanhash AND p1.oprcode = p2.oid AND p2.proname = 'array_eq'; WHERE p1.oprcanhash AND p1.oprcode = p2.oid AND p2.proname = 'array_eq';
oid|oprname oid | oprname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname, p2.oid, p2.proname -- Check that each operator defined in pg_operator matches its oprcode entry
-- in pg_proc. Easiest to do this separately for each oprkind.
-- FIXME: want to check that argument/result types match, but how to do that
-- in the face of binary-compatible types?
SELECT p1.oid, p1.oprname, p2.oid, p2.proname
FROM pg_operator AS p1, pg_proc AS p2 FROM pg_operator AS p1, pg_proc AS p2
WHERE p1.oprcode = p2.oid AND WHERE p1.oprcode = p2.oid AND
p1.oprkind = 'b' AND p1.oprkind = 'b' AND
(p2.pronargs != 2 (p2.pronargs != 2
-- diked out until we find a way of marking binary-compatible types
-- OR
-- p1.oprresult != p2.prorettype OR
-- (p1.oprleft != p2.proargtypes[0] AND p2.proargtypes[0] != 0) OR
-- (p1.oprright != p2.proargtypes[1] AND p2.proargtypes[1] != 0)
); );
oid|oprname|oid|proname oid | oprname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname, p2.oid, p2.proname -- These two selects can be left as-is because there are no binary-compatible
-- cases that they trip over, at least in 6.5:
SELECT p1.oid, p1.oprname, p2.oid, p2.proname
FROM pg_operator AS p1, pg_proc AS p2 FROM pg_operator AS p1, pg_proc AS p2
WHERE p1.oprcode = p2.oid AND WHERE p1.oprcode = p2.oid AND
p1.oprkind = 'l' AND p1.oprkind = 'l' AND
...@@ -264,11 +356,11 @@ WHERE p1.oprcode = p2.oid AND ...@@ -264,11 +356,11 @@ WHERE p1.oprcode = p2.oid AND
p1.oprresult != p2.prorettype OR p1.oprresult != p2.prorettype OR
(p1.oprright != p2.proargtypes[0] AND p2.proargtypes[0] != 0) OR (p1.oprright != p2.proargtypes[0] AND p2.proargtypes[0] != 0) OR
p1.oprleft != 0); p1.oprleft != 0);
oid|oprname|oid|proname oid | oprname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname, p2.oid, p2.proname SELECT p1.oid, p1.oprname, p2.oid, p2.proname
FROM pg_operator AS p1, pg_proc AS p2 FROM pg_operator AS p1, pg_proc AS p2
WHERE p1.oprcode = p2.oid AND WHERE p1.oprcode = p2.oid AND
p1.oprkind = 'r' AND p1.oprkind = 'r' AND
...@@ -276,11 +368,15 @@ WHERE p1.oprcode = p2.oid AND ...@@ -276,11 +368,15 @@ WHERE p1.oprcode = p2.oid AND
p1.oprresult != p2.prorettype OR p1.oprresult != p2.prorettype OR
(p1.oprleft != p2.proargtypes[0] AND p2.proargtypes[0] != 0) OR (p1.oprleft != p2.proargtypes[0] AND p2.proargtypes[0] != 0) OR
p1.oprright != 0); p1.oprright != 0);
oid|oprname|oid|proname oid | oprname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname, p2.oid, p2.proname -- If oprrest is set, the operator must return boolean,
-- and it must link to a proc with the right signature
-- to be a restriction selectivity estimator.
-- The proc signature we want is: float8 proc(oid, oid, int2, <any>, int4)
SELECT p1.oid, p1.oprname, p2.oid, p2.proname
FROM pg_operator AS p1, pg_proc AS p2 FROM pg_operator AS p1, pg_proc AS p2
WHERE p1.oprrest = p2.oid AND WHERE p1.oprrest = p2.oid AND
(p1.oprresult != 16 OR (p1.oprresult != 16 OR
...@@ -289,11 +385,15 @@ WHERE p1.oprrest = p2.oid AND ...@@ -289,11 +385,15 @@ WHERE p1.oprrest = p2.oid AND
p2.proargtypes[0] != 26 OR p2.proargtypes[1] != 26 OR p2.proargtypes[0] != 26 OR p2.proargtypes[1] != 26 OR
p2.proargtypes[2] != 21 OR p2.proargtypes[3] != 0 OR p2.proargtypes[2] != 21 OR p2.proargtypes[3] != 0 OR
p2.proargtypes[4] != 23); p2.proargtypes[4] != 23);
oid|oprname|oid|proname oid | oprname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.oprname, p2.oid, p2.proname -- If oprjoin is set, the operator must be a binary boolean op,
-- and it must link to a proc with the right signature
-- to be a join selectivity estimator.
-- The proc signature we want is: float8 proc(oid, oid, int2, oid, int2)
SELECT p1.oid, p1.oprname, p2.oid, p2.proname
FROM pg_operator AS p1, pg_proc AS p2 FROM pg_operator AS p1, pg_proc AS p2
WHERE p1.oprjoin = p2.oid AND WHERE p1.oprjoin = p2.oid AND
(p1.oprkind != 'b' OR p1.oprresult != 16 OR (p1.oprkind != 'b' OR p1.oprresult != 16 OR
...@@ -302,134 +402,169 @@ WHERE p1.oprjoin = p2.oid AND ...@@ -302,134 +402,169 @@ WHERE p1.oprjoin = p2.oid AND
p2.proargtypes[0] != 26 OR p2.proargtypes[1] != 26 OR p2.proargtypes[0] != 26 OR p2.proargtypes[1] != 26 OR
p2.proargtypes[2] != 21 OR p2.proargtypes[3] != 26 OR p2.proargtypes[2] != 21 OR p2.proargtypes[3] != 26 OR
p2.proargtypes[4] != 21); p2.proargtypes[4] != 21);
oid|oprname|oid|proname oid | oprname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.aggname -- **************** pg_aggregate ****************
-- Look for illegal values in pg_aggregate fields.
-- aggbasetype can only be 0 if transfn1 is not present (eg, count(*))
-- or itself takes a wild-card input; we check the latter case below.
SELECT p1.oid, p1.aggname
FROM pg_aggregate as p1 FROM pg_aggregate as p1
WHERE (p1.aggbasetype = 0 AND p1.aggtransfn1 != 0) OR aggfinaltype = 0; WHERE (p1.aggbasetype = 0 AND p1.aggtransfn1 != 0) OR aggfinaltype = 0;
oid|aggname oid | aggname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.aggname -- Check combinations of transfer functions.
-- Although either transfn1 or transfn2 can be null,
-- it makes no sense for both to be. And if both are defined,
-- presumably there should be a finalfn to combine their results.
-- We also check that transtypes are null just when corresponding
-- transfns are. Also, if there is no finalfn then the output type
-- must be the transtype the result will be taken from.
SELECT p1.oid, p1.aggname
FROM pg_aggregate as p1 FROM pg_aggregate as p1
WHERE p1.aggtransfn1 = 0 AND p1.aggtransfn2 = 0; WHERE p1.aggtransfn1 = 0 AND p1.aggtransfn2 = 0;
oid|aggname oid | aggname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.aggname SELECT p1.oid, p1.aggname
FROM pg_aggregate as p1 FROM pg_aggregate as p1
WHERE p1.aggtransfn1 != 0 AND p1.aggtransfn2 = 0 AND WHERE p1.aggtransfn1 != 0 AND p1.aggtransfn2 = 0 AND
(p1.aggtranstype1 = 0 OR p1.aggtranstype2 != 0 OR (p1.aggtranstype1 = 0 OR p1.aggtranstype2 != 0 OR
(p1.aggfinalfn = 0 AND p1.aggfinaltype != p1.aggtranstype1)); (p1.aggfinalfn = 0 AND p1.aggfinaltype != p1.aggtranstype1));
oid|aggname oid | aggname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.aggname SELECT p1.oid, p1.aggname
FROM pg_aggregate as p1 FROM pg_aggregate as p1
WHERE p1.aggtransfn1 = 0 AND p1.aggtransfn2 != 0 AND WHERE p1.aggtransfn1 = 0 AND p1.aggtransfn2 != 0 AND
(p1.aggtranstype1 != 0 OR p1.aggtranstype2 = 0 OR (p1.aggtranstype1 != 0 OR p1.aggtranstype2 = 0 OR
(p1.aggfinalfn = 0 AND p1.aggfinaltype != p1.aggtranstype2)); (p1.aggfinalfn = 0 AND p1.aggfinaltype != p1.aggtranstype2));
oid|aggname oid | aggname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.aggname SELECT p1.oid, p1.aggname
FROM pg_aggregate as p1 FROM pg_aggregate as p1
WHERE p1.aggtransfn1 != 0 AND p1.aggtransfn2 != 0 AND WHERE p1.aggtransfn1 != 0 AND p1.aggtransfn2 != 0 AND
(p1.aggtranstype1 = 0 OR p1.aggtranstype2 = 0 OR (p1.aggtranstype1 = 0 OR p1.aggtranstype2 = 0 OR
p1.aggfinalfn = 0); p1.aggfinalfn = 0);
oid|aggname oid | aggname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.aggname, p2.oid, p2.proname -- Cross-check transfn1 (if present) against its entry in pg_proc.
-- FIXME: what about binary-compatible types?
SELECT p1.oid, p1.aggname, p2.oid, p2.proname
FROM pg_aggregate AS p1, pg_proc AS p2 FROM pg_aggregate AS p1, pg_proc AS p2
WHERE p1.aggtransfn1 = p2.oid AND WHERE p1.aggtransfn1 = p2.oid AND
(p2.proretset OR p2.pronargs != 2 (p2.proretset OR p2.pronargs != 2
-- diked out until we find a way of marking binary-compatible types
-- OR
-- p1.aggtranstype1 != p2.prorettype OR
-- p1.aggtranstype1 != p2.proargtypes[0] OR
-- p1.aggbasetype != p2.proargtypes[1]
); );
oid|aggname|oid|proname oid | aggname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.aggname, p2.oid, p2.proname -- Cross-check transfn2 (if present) against its entry in pg_proc.
-- FIXME: what about binary-compatible types?
SELECT p1.oid, p1.aggname, p2.oid, p2.proname
FROM pg_aggregate AS p1, pg_proc AS p2 FROM pg_aggregate AS p1, pg_proc AS p2
WHERE p1.aggtransfn2 = p2.oid AND WHERE p1.aggtransfn2 = p2.oid AND
(p2.proretset OR p1.aggtranstype2 != p2.prorettype OR (p2.proretset OR p1.aggtranstype2 != p2.prorettype OR
p2.pronargs != 1 OR p2.pronargs != 1 OR
p1.aggtranstype2 != p2.proargtypes[0]); p1.aggtranstype2 != p2.proargtypes[0]);
oid|aggname|oid|proname oid | aggname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.aggname, p2.oid, p2.proname -- Cross-check finalfn (if present) against its entry in pg_proc.
-- FIXME: what about binary-compatible types?
SELECT p1.oid, p1.aggname, p2.oid, p2.proname
FROM pg_aggregate AS p1, pg_proc AS p2 FROM pg_aggregate AS p1, pg_proc AS p2
WHERE p1.aggfinalfn = p2.oid AND WHERE p1.aggfinalfn = p2.oid AND
(p2.proretset OR p1.aggfinaltype != p2.prorettype OR (p2.proretset OR p1.aggfinaltype != p2.prorettype OR
p2.pronargs != 2 OR p2.pronargs != 2 OR
p1.aggtranstype1 != p2.proargtypes[0] OR p1.aggtranstype1 != p2.proargtypes[0] OR
p1.aggtranstype2 != p2.proargtypes[1]); p1.aggtranstype2 != p2.proargtypes[1]);
oid|aggname|oid|proname oid | aggname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid -- **************** pg_amop ****************
-- Look for illegal values in pg_amop fields
SELECT p1.oid
FROM pg_amop as p1 FROM pg_amop as p1
WHERE p1.amopid = 0 OR p1.amopclaid = 0 OR p1.amopopr = 0 OR WHERE p1.amopid = 0 OR p1.amopclaid = 0 OR p1.amopopr = 0 OR
p1.amopstrategy <= 0 OR p1.amopselect = 0 OR p1.amopnpages = 0; p1.amopstrategy <= 0 OR p1.amopselect = 0 OR p1.amopnpages = 0;
oid oid
--- -----
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid -- Look for duplicate pg_amop entries
SELECT p1.oid, p2.oid
FROM pg_amop AS p1, pg_amop AS p2 FROM pg_amop AS p1, pg_amop AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.amopid = p2.amopid AND p1.amopid = p2.amopid AND
p1.amopclaid = p2.amopclaid AND p1.amopclaid = p2.amopclaid AND
p1.amopstrategy = p2.amopstrategy; p1.amopstrategy = p2.amopstrategy;
oid|oid oid | oid
---+--- -----+-----
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid, p2.amname -- Cross-check amopstrategy index against parent AM
SELECT p1.oid, p2.oid, p2.amname
FROM pg_amop AS p1, pg_am AS p2 FROM pg_amop AS p1, pg_am AS p2
WHERE p1.amopid = p2.oid AND p1.amopstrategy > p2.amstrategies; WHERE p1.amopid = p2.oid AND p1.amopstrategy > p2.amstrategies;
oid|oid|amname oid | oid | amname
---+---+------ -----+-----+--------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.amname, p2.oid, p2.opcname -- Detect missing pg_amop entries: should have as many strategy functions
-- as AM expects for each opclass, unless there are none at all
-- (some opclasses only offer support for a limited set of AMs...)
SELECT p1.oid, p1.amname, p2.oid, p2.opcname
FROM pg_am AS p1, pg_opclass AS p2 FROM pg_am AS p1, pg_opclass AS p2
WHERE p1.amstrategies != (SELECT count(*) FROM pg_amop AS p3 WHERE p1.amstrategies != (SELECT count(*) FROM pg_amop AS p3
WHERE p3.amopid = p1.oid AND p3.amopclaid = p2.oid) WHERE p3.amopid = p1.oid AND p3.amopclaid = p2.oid)
AND EXISTS (SELECT * FROM pg_amop AS p3 AND EXISTS (SELECT * FROM pg_amop AS p3
WHERE p3.amopid = p1.oid AND p3.amopclaid = p2.oid); WHERE p3.amopid = p1.oid AND p3.amopclaid = p2.oid);
oid|amname|oid|opcname oid | amname | oid | opcname
---+------+---+------- -----+--------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid, p2.oprname -- Check that amopopr points at a reasonable-looking operator
SELECT p1.oid, p2.oid, p2.oprname
FROM pg_amop AS p1, pg_operator AS p2 FROM pg_amop AS p1, pg_operator AS p2
WHERE p1.amopopr = p2.oid AND WHERE p1.amopopr = p2.oid AND
(p2.oprkind != 'b' OR p2.oprresult != 16); (p2.oprkind != 'b' OR p2.oprresult != 16);
oid|oid|oprname oid | oid | oprname
---+---+------- -----+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid, p2.oprname, p3.oid, p3.opcname -- If opclass is for a specific type, operator inputs should be of that type
SELECT p1.oid, p2.oid, p2.oprname, p3.oid, p3.opcname
FROM pg_amop AS p1, pg_operator AS p2, pg_opclass AS p3 FROM pg_amop AS p1, pg_operator AS p2, pg_opclass AS p3
WHERE p1.amopopr = p2.oid AND p1.amopclaid = p3.oid AND WHERE p1.amopopr = p2.oid AND p1.amopclaid = p3.oid AND
p3.opcdeftype != 0 AND p3.opcdeftype != 0 AND
(p3.opcdeftype != p2.oprleft OR p3.opcdeftype != p2.oprright); (p3.opcdeftype != p2.oprleft OR p3.opcdeftype != p2.oprright);
oid|oid|oprname|oid|opcname oid | oid | oprname | oid | opcname
---+---+-------+---+------- -----+-----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid, p2.proname -- Check that amopselect points to a proc with the right signature
-- to be an access-method selectivity estimator.
-- The proc signature we want is:
-- float8 proc(oid, oid, int2, <any>, int4, int4, oid)
SELECT p1.oid, p2.oid, p2.proname
FROM pg_amop AS p1, pg_proc AS p2 FROM pg_amop AS p1, pg_proc AS p2
WHERE p1.amopselect = p2.oid AND WHERE p1.amopselect = p2.oid AND
(p2.prorettype != 701 OR p2.proretset OR (p2.prorettype != 701 OR p2.proretset OR
...@@ -438,11 +573,15 @@ WHERE p1.amopselect = p2.oid AND ...@@ -438,11 +573,15 @@ WHERE p1.amopselect = p2.oid AND
p2.proargtypes[2] != 21 OR p2.proargtypes[3] != 0 OR p2.proargtypes[2] != 21 OR p2.proargtypes[3] != 0 OR
p2.proargtypes[4] != 23 OR p2.proargtypes[5] != 23 OR p2.proargtypes[4] != 23 OR p2.proargtypes[5] != 23 OR
p2.proargtypes[6] != 26); p2.proargtypes[6] != 26);
oid|oid|proname oid | oid | proname
---+---+------- -----+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid, p2.proname -- Check that amopnpages points to a proc with the right signature
-- to be an access-method page-count estimator.
-- The proc signature we want is:
-- float8 proc(oid, oid, int2, <any>, int4, int4, oid)
SELECT p1.oid, p2.oid, p2.proname
FROM pg_amop AS p1, pg_proc AS p2 FROM pg_amop AS p1, pg_proc AS p2
WHERE p1.amopnpages = p2.oid AND WHERE p1.amopnpages = p2.oid AND
(p2.prorettype != 701 OR p2.proretset OR (p2.prorettype != 701 OR p2.proretset OR
...@@ -451,52 +590,64 @@ WHERE p1.amopnpages = p2.oid AND ...@@ -451,52 +590,64 @@ WHERE p1.amopnpages = p2.oid AND
p2.proargtypes[2] != 21 OR p2.proargtypes[3] != 0 OR p2.proargtypes[2] != 21 OR p2.proargtypes[3] != 0 OR
p2.proargtypes[4] != 23 OR p2.proargtypes[5] != 23 OR p2.proargtypes[4] != 23 OR p2.proargtypes[5] != 23 OR
p2.proargtypes[6] != 26); p2.proargtypes[6] != 26);
oid|oid|proname oid | oid | proname
---+---+------- -----+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid -- **************** pg_amproc ****************
-- Look for illegal values in pg_amproc fields
SELECT p1.oid
FROM pg_amproc as p1 FROM pg_amproc as p1
WHERE p1.amid = 0 OR p1.amopclaid = 0 OR p1.amproc = 0 OR WHERE p1.amid = 0 OR p1.amopclaid = 0 OR p1.amproc = 0 OR
p1.amprocnum <= 0; p1.amprocnum <= 0;
oid oid
--- -----
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid -- Look for duplicate pg_amproc entries
SELECT p1.oid, p2.oid
FROM pg_amproc AS p1, pg_amproc AS p2 FROM pg_amproc AS p1, pg_amproc AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.amid = p2.amid AND p1.amid = p2.amid AND
p1.amopclaid = p2.amopclaid AND p1.amopclaid = p2.amopclaid AND
p1.amprocnum = p2.amprocnum; p1.amprocnum = p2.amprocnum;
oid|oid oid | oid
---+--- -----+-----
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid, p2.amname -- Cross-check amprocnum index against parent AM
SELECT p1.oid, p2.oid, p2.amname
FROM pg_amproc AS p1, pg_am AS p2 FROM pg_amproc AS p1, pg_am AS p2
WHERE p1.amid = p2.oid AND p1.amprocnum > p2.amsupport; WHERE p1.amid = p2.oid AND p1.amprocnum > p2.amsupport;
oid|oid|amname oid | oid | amname
---+---+------ -----+-----+--------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.amname, p2.oid, p2.opcname -- Detect missing pg_amproc entries: should have as many support functions
-- as AM expects for each opclass, unless there are none at all
-- (some opclasses only offer support for a limited set of AMs...)
SELECT p1.oid, p1.amname, p2.oid, p2.opcname
FROM pg_am AS p1, pg_opclass AS p2 FROM pg_am AS p1, pg_opclass AS p2
WHERE p1.amsupport != (SELECT count(*) FROM pg_amproc AS p3 WHERE p1.amsupport != (SELECT count(*) FROM pg_amproc AS p3
WHERE p3.amid = p1.oid AND p3.amopclaid = p2.oid) WHERE p3.amid = p1.oid AND p3.amopclaid = p2.oid)
AND EXISTS (SELECT * FROM pg_amproc AS p3 AND EXISTS (SELECT * FROM pg_amproc AS p3
WHERE p3.amid = p1.oid AND p3.amopclaid = p2.oid); WHERE p3.amid = p1.oid AND p3.amopclaid = p2.oid);
oid|amname|oid|opcname oid | amname | oid | opcname
---+------+---+------- -----+--------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p2.oid, p2.proname, p3.oid, p4.oid, p4.proname -- Unfortunately, we can't check the amproc link very well because the
-- signature of the function may be different for different support routines
-- or different base data types.
-- We can check that all the referenced instances of the same support
-- routine number take the same number of parameters, but that's about it...
SELECT p1.oid, p2.oid, p2.proname, p3.oid, p4.oid, p4.proname
FROM pg_amproc AS p1, pg_proc AS p2, pg_amproc AS p3, pg_proc AS p4 FROM pg_amproc AS p1, pg_proc AS p2, pg_amproc AS p3, pg_proc AS p4
WHERE p1.oid != p3.oid AND WHERE p1.oid != p3.oid AND
p1.amid = p3.amid AND p1.amprocnum = p3.amprocnum AND p1.amid = p3.amid AND p1.amprocnum = p3.amprocnum AND
p1.amproc = p2.oid AND p3.amproc = p4.oid AND p1.amproc = p2.oid AND p3.amproc = p4.oid AND
(p2.proretset OR p4.proretset OR p2.pronargs != p4.pronargs); (p2.proretset OR p4.proretset OR p2.pronargs != p4.pronargs);
oid|oid|proname|oid|oid|proname oid | oid | proname | oid | oid | proname
---+---+-------+---+---+------- -----+-----+---------+-----+-----+---------
(0 rows) (0 rows)
QUERY: CREATE TABLE PATH_TBL (f1 path); --
QUERY: INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]'); -- PATH
QUERY: INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))'); --
QUERY: INSERT INTO PATH_TBL VALUES ('[(0,0),(3,0),(4,5),(1,6)]'); --DROP TABLE PATH_TBL;
QUERY: INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))'); CREATE TABLE PATH_TBL (f1 path);
QUERY: INSERT INTO PATH_TBL VALUES ('1,2 ,3,4'); INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]');
QUERY: INSERT INTO PATH_TBL VALUES ('[1,2,3, 4]'); INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))');
QUERY: INSERT INTO PATH_TBL VALUES ('[11,12,13,14]'); INSERT INTO PATH_TBL VALUES ('[(0,0),(3,0),(4,5),(1,6)]');
QUERY: INSERT INTO PATH_TBL VALUES ('(11,12,13,14)'); INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))');
QUERY: INSERT INTO PATH_TBL VALUES ('[(,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)');
-- bad values for parser testing
INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
ERROR: Bad path external representation '[(,2),(3,4)]' ERROR: Bad path external representation '[(,2),(3,4)]'
QUERY: INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)'); INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
ERROR: Bad path external representation '[(1,2),(3,4)' ERROR: Bad path external representation '[(1,2),(3,4)'
QUERY: SELECT f1 FROM PATH_TBL; SELECT f1 FROM PATH_TBL;
f1 f1
------------------------- ---------------------------
[(1,2),(3,4)] [(1,2),(3,4)]
((1,2),(3,4)) ((1,2),(3,4))
[(0,0),(3,0),(4,5),(1,6)] [(0,0),(3,0),(4,5),(1,6)]
((1,2),(3,4)) ((1,2),(3,4))
((1,2),(3,4)) ((1,2),(3,4))
[(1,2),(3,4)] [(1,2),(3,4)]
[(11,12),(13,14)] [(11,12),(13,14)]
((11,12),(13,14)) ((11,12),(13,14))
(8 rows) (8 rows)
QUERY: 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);
count|open_path count | open_path
-----+------------------------- -------+---------------------------
|[(1,2),(3,4)] | [(1,2),(3,4)]
|[(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
|[(1,2),(3,4)] | [(1,2),(3,4)]
|[(11,12),(13,14)] | [(11,12),(13,14)]
(4 rows) (4 rows)
QUERY: 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);
count|closed_path count | closed_path
-----+----------------- -------+-------------------
|((1,2),(3,4)) | ((1,2),(3,4))
|((1,2),(3,4)) | ((1,2),(3,4))
|((1,2),(3,4)) | ((1,2),(3,4))
|((11,12),(13,14)) | ((11,12),(13,14))
(4 rows) (4 rows)
QUERY: SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL; SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL;
count|closed_path count | closed_path
-----+------------------------- -------+---------------------------
|((1,2),(3,4)) | ((1,2),(3,4))
|((1,2),(3,4)) | ((1,2),(3,4))
|((0,0),(3,0),(4,5),(1,6)) | ((0,0),(3,0),(4,5),(1,6))
|((1,2),(3,4)) | ((1,2),(3,4))
|((1,2),(3,4)) | ((1,2),(3,4))
|((1,2),(3,4)) | ((1,2),(3,4))
|((11,12),(13,14)) | ((11,12),(13,14))
|((11,12),(13,14)) | ((11,12),(13,14))
(8 rows) (8 rows)
QUERY: SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL; SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL;
count|open_path count | open_path
-----+------------------------- -------+---------------------------
|[(1,2),(3,4)] | [(1,2),(3,4)]
|[(1,2),(3,4)] | [(1,2),(3,4)]
|[(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
|[(1,2),(3,4)] | [(1,2),(3,4)]
|[(1,2),(3,4)] | [(1,2),(3,4)]
|[(1,2),(3,4)] | [(1,2),(3,4)]
|[(11,12),(13,14)] | [(11,12),(13,14)]
|[(11,12),(13,14)] | [(11,12),(13,14)]
(8 rows) (8 rows)
QUERY: CREATE TABLE POINT_TBL(f1 point); --
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('(0.0,0.0)'); -- POINT
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('(-10.0,0.0)'); --
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('(-3.0,4.0)'); CREATE TABLE POINT_TBL(f1 point);
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('(5.1, 34.5)'); INSERT INTO POINT_TBL(f1) VALUES ('(0.0,0.0)');
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('(-5.0,-12.0)'); INSERT INTO POINT_TBL(f1) VALUES ('(-10.0,0.0)');
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf'); INSERT INTO POINT_TBL(f1) VALUES ('(-3.0,4.0)');
INSERT INTO POINT_TBL(f1) VALUES ('(5.1, 34.5)');
INSERT INTO POINT_TBL(f1) VALUES ('(-5.0,-12.0)');
-- bad format points
INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf');
ERROR: Bad point external representation 'asdfasdf' ERROR: Bad point external representation 'asdfasdf'
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('10.0,10.0'); INSERT INTO POINT_TBL(f1) VALUES ('10.0,10.0');
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('(10.0 10.0)'); INSERT INTO POINT_TBL(f1) VALUES ('(10.0 10.0)');
ERROR: Bad point external representation '(10.0 10.0)' ERROR: Bad point external representation '(10.0 10.0)'
QUERY: INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0'); INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0');
ERROR: Bad point external representation '(10.0,10.0' ERROR: Bad point external representation '(10.0,10.0'
QUERY: SELECT '' AS six, POINT_TBL.*; SELECT '' AS six, POINT_TBL.*;
six|f1 six | f1
---+---------- -----+------------
|(0,0) | (0,0)
|(-10,0) | (-10,0)
|(-3,4) | (-3,4)
|(5.1,34.5) | (5.1,34.5)
|(-5,-12) | (-5,-12)
|(10,10) | (10,10)
(6 rows) (6 rows)
QUERY: SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)'; -- left of
three|f1 SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)';
-----+-------- three | f1
|(-10,0) -------+----------
|(-3,4) | (-10,0)
|(-5,-12) | (-3,4)
| (-5,-12)
(3 rows) (3 rows)
QUERY: SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1; -- right of
three|f1 SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1;
-----+-------- three | f1
|(-10,0) -------+----------
|(-3,4) | (-10,0)
|(-5,-12) | (-3,4)
| (-5,-12)
(3 rows) (3 rows)
QUERY: SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1; -- above
one|f1 SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1;
---+-------- one | f1
|(-5,-12) -----+----------
| (-5,-12)
(1 row) (1 row)
QUERY: SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)'; -- below
one|f1 SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)';
---+-------- one | f1
|(-5,-12) -----+----------
| (-5,-12)
(1 row) (1 row)
QUERY: SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)'; -- equal
one|f1 SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)';
---+---------- one | f1
|(5.1,34.5) -----+------------
| (5.1,34.5)
(1 row) (1 row)
QUERY: SELECT '' AS three, p.* FROM POINT_TBL p -- point in box
WHERE p.f1 @ '(0,0,100,100)'::box; SELECT '' AS three, p.* FROM POINT_TBL p
three|f1 WHERE p.f1 @ box '(0,0,100,100)';
-----+---------- three | f1
|(0,0) -------+------------
|(5.1,34.5) | (0,0)
|(10,10) | (5.1,34.5)
| (10,10)
(3 rows) (3 rows)
QUERY: SELECT '' AS three, p.* FROM POINT_TBL p SELECT '' AS three, p.* FROM POINT_TBL p
WHERE not p.f1 @ '(0,0,100,100)'::box; WHERE not p.f1 @ box '(0,0,100,100)';
three|f1 three | f1
-----+-------- -------+----------
|(-10,0) | (-10,0)
|(-3,4) | (-3,4)
|(-5,-12) | (-5,-12)
(3 rows) (3 rows)
QUERY: SELECT '' AS two, p.* FROM POINT_TBL p SELECT '' AS two, p.* FROM POINT_TBL p
WHERE p.f1 @ '[(0,0),(-10,0),(-10,10)]'::path; WHERE p.f1 @ path '[(0,0),(-10,0),(-10,10)]';
two|f1 two | f1
---+------- -----+---------
|(0,0) | (0,0)
|(-10,0) | (-10,0)
(2 rows) (2 rows)
QUERY: SELECT '' AS six, p.f1, p.f1 <-> '(0,0)'::point AS dist SELECT '' AS six, p.f1, p.f1 <-> point '(0,0)' AS dist
FROM POINT_TBL p FROM POINT_TBL p
ORDER BY dist; ORDER BY dist;
six|f1 | dist six | f1 | dist
---+----------+---------------- -----+------------+------------------
|(0,0) | 0 | (0,0) | 0
|(-3,4) | 5 | (-3,4) | 5
|(-10,0) | 10 | (-10,0) | 10
|(-5,-12) | 13 | (-5,-12) | 13
|(10,10) | 14.142135623731 | (10,10) | 14.142135623731
|(5.1,34.5)|34.8749193547455 | (5.1,34.5) | 34.8749193547455
(6 rows) (6 rows)
QUERY: SET geqo TO 'off'; SET geqo TO 'off';
QUERY: SELECT '' AS thirtysix, p1.f1 AS point1, p2.f1 AS point2, p1.f1 <-> p2.f1 AS dist SELECT '' AS thirtysix, p1.f1 AS point1, p2.f1 AS point2, p1.f1 <-> p2.f1 AS dist
FROM POINT_TBL p1, POINT_TBL p2 FROM POINT_TBL p1, POINT_TBL p2
ORDER BY dist, point1 using <<, point2 using <<; ORDER BY dist, point1 using <<, point2 using <<;
thirtysix|point1 |point2 | dist thirtysix | point1 | point2 | dist
---------+----------+----------+---------------- -----------+------------+------------+------------------
|(-10,0) |(-10,0) | 0 | (-10,0) | (-10,0) | 0
|(-5,-12) |(-5,-12) | 0 | (-5,-12) | (-5,-12) | 0
|(-3,4) |(-3,4) | 0 | (-3,4) | (-3,4) | 0
|(0,0) |(0,0) | 0 | (0,0) | (0,0) | 0
|(5.1,34.5)|(5.1,34.5)| 0 | (5.1,34.5) | (5.1,34.5) | 0
|(10,10) |(10,10) | 0 | (10,10) | (10,10) | 0
|(-3,4) |(0,0) | 5 | (-3,4) | (0,0) | 5
|(0,0) |(-3,4) | 5 | (0,0) | (-3,4) | 5
|(-10,0) |(-3,4) |8.06225774829855 | (-10,0) | (-3,4) | 8.06225774829855
|(-3,4) |(-10,0) |8.06225774829855 | (-3,4) | (-10,0) | 8.06225774829855
|(-10,0) |(0,0) | 10 | (-10,0) | (0,0) | 10
|(0,0) |(-10,0) | 10 | (0,0) | (-10,0) | 10
|(-10,0) |(-5,-12) | 13 | (-10,0) | (-5,-12) | 13
|(-5,-12) |(-10,0) | 13 | (-5,-12) | (-10,0) | 13
|(-5,-12) |(0,0) | 13 | (-5,-12) | (0,0) | 13
|(0,0) |(-5,-12) | 13 | (0,0) | (-5,-12) | 13
|(0,0) |(10,10) | 14.142135623731 | (0,0) | (10,10) | 14.142135623731
|(10,10) |(0,0) | 14.142135623731 | (10,10) | (0,0) | 14.142135623731
|(-3,4) |(10,10) |14.3178210632764 | (-3,4) | (10,10) | 14.3178210632764
|(10,10) |(-3,4) |14.3178210632764 | (10,10) | (-3,4) | 14.3178210632764
|(-5,-12) |(-3,4) |16.1245154965971 | (-5,-12) | (-3,4) | 16.1245154965971
|(-3,4) |(-5,-12) |16.1245154965971 | (-3,4) | (-5,-12) | 16.1245154965971
|(-10,0) |(10,10) |22.3606797749979 | (-10,0) | (10,10) | 22.3606797749979
|(10,10) |(-10,0) |22.3606797749979 | (10,10) | (-10,0) | 22.3606797749979
|(5.1,34.5)|(10,10) |24.9851956166046 | (5.1,34.5) | (10,10) | 24.9851956166046
|(10,10) |(5.1,34.5)|24.9851956166046 | (10,10) | (5.1,34.5) | 24.9851956166046
|(-5,-12) |(10,10) |26.6270539113887 | (-5,-12) | (10,10) | 26.6270539113887
|(10,10) |(-5,-12) |26.6270539113887 | (10,10) | (-5,-12) | 26.6270539113887
|(-3,4) |(5.1,34.5)|31.5572495632937 | (-3,4) | (5.1,34.5) | 31.5572495632937
|(5.1,34.5)|(-3,4) |31.5572495632937 | (5.1,34.5) | (-3,4) | 31.5572495632937
|(0,0) |(5.1,34.5)|34.8749193547455 | (0,0) | (5.1,34.5) | 34.8749193547455
|(5.1,34.5)|(0,0) |34.8749193547455 | (5.1,34.5) | (0,0) | 34.8749193547455
|(-10,0) |(5.1,34.5)|37.6597928831267 | (-10,0) | (5.1,34.5) | 37.6597928831267
|(5.1,34.5)|(-10,0) |37.6597928831267 | (5.1,34.5) | (-10,0) | 37.6597928831267
|(-5,-12) |(5.1,34.5)|47.5842410888311 | (-5,-12) | (5.1,34.5) | 47.5842410888311
|(5.1,34.5)|(-5,-12) |47.5842410888311 | (5.1,34.5) | (-5,-12) | 47.5842410888311
(36 rows) (36 rows)
QUERY: SELECT '' AS thirty, p1.f1 AS point1, p2.f1 AS point2 SELECT '' AS thirty, p1.f1 AS point1, p2.f1 AS point2
FROM POINT_TBL p1, POINT_TBL p2 FROM POINT_TBL p1, POINT_TBL p2
WHERE (p1.f1 <-> p2.f1) > 3; WHERE (p1.f1 <-> p2.f1) > 3;
thirty|point1 |point2 thirty | point1 | point2
------+----------+---------- --------+------------+------------
|(-10,0) |(0,0) | (-10,0) | (0,0)
|(-3,4) |(0,0) | (-3,4) | (0,0)
|(5.1,34.5)|(0,0) | (5.1,34.5) | (0,0)
|(-5,-12) |(0,0) | (-5,-12) | (0,0)
|(10,10) |(0,0) | (10,10) | (0,0)
|(0,0) |(-10,0) | (0,0) | (-10,0)
|(-3,4) |(-10,0) | (-3,4) | (-10,0)
|(5.1,34.5)|(-10,0) | (5.1,34.5) | (-10,0)
|(-5,-12) |(-10,0) | (-5,-12) | (-10,0)
|(10,10) |(-10,0) | (10,10) | (-10,0)
|(0,0) |(-3,4) | (0,0) | (-3,4)
|(-10,0) |(-3,4) | (-10,0) | (-3,4)
|(5.1,34.5)|(-3,4) | (5.1,34.5) | (-3,4)
|(-5,-12) |(-3,4) | (-5,-12) | (-3,4)
|(10,10) |(-3,4) | (10,10) | (-3,4)
|(0,0) |(5.1,34.5) | (0,0) | (5.1,34.5)
|(-10,0) |(5.1,34.5) | (-10,0) | (5.1,34.5)
|(-3,4) |(5.1,34.5) | (-3,4) | (5.1,34.5)
|(-5,-12) |(5.1,34.5) | (-5,-12) | (5.1,34.5)
|(10,10) |(5.1,34.5) | (10,10) | (5.1,34.5)
|(0,0) |(-5,-12) | (0,0) | (-5,-12)
|(-10,0) |(-5,-12) | (-10,0) | (-5,-12)
|(-3,4) |(-5,-12) | (-3,4) | (-5,-12)
|(5.1,34.5)|(-5,-12) | (5.1,34.5) | (-5,-12)
|(10,10) |(-5,-12) | (10,10) | (-5,-12)
|(0,0) |(10,10) | (0,0) | (10,10)
|(-10,0) |(10,10) | (-10,0) | (10,10)
|(-3,4) |(10,10) | (-3,4) | (10,10)
|(5.1,34.5)|(10,10) | (5.1,34.5) | (10,10)
|(-5,-12) |(10,10) | (-5,-12) | (10,10)
(30 rows) (30 rows)
QUERY: SELECT '' AS fifteen, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance -- 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
FROM POINT_TBL p1, POINT_TBL p2 FROM POINT_TBL p1, POINT_TBL p2
WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1
ORDER BY distance, point1 using <<, point2 using <<; ORDER BY distance, point1 using <<, point2 using <<;
fifteen|point1 |point2 | distance fifteen | point1 | point2 | distance
-------+----------+----------+---------------- ---------+------------+------------+------------------
|(-3,4) |(0,0) | 5 | (-3,4) | (0,0) | 5
|(-10,0) |(-3,4) |8.06225774829855 | (-10,0) | (-3,4) | 8.06225774829855
|(-10,0) |(0,0) | 10 | (-10,0) | (0,0) | 10
|(-10,0) |(-5,-12) | 13 | (-10,0) | (-5,-12) | 13
|(-5,-12) |(0,0) | 13 | (-5,-12) | (0,0) | 13
|(0,0) |(10,10) | 14.142135623731 | (0,0) | (10,10) | 14.142135623731
|(-3,4) |(10,10) |14.3178210632764 | (-3,4) | (10,10) | 14.3178210632764
|(-5,-12) |(-3,4) |16.1245154965971 | (-5,-12) | (-3,4) | 16.1245154965971
|(-10,0) |(10,10) |22.3606797749979 | (-10,0) | (10,10) | 22.3606797749979
|(5.1,34.5)|(10,10) |24.9851956166046 | (5.1,34.5) | (10,10) | 24.9851956166046
|(-5,-12) |(10,10) |26.6270539113887 | (-5,-12) | (10,10) | 26.6270539113887
|(-3,4) |(5.1,34.5)|31.5572495632937 | (-3,4) | (5.1,34.5) | 31.5572495632937
|(0,0) |(5.1,34.5)|34.8749193547455 | (0,0) | (5.1,34.5) | 34.8749193547455
|(-10,0) |(5.1,34.5)|37.6597928831267 | (-10,0) | (5.1,34.5) | 37.6597928831267
|(-5,-12) |(5.1,34.5)|47.5842410888311 | (-5,-12) | (5.1,34.5) | 47.5842410888311
(15 rows) (15 rows)
QUERY: SELECT '' AS three, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance -- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10
FROM POINT_TBL p1, POINT_TBL p2 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 WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 >^ p2.f1
ORDER BY distance; ORDER BY distance;
three|point1 |point2 | distance three | point1 | point2 | distance
-----+----------+--------+---------------- -------+------------+----------+------------------
|(-3,4) |(0,0) | 5 | (-3,4) | (0,0) | 5
|(-10,0) |(-5,-12)| 13 | (-10,0) | (-5,-12) | 13
|(5.1,34.5)|(10,10) |24.9851956166046 | (5.1,34.5) | (10,10) | 24.9851956166046
(3 rows) (3 rows)
QUERY: RESET geqo; RESET geqo;
QUERY: CREATE TABLE POLYGON_TBL(f1 polygon); --
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,0.0),(2.0,4.0),(0.0,0.0)'); -- POLYGON
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)'); --
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)'); -- polygon logic
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)'); --
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('0.0'); -- 3 o
-- |
-- 2 + |
-- / |
-- 1 # o +
-- / |
-- 0 #-----o-+
--
-- 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)');
-- 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)');
-- bad polygon input strings
INSERT INTO POLYGON_TBL(f1) VALUES ('0.0');
ERROR: Bad polygon external representation '0.0' ERROR: Bad polygon external representation '0.0'
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0'); INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0');
ERROR: Bad polygon external representation '(0.0 0.0' ERROR: Bad polygon external representation '(0.0 0.0'
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)'); INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)');
ERROR: Bad polygon external representation '(0,1,2)' ERROR: Bad polygon external representation '(0,1,2)'
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3'); INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
ERROR: Bad polygon external representation '(0,1,2,3' ERROR: Bad polygon external representation '(0,1,2,3'
QUERY: INSERT INTO POLYGON_TBL(f1) VALUES ('asdf'); INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
ERROR: Bad polygon external representation 'asdf' ERROR: Bad polygon external representation 'asdf'
QUERY: SELECT '' AS four, POLYGON_TBL.*; SELECT '' AS four, POLYGON_TBL.*;
four|f1 four | f1
----+------------------- ------+---------------------
|((2,0),(2,4),(0,0)) | ((2,0),(2,4),(0,0))
|((3,1),(3,3),(1,0)) | ((3,1),(3,3),(1,0))
|((0,0)) | ((0,0))
|((0,1),(0,1)) | ((0,1),(0,1))
(4 rows) (4 rows)
QUERY: SELECT '' AS three, p.* -- overlap
SELECT '' AS three, p.*
FROM POLYGON_TBL 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)';
three|f1 three | f1
-----+------------------- -------+---------------------
|((2,0),(2,4),(0,0)) | ((2,0),(2,4),(0,0))
|((3,1),(3,3),(1,0)) | ((3,1),(3,3),(1,0))
(2 rows) (2 rows)
QUERY: SELECT '' AS four, p.* -- left overlap
SELECT '' AS four, p.*
FROM POLYGON_TBL 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)';
four|f1 four | f1
----+------------------- ------+---------------------
|((2,0),(2,4),(0,0)) | ((2,0),(2,4),(0,0))
|((3,1),(3,3),(1,0)) | ((3,1),(3,3),(1,0))
|((0,0)) | ((0,0))
|((0,1),(0,1)) | ((0,1),(0,1))
(4 rows) (4 rows)
QUERY: SELECT '' AS two, p.* -- right overlap
SELECT '' AS two, p.*
FROM POLYGON_TBL 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)';
two|f1 two | f1
---+------------------- -----+---------------------
|((2,0),(2,4),(0,0)) | ((2,0),(2,4),(0,0))
|((3,1),(3,3),(1,0)) | ((3,1),(3,3),(1,0))
(2 rows) (2 rows)
QUERY: SELECT '' AS one, p.* -- left of
SELECT '' AS one, p.*
FROM POLYGON_TBL 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)';
one|f1 one | f1
---+------------- -----+---------------
|((0,0)) | ((0,0))
|((0,1),(0,1)) | ((0,1),(0,1))
(2 rows) (2 rows)
QUERY: SELECT '' AS zero, p.* -- right of
SELECT '' AS zero, p.*
FROM POLYGON_TBL 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)';
zero|f1 zero | f1
----+-- ------+----
(0 rows) (0 rows)
QUERY: SELECT '' AS one, p.* -- contained
SELECT '' AS one, p.*
FROM POLYGON_TBL p FROM POLYGON_TBL p
WHERE p.f1 @ '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon; WHERE p.f1 @ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
one|f1 one | f1
---+------------------- -----+---------------------
|((3,1),(3,3),(1,0)) | ((3,1),(3,3),(1,0))
(1 row) (1 row)
QUERY: SELECT '' AS one, p.* -- same
SELECT '' AS one, p.*
FROM POLYGON_TBL p FROM POLYGON_TBL p
WHERE p.f1 ~= '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon; WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
one|f1 one | f1
---+------------------- -----+---------------------
|((3,1),(3,3),(1,0)) | ((3,1),(3,3),(1,0))
(1 row) (1 row)
QUERY: SELECT '' AS one, p.* -- contains
SELECT '' AS one, p.*
FROM POLYGON_TBL p FROM POLYGON_TBL p
WHERE p.f1 ~ '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon; WHERE p.f1 ~ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
one|f1 one | f1
---+------------------- -----+---------------------
|((3,1),(3,3),(1,0)) | ((3,1),(3,3),(1,0))
(1 row) (1 row)
QUERY: SELECT '(2.0,0.0),(2.0,4.0),(0.0,0.0)'::polygon << '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon AS false; --
false -- polygon logic
----- --
f -- 3 o
-- |
-- 2 + |
-- / |
-- 1 / o +
-- / |
-- 0 +-----o-+
--
-- 0 1 2 3 4
--
-- left of
SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
false
-------
f
(1 row) (1 row)
QUERY: SELECT '(2.0,0.0),(2.0,4.0),(0.0,0.0)'::polygon << '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon AS true; -- left overlap
true SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
---- true
f ------
f
(1 row) (1 row)
QUERY: SELECT '(2.0,0.0),(2.0,4.0),(0.0,0.0)'::polygon &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon AS true; -- right overlap
true SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
---- true
t ------
t
(1 row) (1 row)
QUERY: SELECT '(2.0,0.0),(2.0,4.0),(0.0,0.0)'::polygon >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon AS false; -- right of
false SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' >> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
----- false
f -------
f
(1 row) (1 row)
QUERY: SELECT '(2.0,0.0),(2.0,4.0),(0.0,0.0)'::polygon @ '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon AS false; -- contained in
false SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' @ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
----- false
f -------
f
(1 row) (1 row)
QUERY: SELECT '(2.0,0.0),(2.0,4.0),(0.0,0.0)'::polygon ~ '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon AS false; -- contains
false SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' ~ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
----- false
f -------
f
(1 row) (1 row)
QUERY: SELECT '(2.0,0.0),(2.0,4.0),(0.0,0.0)'::polygon ~= '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon AS false; -- same
false SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
----- false
f -------
f
(1 row) (1 row)
QUERY: SELECT '(2.0,0.0),(2.0,4.0),(0.0,0.0)'::polygon && '(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon AS true; -- overlap
true SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' && polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
---- true
t ------
t
(1 row) (1 row)
QUERY: CREATE TABLE RELTIME_TBL (f1 reltime); --
QUERY: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 1 minute'); -- RELTIME
QUERY: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 5 hour'); --
QUERY: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 10 day'); CREATE TABLE RELTIME_TBL (f1 reltime);
QUERY: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 34 year'); INSERT INTO RELTIME_TBL (f1) VALUES ('@ 1 minute');
QUERY: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 3 months'); INSERT INTO RELTIME_TBL (f1) VALUES ('@ 5 hour');
QUERY: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 14 seconds ago'); INSERT INTO RELTIME_TBL (f1) VALUES ('@ 10 day');
QUERY: INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltime'); INSERT INTO RELTIME_TBL (f1) VALUES ('@ 34 year');
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 3 months');
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 14 seconds ago');
-- badly formatted reltimes
INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltime');
ERROR: Bad reltime external representation 'badly formatted reltime' ERROR: Bad reltime external representation 'badly formatted reltime'
QUERY: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago'); INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago');
ERROR: Bad reltime external representation '@ 30 eons ago' ERROR: Bad reltime external representation '@ 30 eons ago'
QUERY: SELECT '' AS six, RELTIME_TBL.*; -- test reltime operators
six|f1 SELECT '' AS six, RELTIME_TBL.*;
---+------------- six | f1
|@ 1 min -----+---------------
|@ 5 hours | @ 1 min
|@ 10 days | @ 5 hours
|@ 34 years | @ 10 days
|@ 3 mons | @ 34 years
|@ 14 secs ago | @ 3 mons
| @ 14 secs ago
(6 rows) (6 rows)
QUERY: SELECT '' AS five, RELTIME_TBL.* SELECT '' AS five, RELTIME_TBL.*
WHERE RELTIME_TBL.f1 <> '@ 10 days'::reltime; WHERE RELTIME_TBL.f1 <> reltime '@ 10 days';
five|f1 five | f1
----+------------- ------+---------------
|@ 1 min | @ 1 min
|@ 5 hours | @ 5 hours
|@ 34 years | @ 34 years
|@ 3 mons | @ 3 mons
|@ 14 secs ago | @ 14 secs ago
(5 rows) (5 rows)
QUERY: SELECT '' AS three, RELTIME_TBL.* SELECT '' AS three, RELTIME_TBL.*
WHERE RELTIME_TBL.f1 <= '@ 5 hours'::reltime; WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours';
three|f1 three | f1
-----+------------- -------+---------------
|@ 1 min | @ 1 min
|@ 5 hours | @ 5 hours
|@ 14 secs ago | @ 14 secs ago
(3 rows) (3 rows)
QUERY: SELECT '' AS three, RELTIME_TBL.* SELECT '' AS three, RELTIME_TBL.*
WHERE RELTIME_TBL.f1 < '@ 1 day'::reltime; WHERE RELTIME_TBL.f1 < reltime '@ 1 day';
three|f1 three | f1
-----+------------- -------+---------------
|@ 1 min | @ 1 min
|@ 5 hours | @ 5 hours
|@ 14 secs ago | @ 14 secs ago
(3 rows) (3 rows)
QUERY: SELECT '' AS one, RELTIME_TBL.* SELECT '' AS one, RELTIME_TBL.*
WHERE RELTIME_TBL.f1 = '@ 34 years'::reltime; WHERE RELTIME_TBL.f1 = reltime '@ 34 years';
one|f1 one | f1
---+---------- -----+------------
|@ 34 years | @ 34 years
(1 row) (1 row)
QUERY: SELECT '' AS two, RELTIME_TBL.* SELECT '' AS two, RELTIME_TBL.*
WHERE RELTIME_TBL.f1 >= '@ 1 month'::reltime; WHERE RELTIME_TBL.f1 >= reltime '@ 1 month';
two|f1 two | f1
---+---------- -----+------------
|@ 34 years | @ 34 years
|@ 3 mons | @ 3 mons
(2 rows) (2 rows)
QUERY: SELECT '' AS five, RELTIME_TBL.* SELECT '' AS five, RELTIME_TBL.*
WHERE RELTIME_TBL.f1 > '@ 3 seconds ago'::reltime; WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago';
five|f1 five | f1
----+---------- ------+------------
|@ 1 min | @ 1 min
|@ 5 hours | @ 5 hours
|@ 10 days | @ 10 days
|@ 34 years | @ 34 years
|@ 3 mons | @ 3 mons
(5 rows) (5 rows)
QUERY: SELECT '' AS fifteen, r1.*, r2.* SELECT '' AS fifteen, r1.*, r2.*
FROM RELTIME_TBL r1, RELTIME_TBL r2 FROM RELTIME_TBL r1, RELTIME_TBL r2
WHERE r1.f1 > r2.f1 WHERE r1.f1 > r2.f1
ORDER BY r1.f1, r2.f1; ORDER BY r1.f1, r2.f1;
fifteen|f1 |f1 fifteen | f1 | f1
-------+----------+------------- ---------+------------+---------------
|@ 1 min |@ 14 secs ago | @ 1 min | @ 14 secs ago
|@ 5 hours |@ 14 secs ago | @ 5 hours | @ 14 secs ago
|@ 5 hours |@ 1 min | @ 5 hours | @ 1 min
|@ 10 days |@ 14 secs ago | @ 10 days | @ 14 secs ago
|@ 10 days |@ 1 min | @ 10 days | @ 1 min
|@ 10 days |@ 5 hours | @ 10 days | @ 5 hours
|@ 3 mons |@ 14 secs ago | @ 3 mons | @ 14 secs ago
|@ 3 mons |@ 1 min | @ 3 mons | @ 1 min
|@ 3 mons |@ 5 hours | @ 3 mons | @ 5 hours
|@ 3 mons |@ 10 days | @ 3 mons | @ 10 days
|@ 34 years|@ 14 secs ago | @ 34 years | @ 14 secs ago
|@ 34 years|@ 1 min | @ 34 years | @ 1 min
|@ 34 years|@ 5 hours | @ 34 years | @ 5 hours
|@ 34 years|@ 10 days | @ 34 years | @ 10 days
|@ 34 years|@ 3 mons | @ 34 years | @ 3 mons
(15 rows) (15 rows)
QUERY: SELECT 'first line' --
-- STRINGS
-- Test various data entry syntaxes.
--
-- SQL92 string continuation syntax
SELECT 'first line'
' - next line' ' - next line'
' - third line' ' - third line'
AS "Three lines to one"; AS "Three lines to one";
Three lines to one Three lines to one
----------------------------------- -------------------------------------
first line - next line - third line first line - next line - third line
(1 row) (1 row)
QUERY: SELECT 'first line' -- illegal string continuation syntax
SELECT 'first line'
' - next line' /* this comment is not allowed here */ ' - next line' /* this comment is not allowed here */
' - third line' ' - third line'
AS "Illegal comment within continuation"; AS "Illegal comment within continuation";
ERROR: parser: parse error at or near "'" ERROR: parser: parse error at or near "'"
QUERY: SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL; --
text(char) -- test conversions between various string types
---------- --
a SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL;
ab text(char)
abcd ------------
abcd a
ab
abcd
abcd
(4 rows) (4 rows)
QUERY: SELECT CAST(f1 AS text) AS "text(varchar)" FROM VARCHAR_TBL; SELECT CAST(f1 AS text) AS "text(varchar)" FROM VARCHAR_TBL;
text(varchar) text(varchar)
------------- ---------------
a a
ab ab
abcd abcd
abcd abcd
(4 rows) (4 rows)
QUERY: SELECT CAST(name 'namefield' AS text) AS "text(name)"; SELECT CAST(name 'namefield' AS text) AS "text(name)";
text(name) text(name)
---------- ------------
namefield namefield
(1 row) (1 row)
QUERY: SELECT CAST(f1 AS char) AS "char(text)" FROM TEXT_TBL; SELECT CAST(f1 AS char) AS "char(text)" FROM TEXT_TBL;
char(text) char(text)
----------------- -------------------
doh! doh!
hi de ho neighbor hi de ho neighbor
(2 rows) (2 rows)
QUERY: SELECT CAST(f1 AS char) AS "char(varchar)" FROM VARCHAR_TBL; SELECT CAST(f1 AS char) AS "char(varchar)" FROM VARCHAR_TBL;
char(varchar) char(varchar)
------------- ---------------
a a
ab ab
abcd abcd
abcd abcd
(4 rows) (4 rows)
QUERY: SELECT CAST(name 'namefield' AS char) AS "char(name)"; SELECT CAST(name 'namefield' AS char) AS "char(name)";
char(name) char(name)
---------- ------------
namefield namefield
(1 row) (1 row)
QUERY: SELECT CAST(f1 AS varchar) AS "varchar(text)" FROM TEXT_TBL; SELECT CAST(f1 AS varchar) AS "varchar(text)" FROM TEXT_TBL;
varchar(text) varchar(text)
----------------- -------------------
doh! doh!
hi de ho neighbor hi de ho neighbor
(2 rows) (2 rows)
QUERY: SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL; SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL;
varchar(char) varchar(char)
------------- ---------------
a a
ab ab
abcd abcd
abcd abcd
(4 rows) (4 rows)
QUERY: SELECT CAST(name 'namefield' AS varchar) AS "varchar(name)"; SELECT CAST(name 'namefield' AS varchar) AS "varchar(name)";
varchar(name) varchar(name)
------------- ---------------
namefield namefield
(1 row) (1 row)
QUERY: SELECT TRIM(BOTH FROM ' bunch o blanks ') AS "bunch o blanks"; --
bunch o blanks -- test SQL92 string functions
-------------- --
bunch o blanks SELECT TRIM(BOTH FROM ' bunch o blanks ') AS "bunch o blanks";
bunch o blanks
----------------
bunch o blanks
(1 row) (1 row)
QUERY: SELECT TRIM(LEADING FROM ' bunch o blanks ') AS "bunch o blanks "; SELECT TRIM(LEADING FROM ' bunch o blanks ') AS "bunch o blanks ";
bunch o blanks bunch o blanks
---------------- ------------------
bunch o blanks bunch o blanks
(1 row) (1 row)
QUERY: SELECT TRIM(TRAILING FROM ' bunch o blanks ') AS " bunch o blanks"; SELECT TRIM(TRAILING FROM ' bunch o blanks ') AS " bunch o blanks";
bunch o blanks bunch o blanks
---------------- ------------------
bunch o blanks bunch o blanks
(1 row) (1 row)
QUERY: SELECT TRIM(BOTH 'x' FROM 'xxxxxsome Xsxxxxx') AS "some Xs"; SELECT TRIM(BOTH 'x' FROM 'xxxxxsome Xsxxxxx') AS "some Xs";
some Xs some Xs
------- ---------
some Xs some Xs
(1 row) (1 row)
QUERY: SELECT SUBSTRING('1234567890' FROM 3) AS "34567890"; SELECT SUBSTRING('1234567890' FROM 3) AS "34567890";
34567890 34567890
-------- ----------
34567890 34567890
(1 row) (1 row)
QUERY: SELECT SUBSTRING('1234567890' FROM 4 FOR 3) AS "456"; SELECT SUBSTRING('1234567890' FROM 4 FOR 3) AS "456";
456 456
--- -----
456 456
(1 row) (1 row)
QUERY: SELECT POSITION('4' IN '1234567890') AS "4"; SELECT POSITION('4' IN '1234567890') AS "4";
4 4
- ---
4 4
(1 row) (1 row)
QUERY: SELECT POSITION(5 IN '1234567890') AS "5"; SELECT POSITION(5 IN '1234567890') AS "5";
5 5
- ---
5 5
(1 row) (1 row)
QUERY: SELECT 'unknown' || ' and unknown' AS "Concat unknown types"; --
Concat unknown types -- test implicit type conversion
-------------------- --
unknown and unknown SELECT 'unknown' || ' and unknown' AS "Concat unknown types";
Concat unknown types
----------------------
unknown and unknown
(1 row) (1 row)
QUERY: SELECT text 'text' || ' and unknown' AS "Concat text to unknown type"; SELECT text 'text' || ' and unknown' AS "Concat text to unknown type";
Concat text to unknown type Concat text to unknown type
--------------------------- -----------------------------
text and unknown text and unknown
(1 row) (1 row)
QUERY: SELECT text 'text' || char ' and char' AS "Concat text to char"; SELECT text 'text' || char ' and char' AS "Concat text to char";
Concat text to char Concat text to char
------------------- ---------------------
text and char text and char
(1 row) (1 row)
QUERY: SELECT text 'text' || varchar ' and varchar' AS "Concat text to varchar"; SELECT text 'text' || varchar ' and varchar' AS "Concat text to varchar";
Concat text to varchar Concat text to varchar
---------------------- ------------------------
text and varchar text and varchar
(1 row) (1 row)
QUERY: CREATE TABLE TIMESPAN_TBL (f1 timespan); --
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 1 minute'); -- TIMESPAN
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 5 hour'); --
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 10 day'); CREATE TABLE TIMESPAN_TBL (f1 timespan);
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 34 year'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 1 minute');
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 3 months'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 5 hour');
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 14 seconds ago'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 10 day');
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('1 day 2 hours 3 minutes 4 seconds'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 34 year');
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('6 years'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 3 months');
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('5 months'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 14 seconds ago');
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('5 months 12 hours'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('1 day 2 hours 3 minutes 4 seconds');
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('badly formatted timespan'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('6 years');
INSERT INTO TIMESPAN_TBL (f1) VALUES ('5 months');
INSERT INTO TIMESPAN_TBL (f1) VALUES ('5 months 12 hours');
-- badly formatted timespan
INSERT INTO TIMESPAN_TBL (f1) VALUES ('badly formatted timespan');
ERROR: Bad timespan external representation 'badly formatted timespan' ERROR: Bad timespan external representation 'badly formatted timespan'
QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 30 eons ago'); INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 30 eons ago');
ERROR: Bad timespan external representation '@ 30 eons ago' ERROR: Bad timespan external representation '@ 30 eons ago'
QUERY: SELECT '' AS ten, TIMESPAN_TBL.*; -- test timespan operators
ten|f1 SELECT '' AS ten, TIMESPAN_TBL.*;
---+----------------------------- ten | f1
|@ 1 min -----+-------------------------------
|@ 5 hours | @ 1 min
|@ 10 days | @ 5 hours
|@ 34 years | @ 10 days
|@ 3 mons | @ 34 years
|@ 14 secs ago | @ 3 mons
|@ 1 day 2 hours 3 mins 4 secs | @ 14 secs ago
|@ 6 years | @ 1 day 2 hours 3 mins 4 secs
|@ 5 mons | @ 6 years
|@ 5 mons 12 hours | @ 5 mons
| @ 5 mons 12 hours
(10 rows) (10 rows)
QUERY: SELECT '' AS nine, TIMESPAN_TBL.* SELECT '' AS nine, TIMESPAN_TBL.*
WHERE TIMESPAN_TBL.f1 <> '@ 10 days'::timespan; WHERE TIMESPAN_TBL.f1 <> timespan '@ 10 days';
nine|f1 nine | f1
----+----------------------------- ------+-------------------------------
|@ 1 min | @ 1 min
|@ 5 hours | @ 5 hours
|@ 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
(9 rows) (9 rows)
QUERY: SELECT '' AS three, TIMESPAN_TBL.* SELECT '' AS three, TIMESPAN_TBL.*
WHERE TIMESPAN_TBL.f1 <= '@ 5 hours'::timespan; WHERE TIMESPAN_TBL.f1 <= timespan '@ 5 hours';
three|f1 three | f1
-----+------------- -------+---------------
|@ 1 min | @ 1 min
|@ 5 hours | @ 5 hours
|@ 14 secs ago | @ 14 secs ago
(3 rows) (3 rows)
QUERY: SELECT '' AS three, TIMESPAN_TBL.* SELECT '' AS three, TIMESPAN_TBL.*
WHERE TIMESPAN_TBL.f1 < '@ 1 day'::timespan; WHERE TIMESPAN_TBL.f1 < timespan '@ 1 day';
three|f1 three | f1
-----+------------- -------+---------------
|@ 1 min | @ 1 min
|@ 5 hours | @ 5 hours
|@ 14 secs ago | @ 14 secs ago
(3 rows) (3 rows)
QUERY: SELECT '' AS one, TIMESPAN_TBL.* SELECT '' AS one, TIMESPAN_TBL.*
WHERE TIMESPAN_TBL.f1 = '@ 34 years'::timespan; WHERE TIMESPAN_TBL.f1 = timespan '@ 34 years';
one|f1 one | f1
---+---------- -----+------------
|@ 34 years | @ 34 years
(1 row) (1 row)
QUERY: SELECT '' AS five, TIMESPAN_TBL.* SELECT '' AS five, TIMESPAN_TBL.*
WHERE TIMESPAN_TBL.f1 >= '@ 1 month'::timespan; WHERE TIMESPAN_TBL.f1 >= timespan '@ 1 month';
five|f1 five | f1
----+----------------- ------+-------------------
|@ 34 years | @ 34 years
|@ 3 mons | @ 3 mons
|@ 6 years | @ 6 years
|@ 5 mons | @ 5 mons
|@ 5 mons 12 hours | @ 5 mons 12 hours
(5 rows) (5 rows)
QUERY: SELECT '' AS nine, TIMESPAN_TBL.* SELECT '' AS nine, TIMESPAN_TBL.*
WHERE TIMESPAN_TBL.f1 > '@ 3 seconds ago'::timespan; WHERE TIMESPAN_TBL.f1 > timespan '@ 3 seconds ago';
nine|f1 nine | f1
----+----------------------------- ------+-------------------------------
|@ 1 min | @ 1 min
|@ 5 hours | @ 5 hours
|@ 10 days | @ 10 days
|@ 34 years | @ 34 years
|@ 3 mons | @ 3 mons
|@ 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
(9 rows) (9 rows)
QUERY: SELECT '' AS fortyfive, r1.*, r2.* SELECT '' AS fortyfive, r1.*, r2.*
FROM TIMESPAN_TBL r1, TIMESPAN_TBL r2 FROM TIMESPAN_TBL r1, TIMESPAN_TBL r2
WHERE r1.f1 > r2.f1 WHERE r1.f1 > r2.f1
ORDER BY r1.f1, r2.f1; ORDER BY r1.f1, r2.f1;
fortyfive|f1 |f1 fortyfive | f1 | f1
---------+-----------------------------+----------------------------- -----------+-------------------------------+-------------------------------
|@ 1 min |@ 14 secs ago | @ 1 min | @ 14 secs ago
|@ 5 hours |@ 14 secs ago | @ 5 hours | @ 14 secs ago
|@ 5 hours |@ 1 min | @ 5 hours | @ 1 min
|@ 1 day 2 hours 3 mins 4 secs|@ 14 secs ago | @ 1 day 2 hours 3 mins 4 secs | @ 14 secs ago
|@ 1 day 2 hours 3 mins 4 secs|@ 1 min | @ 1 day 2 hours 3 mins 4 secs | @ 1 min
|@ 1 day 2 hours 3 mins 4 secs|@ 5 hours | @ 1 day 2 hours 3 mins 4 secs | @ 5 hours
|@ 10 days |@ 14 secs ago | @ 10 days | @ 14 secs ago
|@ 10 days |@ 1 min | @ 10 days | @ 1 min
|@ 10 days |@ 5 hours | @ 10 days | @ 5 hours
|@ 10 days |@ 1 day 2 hours 3 mins 4 secs | @ 10 days | @ 1 day 2 hours 3 mins 4 secs
|@ 3 mons |@ 14 secs ago | @ 3 mons | @ 14 secs ago
|@ 3 mons |@ 1 min | @ 3 mons | @ 1 min
|@ 3 mons |@ 5 hours | @ 3 mons | @ 5 hours
|@ 3 mons |@ 1 day 2 hours 3 mins 4 secs | @ 3 mons | @ 1 day 2 hours 3 mins 4 secs
|@ 3 mons |@ 10 days | @ 3 mons | @ 10 days
|@ 5 mons |@ 14 secs ago | @ 5 mons | @ 14 secs ago
|@ 5 mons |@ 1 min | @ 5 mons | @ 1 min
|@ 5 mons |@ 5 hours | @ 5 mons | @ 5 hours
|@ 5 mons |@ 1 day 2 hours 3 mins 4 secs | @ 5 mons | @ 1 day 2 hours 3 mins 4 secs
|@ 5 mons |@ 10 days | @ 5 mons | @ 10 days
|@ 5 mons |@ 3 mons | @ 5 mons | @ 3 mons
|@ 5 mons 12 hours |@ 14 secs ago | @ 5 mons 12 hours | @ 14 secs ago
|@ 5 mons 12 hours |@ 1 min | @ 5 mons 12 hours | @ 1 min
|@ 5 mons 12 hours |@ 5 hours | @ 5 mons 12 hours | @ 5 hours
|@ 5 mons 12 hours |@ 1 day 2 hours 3 mins 4 secs | @ 5 mons 12 hours | @ 1 day 2 hours 3 mins 4 secs
|@ 5 mons 12 hours |@ 10 days | @ 5 mons 12 hours | @ 10 days
|@ 5 mons 12 hours |@ 3 mons | @ 5 mons 12 hours | @ 3 mons
|@ 5 mons 12 hours |@ 5 mons | @ 5 mons 12 hours | @ 5 mons
|@ 6 years |@ 14 secs ago | @ 6 years | @ 14 secs ago
|@ 6 years |@ 1 min | @ 6 years | @ 1 min
|@ 6 years |@ 5 hours | @ 6 years | @ 5 hours
|@ 6 years |@ 1 day 2 hours 3 mins 4 secs | @ 6 years | @ 1 day 2 hours 3 mins 4 secs
|@ 6 years |@ 10 days | @ 6 years | @ 10 days
|@ 6 years |@ 3 mons | @ 6 years | @ 3 mons
|@ 6 years |@ 5 mons | @ 6 years | @ 5 mons
|@ 6 years |@ 5 mons 12 hours | @ 6 years | @ 5 mons 12 hours
|@ 34 years |@ 14 secs ago | @ 34 years | @ 14 secs ago
|@ 34 years |@ 1 min | @ 34 years | @ 1 min
|@ 34 years |@ 5 hours | @ 34 years | @ 5 hours
|@ 34 years |@ 1 day 2 hours 3 mins 4 secs | @ 34 years | @ 1 day 2 hours 3 mins 4 secs
|@ 34 years |@ 10 days | @ 34 years | @ 10 days
|@ 34 years |@ 3 mons | @ 34 years | @ 3 mons
|@ 34 years |@ 5 mons | @ 34 years | @ 5 mons
|@ 34 years |@ 5 mons 12 hours | @ 34 years | @ 5 mons 12 hours
|@ 34 years |@ 6 years | @ 34 years | @ 6 years
(45 rows) (45 rows)
QUERY: CREATE TABLE TINTERVAL_TBL (f1 tinterval); --
QUERY: INSERT INTO TINTERVAL_TBL (f1) -- TINTERVAL
--
CREATE TABLE TINTERVAL_TBL (f1 tinterval);
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["-infinity" "infinity"]'); VALUES ('["-infinity" "infinity"]');
QUERY: INSERT INTO TINTERVAL_TBL (f1) INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["May 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]'); VALUES ('["May 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]');
QUERY: INSERT INTO TINTERVAL_TBL (f1) INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["Sep 4, 1983 23:59:12" "Oct 4, 1983 23:59:12"]'); VALUES ('["Sep 4, 1983 23:59:12" "Oct 4, 1983 23:59:12"]');
QUERY: INSERT INTO TINTERVAL_TBL (f1) INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["epoch" "Mon May 1 00:30:30 1995"]'); VALUES ('["epoch" "Mon May 1 00:30:30 1995"]');
QUERY: INSERT INTO TINTERVAL_TBL (f1) INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["Feb 15 1990 12:15:03" "current"]'); VALUES ('["Feb 15 1990 12:15:03" "current"]');
QUERY: INSERT INTO TINTERVAL_TBL (f1) -- badly formatted tintervals
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["bad time specifications" ""]'); VALUES ('["bad time specifications" ""]');
ERROR: Bad abstime external representation 'bad time specifications' ERROR: Bad abstime external representation 'bad time specifications'
QUERY: INSERT INTO TINTERVAL_TBL (f1) INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["" "infinity"]'); VALUES ('["" "infinity"]');
ERROR: Bad abstime external representation '' ERROR: Bad abstime external representation ''
QUERY: SELECT '' AS five, TINTERVAL_TBL.*; -- test tinterval operators
five|f1 SELECT '' AS five, TINTERVAL_TBL.*;
----+--------------------------------------------------------------- five | f1
|["-infinity" "infinity"] ------+-----------------------------------------------------------------
|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["-infinity" "infinity"]
|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
|["Thu Feb 15 12:15:03 1990 PST" "current"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"]
(5 rows) (5 rows)
QUERY: SELECT '' AS one, t.* -- length ==
SELECT '' AS one, t.*
FROM TINTERVAL_TBL t FROM TINTERVAL_TBL t
WHERE t.f1 #= '@ 1 months'; WHERE t.f1 #= '@ 1 months';
one|f1 one | f1
---+--------------------------------------------------------------- -----+-----------------------------------------------------------------
|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
(1 row) (1 row)
QUERY: SELECT '' AS three, t.* -- length <>
SELECT '' AS three, t.*
FROM TINTERVAL_TBL t FROM TINTERVAL_TBL t
WHERE t.f1 #<> '@ 1 months'; WHERE t.f1 #<> '@ 1 months';
three|f1 three | f1
-----+--------------------------------------------------------------- -------+-----------------------------------------------------------------
|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
|["Thu Feb 15 12:15:03 1990 PST" "current"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
(3 rows) (3 rows)
QUERY: SELECT '' AS zero, t.* -- length <
SELECT '' AS zero, t.*
FROM TINTERVAL_TBL t FROM TINTERVAL_TBL t
WHERE t.f1 #< '@ 1 month'; WHERE t.f1 #< '@ 1 month';
zero|f1 zero | f1
----+-- ------+----
(0 rows) (0 rows)
QUERY: SELECT '' AS one, t.* -- length <=
SELECT '' AS one, t.*
FROM TINTERVAL_TBL t FROM TINTERVAL_TBL t
WHERE t.f1 #<= '@ 1 month'; WHERE t.f1 #<= '@ 1 month';
one|f1 one | f1
---+--------------------------------------------------------------- -----+-----------------------------------------------------------------
|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
(1 row) (1 row)
QUERY: SELECT '' AS three, t.* -- length >
SELECT '' AS three, t.*
FROM TINTERVAL_TBL t FROM TINTERVAL_TBL t
WHERE t.f1 #> '@ 1 year'; WHERE t.f1 #> '@ 1 year';
three|f1 three | f1
-----+--------------------------------------------------------------- -------+-----------------------------------------------------------------
|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
|["Thu Feb 15 12:15:03 1990 PST" "current"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
(3 rows) (3 rows)
QUERY: SELECT '' AS three, t.* -- length >=
SELECT '' AS three, t.*
FROM TINTERVAL_TBL t FROM TINTERVAL_TBL t
WHERE t.f1 #>= '@ 3 years'; WHERE t.f1 #>= '@ 3 years';
three|f1 three | f1
-----+--------------------------------------------------------------- -------+-----------------------------------------------------------------
|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
|["Thu Feb 15 12:15:03 1990 PST" "current"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
(3 rows) (3 rows)
QUERY: SELECT '' AS three, t1.* -- overlaps
SELECT '' AS three, t1.*
FROM TINTERVAL_TBL t1 FROM TINTERVAL_TBL t1
WHERE t1.f1 && WHERE t1.f1 &&
'["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]'::tinterval; tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]';
three|f1 three | f1
-----+--------------------------------------------------------------- -------+-----------------------------------------------------------------
|["-infinity" "infinity"] | ["-infinity" "infinity"]
|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
(3 rows) (3 rows)
QUERY: SET geqo TO 'off'; SET geqo TO 'off';
QUERY: SELECT '' AS five, t1.f1, t2.f1 SELECT '' AS five, t1.f1, t2.f1
FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2 FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2
WHERE t1.f1 && t2.f1 and WHERE t1.f1 && t2.f1 and
t1.f1 = t2.f1 t1.f1 = t2.f1
ORDER BY t1.f1, t2.f1; ORDER BY t1.f1, t2.f1;
five|f1 |f1 five | f1 | f1
----+---------------------------------------------------------------+--------------------------------------------------------------- ------+-----------------------------------------------------------------+-----------------------------------------------------------------
|["-infinity" "infinity"] |["-infinity" "infinity"] | ["-infinity" "infinity"] | ["-infinity" "infinity"]
|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
|["Thu Feb 15 12:15:03 1990 PST" "current"] |["Thu Feb 15 12:15:03 1990 PST" "current"] | ["Thu Feb 15 12:15:03 1990 PST" "current"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] |["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]
(5 rows) (5 rows)
QUERY: SELECT '' AS fourteen, t1.f1 AS interval1, t2.f1 AS interval2 SELECT '' AS fourteen, t1.f1 AS interval1, t2.f1 AS interval2
FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2 FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2
WHERE t1.f1 && t2.f1 and not t1.f1 = t2.f1 WHERE t1.f1 && t2.f1 and not t1.f1 = t2.f1
ORDER BY interval1, interval2; ORDER BY interval1, interval2;
fourteen|interval1 |interval2 fourteen | interval1 | interval2
--------+---------------------------------------------------------------+--------------------------------------------------------------- ----------+-----------------------------------------------------------------+-----------------------------------------------------------------
|["-infinity" "infinity"] |["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["-infinity" "infinity"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
|["-infinity" "infinity"] |["Thu Feb 15 12:15:03 1990 PST" "current"] | ["-infinity" "infinity"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
|["-infinity" "infinity"] |["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["-infinity" "infinity"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
|["-infinity" "infinity"] |["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["-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"]|["-infinity" "infinity"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["-infinity" "infinity"]
|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]|["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
|["Thu Feb 15 12:15:03 1990 PST" "current"] |["-infinity" "infinity"] | ["Thu Feb 15 12:15:03 1990 PST" "current"] | ["-infinity" "infinity"]
|["Thu Feb 15 12:15:03 1990 PST" "current"] |["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "current"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] |["-infinity" "infinity"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["-infinity" "infinity"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] |["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] |["Thu Feb 15 12:15:03 1990 PST" "current"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] |["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]
|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]|["-infinity" "infinity"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["-infinity" "infinity"]
|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]|["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
(14 rows) (14 rows)
QUERY: SELECT '' AS five, t1.f1 -- contains
SELECT '' AS five, t1.f1
FROM TINTERVAL_TBL t1 FROM TINTERVAL_TBL t1
WHERE not t1.f1 << WHERE not t1.f1 <<
'["Aug 15 14:23:19 1980" "Sep 16 14:23:19 1990"]'::tinterval tinterval '["Aug 15 14:23:19 1980" "Sep 16 14:23:19 1990"]'
ORDER BY t1.f1; ORDER BY t1.f1;
five|f1 five | f1
----+--------------------------------------------------------------- ------+-----------------------------------------------------------------
|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
|["Thu Feb 15 12:15:03 1990 PST" "current"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
|["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"]
(3 rows) (3 rows)
QUERY: SELECT '' AS three, t1.f1 -- make time interval
SELECT '' AS three, t1.f1
FROM TINTERVAL_TBL t1 FROM TINTERVAL_TBL t1
WHERE t1.f1 && WHERE t1.f1 &&
('Aug 15 14:23:19 1983'::abstime <#> (abstime 'Aug 15 14:23:19 1983' <#>
'Sep 16 14:23:19 1983'::abstime) abstime 'Sep 16 14:23:19 1983')
ORDER BY t1.f1; ORDER BY t1.f1;
three|f1 three | f1
-----+--------------------------------------------------------------- -------+-----------------------------------------------------------------
|["-infinity" "infinity"] | ["-infinity" "infinity"]
|["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
|["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
(3 rows) (3 rows)
QUERY: RESET geqo; RESET geqo;
QUERY: SELECT p1.oid, p1.typname --
-- TYPE_SANITY
-- Sanity checks for common errors in making type-related system tables:
-- pg_type, pg_class, pg_attribute.
--
-- None of the SELECTs here should ever find any matching entries,
-- so the expected output is easy to maintain ;-).
-- A test failure indicates someone messed up an entry in the system tables.
--
-- NB: we assume the oidjoins test will have caught any dangling links,
-- that is OID or REGPROC fields that are not zero and do not match some
-- row in the linked-to table. However, if we want to enforce that a link
-- field can't be 0, we have to check it here.
-- **************** pg_type ****************
-- Look for illegal values in pg_type fields.
SELECT p1.oid, p1.typname
FROM pg_type as p1 FROM pg_type as p1
WHERE (p1.typlen <= 0 AND p1.typlen != -1) OR WHERE (p1.typlen <= 0 AND p1.typlen != -1) OR
(p1.typtype != 'b' AND p1.typtype != 'c') OR (p1.typtype != 'b' AND p1.typtype != 'c') OR
NOT p1.typisdefined OR NOT p1.typisdefined OR
(p1.typalign != 'c' AND p1.typalign != 's' AND (p1.typalign != 'c' AND p1.typalign != 's' AND
p1.typalign != 'i' AND p1.typalign != 'd'); p1.typalign != 'i' AND p1.typalign != 'd');
oid|typname oid | typname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.typname -- Look for "pass by value" types that can't be passed by value.
SELECT p1.oid, p1.typname
FROM pg_type as p1 FROM pg_type as p1
WHERE p1.typbyval AND WHERE p1.typbyval AND
(p1.typlen != 1 OR p1.typalign != 'c') AND (p1.typlen != 1 OR p1.typalign != 'c') AND
(p1.typlen != 2 OR p1.typalign != 's') AND (p1.typlen != 2 OR p1.typalign != 's') AND
(p1.typlen != 4 OR p1.typalign != 'i'); (p1.typlen != 4 OR p1.typalign != 'i');
oid|typname oid | typname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.typname -- Look for complex types that do not have a typrelid entry,
-- or basic types that do.
SELECT p1.oid, p1.typname
FROM pg_type as p1 FROM pg_type as p1
WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR
(p1.typtype != 'c' AND p1.typrelid != 0); (p1.typtype != 'c' AND p1.typrelid != 0);
oid|typname oid | typname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.typname -- Conversion routines must be provided except in 'c' entries.
SELECT p1.oid, p1.typname
FROM pg_type as p1 FROM pg_type as p1
WHERE p1.typtype != 'c' AND WHERE p1.typtype != 'c' AND
(p1.typinput = 0 OR p1.typoutput = 0 OR (p1.typinput = 0 OR p1.typoutput = 0 OR
p1.typreceive = 0 OR p1.typsend = 0); p1.typreceive = 0 OR p1.typsend = 0);
oid|typname oid | typname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.typname, p2.oid, p2.proname -- Check for bogus typinput routines
-- FIXME: ought to check prorettype, but there are special cases that make it
-- hard: prorettype might be binary-compatible with the type but not the same,
-- and for array types array_in's result has nothing to do with anything.
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2 FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typinput = p2.oid AND p1.typtype = 'b' AND WHERE p1.typinput = p2.oid AND p1.typtype = 'b' AND
(p2.pronargs != 1 OR p2.proretset) AND (p2.pronargs != 1 OR p2.proretset) AND
(p2.pronargs != 3 OR p2.proretset OR p2.proargtypes[2] != 23); (p2.pronargs != 3 OR p2.proretset OR p2.proargtypes[2] != 23);
oid|typname|oid|proname oid | typname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.typname, p2.oid, p2.proname -- Check for bogus typoutput routines
-- The first OR subclause detects bogus non-array cases,
-- the second one detects bogus array cases.
-- FIXME: ought to check prorettype, but not clear what it should be.
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2 FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typoutput = p2.oid AND p1.typtype = 'b' AND WHERE p1.typoutput = p2.oid AND p1.typtype = 'b' AND
(p2.pronargs != 1 OR p2.proretset) AND (p2.pronargs != 1 OR p2.proretset) AND
(p2.pronargs != 2 OR p2.proretset OR p1.typelem = 0); (p2.pronargs != 2 OR p2.proretset OR p1.typelem = 0);
oid|typname|oid|proname oid | typname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.typname, p2.oid, p2.proname -- Check for bogus typreceive routines
-- FIXME: ought to check prorettype, but there are special cases that make it
-- hard: prorettype might be binary-compatible with the type but not the same,
-- and for array types array_in's result has nothing to do with anything.
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2 FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype = 'b' AND WHERE p1.typreceive = p2.oid AND p1.typtype = 'b' AND
(p2.pronargs != 1 OR p2.proretset) AND (p2.pronargs != 1 OR p2.proretset) AND
(p2.pronargs != 3 OR p2.proretset OR p2.proargtypes[2] != 23); (p2.pronargs != 3 OR p2.proretset OR p2.proargtypes[2] != 23);
oid|typname|oid|proname oid | typname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.typname, p2.oid, p2.proname -- Check for bogus typsend routines
-- The first OR subclause detects bogus non-array cases,
-- the second one detects bogus array cases.
-- FIXME: ought to check prorettype, but not clear what it should be.
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2 FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typsend = p2.oid AND p1.typtype = 'b' AND WHERE p1.typsend = p2.oid AND p1.typtype = 'b' AND
(p2.pronargs != 1 OR p2.proretset) AND (p2.pronargs != 1 OR p2.proretset) AND
(p2.pronargs != 2 OR p2.proretset OR p1.typelem = 0); (p2.pronargs != 2 OR p2.proretset OR p1.typelem = 0);
oid|typname|oid|proname oid | typname | oid | proname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.relname -- **************** pg_class ****************
-- Look for illegal values in pg_class fields
SELECT p1.oid, p1.relname
FROM pg_class as p1 FROM pg_class as p1
WHERE (p1.relkind != 'r' AND p1.relkind != 'i' AND WHERE (p1.relkind != 'r' AND p1.relkind != 'i' AND
p1.relkind != 's' AND p1.relkind != 'S'); p1.relkind != 's' AND p1.relkind != 'S');
oid|relname oid | relname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.relname -- Indexes should have an access method, others not.
SELECT p1.oid, p1.relname
FROM pg_class as p1 FROM pg_class as p1
WHERE (p1.relkind = 'i' AND p1.relam = 0) OR WHERE (p1.relkind = 'i' AND p1.relam = 0) OR
(p1.relkind != 'i' AND p1.relam != 0); (p1.relkind != 'i' AND p1.relam != 0);
oid|relname oid | relname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.attrelid, p1.attname -- **************** pg_attribute ****************
-- Look for illegal values in pg_attribute fields
SELECT p1.oid, p1.attrelid, p1.attname
FROM pg_attribute as p1 FROM pg_attribute as p1
WHERE p1.attrelid = 0 OR p1.atttypid = 0 OR p1.attnum = 0 OR WHERE p1.attrelid = 0 OR p1.atttypid = 0 OR p1.attnum = 0 OR
p1.attcacheoff != -1; p1.attcacheoff != -1;
oid|attrelid|attname oid | attrelid | attname
---+--------+------- -----+----------+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.attname, p2.oid, p2.attname -- Look for duplicate pg_attribute entries
-- (This would not be necessary if the indexes on pg_attribute were UNIQUE?)
SELECT p1.oid, p1.attname, p2.oid, p2.attname
FROM pg_attribute AS p1, pg_attribute AS p2 FROM pg_attribute AS p1, pg_attribute AS p2
WHERE p1.oid != p2.oid AND WHERE p1.oid != p2.oid AND
p1.attrelid = p2.attrelid AND p1.attrelid = p2.attrelid AND
(p1.attname = p2.attname OR p1.attnum = p2.attnum); (p1.attname = p2.attname OR p1.attnum = p2.attnum);
oid|attname|oid|attname oid | attname | oid | attname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.attname, p2.oid, p2.relname -- Cross-check attnum against parent relation
SELECT p1.oid, p1.attname, p2.oid, p2.relname
FROM pg_attribute AS p1, pg_class AS p2 FROM pg_attribute AS p1, pg_class AS p2
WHERE p1.attrelid = p2.oid AND p1.attnum > p2.relnatts; WHERE p1.attrelid = p2.oid AND p1.attnum > p2.relnatts;
oid|attname|oid|relname oid | attname | oid | relname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.relname -- Detect missing pg_attribute entries: should have as many non-system
-- attributes as parent relation expects
SELECT p1.oid, p1.relname
FROM pg_class AS p1 FROM pg_class AS p1
WHERE p1.relnatts != (SELECT count(*) FROM pg_attribute AS p2 WHERE p1.relnatts != (SELECT count(*) FROM pg_attribute AS p2
WHERE p2.attrelid = p1.oid AND p2.attnum > 0); WHERE p2.attrelid = p1.oid AND p2.attnum > 0);
oid|relname oid | relname
---+------- -----+---------
(0 rows) (0 rows)
QUERY: SELECT p1.oid, p1.attname, p2.oid, p2.typname -- Cross-check against pg_type entry
SELECT p1.oid, p1.attname, p2.oid, p2.typname
FROM pg_attribute AS p1, pg_type AS p2 FROM pg_attribute AS p1, pg_type AS p2
WHERE p1.atttypid = p2.oid AND WHERE p1.atttypid = p2.oid AND
(p1.attlen != p2.typlen OR (p1.attlen != p2.typlen OR
p1.attalign != p2.typalign OR p1.attalign != p2.typalign OR
p1.attbyval != p2.typbyval); p1.attbyval != p2.typbyval);
oid|attname|oid|typname oid | attname | oid | typname
---+-------+---+------- -----+---------+-----+---------
(0 rows) (0 rows)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment