Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 469ebee

Browse files
committed
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
1 parent 72ad5fe commit 469ebee

File tree

7 files changed

+82
-12
lines changed

7 files changed

+82
-12
lines changed

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ fcntl(0, F_SETLK, &lck);],
716716
;;
717717
esac
718718

719-
AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid])
719+
AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen])
720720

721721
AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
722722
[AC_TRY_LINK(

src/backend/port/aix/mkldexport.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ fi
4343
if [ -z "$2" ]; then
4444
echo '#!'
4545
else
46-
echo '#!' $2/$OBJNAME
46+
if [ "$2" = "." ]; then
47+
# for the base executable (AIX 4.2 and up)
48+
echo '#! .'
49+
else
50+
echo '#!' $2/$OBJNAME
51+
fi
4752
fi
4853
$NM -Bg $1 | \
4954
egrep ' [TDB] ' | \

src/backend/port/dynloader/aix.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
#include "postgres.h"
1515
#include "dynloader.h"
1616

17+
#ifndef HAVE_DLOPEN
18+
19+
/*
20+
* AIX 4.3 and up has dlopen() and friends in -ldl.
21+
* A la long, the homebrewn dl*() functions below should be obsolete.
22+
*/
23+
1724
/*
1825
* We simulate dlopen() et al. through a call to load. Because AIX has
1926
* no call to find an exported symbol we read the loader section of the
@@ -601,3 +608,5 @@ findMain(void)
601608
free(buf);
602609
return ret;
603610
}
611+
612+
#endif /* HAVE_DLOPEN */

src/backend/port/dynloader/aix.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
/*
2-
* $Id: aix.h,v 1.2 1998/09/01 04:30:51 momjian Exp $
2+
* $Id: aix.h,v 1.3 2000/09/29 22:00:43 momjian Exp $
33
*
44
* @(#)dlfcn.h 1.4 revision of 95/04/25 09:36:52
55
* This is an unpublished work copyright (c) 1992 HELIOS Software GmbH
66
* 30159 Hannover, Germany
77
*/
88

9-
#ifndef __dlfcn_h__
10-
#define __dlfcn_h__
9+
#ifndef PORT_PROTOS_H
10+
#define PORT_PROTOS_H
11+
12+
#ifdef HAVE_DLOPEN
13+
14+
#include <dlfcn.h>
15+
16+
#else /* HAVE_DLOPEN */
1117

1218
#ifdef __cplusplus
1319
extern "C"
@@ -48,9 +54,14 @@ extern "C"
4854

4955
#endif
5056

51-
#define pg_dlopen(f) dlopen(filename, RTLD_LAZY)
52-
#define pg_dlsym(h,f) dlsym(h, f)
53-
#define pg_dlclose(h) dlclose(h)
54-
#define pg_dlerror() dlerror()
57+
#endif /* HAVE_DLOPEN */
58+
59+
#include "fmgr.h"
60+
#include "utils/dynamic_loader.h"
61+
62+
#define pg_dlopen(f) dlopen(f, RTLD_LAZY)
63+
#define pg_dlsym dlsym
64+
#define pg_dlclose dlclose
65+
#define pg_dlerror dlerror
5566

56-
#endif /* __dlfcn_h__ */
67+
#endif /* PORT_PROTOS_H */

src/include/config.h.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in config.h afterwards. Of course, if you edit config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: config.h.in,v 1.136 2000/09/29 13:53:32 petere Exp $
11+
* $Id: config.h.in,v 1.137 2000/09/29 22:00:45 momjian Exp $
1212
*/
1313

1414
#ifndef CONFIG_H
@@ -581,6 +581,9 @@ extern void srandom(unsigned int seed);
581581
/* Define if C++ compiler accepts "#include <string>" */
582582
#undef HAVE_CXX_STRING_HEADER
583583

584+
/* Define if a system lib (-ldl) has dlopen() (needed for AIX) */
585+
#undef HAVE_DLOPEN
586+
584587

585588
/*
586589
*------------------------------------------------------------------------

src/makefiles/Makefile.aix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ $(POSTGRES_IMP):
2222

2323
%$(DLSUFFIX): %.o %$(EXPSUFF)
2424
@echo Making share library $@ from $*.o, $*$(EXPSUFF), and installed postgres.imp
25-
$(LD) -H512 -bM:SRE -bI:$(libdir)/$(POSTGRES_IMP) -bE:$*$(EXPSUFF) -o $@ $*.o $(LDFLAGS) $(CFLAGS_SL)
25+
$(CC) -Wl,-H512 -Wl,-bM:SRE -Wl,-bI:$(libdir)/$(POSTGRES_IMP) -Wl,-bE:$*$(EXPSUFF) -o $@ $*.o $(LDFLAGS) $(CFLAGS_SL)

src/test/regress/expected/horology-1947-PDT.out

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,48 @@
22
-- HOROLOGY
33
--
44
--
5+
-- date, time arithmetic
6+
--
7+
SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time";
8+
Date + Time
9+
------------------------------
10+
Tue Feb 03 04:05:06 1981 PST
11+
(1 row)
12+
13+
SELECT date '1991-02-03' + time with time zone '04:05:06 PST' AS "Date + Time PST";
14+
Date + Time PST
15+
------------------------------
16+
Sun Feb 03 04:05:06 1991 PST
17+
(1 row)
18+
19+
SELECT date '2001-02-03' + time with time zone '04:05:06 UTC' AS "Date + Time UTC";
20+
Date + Time UTC
21+
------------------------------
22+
Fri Feb 02 20:05:06 2001 PST
23+
(1 row)
24+
25+
SELECT date '1991-02-03' + interval '2 years' AS "Add Two Years";
26+
Add Two Years
27+
------------------------------
28+
Wed Feb 03 00:00:00 1993 PST
29+
(1 row)
30+
31+
SELECT date '2001-12-13' - interval '2 years' AS "Subtract Two Years";
32+
Subtract Two Years
33+
------------------------------
34+
Mon Dec 13 00:00:00 1999 PST
35+
(1 row)
36+
37+
SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
38+
Subtract Time
39+
------------------------------
40+
Sat Feb 02 19:54:54 1991 PST
41+
(1 row)
42+
43+
SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
44+
ERROR: Unable to identify an operator '-' for types 'date' and 'timetz'
45+
You will have to retype this query using an explicit cast
46+
--
547
-- timestamp, interval arithmetic
648
--
749
SELECT timestamp '1996-03-01' - interval '1 second' AS "Feb 29";

0 commit comments

Comments
 (0)