From 03f1648872daf555bdf48427f22219626c7b666a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 18 Dec 1998 07:08:03 +0000 Subject: [PATCH] Attached is a patch with some fixes that (I think that) should go into 6.4.1. Here is the list: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The type int8 now works. In fact, the bug(s) were in src/backend/port/snprintf.c, so int8 is probably broken in every platform that hasn't a native snprintf/vsnprintf. The type itself worked as expected, only the output was wrong. Anyway, this patch should be checked in other platforms. - The regression tests for int2 and int4, which were broken due to differences in the error messages, are fixed. - The regression test for float8, which was broken in the reference platform, is also fixed. I don't know if the new file (float8-OSF1.out) will work on other platforms, but it might be worth to try it. - Two new template files are provided (alpha_cc, which includes optimization, and alpha_gcc), and src/templates/.similar is updated accordingly. src/templates/alpha should be removed from the distribution. *IMPORTANT NOTE*: I don't know if you can use gcc to compile postgres; I've written the alpha_gcc file because alpha_cc has some flags that are specific to DEC C. - There is a (very basic) Digital Unix specific FAQ in doc/FAQ_DigitalUnix. -- ------------------------------------------------------------------- Pedro José Lobo Perea Tel: +34 91 336 78 19 --- doc/FAQ_DigitalUnix | 103 ++++++++++ src/backend/port/snprintf.c | 4 +- src/template/.similar | 2 +- src/template/alpha_cc | 15 ++ src/template/{alpha => alpha_gcc} | 0 src/test/regress/expected/float8-OSF1.out | 234 ++++++++++++++++++++++ 6 files changed, 355 insertions(+), 3 deletions(-) create mode 100644 doc/FAQ_DigitalUnix create mode 100644 src/template/alpha_cc rename src/template/{alpha => alpha_gcc} (100%) create mode 100644 src/test/regress/expected/float8-OSF1.out diff --git a/doc/FAQ_DigitalUnix b/doc/FAQ_DigitalUnix new file mode 100644 index 0000000000..1671f290cd --- /dev/null +++ b/doc/FAQ_DigitalUnix @@ -0,0 +1,103 @@ +======================================================= +Frequently Asked Questions (FAQ) for PostgreSQL V6.4.1 +FreeBSD Specific +TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ +======================================================= +last updated: Mon Dec 14 17:26:03 CET 1998 + +current maintainer: Pedro J. Lobo (pjlobo@euitt.upm.es) +original author: Pedro J. Lobo (pjlobo@euitt.upm.es) + +This FAQ covers issues that are specific for PostgreSQL running on Digital +Unix (formerly known as DEC OSF/1). Please check the global FAQ for questions +not specific to this platform. + +Changes in this version (* = modified, + = new, - = removed): + +This file is divided approximately as follows: + +1.*) Installing PostgreSQL + +1.1.*) Compiling PostgreSQL + +1.2.*) Running the regression tests + + +Questions answered: +1.1.1) I can't compile PostgreSQL with gcc. + +1.1.2) DEC C dies with an internal error when optimization is + enabled (-O flag). + +1.2.1) The regression tests fail for char, varchar, select_implicit, + select_having and rules. + +1.2.2) The regression tests fail for abstime, tinterval and horology. + +1.2.3) The regression tests fail for geometry. + +1.2.4) The regression tests fail for inet. + +---------------------------------------------------------------------- +Section 1: Installing PostgreSQL +---------------------------------------------------------------------- + +Section 1.1: Compiling PostgreSQL +------------------------------------ + +1.1.1) I can't compile PostgreSQL with gcc. + + Me too O:-) I tried to compile it with gcc 2.7.2.1 without + success. However, I've found that DEC C works much better than + gcc for alphas, and so I didn't make any effort to find out + why gcc fails. If you succedd on this task, please take the + time to update this section (see http://www.postgresql.org for + the details on how to do this). + +1.1.2) The DEC C compiler dies with an internal error when optimization is + enabled (-O flag). + + I've seen this happening on 3.2c and 3.2g systems, and only on + one of the source files (can't remember exactly which one). + The workaround was to compile the offending module without + optimization by hand, and re-running gmake to let the process + continue. + + It doesn't happen on 4.0d systems (mine at least). Don't know + about earlier 4.0 versions. + +Section 1.2: Running the regression tests +-------------------------------------------- + +1.2.1) The regression tests fail for char, varchar, select_implicit, + select_having and rules. + + This only happens when you enable locale support, and is due + to a bug in the system's locale libraries. The problem is + that strcoll("Axxx", "axxx") returns a value greater than + zero instead of lower, which is how it should be. + + This isn't a great problem unless you (or your application) + relies on upper-case letters being considered "smaller" than + lower-case for ordering purposes. Otherwise, you will only + notice that the ordering between upper-case and lower-case + letters is reversed. + +1.2.2) The regression tests fail for abstime, tinterval and horology. + + I think that these failures are due to some inconsistencies + in time zone handling in some years near 1950, in which case + the problem would be in the operating system's time zone + libraries. Recent dates seem to work as expected, but I can't + assure it. + +1.2.3) The regression tests fail for geometry. + + These are (small) rounding errors that shouldn't affect any + application (but could do, who knows). + +1.2.4) The regression tests fail for inet. + + Yes, they do. You must consider the inet type broken for + Digital Unix. + diff --git a/src/backend/port/snprintf.c b/src/backend/port/snprintf.c index 2e3e077a66..7ec97b94e8 100644 --- a/src/backend/port/snprintf.c +++ b/src/backend/port/snprintf.c @@ -72,7 +72,7 @@ typedef long long long_long; * causing nast effects. **************************************************************/ -/*static char _id[] = "$Id: snprintf.c,v 1.13 1998/12/18 07:03:06 momjian Exp $";*/ +/*static char _id[] = "$Id: snprintf.c,v 1.14 1998/12/18 07:08:00 momjian Exp $";*/ static char *end; static int SnprfOverflow; @@ -349,7 +349,7 @@ int base, zpad; { int signvalue = 0; -#ifdef HAVE_LONG_INT_64 +#ifdef HAVE_LONG_LONG_INT_64 unsigned long_long uvalue; #else unsigned long uvalue; diff --git a/src/template/.similar b/src/template/.similar index 96e4f86271..c5f74dc39f 100644 --- a/src/template/.similar +++ b/src/template/.similar @@ -1,4 +1,4 @@ -alpha-dec-osf=alpha +alpha-dec-osf=alpha_cc alpha-unknown-linux-gnu=linux_alpha hppa1.1-hp-hpux=hpux_cc hppa1.1-stratus-sysv4=svr4 diff --git a/src/template/alpha_cc b/src/template/alpha_cc new file mode 100644 index 0000000000..20c3d1c94c --- /dev/null +++ b/src/template/alpha_cc @@ -0,0 +1,15 @@ +AROPT:crs +# NOFIXADE disallows unaligned access. +# on Ultrix and OSF/1 it invokes an explicit syscall. +# on HP-UX it turns off certain compiler options. +# This is defined here because a bunch of clients include tmp/c.h, +# which is where the work is done on HP-UX. It only affects the +# backend on Ultrix and OSF/1. +CFLAGS:-DNOFIXADE -std -O4 -Olimit 2000 +SHARED_LIB: +ALL: +SRCH_INC: +SRCH_LIB: +DLSUFFIX:.so +YFLAGS:-d +YACC: diff --git a/src/template/alpha b/src/template/alpha_gcc similarity index 100% rename from src/template/alpha rename to src/template/alpha_gcc diff --git a/src/test/regress/expected/float8-OSF1.out b/src/test/regress/expected/float8-OSF1.out new file mode 100644 index 0000000000..30003c3c31 --- /dev/null +++ b/src/test/regress/expected/float8-OSF1.out @@ -0,0 +1,234 @@ +QUERY: CREATE TABLE FLOAT8_TBL(f1 float8); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0'); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30'); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84'); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200'); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200'); +QUERY: SELECT '' AS five, FLOAT8_TBL.*; +five|f1 +----+-------------------- + |0 + |1004.3 + |-34.84 + |1.2345678901234e+200 + |1.2345678901234e-200 +(5 rows) + +QUERY: 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) + +QUERY: SELECT '' AS one, f.* FROM FLOAT8_TBL f WHERE f.f1 = '1004.3'; +one| f1 +---+------ + |1004.3 +(1 row) + +QUERY: SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1; +three| f1 +-----+-------------------- + | 0 + | -34.84 + |1.2345678901234e-200 +(3 rows) + +QUERY: SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE f.f1 < '1004.3'; +three| f1 +-----+-------------------- + | 0 + | -34.84 + |1.2345678901234e-200 +(3 rows) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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) + +QUERY: 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.23456789012338e+200 + |1.2345678901234e-200|1.23456789012339e-200 +(3 rows) + +QUERY: 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.97933859234765e+66 + |1.2345678901234e-200|2.3112042409018e-67 +(5 rows) + +QUERY: SELECT '' AS five, FLOAT8_TBL.*; +five|f1 +----+-------------------- + |0 + |1004.3 + |-34.84 + |1.2345678901234e+200 + |1.2345678901234e-200 +(5 rows) + +QUERY: UPDATE FLOAT8_TBL + SET f1 = FLOAT8_TBL.f1 * '-1' + WHERE FLOAT8_TBL.f1 > '0.0'; +QUERY: SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f; +ERROR: floating point exception! The last floating point operation either exceeded legal ranges or was a divide by zero +QUERY: SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f; +ERROR: pow() result is out of range +QUERY: SELECT '' AS bad, (; (f.f1)) from FLOAT8_TBL f where f.f1 = '0.0' ; +ERROR: can't take log of zero +QUERY: SELECT '' AS bad, (; (f.f1)) from FLOAT8_TBL f where f.f1 < '0.0' ; +ERROR: can't take log of a negative number +QUERY: SELECT '' AS bad, : (f.f1) from FLOAT8_TBL f; +ERROR: exp() result is out of range +QUERY: SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f; +ERROR: float8div: divide by zero error +QUERY: SELECT '' AS five, FLOAT8_TBL.*; +five|f1 +----+--------------------- + |0 + |-34.84 + |-1004.3 + |-1.2345678901234e+200 + |-1.2345678901234e-200 +(5 rows) + +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); +ERROR: Bad float8 input format '10e400' +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400'); +ERROR: Bad float8 input format '-10e400' +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400'); +ERROR: Bad float8 input format '10e-400' +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400'); +ERROR: Bad float8 input format '-10e-400' +QUERY: DELETE FROM FLOAT8_TBL; +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0'); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84'); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('-1004.30'); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e+200'); +QUERY: INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e-200'); +QUERY: SELECT '' AS five, FLOAT8_TBL.*; +five|f1 +----+--------------------- + |0 + |-34.84 + |-1004.3 + |-1.2345678901234e+200 + |-1.2345678901234e-200 +(5 rows) +