AT_BANNER([GET DATA /TYPE=PSQL]) m4_define([INIT_PSQL], [AT_SKIP_IF([test "$PSQL_SUPPORT" = no]) PATH=$PG_PATH:$PATH export PATH PGDATA=`pwd`/cluster export PGDATA PGHOST=`pwd` export PGHOST PGPORT=$PG_PORT export PGPORT AT_CHECK([initdb -A trust], [0], [ignore]) AT_CHECK([pg_ctl start -w -o "-k `pwd` -h ''"], [0], [ignore]) trap 'CLEANUP_PSQL' 0 AT_CHECK([createdb -h "`pwd`" -p $PG_PORT $PG_DBASE], [0], [ignore], [ignore]) AT_DATA([populate.sql], [CREATE TABLE empty (a int, b date, c numeric(23, 4)); -- a largeish table to check big queries work ok. CREATE TABLE large (x int); INSERT INTO large (select * from generate_series(1, 1000)); CREATE TABLE thing ( bool bool , bytea bytea , char char , int8 int8 , int2 int2 , int4 int4 , numeric numeric(50,6) , text text , oid oid , float4 float4 , float8 float8 , money money , pbchar bpchar , varchar varchar , date date , time time , timestamp timestamp , timestamptz timestamptz , interval interval , timetz timetz ); INSERT INTO thing VALUES ( false, '0', 'a', '0', 0, 0, -256.098, 'this-long-text', 0, 0, 0, '0.01', 'a', 'A', '1-Jan-2000', '00:00', 'January 8 04:05:06 1999', 'January 8 04:05:06 1999 PST', '1 minutes', '10:09 UTC+4' ); INSERT INTO thing VALUES ( null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ); INSERT INTO thing VALUES ( true, '1', 'b', '1', 1, 1, 65535.00001, 'that-long-text', 1, 1, 1, '1.23', 'b', 'B', '10-Jan-1963', '01:05:02', '10-Jan-1963 23:58:00', '10-Jan-1963 23:58:00 CET', '2 year 1 month 12 days 1 hours 3 minutes 4 seconds', '01:05:02 UTC-7' ); ]) AT_CHECK([psql -h "`pwd`" -p $PG_PORT $PG_DBASE < populate.sql], [0], [ignore])]) m4_define([CLEANUP_PSQL], [pg_ctl stop -W -o "-k `pwd` -h ''"]) AT_SETUP([GET DATA /TYPE=PSQL]) INIT_PSQL dnl Test with an ordinary query. AT_CHECK([cat > ordinary-query.sps < empty-result.sps < large-result.sps < 1). LIST. TEMPORARY. N OF CASES 6. LIST. SORT CASES BY x (D). TEMPORARY. N OF CASES 6. LIST. EOF ]) AT_CHECK([pspp -o pspp.csv large-result.sps]) AT_CHECK([cat pspp.csv], [0], [dnl Table: Data List x,diff 1.00,. @&t@ 2.00,1.00 3.00,1.00 4.00,1.00 5.00,1.00 6.00,1.00 Table: Data List x,diff 1000.00,1.00 999.00,1.00 998.00,1.00 997.00,1.00 996.00,1.00 995.00,1.00 ]) dnl Check for a bug caused by having string variables in the database, dnl all of which are null. AT_DATA([all-null-string.sql], [-- a table which has a text field containing only null, or zero -- length entries. CREATE TABLE foo (int4 int4, text text); INSERT INTO foo VALUES ('12', ''); INSERT INTO foo VALUES (null, ''); ]) AT_CHECK([psql -h "`pwd`" -p $PG_PORT $PG_DBASE < all-null-string.sql], [0], [ignore]) AT_CAPTURE_FILE([get-data.sps]) AT_CHECK([cat > get-data.sps <