From 8daa31a21ef7ba692fc45493d98318bf80b047bc Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 1 Mar 2000 19:11:12 +0000 Subject: [PATCH] Add QNX fixes from Kardos, Dr. Andreas --- doc/FAQ_QNX4 | 37 +-- .../expected/float4-exp-three-digits.out | 150 +++++++++++ .../expected/float8-exp-three-digits.out | 246 ++++++++++++++++++ .../expected/int8-exp-three-digits.out | 119 +++++++++ src/test/regress/regress.sh | 13 +- src/test/regress/resultmap | 5 + 6 files changed, 539 insertions(+), 31 deletions(-) create mode 100644 src/test/regress/expected/float4-exp-three-digits.out create mode 100644 src/test/regress/expected/float8-exp-three-digits.out create mode 100644 src/test/regress/expected/int8-exp-three-digits.out diff --git a/doc/FAQ_QNX4 b/doc/FAQ_QNX4 index 288283cd03..8cf83763b9 100644 --- a/doc/FAQ_QNX4 +++ b/doc/FAQ_QNX4 @@ -109,10 +109,11 @@ see backend/Makefile and backend/bootstrap/Makefile. libpgsql.a currently cannot be generated because of the same problem. But this doesn't matter since shared libraries are not supported. -Currently yacc fails on interfaces/ecpg/preproc/preproc.y because of -exceeded maximum table size. You can generate the preproc.h and preproc.c -files on another platform and use them. This is only a problem when you use -the current source tree since preproc.h and preporc.c are included in official +Currently yacc fails on backend/parser/gram.y and +interfaces/ecpg/preproc/preproc.y due to exceeded maximum table size. You can +generate the gram.h, parse.h, preproc.h and preproc.c files on another platform +and use them. This is only a problem when you use the current source tree since +parse.h, gram.c, preproc.h and preporc.c are included in official distributions. Regression tests: @@ -120,23 +121,11 @@ Regression tests: The majority of regression tests succeeded. The following tests failed: -int2, int4: -Error message "Result too large" instead of "Numerical result out of range". -Can be ignored. - -int8, float4: -Exponent expression "e+nnn" instead of "e+nn". Can be ignored. - -float8: -Exponent expression "e+nnn" instead of "e+nn" and some slight difference -in the last digit. -Can be ignored. - geometry: Some slight deviation in the last digit and "0" instead of "-0". Can be ignored. -datetime, abstime, tinterval, horology: +timestamp, tinterval, abstime, horology: Differences for years outside the normal Unix range, e.g. 1968 instead of 2105 Can be ignored. @@ -144,13 +133,13 @@ Can be ignored. create_function_2, triggers, misc, plpgsql: Error messages due to the lack of shared library support. -rules: -Subject of further investigation. - -numeric, numeric_big: -ERROR: Cannot create unique index. Table contains non-unique values +numeric, numeric_big, sanity_check: +"ERROR: Cannot create unique index. Table contains non-unique values" +This error occurs for indices of tables num_exp_add, num_exp_sub, +num_exp_div and num_exp_mul only. Subject of further investigation. Probably because of the missing indices -these tests take a long time. +these numeric tests take a long time. +The diffence in sanity_check.out is a consequence of this problem only. The reached state of this port should be sufficient for lot of applications. @@ -158,7 +147,7 @@ Have fun! Andreas Kardos kardos@repas-aeg.de -1999-12-16 +2000-02-28 --------------------------------------------------------------------------- diff --git a/src/test/regress/expected/float4-exp-three-digits.out b/src/test/regress/expected/float4-exp-three-digits.out new file mode 100644 index 0000000000..8efd434a85 --- /dev/null +++ b/src/test/regress/expected/float4-exp-three-digits.out @@ -0,0 +1,150 @@ +-- +-- FLOAT4 +-- +CREATE TABLE FLOAT4_TBL (f1 float4); +INSERT INTO FLOAT4_TBL(f1) VALUES ('0.0'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('1004.30'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-34.84'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e+20'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e-20'); +-- test for over and under flow +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e40'); +ERROR: Bad float4 input format -- overflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e40'); +ERROR: Bad float4 input format -- overflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-40'); +ERROR: Bad float4 input format -- underflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-40'); +ERROR: Bad float4 input format -- underflow +SELECT '' AS five, FLOAT4_TBL.*; + five | f1 +------+-------------- + | 0 + | 1004.3 + | -34.84 + | 1.23457e+020 + | 1.23457e-020 +(5 rows) + +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <> '1004.3'; + four | f1 +------+-------------- + | 0 + | -34.84 + | 1.23457e+020 + | 1.23457e-020 +(4 rows) + +SELECT '' AS one, f.* FROM FLOAT4_TBL f WHERE f.f1 = '1004.3'; + one | f1 +-----+-------- + | 1004.3 +(1 row) + +SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE '1004.3' > f.f1; + three | f1 +-------+-------------- + | 0 + | -34.84 + | 1.23457e-020 +(3 rows) + +SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE f.f1 < '1004.3'; + three | f1 +-------+-------------- + | 0 + | -34.84 + | 1.23457e-020 +(3 rows) + +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE '1004.3' >= f.f1; + four | f1 +------+-------------- + | 0 + | 1004.3 + | -34.84 + | 1.23457e-020 +(4 rows) + +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <= '1004.3'; + four | f1 +------+-------------- + | 0 + | 1004.3 + | -34.84 + | 1.23457e-020 +(4 rows) + +SELECT '' AS three, f.f1, f.f1 * '-10' AS x FROM FLOAT4_TBL f + WHERE f.f1 > '0.0'; + three | f1 | x +-------+--------------+--------------- + | 1004.3 | -10043 + | 1.23457e+020 | -1.23457e+021 + | 1.23457e-020 | -1.23457e-019 +(3 rows) + +SELECT '' AS three, f.f1, f.f1 + '-10' AS x FROM FLOAT4_TBL f + WHERE f.f1 > '0.0'; + three | f1 | x +-------+--------------+-------------- + | 1004.3 | 994.3 + | 1.23457e+020 | 1.23457e+020 + | 1.23457e-020 | -10 +(3 rows) + +SELECT '' AS three, f.f1, f.f1 / '-10' AS x FROM FLOAT4_TBL f + WHERE f.f1 > '0.0'; + three | f1 | x +-------+--------------+--------------- + | 1004.3 | -100.43 + | 1.23457e+020 | -1.23457e+019 + | 1.23457e-020 | -1.23457e-021 +(3 rows) + +SELECT '' AS three, f.f1, f.f1 - '-10' AS x FROM FLOAT4_TBL f + WHERE f.f1 > '0.0'; + three | f1 | x +-------+--------------+-------------- + | 1004.3 | 1014.3 + | 1.23457e+020 | 1.23457e+020 + | 1.23457e-020 | 10 +(3 rows) + +-- test divide by zero +SELECT '' AS bad, f.f1 / '0.0' from FLOAT4_TBL f; +ERROR: float4div: divide by zero error +SELECT '' AS five, FLOAT4_TBL.*; + five | f1 +------+-------------- + | 0 + | 1004.3 + | -34.84 + | 1.23457e+020 + | 1.23457e-020 +(5 rows) + +-- test the unary float4abs operator +SELECT '' AS five, f.f1, @f.f1 AS abs_f1 FROM FLOAT4_TBL f; + five | f1 | abs_f1 +------+--------------+-------------- + | 0 | 0 + | 1004.3 | 1004.3 + | -34.84 | 34.84 + | 1.23457e+020 | 1.23457e+020 + | 1.23457e-020 | 1.23457e-020 +(5 rows) + +UPDATE FLOAT4_TBL + SET f1 = FLOAT4_TBL.f1 * '-1' + WHERE FLOAT4_TBL.f1 > '0.0'; +SELECT '' AS five, FLOAT4_TBL.*; + five | f1 +------+--------------- + | 0 + | -34.84 + | -1004.3 + | -1.23457e+020 + | -1.23457e-020 +(5 rows) + diff --git a/src/test/regress/expected/float8-exp-three-digits.out b/src/test/regress/expected/float8-exp-three-digits.out new file mode 100644 index 0000000000..9e87bcc204 --- /dev/null +++ b/src/test/regress/expected/float8-exp-three-digits.out @@ -0,0 +1,246 @@ +-- +-- FLOAT8 +-- +CREATE TABLE FLOAT8_TBL(f1 float8); +INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200'); +SELECT '' AS five, FLOAT8_TBL.*; + five | f1 +------+---------------------- + | 0 + | 1004.3 + | -34.84 + | 1.2345678901234e+200 + | 1.2345678901234e-200 +(5 rows) + +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <> '1004.3'; + four | f1 +------+---------------------- + | 0 + | -34.84 + | 1.2345678901234e+200 + | 1.2345678901234e-200 +(4 rows) + +SELECT '' AS one, f.* FROM FLOAT8_TBL f WHERE f.f1 = '1004.3'; + one | f1 +-----+-------- + | 1004.3 +(1 row) + +SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1; + three | f1 +-------+---------------------- + | 0 + | -34.84 + | 1.2345678901234e-200 +(3 rows) + +SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE f.f1 < '1004.3'; + three | f1 +-------+---------------------- + | 0 + | -34.84 + | 1.2345678901234e-200 +(3 rows) + +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE '1004.3' >= f.f1; + four | f1 +------+---------------------- + | 0 + | 1004.3 + | -34.84 + | 1.2345678901234e-200 +(4 rows) + +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <= '1004.3'; + four | f1 +------+---------------------- + | 0 + | 1004.3 + | -34.84 + | 1.2345678901234e-200 +(4 rows) + +SELECT '' AS three, f.f1, f.f1 * '-10' AS x + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + three | f1 | x +-------+----------------------+----------------------- + | 1004.3 | -10043 + | 1.2345678901234e+200 | -1.2345678901234e+201 + | 1.2345678901234e-200 | -1.2345678901234e-199 +(3 rows) + +SELECT '' AS three, f.f1, f.f1 + '-10' AS x + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + three | f1 | x +-------+----------------------+---------------------- + | 1004.3 | 994.3 + | 1.2345678901234e+200 | 1.2345678901234e+200 + | 1.2345678901234e-200 | -10 +(3 rows) + +SELECT '' AS three, f.f1, f.f1 / '-10' AS x + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + three | f1 | x +-------+----------------------+----------------------- + | 1004.3 | -100.43 + | 1.2345678901234e+200 | -1.2345678901234e+199 + | 1.2345678901234e-200 | -1.2345678901234e-201 +(3 rows) + +SELECT '' AS three, f.f1, f.f1 - '-10' AS x + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + three | f1 | x +-------+----------------------+---------------------- + | 1004.3 | 1014.3 + | 1.2345678901234e+200 | 1.2345678901234e+200 + | 1.2345678901234e-200 | 10 +(3 rows) + +SELECT '' AS one, f.f1 ^ '2.0' AS square_f1 + FROM FLOAT8_TBL f where f.f1 = '1004.3'; + one | square_f1 +-----+------------ + | 1008618.49 +(1 row) + +-- absolute value +SELECT '' AS five, f.f1, @f.f1 AS abs_f1 + FROM FLOAT8_TBL f; + five | f1 | abs_f1 +------+----------------------+---------------------- + | 0 | 0 + | 1004.3 | 1004.3 + | -34.84 | 34.84 + | 1.2345678901234e+200 | 1.2345678901234e+200 + | 1.2345678901234e-200 | 1.2345678901234e-200 +(5 rows) + +-- truncate +SELECT '' AS five, f.f1, %f.f1 AS trunc_f1 + FROM FLOAT8_TBL f; + five | f1 | trunc_f1 +------+----------------------+---------------------- + | 0 | 0 + | 1004.3 | 1004 + | -34.84 | -34 + | 1.2345678901234e+200 | 1.2345678901234e+200 + | 1.2345678901234e-200 | 0 +(5 rows) + +-- round +SELECT '' AS five, f.f1, f.f1 % AS round_f1 + FROM FLOAT8_TBL f; + five | f1 | round_f1 +------+----------------------+---------------------- + | 0 | 0 + | 1004.3 | 1004 + | -34.84 | -35 + | 1.2345678901234e+200 | 1.2345678901234e+200 + | 1.2345678901234e-200 | 0 +(5 rows) + +-- square root +SELECT '' AS three, f.f1, |/f.f1 AS sqrt_f1 + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + three | f1 | sqrt_f1 +-------+----------------------+----------------------- + | 1004.3 | 31.6906926399535 + | 1.2345678901234e+200 | 1.11111110611109e+100 + | 1.2345678901234e-200 | 1.11111110611109e-100 +(3 rows) + +-- take exp of ln(f.f1) +SELECT '' AS three, f.f1, : ( ; f.f1) AS exp_ln_f1 + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + three | f1 | exp_ln_f1 +-------+----------------------+----------------------- + | 1004.3 | 1004.3 + | 1.2345678901234e+200 | 1.23456789012337e+200 + | 1.2345678901234e-200 | 1.23456789012338e-200 +(3 rows) + +-- cube root +SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f; + five | f1 | cbrt_f1 +------+----------------------+----------------------- + | 0 | 0 + | 1004.3 | 10.014312837827 + | -34.84 | -3.26607421344208 + | 1.2345678901234e+200 | 4.97933859234757e+066 + | 1.2345678901234e-200 | 2.3112042409018e-067 +(5 rows) + +SELECT '' AS five, FLOAT8_TBL.*; + five | f1 +------+---------------------- + | 0 + | 1004.3 + | -34.84 + | 1.2345678901234e+200 + | 1.2345678901234e-200 +(5 rows) + +UPDATE FLOAT8_TBL + SET f1 = FLOAT8_TBL.f1 * '-1' + WHERE FLOAT8_TBL.f1 > '0.0'; +SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f; +ERROR: Bad float8 input format -- overflow +SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f; +ERROR: pow() result is out of range +SELECT '' AS bad, (; (f.f1)) from FLOAT8_TBL f where f.f1 = '0.0' ; +ERROR: can't take log of zero +SELECT '' AS bad, (; (f.f1)) from FLOAT8_TBL f where f.f1 < '0.0' ; +ERROR: can't take log of a negative number +SELECT '' AS bad, : (f.f1) from FLOAT8_TBL f; +ERROR: exp() result is out of range +SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f; +ERROR: float8div: divide by zero error +SELECT '' AS five, FLOAT8_TBL.*; + five | f1 +------+----------------------- + | 0 + | -34.84 + | -1004.3 + | -1.2345678901234e+200 + | -1.2345678901234e-200 +(5 rows) + +-- test for over and under flow +INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); +ERROR: Input '10e400' is out of range for float8 +INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400'); +ERROR: Input '-10e400' is out of range for float8 +INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400'); +ERROR: Input '10e-400' is out of range for float8 +INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400'); +ERROR: Input '-10e-400' is out of range for float8 +-- maintain external table consistency across platforms +-- delete all values and reinsert well-behaved ones +DELETE FROM FLOAT8_TBL; +INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('-1004.30'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e+200'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e-200'); +SELECT '' AS five, FLOAT8_TBL.*; + five | f1 +------+----------------------- + | 0 + | -34.84 + | -1004.3 + | -1.2345678901234e+200 + | -1.2345678901234e-200 +(5 rows) + diff --git a/src/test/regress/expected/int8-exp-three-digits.out b/src/test/regress/expected/int8-exp-three-digits.out new file mode 100644 index 0000000000..71b709510d --- /dev/null +++ b/src/test/regress/expected/int8-exp-three-digits.out @@ -0,0 +1,119 @@ +-- +-- INT8 +-- Test int8 64-bit integers. +-- +CREATE TABLE INT8_TBL(q1 int8, q2 int8); +INSERT INTO INT8_TBL VALUES('123','456'); +INSERT INTO INT8_TBL VALUES('123','4567890123456789'); +INSERT INTO INT8_TBL VALUES('4567890123456789','123'); +INSERT INTO INT8_TBL VALUES('4567890123456789','4567890123456789'); +INSERT INTO INT8_TBL VALUES('4567890123456789','-4567890123456789'); +SELECT * FROM INT8_TBL; + q1 | q2 +------------------+------------------- + 123 | 456 + 123 | 4567890123456789 + 4567890123456789 | 123 + 4567890123456789 | 4567890123456789 + 4567890123456789 | -4567890123456789 +(5 rows) + +SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL; + five | plus | minus +------+------------------+------------------- + | 123 | -123 + | 123 | -123 + | 4567890123456789 | -4567890123456789 + | 4567890123456789 | -4567890123456789 + | 4567890123456789 | -4567890123456789 +(5 rows) + +SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL; + five | q1 | q2 | plus +------+------------------+-------------------+------------------ + | 123 | 456 | 579 + | 123 | 4567890123456789 | 4567890123456912 + | 4567890123456789 | 123 | 4567890123456912 + | 4567890123456789 | 4567890123456789 | 9135780246913578 + | 4567890123456789 | -4567890123456789 | 0 +(5 rows) + +SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL; + five | q1 | q2 | minus +------+------------------+-------------------+------------------- + | 123 | 456 | -333 + | 123 | 4567890123456789 | -4567890123456666 + | 4567890123456789 | 123 | 4567890123456666 + | 4567890123456789 | 4567890123456789 | 0 + | 4567890123456789 | -4567890123456789 | 9135780246913578 +(5 rows) + +SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL + WHERE q1 < 1000 or (q2 > 0 and q2 < 1000); + three | q1 | q2 | multiply +-------+------------------+------------------+-------------------- + | 123 | 456 | 56088 + | 123 | 4567890123456789 | 561850485185185047 + | 4567890123456789 | 123 | 561850485185185047 +(3 rows) + +SELECT '' AS five, q1, q2, q1 / q2 AS divide FROM INT8_TBL; + five | q1 | q2 | divide +------+------------------+-------------------+---------------- + | 123 | 456 | 0 + | 123 | 4567890123456789 | 0 + | 4567890123456789 | 123 | 37137318076884 + | 4567890123456789 | 4567890123456789 | 1 + | 4567890123456789 | -4567890123456789 | -1 +(5 rows) + +SELECT '' AS five, q1, float8(q1) FROM INT8_TBL; + five | q1 | float8 +------+------------------+----------------------- + | 123 | 123 + | 123 | 123 + | 4567890123456789 | 4.56789012345679e+015 + | 4567890123456789 | 4.56789012345679e+015 + | 4567890123456789 | 4.56789012345679e+015 +(5 rows) + +SELECT '' AS five, q2, float8(q2) FROM INT8_TBL; + five | q2 | float8 +------+-------------------+------------------------ + | 456 | 456 + | 4567890123456789 | 4.56789012345679e+015 + | 123 | 123 + | 4567890123456789 | 4.56789012345679e+015 + | -4567890123456789 | -4.56789012345679e+015 +(5 rows) + +SELECT '' AS five, q1, int8(float8(q1)) AS "two coercions" FROM INT8_TBL; + five | q1 | two coercions +------+------------------+------------------ + | 123 | 123 + | 123 | 123 + | 4567890123456789 | 4567890123456789 + | 4567890123456789 | 4567890123456789 + | 4567890123456789 | 4567890123456789 +(5 rows) + +SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL; + five | twice int4 +------+------------------ + | 246 + | 246 + | 9135780246913578 + | 9135780246913578 + | 9135780246913578 +(5 rows) + +SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL; + five | twice int4 +------+------------------ + | 246 + | 246 + | 9135780246913578 + | 9135780246913578 + | 9135780246913578 +(5 rows) + diff --git a/src/test/regress/regress.sh b/src/test/regress/regress.sh index 125a6a2dd3..b717f34dfb 100755 --- a/src/test/regress/regress.sh +++ b/src/test/regress/regress.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.41 2000/02/15 03:30:57 thomas Exp $ +# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.42 2000/03/01 19:11:06 momjian Exp $ # if [ $# -eq 0 ] then @@ -11,7 +11,7 @@ hostname=$1 shift extratests="$*" -if [ "x$hostname" = "xwin" -o "x$hostname" = "xqnx4" ] +if [ "x$hostname" = "xwin" -o "x$hostname" = "xi386-pc-qnx4" ] then HOSTLOC="-h localhost" else @@ -40,8 +40,8 @@ FRONTEND="psql $HOSTLOC -a -q" # it is a standard regular expression with an implicit ^ at the start. # ---------- SUBSTLIST="" -exec 4