From 469ebeefd644e829facdb9fab2dc8b8a47352795 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 29 Sep 2000 22:00:49 +0000 Subject: [PATCH] Please apply the following patch to fix problems with the AIX port and the fmgr redesign. It makes the homebrewn dl*() functions for more recent Versions of AIX obsolete by using the system dl*() functions instead. It also fixes the expected file for the horology regression test. Please regenerate configure from configure.in, I don't have the environment/time. Andreas --- configure.in | 2 +- src/backend/port/aix/mkldexport.sh | 7 +++- src/backend/port/dynloader/aix.c | 9 ++++ src/backend/port/dynloader/aix.h | 27 ++++++++---- src/include/config.h.in | 5 ++- src/makefiles/Makefile.aix | 2 +- .../regress/expected/horology-1947-PDT.out | 42 +++++++++++++++++++ 7 files changed, 82 insertions(+), 12 deletions(-) diff --git a/configure.in b/configure.in index 2ea1b3c63e..51230d9e22 100644 --- a/configure.in +++ b/configure.in @@ -716,7 +716,7 @@ fcntl(0, F_SETLK, &lck);], ;; esac -AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid]) +AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen]) AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS], [AC_TRY_LINK( diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh index 4a42a9729c..4e6c98541d 100755 --- a/src/backend/port/aix/mkldexport.sh +++ b/src/backend/port/aix/mkldexport.sh @@ -43,7 +43,12 @@ fi if [ -z "$2" ]; then echo '#!' else - echo '#!' $2/$OBJNAME + if [ "$2" = "." ]; then + # for the base executable (AIX 4.2 and up) + echo '#! .' + else + echo '#!' $2/$OBJNAME + fi fi $NM -Bg $1 | \ egrep ' [TDB] ' | \ diff --git a/src/backend/port/dynloader/aix.c b/src/backend/port/dynloader/aix.c index c6295406e2..c1556bb1c2 100644 --- a/src/backend/port/dynloader/aix.c +++ b/src/backend/port/dynloader/aix.c @@ -14,6 +14,13 @@ #include "postgres.h" #include "dynloader.h" +#ifndef HAVE_DLOPEN + +/* + * AIX 4.3 and up has dlopen() and friends in -ldl. + * A la long, the homebrewn dl*() functions below should be obsolete. + */ + /* * We simulate dlopen() et al. through a call to load. Because AIX has * no call to find an exported symbol we read the loader section of the @@ -601,3 +608,5 @@ findMain(void) free(buf); return ret; } + +#endif /* HAVE_DLOPEN */ diff --git a/src/backend/port/dynloader/aix.h b/src/backend/port/dynloader/aix.h index ee19b47ea4..35b3a0d0aa 100644 --- a/src/backend/port/dynloader/aix.h +++ b/src/backend/port/dynloader/aix.h @@ -1,13 +1,19 @@ /* - * $Id: aix.h,v 1.2 1998/09/01 04:30:51 momjian Exp $ + * $Id: aix.h,v 1.3 2000/09/29 22:00:43 momjian Exp $ * * @(#)dlfcn.h 1.4 revision of 95/04/25 09:36:52 * This is an unpublished work copyright (c) 1992 HELIOS Software GmbH * 30159 Hannover, Germany */ -#ifndef __dlfcn_h__ -#define __dlfcn_h__ +#ifndef PORT_PROTOS_H +#define PORT_PROTOS_H + +#ifdef HAVE_DLOPEN + +#include + +#else /* HAVE_DLOPEN */ #ifdef __cplusplus extern "C" @@ -48,9 +54,14 @@ extern "C" #endif -#define pg_dlopen(f) dlopen(filename, RTLD_LAZY) -#define pg_dlsym(h,f) dlsym(h, f) -#define pg_dlclose(h) dlclose(h) -#define pg_dlerror() dlerror() +#endif /* HAVE_DLOPEN */ + +#include "fmgr.h" +#include "utils/dynamic_loader.h" + +#define pg_dlopen(f) dlopen(f, RTLD_LAZY) +#define pg_dlsym dlsym +#define pg_dlclose dlclose +#define pg_dlerror dlerror -#endif /* __dlfcn_h__ */ +#endif /* PORT_PROTOS_H */ diff --git a/src/include/config.h.in b/src/include/config.h.in index 05228d18ba..c363bceb4c 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -8,7 +8,7 @@ * or in config.h afterwards. Of course, if you edit config.h, then your * changes will be overwritten the next time you run configure. * - * $Id: config.h.in,v 1.136 2000/09/29 13:53:32 petere Exp $ + * $Id: config.h.in,v 1.137 2000/09/29 22:00:45 momjian Exp $ */ #ifndef CONFIG_H @@ -581,6 +581,9 @@ extern void srandom(unsigned int seed); /* Define if C++ compiler accepts "#include " */ #undef HAVE_CXX_STRING_HEADER +/* Define if a system lib (-ldl) has dlopen() (needed for AIX) */ +#undef HAVE_DLOPEN + /* *------------------------------------------------------------------------ diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix index 0066135179..c40ff6d374 100644 --- a/src/makefiles/Makefile.aix +++ b/src/makefiles/Makefile.aix @@ -22,4 +22,4 @@ $(POSTGRES_IMP): %$(DLSUFFIX): %.o %$(EXPSUFF) @echo Making share library $@ from $*.o, $*$(EXPSUFF), and installed postgres.imp - $(LD) -H512 -bM:SRE -bI:$(libdir)/$(POSTGRES_IMP) -bE:$*$(EXPSUFF) -o $@ $*.o $(LDFLAGS) $(CFLAGS_SL) + $(CC) -Wl,-H512 -Wl,-bM:SRE -Wl,-bI:$(libdir)/$(POSTGRES_IMP) -Wl,-bE:$*$(EXPSUFF) -o $@ $*.o $(LDFLAGS) $(CFLAGS_SL) diff --git a/src/test/regress/expected/horology-1947-PDT.out b/src/test/regress/expected/horology-1947-PDT.out index b04f877b87..b467286bca 100644 --- a/src/test/regress/expected/horology-1947-PDT.out +++ b/src/test/regress/expected/horology-1947-PDT.out @@ -2,6 +2,48 @@ -- HOROLOGY -- -- +-- date, time arithmetic +-- +SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time"; + Date + Time +------------------------------ + Tue Feb 03 04:05:06 1981 PST +(1 row) + +SELECT date '1991-02-03' + time with time zone '04:05:06 PST' AS "Date + Time PST"; + Date + Time PST +------------------------------ + Sun Feb 03 04:05:06 1991 PST +(1 row) + +SELECT date '2001-02-03' + time with time zone '04:05:06 UTC' AS "Date + Time UTC"; + Date + Time UTC +------------------------------ + Fri Feb 02 20:05:06 2001 PST +(1 row) + +SELECT date '1991-02-03' + interval '2 years' AS "Add Two Years"; + Add Two Years +------------------------------ + Wed Feb 03 00:00:00 1993 PST +(1 row) + +SELECT date '2001-12-13' - interval '2 years' AS "Subtract Two Years"; + Subtract Two Years +------------------------------ + Mon Dec 13 00:00:00 1999 PST +(1 row) + +SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time"; + Subtract Time +------------------------------ + Sat Feb 02 19:54:54 1991 PST +(1 row) + +SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC"; +ERROR: Unable to identify an operator '-' for types 'date' and 'timetz' + You will have to retype this query using an explicit cast +-- -- timestamp, interval arithmetic -- SELECT timestamp '1996-03-01' - interval '1 second' AS "Feb 29"; -- GitLab