PostgreSQL on SunOS 4.1.2 - Mailing list pgsql-ports
| From | Ralf_Meister@comcity-online.de (Ralf Meister) |
|---|---|
| Subject | PostgreSQL on SunOS 4.1.2 |
| Date | |
| Msg-id | ae483704f1c5646e5de724ee665b62b1 Whole thread Raw |
| List | pgsql-ports |
Hello postgres team,
after a few changes I have PostgreSQL successfully running on SunOS 4.1.2.
The following things had to be fixed:
configuring:
- - configure chooses templates for Solaris (not SunOS) with wrong options
for ar. No patch included.
- - sunos.h is not up to date. Defining Marcos for tas().
- - Creating of shared Libraries is not supported by default. Changing
Makefile.shlist to create shared libraries.
Backend:
- - fflush(NULL) does not work on SunOS 4.1.2. Use explicit flushing of
stdin, stdout and stderr instead.
libpq:
- - realloc(oldptr, newsize) does not allocate a buffer if oldptr==NULL.
Test oldprt==NULL and call malloc instead.
libecpg:
- - strtoul is not in standard C library. Use avaiable source code instead
(e.g. OpenBSD or Linux source-code)
That's all. Thank you for postgres
Ralf Meister
Am Gangsteig 11
85551 Heimstetten
Germany
(Ralf_Meister@comcity-online.de)
Here are the diffs (without source code for strtoul):
I`ve also included the result of regression test.
*** postgresql-v6.4/src/backend/postmaster/postmaster.c.dist Sat Nov 28 14:25:04 1998
- --- postgresql-v6.4/src/backend/postmaster/postmaster.c Fri Nov 27 21:48:18 1998
***************
*** 1292,1298 ****
* Flush all stdio channels just before fork, to avoid double-output
* problems.
*/
! fflush(NULL);
if ((pid = fork()) == 0)
{ /* child */
- --- 1292,1300 ----
* Flush all stdio channels just before fork, to avoid double-output
* problems.
*/
! fflush(stdin);
! fflush(stdout);
! fflush(stderr);
if ((pid = fork()) == 0)
{ /* child */
No differences encountered
*** postgresql-v6.4/src/include/port/sunos4.h.dist Sun Sep 7 06:59:58 1997
- --- postgresql-v6.4/src/include/port/sunos4.h Thu Nov 26 22:38:21 1998
***************
*** 1,4 ****
- --- 1,8 ----
#define USE_POSIX_TIME
+ #define HAS_TEST_AND_SET
+ #define NEED_SPARC_TAS_ASM
+
+ typedef unsigned char slock_t;
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
*** postgresql-v6.4/src/interfaces/libpq/fe-exec.c.dist Sat Nov 28 16:45:05 1998
- --- postgresql-v6.4/src/interfaces/libpq/fe-exec.c Sat Nov 28 17:56:10 1998
***************
*** 220,228 ****
* Note that the positions beyond res->ntups are garbage, not
* necessarily NULL.
*/
int newSize = res->tupArrSize + TUPARR_GROW_BY;
! PGresAttValue ** newTuples = (PGresAttValue **)
realloc(res->tuples, newSize * sizeof(PGresAttValue *));
if (! newTuples)
return FALSE; /* realloc failed */
res->tupArrSize = newSize;
- --- 220,233 ----
* Note that the positions beyond res->ntups are garbage, not
* necessarily NULL.
*/
+ PGresAttValue ** newTuples;
int newSize = res->tupArrSize + TUPARR_GROW_BY;
! if( res->tuples != NULL )
! newTuples = (PGresAttValue **)
realloc(res->tuples, newSize * sizeof(PGresAttValue *));
+ else
+ newTuples = (PGresAttValue **)
+ malloc(newSize * sizeof(PGresAttValue *));
if (! newTuples)
return FALSE; /* realloc failed */
res->tupArrSize = newSize;
*** postgresql-v6.4/src/Makefile.shlib.dist Sat Oct 31 04:58:51 1998
- --- postgresql-v6.4/src/Makefile.shlib Sat Nov 28 20:18:51 1998
***************
*** 126,131 ****
- --- 126,138 ----
CFLAGS += $(CFLAGS_SL)
endif
+ ifeq ($(PORTNAME), sunos4)
+ install-shlib-dep := install-shlib
+ shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
+ LDFLAGS_SL := -assert pure-text
+ CFLAGS += $(CFLAGS_SL)
+ endif
+
ifeq ($(PORTNAME), svr4)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
- ----------------------------------------------------------------------------------------
Here are the results of regression:
=============== Notes... =================
postmaster must already be running for the regression tests to succeed.
The time zone is now set to PST8PDT explicitly by this regression test
client frontend. Please report any apparent problems to
ports@postgresql.org
See regress/README for more information.
=============== destroying old regression database... =================
ERROR: destroydb: database 'regression' does not exist
destroydb: database destroy failed on regression.
=============== creating new regression database... =================
=============== running regression queries... =================
boolean .. ok
char .. ok
name .. ok
varchar .. ok
text .. ok
strings .. ok
int2 .. ok
int4 .. failed
int8 .. failed
oid .. ok
float4 .. ok
float8 .. failed
numerology .. failed
point .. ok
lseg .. ok
box .. ok
path .. ok
polygon .. ok
circle .. ok
geometry .. failed
timespan .. ok
datetime .. ok
reltime .. ok
abstime .. ok
tinterval .. ok
horology .. failed
inet .. failed
comments .. ok
opr_sanity .. ok
create_function_1 .. ok
create_type .. ok
create_table .. ok
create_function_2 .. ok
constraints .. ok
triggers .. ok
copy .. ok
create_misc .. ok
create_aggregate .. ok
create_operator .. ok
create_view .. ok
create_index .. ok
sanity_check .. ok
errors .. ok
select .. ok
select_into .. ok
select_distinct .. ok
select_distinct_on .. ok
select_implicit .. ok
select_having .. ok
subselect .. ok
union .. failed
aggregates .. ok
transactions .. ok
random .. ok
portals .. ok
misc .. ok
arrays .. ok
btree_index .. ok
hash_index .. ok
select_views .. ok
alter_table .. ok
portals_p2 .. ok
rules .. ok
install_plpgsql .. ok
plpgsql .. failed
- -----------------------------------------------------------------
The failure of plpqsql has been fixed. The backend did not
find the shared library. I'm a little bit worried about
the failure of int4 test. Here is regression.diffs:
- -----------------------------------------------------------------
*** expected/int4-SunOS.out Tue Feb 10 15:22:48 1998
- --- results/int4.out Sat Nov 28 22:01:46 1998
***************
*** 7,13 ****
QUERY: INSERT INTO INT4_TBL(f1) VALUES ('2147483647');
QUERY: INSERT INTO INT4_TBL(f1) VALUES ('-2147483647');
QUERY: INSERT INTO INT4_TBL(f1) VALUES ('1000000000000');
- - ERROR: pg_atoi: error reading "1000000000000": Result too large
QUERY: INSERT INTO INT4_TBL(f1) VALUES ('asdf');
ERROR: pg_atoi: error in "asdf": can't parse "asdf"
QUERY: SELECT '' AS five, INT4_TBL.*;
- --- 7,12 ----
***************
*** 18,24 ****
| -123456
| 2147483647
|-2147483647
! (5 rows)
QUERY: SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> '0'::int2;
four| f1
- --- 17,24 ----
| -123456
| 2147483647
|-2147483647
! | -727379968
! (6 rows)
QUERY: SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> '0'::int2;
four| f1
***************
*** 27,33 ****
| -123456
| 2147483647
|-2147483647
! (4 rows)
QUERY: SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> '0'::int4;
four| f1
- --- 27,34 ----
| -123456
| 2147483647
|-2147483647
! | -727379968
! (5 rows)
QUERY: SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> '0'::int4;
four| f1
***************
*** 36,42 ****
| -123456
| 2147483647
|-2147483647
! (4 rows)
QUERY: SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = '0'::int2;
one|f1
- --- 37,44 ----
| -123456
| 2147483647
|-2147483647
! | -727379968
! (5 rows)
QUERY: SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = '0'::int2;
one|f1
***************
*** 55,61 ****
---+-----------
| -123456
|-2147483647
! (2 rows)
QUERY: SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < '0'::int4;
two| f1
- --- 57,64 ----
---+-----------
| -123456
|-2147483647
! | -727379968
! (3 rows)
QUERY: SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < '0'::int4;
two| f1
***************
*** 62,68 ****
---+-----------
| -123456
|-2147483647
! (2 rows)
QUERY: SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= '0'::int2;
three| f1
- --- 65,72 ----
---+-----------
| -123456
|-2147483647
! | -727379968
! (3 rows)
QUERY: SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= '0'::int2;
three| f1
***************
*** 70,76 ****
| 0
| -123456
|-2147483647
! (3 rows)
QUERY: SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= '0'::int4;
three| f1
- --- 74,81 ----
| 0
| -123456
|-2147483647
! | -727379968
! (4 rows)
QUERY: SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= '0'::int4;
three| f1
***************
*** 78,84 ****
| 0
| -123456
|-2147483647
! (3 rows)
QUERY: SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > '0'::int2;
two| f1
- --- 83,90 ----
| 0
| -123456
|-2147483647
! | -727379968
! (4 rows)
QUERY: SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > '0'::int2;
two| f1
***************
*** 118,148 ****
QUERY: SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % '2'::int4) = '0'::int2;
three| f1
! -----+-------
| 0
| 123456
|-123456
! (3 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 * '2'::int2 AS x FROM INT4_TBL i;
five| f1| x
! ----+-----------+-------
| 0| 0
| 123456| 246912
| -123456|-246912
| 2147483647| -2
|-2147483647| 2
! (5 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 * '2'::int4 AS x FROM INT4_TBL i;
five| f1| x
! ----+-----------+-------
| 0| 0
| 123456| 246912
| -123456|-246912
| 2147483647| -2
|-2147483647| 2
! (5 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 + '2'::int2 AS x FROM INT4_TBL i;
five| f1| x
- --- 124,157 ----
QUERY: SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % '2'::int4) = '0'::int2;
three| f1
! -----+----------
| 0
| 123456
| -123456
! |-727379968
! (4 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 * '2'::int2 AS x FROM INT4_TBL i;
five| f1| x
! ----+-----------+-----------
| 0| 0
| 123456| 246912
| -123456| -246912
| 2147483647| -2
|-2147483647| 2
! | -727379968|-1454759936
! (6 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 * '2'::int4 AS x FROM INT4_TBL i;
five| f1| x
! ----+-----------+-----------
| 0| 0
| 123456| 246912
| -123456| -246912
| 2147483647| -2
|-2147483647| 2
! | -727379968|-1454759936
! (6 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 + '2'::int2 AS x FROM INT4_TBL i;
five| f1| x
***************
*** 152,158 ****
| -123456| -123454
| 2147483647|-2147483647
|-2147483647|-2147483645
! (5 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 + '2'::int4 AS x FROM INT4_TBL i;
five| f1| x
- --- 161,168 ----
| -123456| -123454
| 2147483647|-2147483647
|-2147483647|-2147483645
! | -727379968| -727379966
! (6 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 + '2'::int4 AS x FROM INT4_TBL i;
five| f1| x
***************
*** 162,168 ****
| -123456| -123454
| 2147483647|-2147483647
|-2147483647|-2147483645
! (5 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 - '2'::int2 AS x FROM INT4_TBL i;
five| f1| x
- --- 172,179 ----
| -123456| -123454
| 2147483647|-2147483647
|-2147483647|-2147483645
! | -727379968| -727379966
! (6 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 - '2'::int2 AS x FROM INT4_TBL i;
five| f1| x
***************
*** 172,178 ****
| -123456| -123458
| 2147483647|2147483645
|-2147483647|2147483647
! (5 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 - '2'::int4 AS x FROM INT4_TBL i;
five| f1| x
- --- 183,190 ----
| -123456| -123458
| 2147483647|2147483645
|-2147483647|2147483647
! | -727379968|-727379970
! (6 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 - '2'::int4 AS x FROM INT4_TBL i;
five| f1| x
***************
*** 182,188 ****
| -123456| -123458
| 2147483647|2147483645
|-2147483647|2147483647
! (5 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 / '2'::int2 AS x FROM INT4_TBL i;
five| f1| x
- --- 194,201 ----
| -123456| -123458
| 2147483647|2147483645
|-2147483647|2147483647
! | -727379968|-727379970
! (6 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 / '2'::int2 AS x FROM INT4_TBL i;
five| f1| x
***************
*** 192,198 ****
| -123456| -61728
| 2147483647| 1073741823
|-2147483647|-1073741823
! (5 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 / '2'::int4 AS x FROM INT4_TBL i;
five| f1| x
- --- 205,212 ----
| -123456| -61728
| 2147483647| 1073741823
|-2147483647|-1073741823
! | -727379968| -363689984
! (6 rows)
QUERY: SELECT '' AS five, i.f1, i.f1 / '2'::int4 AS x FROM INT4_TBL i;
five| f1| x
***************
*** 202,208 ****
| -123456| -61728
| 2147483647| 1073741823
|-2147483647|-1073741823
! (5 rows)
QUERY: SELECT -2+3 AS one;
one
- --- 216,223 ----
| -123456| -61728
| 2147483647| 1073741823
|-2147483647|-1073741823
! | -727379968| -363689984
! (6 rows)
QUERY: SELECT -2+3 AS one;
one
- ----------------------
*** expected/int8.out Wed Jul 8 16:29:08 1998
- --- results/int8.out Sat Nov 28 22:01:50 1998
***************
*** 6,115 ****
QUERY: INSERT INTO INT8_TBL VALUES('4567890123456789','-4567890123456789');
QUERY: SELECT * FROM INT8_TBL;
q1| q2
! ----------------+-----------------
! 123| 456
! 123| 4567890123456789
! 4567890123456789| 123
! 4567890123456789| 4567890123456789
! 4567890123456789|-4567890123456789
(5 rows)
QUERY: 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)
QUERY: 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)
QUERY: 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)
QUERY: 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)
QUERY: 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)
QUERY: SELECT '' AS five, q1, float8(q1) FROM INT8_TBL;
five| q1|float8
! ----+----------------+--------------------
! | 123|123
! | 123|123
! |4567890123456789|4.56789012345679e+15
! |4567890123456789|4.56789012345679e+15
! |4567890123456789|4.56789012345679e+15
(5 rows)
QUERY: SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
five| q2|float8
! ----+-----------------+---------------------
! | 456|456
! | 4567890123456789|4.56789012345679e+15
! | 123|123
! | 4567890123456789|4.56789012345679e+15
! |-4567890123456789|-4.56789012345679e+15
(5 rows)
QUERY: 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)
QUERY: SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
five| twice int4
! ----+----------------
! | 246
! | 246
! |9135780246913578
! |9135780246913578
! |9135780246913578
(5 rows)
QUERY: SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL;
five| twice int4
! ----+----------------
! | 246
! | 246
! |9135780246913578
! |9135780246913578
! |9135780246913578
(5 rows)
- --- 6,117 ----
QUERY: INSERT INTO INT8_TBL VALUES('4567890123456789','-4567890123456789');
QUERY: SELECT * FROM INT8_TBL;
q1| q2
! ----------+----------
! -134230880|-134230880
! -134230880|-134230880
! -134230880|-134230880
! -134230880|-134230880
! -134230880|-134230880
(5 rows)
QUERY: SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL;
five| plus| minus
! ----+----------+----------
! |-134230880|-134230880
! |-134230880|-134230880
! |-134230880|-134230880
! |-134230880|-134230880
! |-134230880|-134230880
(5 rows)
QUERY: SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL;
five| q1| q2| plus
! ----+----------+----------+----------
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
(5 rows)
QUERY: SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL;
five| q1| q2| minus
! ----+----------+----------+----------
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
(5 rows)
QUERY: 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
! -----+----------+----------+----------
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! (5 rows)
QUERY: SELECT '' AS five, q1, q2, q1 / q2 AS divide FROM INT8_TBL;
five| q1| q2| divide
! ----+----------+----------+----------
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
! |-134230880|-134230880|-134230880
(5 rows)
QUERY: SELECT '' AS five, q1, float8(q1) FROM INT8_TBL;
five| q1| float8
! ----+----------+----------
! |-134230880| 123
! |-134230880| 123
! |-134230880|-869367531
! |-134230880|-869367531
! |-134230880|-869367531
(5 rows)
QUERY: SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
five| q2| float8
! ----+----------+----------
! |-134230880| 456
! |-134230880|-869367531
! |-134230880| 123
! |-134230880|-869367531
! |-134230880| 869367531
(5 rows)
QUERY: SELECT '' AS five, q1, int8(float8(q1)) AS "two coercions" FROM INT8_TBL;
five| q1|two coercions
! ----+----------+-------------
! |-134230880| -134230880
! |-134230880| -134230880
! |-134230880| -134230880
! |-134230880| -134230880
! |-134230880| -134230880
(5 rows)
QUERY: SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
five|twice int4
! ----+----------
! |-134230880
! |-134230880
! |-134230880
! |-134230880
! |-134230880
(5 rows)
QUERY: SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL;
five|twice int4
! ----+----------
! |-134230880
! |-134230880
! |-134230880
! |-134230880
! |-134230880
(5 rows)
- ----------------------
pgsql-ports by date: