--- /dev/null
+QUERY: CREATE TABLE DATETIME_TBL( d1 datetime);
+QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('now');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('today');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('yesterday');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow zulu');
+QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'today'::datetime;
+one
+---
+ 1
+(1 row)
+
+QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'tomorrow'::datetime;
+one
+---
+ 1
+(1 row)
+
+QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'yesterday'::datetime;
+one
+---
+ 1
+(1 row)
+
+QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'today'::datetime + '1 day'::timespan;
+one
+---
+ 1
+(1 row)
+
+QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'today'::datetime - '1 day'::timespan;
+one
+---
+ 1
+(1 row)
+
+QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
+QUERY: BEGIN;
+QUERY: INSERT INTO DATETIME_TBL VALUES ('now');
+QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
+one
+---
+ 1
+(1 row)
+
+QUERY: END;
+QUERY: DELETE FROM DATETIME_TBL;
+QUERY: INSERT INTO DATETIME_TBL VALUES ('invalid');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('-infinity');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('infinity');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('epoch');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Invalid Abstime');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Undefined Abstime');
+QUERY: 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.999999 1997 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.4 1997 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.5 1997 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Mon Feb 10 17:32:01.6 1997 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-01-02');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-01-02 03:04:05');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01-08');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01-0800');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01 -08:00');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('19970210 173201 -0800');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-06-10 17:32:01 -07:00');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997 -0800');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 10 5:32PM 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997/02/10 17:32:01-0800');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-02-10 17:32:01 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb-10-1997 17:32:01 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('02-10-1997 17:32:01 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('19970210 173201 PST');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('97FEB10 5:32:01PM UTC');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('97/02/10 17:32:01 UTC');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('97.041 17:32:01 UTC');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('1997-06-10 18:32:01 PDT');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 10 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 11 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 12 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 13 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 14 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 15 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0097 BC');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0097');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 0597');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1097');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1697');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1797');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1897');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 2097');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 28 17:32:01 1996');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 29 17:32:01 1996');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Mar 01 17:32:01 1996');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 30 17:32:01 1996');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1996');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 28 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 29 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Mar 01 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 30 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1997');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 1999');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 2000');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Dec 31 17:32:01 2000');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Jan 01 17:32:01 2001');
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 -0097');
+WARN:Bad datetime external representation Feb 16 17:32:01 -0097
+QUERY: INSERT INTO DATETIME_TBL VALUES ('Feb 16 17:32:01 5097 BC');
+QUERY: SELECT '' AS sixtythree, d1 FROM DATETIME_TBL;
+sixtythree|d1
+----------+-------------------------------
+ |invalid
+ |-infinity
+ |infinity
+ |epoch
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |invalid
+ |invalid
+ |Mon Feb 10 17:32:01.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.50 1997 PST
+ |Mon Feb 10 17:32:01.60 1997 PST
+ |Thu Jan 02 00:00:00.00 1997 PST
+ |Thu Jan 02 03:04:05.00 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:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Tue Jun 10 17:32:01.00 1997 PDT
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:00.00 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:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Tue Jun 10 18:32:01.00 1997 PDT
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Tue Feb 11 17:32:01.00 1997 PST
+ |Wed Feb 12 17:32:01.00 1997 PST
+ |Thu Feb 13 17:32:01.00 1997 PST
+ |Fri Feb 14 17:32:01.00 1997 PST
+ |Sat Feb 15 17:32:01.00 1997 PST
+ |Sun Feb 16 17:32:01.00 1997 PST
+ |Tue Feb 16 17:32 0097 BC
+ |Sat Feb 16 17:32:01.00 0097
+ |Thu Feb 16 17:32:01.00 0597
+ |Tue Feb 16 17:32:01.00 1097
+ |Sat Feb 16 17:32:01.00 1697
+ |Thu Feb 16 17:32:01.00 1797
+ |Tue Feb 16 17:32:01.00 1897
+ |Sun Feb 16 17:32:01.00 1997 PST
+ |Sat Feb 16 17:32:01.00 2097
+ |Wed Feb 28 17:32:01.00 1996 PST
+ |Thu Feb 29 17:32:01.00 1996 PST
+ |Fri Mar 01 17:32:01.00 1996 PST
+ |Mon Dec 30 17:32:01.00 1996 PST
+ |Tue Dec 31 17:32:01.00 1996 PST
+ |Wed Jan 01 17:32:01.00 1997 PST
+ |Fri Feb 28 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Tue Dec 30 17:32:01.00 1997 PST
+ |Wed Dec 31 17:32:01.00 1997 PST
+ |Fri Dec 31 17:32:01.00 1999 PST
+ |Sat Jan 01 17:32:01.00 2000 PST
+ |Sun Dec 31 17:32:01.00 2000 PST
+ |Mon Jan 01 17:32:01.00 2001 PST
+ |invalid
+(63 rows)
+
+QUERY: SELECT '' AS fortythree, d1 FROM DATETIME_TBL
+ WHERE d1 > '1997-01-02'::datetime and d1 != 'current'::datetime;
+fortythree|d1
+----------+-------------------------------
+ |infinity
+ |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:01.40 1997 PST
+ |Mon Feb 10 17:32:01.50 1997 PST
+ |Mon Feb 10 17:32:01.60 1997 PST
+ |Thu Jan 02 03:04:05.00 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:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Tue Jun 10 17:32:01.00 1997 PDT
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:00.00 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:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Tue Jun 10 18:32:01.00 1997 PDT
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Tue Feb 11 17:32:01.00 1997 PST
+ |Wed Feb 12 17:32:01.00 1997 PST
+ |Thu Feb 13 17:32:01.00 1997 PST
+ |Fri Feb 14 17:32:01.00 1997 PST
+ |Sat Feb 15 17:32:01.00 1997 PST
+ |Sun Feb 16 17:32:01.00 1997 PST
+ |Sun Feb 16 17:32:01.00 1997 PST
+ |Sat Feb 16 17:32:01.00 2097
+ |Fri Feb 28 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Tue Dec 30 17:32:01.00 1997 PST
+ |Wed Dec 31 17:32:01.00 1997 PST
+ |Fri Dec 31 17:32:01.00 1999 PST
+ |Sat Jan 01 17:32:01.00 2000 PST
+ |Sun Dec 31 17:32:01.00 2000 PST
+ |Mon Jan 01 17:32:01.00 2001 PST
+(43 rows)
+
+QUERY: SELECT '' AS fifteen, d1 FROM DATETIME_TBL
+ WHERE d1 < '1997-01-02'::datetime and d1 != 'current'::datetime;
+fifteen|d1
+-------+-------------------------------
+ |-infinity
+ |epoch
+ |Tue Feb 16 17:32 0097 BC
+ |Sat Feb 16 17:32:01.00 0097
+ |Thu Feb 16 17:32:01.00 0597
+ |Tue Feb 16 17:32:01.00 1097
+ |Sat Feb 16 17:32:01.00 1697
+ |Thu Feb 16 17:32:01.00 1797
+ |Tue Feb 16 17:32:01.00 1897
+ |Wed Feb 28 17:32:01.00 1996 PST
+ |Thu Feb 29 17:32:01.00 1996 PST
+ |Fri Mar 01 17:32:01.00 1996 PST
+ |Mon Dec 30 17:32:01.00 1996 PST
+ |Tue Dec 31 17:32:01.00 1996 PST
+ |Wed Jan 01 17:32:01.00 1997 PST
+(15 rows)
+
+QUERY: SELECT '' AS one, d1 FROM DATETIME_TBL
+ WHERE d1 = '1997-01-02'::datetime and d1 != 'current'::datetime;
+one|d1
+---+-------------------------------
+ |Thu Jan 02 00:00:00.00 1997 PST
+(1 row)
+
+QUERY: SELECT '' AS fiftyeight, d1 FROM DATETIME_TBL
+ WHERE d1 != '1997-01-02'::datetime and d1 != 'current'::datetime;
+fiftyeight|d1
+----------+-------------------------------
+ |-infinity
+ |infinity
+ |epoch
+ |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:01.40 1997 PST
+ |Mon Feb 10 17:32:01.50 1997 PST
+ |Mon Feb 10 17:32:01.60 1997 PST
+ |Thu Jan 02 03:04:05.00 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:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Tue Jun 10 17:32:01.00 1997 PDT
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:00.00 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:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Tue Jun 10 18:32:01.00 1997 PDT
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Tue Feb 11 17:32:01.00 1997 PST
+ |Wed Feb 12 17:32:01.00 1997 PST
+ |Thu Feb 13 17:32:01.00 1997 PST
+ |Fri Feb 14 17:32:01.00 1997 PST
+ |Sat Feb 15 17:32:01.00 1997 PST
+ |Sun Feb 16 17:32:01.00 1997 PST
+ |Tue Feb 16 17:32 0097 BC
+ |Sat Feb 16 17:32:01.00 0097
+ |Thu Feb 16 17:32:01.00 0597
+ |Tue Feb 16 17:32:01.00 1097
+ |Sat Feb 16 17:32:01.00 1697
+ |Thu Feb 16 17:32:01.00 1797
+ |Tue Feb 16 17:32:01.00 1897
+ |Sun Feb 16 17:32:01.00 1997 PST
+ |Sat Feb 16 17:32:01.00 2097
+ |Wed Feb 28 17:32:01.00 1996 PST
+ |Thu Feb 29 17:32:01.00 1996 PST
+ |Fri Mar 01 17:32:01.00 1996 PST
+ |Mon Dec 30 17:32:01.00 1996 PST
+ |Tue Dec 31 17:32:01.00 1996 PST
+ |Wed Jan 01 17:32:01.00 1997 PST
+ |Fri Feb 28 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Tue Dec 30 17:32:01.00 1997 PST
+ |Wed Dec 31 17:32:01.00 1997 PST
+ |Fri Dec 31 17:32:01.00 1999 PST
+ |Sat Jan 01 17:32:01.00 2000 PST
+ |Sun Dec 31 17:32:01.00 2000 PST
+ |Mon Jan 01 17:32:01.00 2001 PST
+(58 rows)
+
+QUERY: SELECT '' AS sixteen, d1 FROM DATETIME_TBL
+ WHERE d1 <= '1997-01-02'::datetime and d1 != 'current'::datetime;
+sixteen|d1
+-------+-------------------------------
+ |-infinity
+ |epoch
+ |Thu Jan 02 00:00:00.00 1997 PST
+ |Tue Feb 16 17:32 0097 BC
+ |Sat Feb 16 17:32:01.00 0097
+ |Thu Feb 16 17:32:01.00 0597
+ |Tue Feb 16 17:32:01.00 1097
+ |Sat Feb 16 17:32:01.00 1697
+ |Thu Feb 16 17:32:01.00 1797
+ |Tue Feb 16 17:32:01.00 1897
+ |Wed Feb 28 17:32:01.00 1996 PST
+ |Thu Feb 29 17:32:01.00 1996 PST
+ |Fri Mar 01 17:32:01.00 1996 PST
+ |Mon Dec 30 17:32:01.00 1996 PST
+ |Tue Dec 31 17:32:01.00 1996 PST
+ |Wed Jan 01 17:32:01.00 1997 PST
+(16 rows)
+
+QUERY: SELECT '' AS fortyfour, d1 FROM DATETIME_TBL
+ WHERE d1 >= '1997-01-02'::datetime and d1 != 'current'::datetime;
+fortyfour|d1
+---------+-------------------------------
+ |infinity
+ |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:01.40 1997 PST
+ |Mon Feb 10 17:32:01.50 1997 PST
+ |Mon Feb 10 17:32:01.60 1997 PST
+ |Thu Jan 02 00:00:00.00 1997 PST
+ |Thu Jan 02 03:04:05.00 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:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Tue Jun 10 17:32:01.00 1997 PDT
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:00.00 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:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Mon Feb 10 09:32:01.00 1997 PST
+ |Tue Jun 10 18:32:01.00 1997 PDT
+ |Mon Feb 10 17:32:01.00 1997 PST
+ |Tue Feb 11 17:32:01.00 1997 PST
+ |Wed Feb 12 17:32:01.00 1997 PST
+ |Thu Feb 13 17:32:01.00 1997 PST
+ |Fri Feb 14 17:32:01.00 1997 PST
+ |Sat Feb 15 17:32:01.00 1997 PST
+ |Sun Feb 16 17:32:01.00 1997 PST
+ |Sun Feb 16 17:32:01.00 1997 PST
+ |Sat Feb 16 17:32:01.00 2097
+ |Fri Feb 28 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Tue Dec 30 17:32:01.00 1997 PST
+ |Wed Dec 31 17:32:01.00 1997 PST
+ |Fri Dec 31 17:32:01.00 1999 PST
+ |Sat Jan 01 17:32:01.00 2000 PST
+ |Sun Dec 31 17:32:01.00 2000 PST
+ |Mon Jan 01 17:32:01.00 2001 PST
+(44 rows)
+
+QUERY: SELECT '' AS sixtythree, d1 + '1 year'::timespan AS one_year FROM DATETIME_TBL;
+sixtythree|one_year
+----------+-------------------------------
+ |invalid
+ |-infinity
+ |infinity
+ |Thu Dec 31 16:00:00.00 1970 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |invalid
+ |invalid
+ |Tue Feb 10 17:32:01.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.50 1998 PST
+ |Tue Feb 10 17:32:01.60 1998 PST
+ |Fri Jan 02 00:00:00.00 1998 PST
+ |Fri Jan 02 03:04:05.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Wed Jun 10 17:32:01.00 1998 PDT
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:00.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Tue Feb 10 09:32:01.00 1998 PST
+ |Tue Feb 10 09:32:01.00 1998 PST
+ |Tue Feb 10 09:32:01.00 1998 PST
+ |Wed Jun 10 18:32:01.00 1998 PDT
+ |Tue Feb 10 17:32:01.00 1998 PST
+ |Wed Feb 11 17:32:01.00 1998 PST
+ |Thu Feb 12 17:32:01.00 1998 PST
+ |Fri Feb 13 17:32:01.00 1998 PST
+ |Sat Feb 14 17:32:01.00 1998 PST
+ |Sun Feb 15 17:32:01.00 1998 PST
+ |Mon Feb 16 17:32:01.00 1998 PST
+ |Thu Feb 16 17:32 0096 BC
+ |Sun Feb 16 17:32:01.00 0098
+ |Fri Feb 16 17:32:01.00 0598
+ |Wed Feb 16 17:32:01.00 1098
+ |Sun Feb 16 17:32:01.00 1698
+ |Fri Feb 16 17:32:01.00 1798
+ |Wed Feb 16 17:32:01.00 1898
+ |Mon Feb 16 17:32:01.00 1998 PST
+ |Sun Feb 16 17:32:01.00 2098
+ |Thu Feb 27 17:32:01.00 1997 PST
+ |Fri Feb 28 17:32:01.00 1997 PST
+ |Sat Mar 01 17:32:01.00 1997 PST
+ |Tue Dec 30 17:32:01.00 1997 PST
+ |Wed Dec 31 17:32:01.00 1997 PST
+ |Thu Jan 01 17:32:01.00 1998 PST
+ |Sat Feb 28 17:32:01.00 1998 PST
+ |Sun Mar 01 17:32:01.00 1998 PST
+ |Sun Mar 01 17:32:01.00 1998 PST
+ |Wed Dec 30 17:32:01.00 1998 PST
+ |Thu Dec 31 17:32:01.00 1998 PST
+ |Sun Dec 31 17:32:01.00 2000 PST
+ |Mon Jan 01 17:32:01.00 2001 PST
+ |Mon Dec 31 17:32:01.00 2001 PST
+ |Tue Jan 01 17:32:01.00 2002 PST
+ |invalid
+(63 rows)
+
+QUERY: SELECT '' AS sixtythree, d1 - '1 year'::timespan AS one_year FROM DATETIME_TBL;
+sixtythree|one_year
+----------+-------------------------------
+ |invalid
+ |-infinity
+ |infinity
+ |Tue Dec 31 16:00:00.00 1968 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |invalid
+ |invalid
+ |Sat Feb 10 17:32:01.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.50 1996 PST
+ |Sat Feb 10 17:32:01.60 1996 PST
+ |Tue Jan 02 00:00:00.00 1996 PST
+ |Tue Jan 02 03:04:05.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Mon Jun 10 17:32:01.00 1996 PDT
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:00.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sat Feb 10 09:32:01.00 1996 PST
+ |Sat Feb 10 09:32:01.00 1996 PST
+ |Sat Feb 10 09:32:01.00 1996 PST
+ |Mon Jun 10 18:32:01.00 1996 PDT
+ |Sat Feb 10 17:32:01.00 1996 PST
+ |Sun Feb 11 17:32:01.00 1996 PST
+ |Mon Feb 12 17:32:01.00 1996 PST
+ |Tue Feb 13 17:32:01.00 1996 PST
+ |Wed Feb 14 17:32:01.00 1996 PST
+ |Thu Feb 15 17:32:01.00 1996 PST
+ |Fri Feb 16 17:32:01.00 1996 PST
+ |Mon Feb 16 17:32 0098 BC
+ |Thu Feb 16 17:32:01.00 0096
+ |Tue Feb 16 17:32:01.00 0596
+ |Sun Feb 16 17:32:01.00 1096
+ |Thu Feb 16 17:32:01.00 1696
+ |Tue Feb 16 17:32:01.00 1796
+ |Sun Feb 16 17:32:01.00 1896
+ |Fri Feb 16 17:32:01.00 1996 PST
+ |Thu Feb 16 17:32:01.00 2096
+ |Mon Feb 27 17:32:01.00 1995 PST
+ |Tue Feb 28 17:32:01.00 1995 PST
+ |Wed Mar 01 17:32:01.00 1995 PST
+ |Sat Dec 30 17:32:01.00 1995 PST
+ |Sun Dec 31 17:32:01.00 1995 PST
+ |Mon Jan 01 17:32:01.00 1996 PST
+ |Thu Feb 29 17:32:01.00 1996 PST
+ |Fri Mar 01 17:32:01.00 1996 PST
+ |Fri Mar 01 17:32:01.00 1996 PST
+ |Mon Dec 30 17:32:01.00 1996 PST
+ |Tue Dec 31 17:32:01.00 1996 PST
+ |Thu Dec 31 17:32:01.00 1998 PST
+ |Fri Jan 01 17:32:01.00 1999 PST
+ |Fri Dec 31 17:32:01.00 1999 PST
+ |Sat Jan 01 17:32:01.00 2000 PST
+ |invalid
+(63 rows)
+
+QUERY: SELECT '' AS fifty, d1 - '1997-01-02'::datetime AS diff
+ FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
+fifty|diff
+-----+--------------------------------------
+ |@ 9863 days 8 hours ago
+ |@ 39 days 17 hours 32 mins 1 sec
+ |@ 39 days 17 hours 32 mins 1 sec
+ |@ 39 days 17 hours 32 mins 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
+ |@ 0
+ |@ 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
+ |@ 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
+ |@ 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
+ |@ 159 days 17 hours 32 mins 1 sec
+ |@ 39 days 17 hours 32 mins 1 sec
+ |@ 40 days 17 hours 32 mins 1 sec
+ |@ 41 days 17 hours 32 mins 1 sec
+ |@ 42 days 17 hours 32 mins 1 sec
+ |@ 43 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
+ |@ 308 days 6 hours 27 mins 59 secs ago
+ |@ 307 days 6 hours 27 mins 59 secs ago
+ |@ 306 days 6 hours 27 mins 59 secs ago
+ |@ 2 days 6 hours 27 mins 59 secs ago
+ |@ 1 day 6 hours 27 mins 59 secs ago
+ |@ 6 hours 27 mins 59 secs ago
+ |@ 57 days 17 hours 32 mins 1 sec
+ |@ 58 days 17 hours 32 mins 1 sec
+ |@ 58 days 17 hours 32 mins 1 sec
+ |@ 362 days 17 hours 32 mins 1 sec
+ |@ 363 days 17 hours 32 mins 1 sec
+ |@ 1093 days 17 hours 32 mins 1 sec
+ |@ 1094 days 17 hours 32 mins 1 sec
+ |@ 1459 days 17 hours 32 mins 1 sec
+ |@ 1460 days 17 hours 32 mins 1 sec
+(49 rows)
+
+QUERY: 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( 'minute', d1) AS minute, date_part( 'second', d1) AS second
+ FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
+fortynine|year|month|day|hour|minute| second
+---------+----+-----+---+----+------+--------
+ |1969| 12| 31| 16| 0| 0
+ |1997| 2| 10| 17| 32| 1
+ |1997| 2| 10| 17| 32|1.000001
+ |1997| 2| 10| 17| 32|1.999999
+ |1997| 2| 10| 17| 32| 1.4
+ |1997| 2| 10| 17| 32| 1.5
+ |1997| 2| 10| 17| 32| 1.6
+ |1997| 1| 2| 0| 0| 0
+ |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| 6| 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| 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| 6| 10| 18| 32| 1
+ |1997| 2| 10| 17| 32| 1
+ |1997| 2| 11| 17| 32| 1
+ |1997| 2| 12| 17| 32| 1
+ |1997| 2| 13| 17| 32| 1
+ |1997| 2| 14| 17| 32| 1
+ |1997| 2| 15| 17| 32| 1
+ |1997| 2| 16| 17| 32| 1
+ |1997| 2| 16| 17| 32| 1
+ |1996| 2| 28| 17| 32| 1
+ |1996| 2| 29| 17| 32| 1
+ |1996| 3| 1| 17| 32| 1
+ |1996| 12| 30| 17| 32| 1
+ |1996| 12| 31| 17| 32| 1
+ |1997| 1| 1| 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| 31| 17| 32| 1
+ |1999| 12| 31| 17| 32| 1
+ |2000| 1| 1| 17| 32| 1
+ |2000| 12| 31| 17| 32| 1
+ |2001| 1| 1| 17| 32| 1
+(49 rows)
+
+QUERY: SELECT '' AS fortynine, date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec,
+ date_part( 'usec', d1) AS usec
+ FROM DATETIME_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
+fortynine|quarter| msec| usec
+---------+-------+--------------------+-----------------
+ | 4| 0| 0
+ | 1| 0| 0
+ | 1|0.000999999999917733|0.999999999917733
+ | 1| 999.999| 999999
+ | 1| 400| 400000
+ | 1| 500| 500000
+ | 1| 600| 600000
+ | 1| 0| 0
+ | 1| 0| 0
+ | 1| 0| 0
+ | 1| 0| 0
+ | 1| 0| 0
+ | 1| 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
+ | 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
+ | 4| 0| 0
+ | 4| 0| 0
+ | 1| 0| 0
+ | 1| 0| 0
+ | 1| 0| 0
+ | 1| 0| 0
+ | 4| 0| 0
+ | 4| 0| 0
+ | 4| 0| 0
+ | 1| 0| 0
+ | 4| 0| 0
+ | 1| 0| 0
+(49 rows)
+
--- /dev/null
+QUERY: select 1
+select
+select * from nonesuch;
+WARN:parser: parse error at or near "select"
+
+QUERY: select nonesuch from pg_database;
+WARN:attribute "nonesuch" not found
+QUERY: select * from pg_database where nonesuch = pg_database.datname;
+WARN:attribute "nonesuch" not found
+QUERY: select * from pg_database where pg_database.datname = nonesuch;
+WARN:attribute "nonesuch" not found
+QUERY: select distinct on foobar from pg_database;
+WARN:parser: parse error at or near "from"
+
+QUERY: select distinct on foobar * from pg_database;
+WARN:The field specified in the UNIQUE ON clause is not in the targetlist
+QUERY: delete from;
+WARN:parser: parse error at or near ";"
+
+QUERY: delete from nonesuch;
+WARN:nonesuch: Table does not exist.
+QUERY: drop table;
+WARN:parser: parse error at or near ";"
+
+QUERY: drop table nonesuch;
+WARN:Relation nonesuch Does Not Exist!
+QUERY: alter table rename;
+WARN:parser: parse error at or near "rename"
+
+QUERY: alter table nonesuch rename to newnonesuch;
+WARN:renamerel: relation "nonesuch" does not exist
+QUERY: alter table nonesuch rename to stud_emp;
+WARN:renamerel: relation "nonesuch" does not exist
+QUERY: alter table stud_emp rename to pg_stud_emp;
+WARN:renamerel: Illegal class name: "pg_stud_emp" -- pg_ is reserved for system catalogs
+QUERY: alter table stud_emp rename to aggtest;
+WARN:renamerel: relation "aggtest" exists
+QUERY: alter table stud_emp rename to stud_emp;
+WARN:renamerel: relation "stud_emp" exists
+QUERY: alter table nonesuchrel rename column nonesuchatt to newnonesuchatt;
+WARN:renameatt: relation "nonesuchrel" nonexistent
+QUERY: alter table emp rename column nonesuchatt to newnonesuchatt;
+WARN:renameatt: attribute "nonesuchatt" nonexistent
+QUERY: alter table emp rename column salary to manager;
+WARN:renameatt: attribute "manager" exists
+QUERY: alter table emp rename column salary to oid;
+WARN:renameatt: attribute "oid" exists
+QUERY: abort;
+NOTICE:UserAbortTransactionBlock and not in in-progress state
+QUERY: end;
+NOTICE:EndTransactionBlock and not inprogress/abort state
+QUERY: create aggregate newavg1 (sfunc1 = int4pl,
+ basetype = int4,
+ stype1 = int4,
+ sfunc2 = int4inc,
+ stype2 = int4,
+ initcond1 = '0',
+ initcond2 = '0');
+WARN:AggregateCreate: Aggregate must have final function with both transition functions
+QUERY: create aggregate newavg2 (sfunc1 = int4pl,
+ basetype = int4,
+ stype1 = int4,
+ sfunc2 = int2inc,
+ stype2 = int2,
+ finalfunc = int4div,
+ initcond1 = '0',
+ initcond2 = '0');
+WARN:AggregateCreate: 'int4div'('int4','int2') does not exist
+QUERY: create aggregate newavg3 (sfunc1 = int4pl,
+ basetype = int4,
+ stype1 = int4,
+ sfunc2 = int4inc,
+ stype2 = int4,
+ finalfunc = int2div,
+ initcond1 = '0',
+ initcond2 = '0');
+WARN:AggregateCreate: 'int2div'('int4','int4') does not exist
+QUERY: create aggregate newcnt1 (sfunc2 = int4inc,
+ stype2 = int4,
+ initcond2 = '0');
+WARN:Define: "basetype" unspecified
+QUERY: create aggregate newcnt1 (sfunc2 = int4inc,
+ basetype = int4,
+ stype2 = int4);
+WARN:AggregateCreate: transition function 2 MUST have an initial value
+QUERY: drop index;
+WARN:parser: parse error at or near ";"
+
+QUERY: drop index 314159;
+WARN:parser: parse error at or near "314159"
+
+QUERY: drop index nonesuch;
+WARN:index "nonesuch" nonexistent
+QUERY: drop aggregate;
+WARN:parser: parse error at or near ";"
+
+QUERY: drop aggregate 314159;
+WARN:parser: parse error at or near "314159"
+
+QUERY: drop aggregate nonesuch;
+WARN:RemoveAggregate: aggregate 'nonesuch' does not exist
+QUERY: drop function ();
+WARN:parser: parse error at or near "("
+
+QUERY: drop function 314159();
+WARN:parser: parse error at or near "314159"
+
+QUERY: drop function nonesuch();
+WARN:RemoveFunction: function nonesuch() does not exist
+QUERY: drop type;
+WARN:parser: parse error at or near ";"
+
+QUERY: drop type 314159;
+WARN:parser: parse error at or near "314159"
+
+QUERY: drop type nonesuch;
+WARN:RemoveType: type 'nonesuch' does not exist
+QUERY: drop operator;
+WARN:parser: parse error at or near ";"
+
+QUERY: drop operator equals;
+WARN:parser: parse error at or near "equals"
+
+QUERY: drop operator ===;
+WARN:parser: parse error at or near ";"
+
+QUERY: drop operator int4, int4;
+WARN:parser: parse error at or near "int4"
+
+QUERY: drop operator (int4, int4);
+WARN:parser: parse error at or near "("
+
+QUERY: drop operator === ();
+WARN:parser: parse error at or near ")"
+
+QUERY: drop operator === (int4);
+WARN:parser: argument type missing (use NONE for unary operators)
+QUERY: drop operator === (int4, int4);
+WARN:RemoveOperator: binary operator '===' taking 'int4' and 'int4' does not exist
+QUERY: drop operator = (nonesuch);
+WARN:parser: argument type missing (use NONE for unary operators)
+QUERY: drop operator = ( , int4);
+WARN:parser: parse error at or near ","
+
+QUERY: drop operator = (nonesuch, int4);
+WARN:RemoveOperator: type 'nonesuch' does not exist
+QUERY: drop operator = (int4, nonesuch);
+WARN:RemoveOperator: type 'nonesuch' does not exist
+QUERY: drop operator = (int4, );
+WARN:parser: parse error at or near ")"
+
+QUERY: drop rule;
+WARN:parser: parse error at or near ";"
+
+QUERY: drop rule 314159;
+WARN:parser: parse error at or near "314159"
+
+QUERY: drop rule nonesuch;
+WARN:RewriteGetRuleEventRel: rule "nonesuch" not found
+QUERY: drop tuple rule nonesuch;
+WARN:parser: parse error at or near "tuple"
+
+QUERY: drop instance rule nonesuch;
+WARN:parser: parse error at or near "instance"
+
+QUERY: drop rewrite rule nonesuch;
+WARN:parser: parse error at or near "rewrite"
+
--- /dev/null
+QUERY: CREATE TABLE TIMESPAN_TBL (f1 timespan);
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 1 minute');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 5 hour');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 10 day');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 34 year');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 3 months');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 14 seconds ago');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('1 day 2 hours 3 minutes 4 seconds');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('6 years');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('5 months');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('5 months 12 hours');
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('badly formatted timespan');
+WARN:Bad timespan external representation badly formatted timespan
+QUERY: INSERT INTO TIMESPAN_TBL (f1) VALUES ('@ 30 eons ago');
+WARN:Bad timespan external representation @ 30 eons ago
+QUERY: SELECT '' AS ten, TIMESPAN_TBL.*;
+ten|f1
+---+-----------------------------
+ |@ 1 min
+ |@ 5 hours
+ |@ 10 days
+ |@ 34 years
+ |@ 3 mons
+ |@ 14 secs ago
+ |@ 1 day 2 hours 3 mins 4 secs
+ |@ 6 years
+ |@ 5 mons
+ |@ 5 mons 12 hours
+(10 rows)
+
+QUERY: SELECT '' AS nine, TIMESPAN_TBL.*
+ WHERE TIMESPAN_TBL.f1 <> '@ 10 days'::timespan;
+nine|f1
+----+-----------------------------
+ |@ 1 min
+ |@ 5 hours
+ |@ 34 years
+ |@ 3 mons
+ |@ 14 secs ago
+ |@ 1 day 2 hours 3 mins 4 secs
+ |@ 6 years
+ |@ 5 mons
+ |@ 5 mons 12 hours
+(9 rows)
+
+QUERY: SELECT '' AS three, TIMESPAN_TBL.*
+ WHERE TIMESPAN_TBL.f1 <= '@ 5 hours'::timespan;
+three|f1
+-----+-------------
+ |@ 1 min
+ |@ 5 hours
+ |@ 14 secs ago
+(3 rows)
+
+QUERY: SELECT '' AS three, TIMESPAN_TBL.*
+ WHERE TIMESPAN_TBL.f1 < '@ 1 day'::timespan;
+three|f1
+-----+-------------
+ |@ 1 min
+ |@ 5 hours
+ |@ 14 secs ago
+(3 rows)
+
+QUERY: SELECT '' AS one, TIMESPAN_TBL.*
+ WHERE TIMESPAN_TBL.f1 = '@ 34 years'::timespan;
+one|f1
+---+----------
+ |@ 34 years
+(1 row)
+
+QUERY: SELECT '' AS five, TIMESPAN_TBL.*
+ WHERE TIMESPAN_TBL.f1 >= '@ 1 month'::timespan;
+five|f1
+----+-----------------
+ |@ 34 years
+ |@ 3 mons
+ |@ 6 years
+ |@ 5 mons
+ |@ 5 mons 12 hours
+(5 rows)
+
+QUERY: SELECT '' AS nine, TIMESPAN_TBL.*
+ WHERE TIMESPAN_TBL.f1 > '@ 3 seconds ago'::timespan;
+nine|f1
+----+-----------------------------
+ |@ 1 min
+ |@ 5 hours
+ |@ 10 days
+ |@ 34 years
+ |@ 3 mons
+ |@ 1 day 2 hours 3 mins 4 secs
+ |@ 6 years
+ |@ 5 mons
+ |@ 5 mons 12 hours
+(9 rows)
+
+QUERY: SELECT '' AS fortyfive, r1.*, r2.*
+ FROM TIMESPAN_TBL r1, TIMESPAN_TBL r2
+ WHERE r1.f1 > r2.f1;
+fortyfive|f1 |f1
+---------+-----------------------------+-----------------------------
+ |@ 5 hours |@ 1 min
+ |@ 10 days |@ 1 min
+ |@ 34 years |@ 1 min
+ |@ 3 mons |@ 1 min
+ |@ 1 day 2 hours 3 mins 4 secs|@ 1 min
+ |@ 6 years |@ 1 min
+ |@ 5 mons |@ 1 min
+ |@ 5 mons 12 hours |@ 1 min
+ |@ 10 days |@ 5 hours
+ |@ 34 years |@ 5 hours
+ |@ 3 mons |@ 5 hours
+ |@ 1 day 2 hours 3 mins 4 secs|@ 5 hours
+ |@ 6 years |@ 5 hours
+ |@ 5 mons |@ 5 hours
+ |@ 5 mons 12 hours |@ 5 hours
+ |@ 34 years |@ 10 days
+ |@ 3 mons |@ 10 days
+ |@ 6 years |@ 10 days
+ |@ 5 mons |@ 10 days
+ |@ 5 mons 12 hours |@ 10 days
+ |@ 34 years |@ 3 mons
+ |@ 6 years |@ 3 mons
+ |@ 5 mons |@ 3 mons
+ |@ 5 mons 12 hours |@ 3 mons
+ |@ 1 min |@ 14 secs ago
+ |@ 5 hours |@ 14 secs ago
+ |@ 10 days |@ 14 secs ago
+ |@ 34 years |@ 14 secs ago
+ |@ 3 mons |@ 14 secs ago
+ |@ 1 day 2 hours 3 mins 4 secs|@ 14 secs ago
+ |@ 6 years |@ 14 secs ago
+ |@ 5 mons |@ 14 secs ago
+ |@ 5 mons 12 hours |@ 14 secs ago
+ |@ 10 days |@ 1 day 2 hours 3 mins 4 secs
+ |@ 34 years |@ 1 day 2 hours 3 mins 4 secs
+ |@ 3 mons |@ 1 day 2 hours 3 mins 4 secs
+ |@ 6 years |@ 1 day 2 hours 3 mins 4 secs
+ |@ 5 mons |@ 1 day 2 hours 3 mins 4 secs
+ |@ 5 mons 12 hours |@ 1 day 2 hours 3 mins 4 secs
+ |@ 34 years |@ 6 years
+ |@ 34 years |@ 5 mons
+ |@ 6 years |@ 5 mons
+ |@ 5 mons 12 hours |@ 5 mons
+ |@ 34 years |@ 5 mons 12 hours
+ |@ 6 years |@ 5 mons 12 hours
+(45 rows)
+
--
--
-CREATE FUNCTION circle_in(opaque)
- RETURNS circle
- AS '_OBJWD_/regress_DLSUFFIX_'
+CREATE FUNCTION widget_in(opaque)
+ RETURNS widget
+ AS '_CWD_/regress_DLSUFFIX_'
LANGUAGE 'c';
-CREATE FUNCTION circle_out(opaque)
+CREATE FUNCTION widget_out(opaque)
RETURNS opaque
- AS '_OBJWD_/regress_DLSUFFIX_'
+ AS '_CWD_/regress_DLSUFFIX_'
LANGUAGE 'c';
--- /dev/null
+--
+-- hash index
+-- grep 843938989 hash.data
+--
+SELECT hash_i4_heap.*
+ WHERE hash_i4_heap.random = 843938989;
+
+--
+-- hash index
+-- grep 66766766 hash.data
+--
+SELECT hash_i4_heap.*
+ WHERE hash_i4_heap.random = 66766766;
+
+--
+-- hash index
+-- grep 1505703298 hash.data
+--
+SELECT hash_c16_heap.*
+ WHERE hash_c16_heap.random = '1505703298'::char16;
+
+--
+-- hash index
+-- grep 7777777 hash.data
+--
+SELECT hash_c16_heap.*
+ WHERE hash_c16_heap.random = '7777777'::char16;
+
+--
+-- hash index
+-- grep 1351610853 hash.data
+--
+SELECT hash_txt_heap.*
+ WHERE hash_txt_heap.random = '1351610853'::text;
+
+--
+-- hash index
+-- grep 111111112222222233333333 hash.data
+--
+SELECT hash_txt_heap.*
+ WHERE hash_txt_heap.random = '111111112222222233333333'::text;
+
+--
+-- hash index
+-- grep 444705537 hash.data
+--
+SELECT hash_f8_heap.*
+ WHERE hash_f8_heap.random = '444705537'::float8;
+
+--
+-- hash index
+-- grep 88888888 hash.data
+--
+SELECT hash_f8_heap.*
+ WHERE hash_f8_heap.random = '88888888'::float8;
+
+--
+-- hash index
+-- grep '^90[^0-9]' hashovfl.data
+--
+-- SELECT count(*) AS i988 FROM hash_ovfl_heap
+-- WHERE x = 90;
+
+--
+-- hash index
+-- grep '^1000[^0-9]' hashovfl.data
+--
+-- SELECT count(*) AS i0 FROM hash_ovfl_heap
+-- WHERE x = 1000;
+
+
+--
+-- btree index
+-- test retrieval of min/max keys for each
+--
+
+SELECT b.*
+ FROM bt_i4_heap b
+ WHERE b.seqno < 1;
+
+SELECT b.*
+ FROM bt_i4_heap b
+ WHERE b.seqno >= 9999;
+
+SELECT b.*
+ FROM bt_i4_heap b
+ WHERE b.seqno = 4500;
+
+SELECT b.*
+ FROM bt_c16_heap b
+ WHERE b.seqno < '1'::char16;
+
+SELECT b.*
+ FROM bt_c16_heap b
+ WHERE b.seqno >= '9999'::char16;
+
+SELECT b.*
+ FROM bt_c16_heap b
+ WHERE b.seqno = '4500'::char16;
+
+SELECT b.*
+ FROM bt_txt_heap b
+ WHERE b.seqno < '1'::text;
+
+SELECT b.*
+ FROM bt_txt_heap b
+ WHERE b.seqno >= '9999'::text;
+
+SELECT b.*
+ FROM bt_txt_heap b
+ WHERE b.seqno = '4500'::text;
+
+SELECT b.*
+ FROM bt_f8_heap b
+ WHERE b.seqno < '1'::float8;
+
+SELECT b.*
+ FROM bt_f8_heap b
+ WHERE b.seqno >= '9999'::float8;
+
+SELECT b.*
+ FROM bt_f8_heap b
+ WHERE b.seqno = '4500'::float8;
+
+
+
+--
+-- replace
+--
+--
+-- BTREE
+--
+UPDATE onek
+ SET unique1 = onek.unique1 + 1;
+
+UPDATE onek
+ SET unique1 = onek.unique1 - 1;
+
+--
+-- BTREE partial
+--
+-- UPDATE onek2
+-- SET unique1 = onek2.unique1 + 1;
+
+--UPDATE onek2
+-- SET unique1 = onek2.unique1 - 1;
+
+--
+-- BTREE shutting out non-functional updates
+--
+-- the following two tests seem to take a long time on some
+-- systems. This non-func update stuff needs to be examined
+-- more closely. - jolly (2/22/96)
+--
+UPDATE temp
+ SET stringu1 = reverse_c16(onek.stringu1)
+ WHERE onek.stringu1 = 'JBAAAA' and
+ onek.stringu1 = temp.stringu1;
+
+UPDATE temp
+ SET stringu1 = reverse_c16(onek2.stringu1)
+ WHERE onek2.stringu1 = 'JCAAAA' and
+ onek2.stringu1 = temp.stringu1;
+
+DROP TABLE temp;
+
+--UPDATE person*
+-- SET age = age + 1;
+
+--UPDATE person*
+-- SET age = age + 3
+-- WHERE name = 'linda';
+
+
+--
+-- HASH
+--
+UPDATE hash_i4_heap
+ SET random = 1
+ WHERE hash_i4_heap.seqno = 1492;
+
+SELECT h.seqno AS i1492, h.random AS i1
+ FROM hash_i4_heap h
+ WHERE h.random = 1;
+
+UPDATE hash_i4_heap
+ SET seqno = 20000
+ WHERE hash_i4_heap.random = 1492795354;
+
+SELECT h.seqno AS i20000
+ FROM hash_i4_heap h
+ WHERE h.random = 1492795354;
+
+UPDATE hash_c16_heap
+ SET random = '0123456789abcdef'::char16
+ WHERE hash_c16_heap.seqno = 6543;
+
+SELECT h.seqno AS i6543, h.random AS c0_to_f
+ FROM hash_c16_heap h
+ WHERE h.random = '0123456789abcdef'::char16;
+
+UPDATE hash_c16_heap
+ SET seqno = 20000
+ WHERE hash_c16_heap.random = '76652222'::char16;
+
+--
+-- this is the row we just replaced; index scan should return zero rows
+--
+SELECT h.seqno AS emptyset
+ FROM hash_c16_heap h
+ WHERE h.random = '76652222'::char16;
+
+UPDATE hash_txt_heap
+ SET random = '0123456789abcdefghijklmnop'::text
+ WHERE hash_txt_heap.seqno = 4002;
+
+SELECT h.seqno AS i4002, h.random AS c0_to_p
+ FROM hash_txt_heap h
+ WHERE h.random = '0123456789abcdefghijklmnop'::text;
+
+UPDATE hash_txt_heap
+ SET seqno = 20000
+ WHERE hash_txt_heap.random = '959363399'::text;
+
+SELECT h.seqno AS t20000
+ FROM hash_txt_heap h
+ WHERE h.random = '959363399'::text;
+
+UPDATE hash_f8_heap
+ SET random = '-1234.1234'::float8
+ WHERE hash_f8_heap.seqno = 8906;
+
+SELECT h.seqno AS i8096, h.random AS f1234_1234
+ FROM hash_f8_heap h
+ WHERE h.random = '-1234.1234'::float8;
+
+UPDATE hash_f8_heap
+ SET seqno = 20000
+ WHERE hash_f8_heap.random = '488912369'::float8;
+
+SELECT h.seqno AS f20000
+ FROM hash_f8_heap h
+ WHERE h.random = '488912369'::float8;
+
+-- UPDATE hash_ovfl_heap
+-- SET x = 1000
+-- WHERE x = 90;
+
+-- this vacuums the index as well
+-- VACUUM hash_ovfl_heap;
+
+-- SELECT count(*) AS i0 FROM hash_ovfl_heap
+-- WHERE x = 90;
+
+-- SELECT count(*) AS i988 FROM hash_ovfl_heap
+-- WHERE x = 1000;
+
+--
+-- append
+-- (is tested in create.source)
+--
+
+--
+-- queries to plan and execute each plannode and execnode we have
+--
+
+--
+-- builtin functions
+--
+
+--
+-- copy
+--
+COPY onek TO '_OBJWD_/results/onek.data';
+
+DELETE FROM onek;
+
+COPY onek FROM '_OBJWD_/results/onek.data';
+
+SELECT unique1 FROM onek WHERE unique1 < 2;
+
+DELETE FROM onek2;
+
+COPY onek2 FROM '_OBJWD_/results/onek.data';
+
+SELECT unique1 FROM onek2 WHERE unique1 < 2;
+
+COPY BINARY stud_emp TO '_OBJWD_/results/stud_emp.data';
+
+DELETE FROM stud_emp;
+
+COPY BINARY stud_emp FROM '_OBJWD_/results/stud_emp.data';
+
+SELECT * FROM stud_emp;
+
+-- COPY aggtest FROM stdin;
+-- 56 7.8
+-- 100 99.097
+-- 0 0.09561
+-- 42 324.78
+-- .
+-- COPY aggtest TO stdout;
+
+
+--
+-- test the random function
+--
+-- count the number of tuples originally
+SELECT count(*) FROM onek;
+
+-- select roughly 1/10 of the tuples
+SELECT count(*) FROM onek where oidrand(onek.oid, 10);
+
+-- select again, the count should be different
+SELECT count(*) FROM onek where oidrand(onek.oid, 10);
+
+
+--
+-- transaction blocks
+--
+BEGIN;
+
+SELECT *
+ INTO TABLE xacttest
+ FROM aggtest;
+
+INSERT INTO xacttest (a, b) VALUES (777, 777.777);
+
+END;
+
+-- should retrieve one value--
+SELECT a FROM xacttest WHERE a > 100;
+
+
+BEGIN;
+
+CREATE TABLE disappear (a int4);
+
+DELETE FROM aggtest;
+
+-- should be empty
+SELECT * FROM aggtest;
+
+ABORT;
+
+-- should not exist
+SELECT oid FROM pg_class WHERE relname = 'disappear';
+
+-- should have members again
+SELECT * FROM aggtest;
+
+
+--
+-- portal manipulation
+--
+BEGIN;
+
+DECLARE foo1 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo2 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo3 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo4 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo5 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo6 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo7 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo8 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo9 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo10 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo11 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo12 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo13 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo14 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo15 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo16 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo17 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo18 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo19 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo20 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo21 CURSOR FOR SELECT * FROM tenk1;
+
+DECLARE foo22 CURSOR FOR SELECT * FROM tenk2;
+
+DECLARE foo23 CURSOR FOR SELECT * FROM tenk1;
+
+FETCH 1 in foo1;
+
+FETCH 2 in foo2;
+
+FETCH 3 in foo3;
+
+FETCH 4 in foo4;
+
+FETCH 5 in foo5;
+
+FETCH 6 in foo6;
+
+FETCH 7 in foo7;
+
+FETCH 8 in foo8;
+
+FETCH 9 in foo9;
+
+FETCH 10 in foo10;
+
+FETCH 11 in foo11;
+
+FETCH 12 in foo12;
+
+FETCH 13 in foo13;
+
+FETCH 14 in foo14;
+
+FETCH 15 in foo15;
+
+FETCH 16 in foo16;
+
+FETCH 17 in foo17;
+
+FETCH 18 in foo18;
+
+FETCH 19 in foo19;
+
+FETCH 20 in foo20;
+
+FETCH 21 in foo21;
+
+FETCH 22 in foo22;
+
+FETCH 23 in foo23;
+
+FETCH backward 1 in foo23;
+
+FETCH backward 2 in foo22;
+
+FETCH backward 3 in foo21;
+
+FETCH backward 4 in foo20;
+
+FETCH backward 5 in foo19;
+
+FETCH backward 6 in foo18;
+
+FETCH backward 7 in foo17;
+
+FETCH backward 8 in foo16;
+
+FETCH backward 9 in foo15;
+
+FETCH backward 10 in foo14;
+
+FETCH backward 11 in foo13;
+
+FETCH backward 12 in foo12;
+
+FETCH backward 13 in foo11;
+
+FETCH backward 14 in foo10;
+
+FETCH backward 15 in foo9;
+
+FETCH backward 16 in foo8;
+
+FETCH backward 17 in foo7;
+
+FETCH backward 18 in foo6;
+
+FETCH backward 19 in foo5;
+
+FETCH backward 20 in foo4;
+
+FETCH backward 21 in foo3;
+
+FETCH backward 22 in foo2;
+
+FETCH backward 23 in foo1;
+
+CLOSE foo1;
+
+CLOSE foo2;
+
+CLOSE foo3;
+
+CLOSE foo4;
+
+CLOSE foo5;
+
+CLOSE foo6;
+
+CLOSE foo7;
+
+CLOSE foo8;
+
+CLOSE foo9;
+
+CLOSE foo10;
+
+CLOSE foo11;
+
+CLOSE foo12;
+
+end;
+
+EXTEND INDEX onek2_u1_prtl WHERE onek2.unique1 <= 60;
+
+BEGIN;
+
+DECLARE foo13 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 50;
+
+DECLARE foo14 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 51;
+
+DECLARE foo15 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 52;
+
+DECLARE foo16 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 53;
+
+DECLARE foo17 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 54;
+
+DECLARE foo18 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 55;
+
+DECLARE foo19 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 56;
+
+DECLARE foo20 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 57;
+
+DECLARE foo21 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 58;
+
+DECLARE foo22 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 59;
+
+DECLARE foo23 CURSOR FOR
+ SELECT * FROM onek WHERE unique1 = 60;
+
+DECLARE foo24 CURSOR FOR
+ SELECT * FROM onek2 WHERE unique1 = 50;
+
+DECLARE foo25 CURSOR FOR
+ SELECT * FROM onek2 WHERE unique1 = 60;
+
+FETCH all in foo13;
+
+FETCH all in foo14;
+
+FETCH all in foo15;
+
+FETCH all in foo16;
+
+FETCH all in foo17;
+
+FETCH all in foo18;
+
+FETCH all in foo19;
+
+FETCH all in foo20;
+
+FETCH all in foo21;
+
+FETCH all in foo22;
+
+FETCH all in foo23;
+
+FETCH all in foo24;
+
+FETCH all in foo25;
+
+CLOSE foo13;
+
+CLOSE foo14;
+
+CLOSE foo15;
+
+CLOSE foo16;
+
+CLOSE foo17;
+
+CLOSE foo18;
+
+CLOSE foo19;
+
+CLOSE foo20;
+
+CLOSE foo21;
+
+CLOSE foo22;
+
+CLOSE foo23;
+
+CLOSE foo24;
+
+CLOSE foo25;
+
+END;
+
+
+--
+-- PURGE
+--
+-- we did two updates on each of these 10K tables up above. we should
+-- therefore go from 10002 tuples (two of which are not visible without
+-- using a time qual) to 10000.
+--
+-- vacuuming here also tests whether or not the hash index compaction
+-- code works; this used to be commented out because the hash AM would
+-- miss deleting a bunch of index tuples, which caused big problems when
+-- you dereferenced the tids and found garbage..
+--
+-- absolute time
+PURGE hash_f8_heap BEFORE 'now';
+
+SELECT count(*) AS has_10002 FROM hash_f8_heap[,] h;
+
+VACUUM hash_f8_heap;
+
+SELECT count(*) AS has_10000 FROM hash_f8_heap[,] h;
+
+-- relative time
+PURGE hash_i4_heap AFTER '@ 1 second ago';
+
+SELECT count(*) AS has_10002 FROM hash_i4_heap[,] h;
+
+VACUUM hash_i4_heap;
+
+SELECT count(*) AS has_10000 FROM hash_i4_heap[,] h;
+
+
+--
+-- add attribute
+--
+CREATE TABLE temp (initial int4);
+
+ALTER TABLE temp ADD COLUMN a int4;
+
+ALTER TABLE temp ADD COLUMN b char16;
+
+ALTER TABLE temp ADD COLUMN c text;
+
+ALTER TABLE temp ADD COLUMN d float8;
+
+ALTER TABLE temp ADD COLUMN e float4;
+
+ALTER TABLE temp ADD COLUMN f int2;
+
+ALTER TABLE temp ADD COLUMN g polygon;
+
+ALTER TABLE temp ADD COLUMN h abstime;
+
+ALTER TABLE temp ADD COLUMN i char;
+
+ALTER TABLE temp ADD COLUMN j abstime[];
+
+ALTER TABLE temp ADD COLUMN k dt;
+
+ALTER TABLE temp ADD COLUMN l tid;
+
+ALTER TABLE temp ADD COLUMN m xid;
+
+ALTER TABLE temp ADD COLUMN n oid8;
+
+--ALTER TABLE temp ADD COLUMN o lock;
+ALTER TABLE temp ADD COLUMN p smgr;
+
+ALTER TABLE temp ADD COLUMN q point;
+
+ALTER TABLE temp ADD COLUMN r lseg;
+
+ALTER TABLE temp ADD COLUMN s path;
+
+ALTER TABLE temp ADD COLUMN t box;
+
+ALTER TABLE temp ADD COLUMN u tinterval;
+
+ALTER TABLE temp ADD COLUMN v oidint4;
+
+ALTER TABLE temp ADD COLUMN w oidname;
+
+ALTER TABLE temp ADD COLUMN x float8[];
+
+ALTER TABLE temp ADD COLUMN y float4[];
+
+ALTER TABLE temp ADD COLUMN z int2[];
+
+INSERT INTO temp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u,
+ v, w, x, y, z)
+ VALUES (4, 'char16', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
+ 'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}',
+ 314159, '(1,1)', 512,
+ '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
+ '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["current" "infinity"]',
+ '1/3', '1,char16', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
+
+SELECT * FROM temp;
+
+DROP TABLE temp;
+
+-- the wolf bug - schema mods caused inconsistent row descriptors
+CREATE TABLE temp (
+ initial int4
+) ARCHIVE = light;
+
+ALTER TABLE temp ADD COLUMN a int4;
+
+ALTER TABLE temp ADD COLUMN b char16;
+
+ALTER TABLE temp ADD COLUMN c text;
+
+ALTER TABLE temp ADD COLUMN d float8;
+
+ALTER TABLE temp ADD COLUMN e float4;
+
+ALTER TABLE temp ADD COLUMN f int2;
+
+ALTER TABLE temp ADD COLUMN g polygon;
+
+ALTER TABLE temp ADD COLUMN h abstime;
+
+ALTER TABLE temp ADD COLUMN i char;
+
+ALTER TABLE temp ADD COLUMN j abstime[];
+
+ALTER TABLE temp ADD COLUMN k dt;
+
+ALTER TABLE temp ADD COLUMN l tid;
+
+ALTER TABLE temp ADD COLUMN m xid;
+
+ALTER TABLE temp ADD COLUMN n oid8;
+
+--ALTER TABLE temp ADD COLUMN o lock;
+ALTER TABLE temp ADD COLUMN p smgr;
+
+ALTER TABLE temp ADD COLUMN q point;
+
+ALTER TABLE temp ADD COLUMN r lseg;
+
+ALTER TABLE temp ADD COLUMN s path;
+
+ALTER TABLE temp ADD COLUMN t box;
+
+ALTER TABLE temp ADD COLUMN u tinterval;
+
+ALTER TABLE temp ADD COLUMN v oidint4;
+
+ALTER TABLE temp ADD COLUMN w oidname;
+
+ALTER TABLE temp ADD COLUMN x float8[];
+
+ALTER TABLE temp ADD COLUMN y float4[];
+
+ALTER TABLE temp ADD COLUMN z int2[];
+
+INSERT INTO temp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u,
+ v, w, x, y, z)
+ VALUES (4, 'char16', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
+ 'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}',
+ 314159, '(1,1)', 512,
+ '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
+ '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["current" "infinity"]',
+ '1/3', '1,char16', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
+
+SELECT * FROM temp[,];
+
+DROP TABLE temp;
+
+
+--
+-- rename -
+-- should preserve indices
+--
+ALTER TABLE tenk1 RENAME TO ten_k;
+
+-- 20 values, sorted
+SELECT unique1 FROM ten_k WHERE unique1 < 20;
+
+-- 20 values, sorted
+SELECT unique2 FROM ten_k WHERE unique2 < 20;
+
+-- 100 values, sorted
+SELECT hundred FROM ten_k WHERE hundred = 50;
+
+ALTER TABLE ten_k RENAME TO tenk1;
+
+-- 5 values, sorted
+SELECT unique1 FROM tenk1 WHERE unique1 < 5;
+
+
+--
+-- VIEW queries
+--
+-- test the views defined in create.source
+--
+SELECT * from street;
+
+SELECT * from iexit;
+
+SELECT * from toyemp where name='sharon';
+
+
+
+
+--
+-- AGGREGATES
+--
+SELECT avg(four) AS avg_1 FROM onek;
+
+SELECT avg(a) AS avg_49 FROM aggtest WHERE a < 100;
+
+SELECT avg(b) AS avg_107_943 FROM aggtest;
+
+SELECT avg(gpa) AS avg_3_4 FROM student;
+
+
+SELECT sum(four) AS sum_1500 FROM onek;
+
+SELECT sum(a) AS sum_198 FROM aggtest;
+
+SELECT sum(b) AS avg_431_773 FROM aggtest;
+
+SELECT sum(gpa) AS avg_6_8 FROM student;
+
+
+SELECT max(four) AS max_3 FROM onek;
+
+SELECT max(a) AS max_100 FROM aggtest;
+
+SELECT max(aggtest.b) AS max_324_78 FROM aggtest;
+
+SELECT max(student.gpa) AS max_3_7 FROM student;
+
+
+SELECT count(four) AS cnt_1000 FROM onek;
+
+
+SELECT newavg(four) AS avg_1 FROM onek;
+
+SELECT newsum(four) AS sum_1500 FROM onek;
+
+SELECT newcnt(four) AS cnt_1000 FROM onek;
+
+
+--
+-- inheritance stress test
+--
+SELECT * FROM a_star*;
+
+SELECT *
+ FROM b_star* x
+ WHERE x.b = 'bumble'::text or x.a < 3;
+
+SELECT class, a
+ FROM c_star* x
+ WHERE x.c ~ 'hi'::text;
+
+SELECT class, b, c
+ FROM d_star* x
+ WHERE x.a < 100;
+
+SELECT class, c FROM e_star* x WHERE x.c NOTNULL;
+
+SELECT * FROM f_star* x WHERE x.c ISNULL;
+
+ALTER TABLE f_star RENAME COLUMN f TO ff;
+
+ALTER TABLE e_star* RENAME COLUMN e TO ee;
+
+ALTER TABLE d_star* RENAME COLUMN d TO dd;
+
+ALTER TABLE c_star* RENAME COLUMN c TO cc;
+
+ALTER TABLE b_star* RENAME COLUMN b TO bb;
+
+ALTER TABLE a_star* RENAME COLUMN a TO aa;
+
+SELECT class, aa
+ FROM a_star* x
+ WHERE aa ISNULL;
+
+ALTER TABLE a_star RENAME COLUMN aa TO foo;
+
+SELECT class, foo
+ FROM a_star x
+ WHERE x.foo >= 2;
+
+ALTER TABLE a_star RENAME COLUMN foo TO aa;
+
+SELECT *
+ from a_star*
+ WHERE aa < 1000;
+
+ALTER TABLE f_star ADD COLUMN f int4;
+
+UPDATE f_star SET f = 10;
+
+ALTER TABLE e_star* ADD COLUMN e int4;
+
+--UPDATE e_star* SET e = 42;
+
+SELECT * FROM e_star*;
+
+ALTER TABLE a_star* ADD COLUMN a text;
+
+--UPDATE b_star*
+-- SET a = 'gazpacho'::text
+-- WHERE aa > 4;
+
+SELECT class, aa, a FROM a_star*;
+
+
+--
+-- versions
+--
+
+--
+-- postquel functions
+--
+--
+-- mike does post_hacking,
+-- joe and sally play basketball, and
+-- everyone else does nothing.
+--
+SELECT p.name, p.hobbies.name FROM person p;
+
+--
+-- as above, but jeff also does post_hacking.
+--
+SELECT p.name, p.hobbies.name FROM person* p;
+
+--
+-- the next two queries demonstrate how functions generate bogus duplicates.
+-- this is a "feature" ..
+--
+SELECT DISTINCT hobbies_r.name, hobbies_r.equipment.name FROM hobbies_r;
+
+SELECT hobbies_r.name, hobbies_r.equipment.name FROM hobbies_r;
+
+--
+-- mike needs advil and peet's coffee,
+-- joe and sally need hightops, and
+-- everyone else is fine.
+--
+SELECT p.name, p.hobbies.name, p.hobbies.equipment.name FROM person p;
+
+--
+-- as above, but jeff needs advil and peet's coffee as well.
+--
+SELECT p.name, p.hobbies.name, p.hobbies.equipment.name FROM person* p;
+
+--
+-- just like the last two, but make sure that the target list fixup and
+-- unflattening is being done correctly.
+--
+SELECT p.hobbies.equipment.name, p.name, p.hobbies.name FROM person p;
+
+SELECT p.hobbies.equipment.name, p.name, p.hobbies.name FROM person* p;
+
+SELECT p.hobbies.equipment.name, p.hobbies.name, p.name FROM person p;
+
+SELECT p.hobbies.equipment.name, p.hobbies.name, p.name FROM person* p;
+
+SELECT user_relns() AS user_relns
+ ORDER BY user_relns;
+
+--SELECT name(equipment(hobby_construct('skywalking'::text, 'mer'::text))) AS equip_name;
+
+
+--
+-- functional joins
+--
+
+--
+-- instance rules
+--
+
+--
+-- rewrite rules
+--
+
+--
+-- ARRAYS
+--
+SELECT * FROM arrtest;
+
+SELECT arrtest.a[1],
+ arrtest.b[1][1][1],
+ arrtest.c[1],
+ arrtest.d[1][1],
+ arrtest.e[0]
+ FROM arrtest;
+-- ??? what about
+-- SELECT a[1], b[1][1][1], c[1], d[1][1], e[0]
+-- FROM arrtest;
+
+SELECT arrtest.a[1:3],
+ arrtest.b[1:1][1:2][1:2],
+ arrtest.c[1:2],
+ arrtest.d[1:1][1:2]
+ FROM arrtest;
+
+-- returns three different results--
+SELECT array_dims(arrtest.b) AS x;
+
+-- returns nothing
+SELECT *
+ FROM arrtest
+ WHERE arrtest.a[1] < 5 and
+ arrtest.c = '{"foobar"}'::_char16;
+
+-- updating array subranges seems to be broken
+--
+-- UPDATE arrtest
+-- SET a[1:2] = '{16,25}',
+-- b[1:1][1:1][1:2] = '{113, 117}',
+-- c[1:1] = '{"new_word"}';
+
+SELECT arrtest.a[1:3],
+ arrtest.b[1:1][1:2][1:2],
+ arrtest.c[1:2],
+ arrtest.d[1:1][1:2]
+ FROM arrtest;
+
+
+--
+-- expensive functions
+--
+
+