eb9dca7e31149157525dcea36c517286d23b8704
[openwrt/openwrt.git] / openwrt / package / postgresql / patches / 500-debian-subset.patch
1 diff -ruN postgresql-7.4.6-orig/contrib/Makefile postgresql-7.4.6-3/contrib/Makefile
2 --- postgresql-7.4.6-orig/contrib/Makefile 2003-09-11 19:15:27.000000000 +0200
3 +++ postgresql-7.4.6-3/contrib/Makefile 2005-03-09 15:56:11.000000000 +0100
4 @@ -22,8 +22,10 @@
5 lo \
6 ltree \
7 miscutil \
8 + mysql \
9 noupdate \
10 oid2name \
11 + oracle \
12 pg_autovacuum \
13 pg_dumplo \
14 pg_logger \
15 @@ -40,7 +42,8 @@
16 tsearch \
17 tsearch2 \
18 userlock \
19 - vacuumlo
20 + vacuumlo \
21 + xml
22
23 # Missing:
24 # array \ (removed all but the README)
25 @@ -48,13 +51,10 @@
26 # ipc_check \ (does not have a makefile)
27 # mSQL-interface \ (requires msql installed)
28 # mac \ (does not have a makefile)
29 -# mysql \ (does not have a makefile)
30 -# oracle \ (does not have a makefile)
31 # pg_upgrade \ (does not have a makefile)
32 # reindexdb \ (does not have a makefile)
33 # start-scripts \ (does not have a makefile)
34 # tools \ (does not have a makefile)
35 -# xml \ (non-standard makefile)
36
37
38 all install installdirs uninstall clean distclean maintainer-clean check installcheck:
39 diff -ruN postgresql-7.4.6-orig/contrib/dbase/dbf2pg.c postgresql-7.4.6-3/contrib/dbase/dbf2pg.c
40 --- postgresql-7.4.6-orig/contrib/dbase/dbf2pg.c 2003-09-28 00:24:49.000000000 +0200
41 +++ postgresql-7.4.6-3/contrib/dbase/dbf2pg.c 2005-03-09 15:56:11.000000000 +0100
42 @@ -324,6 +324,10 @@
43 case 'L':
44 strcat(query, " char");
45 break;
46 +
47 + case 'M':
48 + strcat(query, " text");
49 + break;
50 }
51 }
52
53 @@ -335,7 +339,10 @@
54 printf("%s\n", query);
55 }
56
57 - if ((res = PQexec(conn, query)) == NULL)
58 + if ((res = PQexec(conn, query)) == NULL ||
59 + PQresultStatus(res) == PGRES_BAD_RESPONSE ||
60 + PQresultStatus(res) == PGRES_NONFATAL_ERROR ||
61 + PQresultStatus(res) == PGRES_FATAL_ERROR)
62 {
63 fprintf(stderr, "Error creating table!\n");
64 fprintf(stderr, "Detailed report: %s\n", PQerrorMessage(conn));
65 @@ -429,7 +436,10 @@
66 }
67 sprintf(query, "COPY %s FROM stdin", table);
68 res = PQexec(conn, query);
69 - if (res == NULL)
70 + if (res == NULL ||
71 + PQresultStatus(res)==PGRES_BAD_RESPONSE ||
72 + PQresultStatus(res)==PGRES_NONFATAL_ERROR ||
73 + PQresultStatus(res)==PGRES_FATAL_ERROR)
74 {
75 fprintf(stderr, "Error starting COPY!\n");
76 fprintf(stderr, "Detailed report: %s\n", PQerrorMessage(conn));
77 diff -ruN postgresql-7.4.6-orig/contrib/dbmirror/Makefile postgresql-7.4.6-3/contrib/dbmirror/Makefile
78 --- postgresql-7.4.6-orig/contrib/dbmirror/Makefile 2002-06-23 23:58:07.000000000 +0200
79 +++ postgresql-7.4.6-3/contrib/dbmirror/Makefile 2005-03-09 15:56:11.000000000 +0100
80 @@ -5,6 +5,8 @@
81 include $(top_builddir)/src/Makefile.global
82
83 MODULES = pending
84 +SCRIPTS = clean_pending.pl DBMirror.pl
85 +DATA = AddTrigger.sql MirrorSetup.sql slaveDatabase.conf
86 DOCS = README.dbmirror
87
88 include $(top_srcdir)/contrib/contrib-global.mk
89 diff -ruN postgresql-7.4.6-orig/contrib/mysql/Makefile postgresql-7.4.6-3/contrib/mysql/Makefile
90 --- postgresql-7.4.6-orig/contrib/mysql/Makefile 1970-01-01 01:00:00.000000000 +0100
91 +++ postgresql-7.4.6-3/contrib/mysql/Makefile 2005-03-09 15:56:11.000000000 +0100
92 @@ -0,0 +1,12 @@
93 +# mysql conversion Perl scripts
94 +
95 +subdir = contrib/mysql
96 +top_builddir = ../..
97 +include $(top_builddir)/src/Makefile.global
98 +
99 +MODULES =
100 +SCRIPTS = my2pg.pl mysql2pgsql
101 +DOCS = README.mysql
102 +
103 +include $(top_srcdir)/contrib/contrib-global.mk
104 +
105 diff -ruN postgresql-7.4.6-orig/contrib/mysql/mysql2pgsql postgresql-7.4.6-3/contrib/mysql/mysql2pgsql
106 --- postgresql-7.4.6-orig/contrib/mysql/mysql2pgsql 2001-01-18 08:16:56.000000000 +0100
107 +++ postgresql-7.4.6-3/contrib/mysql/mysql2pgsql 2005-03-09 15:56:11.000000000 +0100
108 @@ -1,4 +1,4 @@
109 -# -*- perl -*-
110 +#!/usr/bin/perl -w
111 # mysql2pgsql
112 # Take a MySQL schema dump and turn it into SQL92 and PostgreSQL form.
113 # Thomas Lockhart, (c) 2000, PostgreSQL Inc.
114 diff -ruN postgresql-7.4.6-orig/contrib/oracle/Makefile postgresql-7.4.6-3/contrib/oracle/Makefile
115 --- postgresql-7.4.6-orig/contrib/oracle/Makefile 1970-01-01 01:00:00.000000000 +0100
116 +++ postgresql-7.4.6-3/contrib/oracle/Makefile 2005-03-09 15:56:11.000000000 +0100
117 @@ -0,0 +1,11 @@
118 +# oracle conversion Perl scripts
119 +
120 +subdir = contrib/oracle
121 +top_builddir = ../..
122 +include $(top_builddir)/src/Makefile.global
123 +
124 +MODULES =
125 +SCRIPTS = Ora2Pg.pm ora2pg.pl
126 +DOCS = README.ora2pg
127 +
128 +include $(top_srcdir)/contrib/contrib-global.mk
129 diff -ruN postgresql-7.4.6-orig/contrib/oracle/ora2pg.pl postgresql-7.4.6-3/contrib/oracle/ora2pg.pl
130 --- postgresql-7.4.6-orig/contrib/oracle/ora2pg.pl 2003-01-07 23:17:14.000000000 +0100
131 +++ postgresql-7.4.6-3/contrib/oracle/ora2pg.pl 2005-03-09 15:56:11.000000000 +0100
132 @@ -17,6 +17,10 @@
133
134 use strict;
135
136 +# allow to put Ora2Pg.pm in the same directory as this script
137 +use File::Basename;
138 +use lib dirname($0);
139 +
140 use Ora2Pg;
141
142 # Initialyze the database connection
143 diff -ruN postgresql-7.4.6-orig/contrib/pg_autovacuum/pg_autovacuum.c postgresql-7.4.6-3/contrib/pg_autovacuum/pg_autovacuum.c
144 --- postgresql-7.4.6-orig/contrib/pg_autovacuum/pg_autovacuum.c 2004-05-26 20:48:36.000000000 +0200
145 +++ postgresql-7.4.6-3/contrib/pg_autovacuum/pg_autovacuum.c 2005-03-09 15:56:11.000000000 +0100
146 @@ -5,6 +5,12 @@
147 */
148
149 #include "pg_autovacuum.h"
150 +#include <string.h>
151 +#include <stdio.h>
152 +#include <stdlib.h>
153 +#include <unistd.h>
154 +#include <fcntl.h>
155 +
156 #define TIMEBUFF 256
157 FILE *LOGOUTPUT;
158 char timebuffer[TIMEBUFF];
159 @@ -30,6 +36,15 @@
160 daemonize()
161 {
162 pid_t pid;
163 + int nullfd;
164 + char* pgdata = getenv("PGDATA");
165 +
166 + /* Check if PGDATA is set. Needed to create pid file. */
167 + if (!pgdata)
168 + {
169 + fprintf(stderr, "Error: PGDATA not defined. Could not create pid file. Aborting\n");
170 + _exit(1);
171 + }
172
173 pid = fork();
174 if (pid == (pid_t) -1)
175 @@ -40,10 +55,39 @@
176 }
177 else if (pid)
178 { /* parent */
179 +#define PIDFILEBUF 1024
180 + char databuf[PIDFILEBUF];
181 + char *dataptr = databuf;
182 + char *pidfilename = "/autovacuum.pid";
183 + FILE *PIDFILE;
184 +
185 + /* If we can determine PGDATA, write a PID file there.
186 + * This is a fudge that depends on Debian's setting PGDATA
187 + * before calling pg_autovacuum in the init script. It
188 + * could do with being cleaned up for submission upstream. */
189 + strncpy(dataptr, pgdata, PIDFILEBUF - 1);
190 + databuf[PIDFILEBUF - 1] = '\0';
191 + if (strlen(dataptr) > 0 && strlen(dataptr) < PIDFILEBUF - strlen(pidfilename - 1)) {
192 + strcat(dataptr, pidfilename);
193 + /* Don't bother to report errors in opening PIDFILE */
194 + if ((PIDFILE = fopen((const char *) dataptr, "w")) != NULL) {
195 + fprintf(PIDFILE, "%d\n", pid);
196 + fclose(PIDFILE);
197 + }
198 + }
199 /* Parent should just exit, without doing any atexit cleanup */
200 _exit(0);
201 }
202
203 + /* detach from stdin, stdout and stderr
204 + * (patched by Martin Pitt <mpitt@debian.org> for the Debian package) */
205 + nullfd = open("/dev/null", O_RDWR);
206 + dup2(nullfd, 0);
207 + dup2(nullfd, 1);
208 + dup2(nullfd, 2);
209 + if (nullfd != 0 && nullfd != 1 && nullfd != 2)
210 + close(nullfd);
211 +
212 /* GH: If there's no setsid(), we hopefully don't need silent mode.
213 * Until there's a better solution. */
214 #ifdef HAVE_SETSID
215 diff -ruN postgresql-7.4.6-orig/contrib/xml/Makefile postgresql-7.4.6-3/contrib/xml/Makefile
216 --- postgresql-7.4.6-orig/contrib/xml/Makefile 2002-10-22 22:03:09.000000000 +0200
217 +++ postgresql-7.4.6-3/contrib/xml/Makefile 2005-03-09 15:56:11.000000000 +0100
218 @@ -4,6 +4,7 @@
219 top_builddir = ../..
220 include $(top_builddir)/src/Makefile.global
221
222 +CFLAGS += $(shell xml2-config --cflags)
223 MODULE_big = pgxml_dom
224 OBJS = pgxml_dom.o
225 SHLIB_LINK = -lxml2
226 diff -ruN postgresql-7.4.6-orig/doc/src/sgml/Makefile postgresql-7.4.6-3/doc/src/sgml/Makefile
227 --- postgresql-7.4.6-orig/doc/src/sgml/Makefile 2004-03-09 21:10:19.000000000 +0100
228 +++ postgresql-7.4.6-3/doc/src/sgml/Makefile 2005-03-09 15:56:11.000000000 +0100
229 @@ -66,6 +66,9 @@
230 $(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
231 $(mkinstalldirs) man1 man$(DEFAULTSECTION)
232 mv *.1 man1/
233 + mmv '*.' "#l1.$(DEFAULTSECTION)"
234 + mmv '* *.'$(DEFAULTSECTION) "#1_#2.$(DEFAULTSECTION)"
235 + mmv '* *.'$(DEFAULTSECTION) "#1_#2.$(DEFAULTSECTION)"
236 mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
237
238
239 diff -ruN postgresql-7.4.6-orig/doc/src/sgml/ref/initdb.sgml postgresql-7.4.6-3/doc/src/sgml/ref/initdb.sgml
240 --- postgresql-7.4.6-orig/doc/src/sgml/ref/initdb.sgml 2003-08-31 19:32:23.000000000 +0200
241 +++ postgresql-7.4.6-3/doc/src/sgml/ref/initdb.sgml 2005-03-09 15:56:11.000000000 +0100
242 @@ -227,6 +227,24 @@
243 </para>
244 </listitem>
245 </varlistentry>
246 +
247 + <varlistentry>
248 + <term><option>--debian-conffile</option></term>
249 + <listitem>
250 + <para>
251 + On Debian systems, this option is used by the package's
252 + post-initialisation script when it runs <command>initdb</command> to
253 + create a database.
254 + It symlinks the configuration files into the <filename>/etc/postgresql</filename>
255 + directory, whereas the standard behaviour is to put these files
256 + into the database directory.
257 + </para>
258 + <para>
259 + This option disables that behaviour, thus causing <command>initdb</command>
260 + to behave as expected.
261 + </para>
262 + </listitem>
263 + </varlistentry>
264 </variablelist>
265 </para>
266
267 diff -ruN postgresql-7.4.6-orig/doc/src/sgml/ref/pg_dump.sgml postgresql-7.4.6-3/doc/src/sgml/ref/pg_dump.sgml
268 --- postgresql-7.4.6-orig/doc/src/sgml/ref/pg_dump.sgml 2004-10-22 00:49:04.000000000 +0200
269 +++ postgresql-7.4.6-3/doc/src/sgml/ref/pg_dump.sgml 2005-03-09 15:56:11.000000000 +0100
270 @@ -304,6 +304,18 @@
271 </varlistentry>
272
273 <varlistentry>
274 + <term><option>-N</></term>
275 + <term><option>--convert-now</></term>
276 + <listitem>
277 + <para>
278 + In DEFAULT clauses of table column definitions, convert the old
279 + <literal>DEFAULT 'now'</literal> syntax (up to PostgreSQL 7.3) to
280 + <literal>DEFAULT now()</literal>.
281 + </para>
282 + </listitem>
283 + </varlistentry>
284 +
285 + <varlistentry>
286 <term><option>-o</></term>
287 <term><option>--oids</></term>
288 <listitem>
289 diff -ruN postgresql-7.4.6-orig/doc/src/sgml/ref/pg_dumpall.sgml postgresql-7.4.6-3/doc/src/sgml/ref/pg_dumpall.sgml
290 --- postgresql-7.4.6-orig/doc/src/sgml/ref/pg_dumpall.sgml 2003-11-04 10:45:30.000000000 +0100
291 +++ postgresql-7.4.6-3/doc/src/sgml/ref/pg_dumpall.sgml 2005-03-09 15:56:11.000000000 +0100
292 @@ -164,6 +164,18 @@
293 </varlistentry>
294
295 <varlistentry>
296 + <term><option>-N</></term>
297 + <term><option>--convert-now</></term>
298 + <listitem>
299 + <para>
300 + In DEFAULT clauses of table column definitions, convert the old
301 + <literal>DEFAULT 'now'</literal> syntax (up to PostgreSQL 7.3) to
302 + <literal>DEFAULT now()</literal>.
303 + </para>
304 + </listitem>
305 + </varlistentry>
306 +
307 + <varlistentry>
308 <term><option>-o</></term>
309 <term><option>--oids</></term>
310 <listitem>
311 diff -ruN postgresql-7.4.6-orig/doc/src/sgml/ref/psql-ref.sgml postgresql-7.4.6-3/doc/src/sgml/ref/psql-ref.sgml
312 --- postgresql-7.4.6-orig/doc/src/sgml/ref/psql-ref.sgml 2003-11-01 02:56:29.000000000 +0100
313 +++ postgresql-7.4.6-3/doc/src/sgml/ref/psql-ref.sgml 2005-03-09 15:56:11.000000000 +0100
314 @@ -494,7 +494,9 @@
315 local host. The default port number is compile-time determined.
316 Since the database server uses the same default, you will not have
317 to specify the port in most cases. The default user name is your
318 - Unix user name, as is the default database name. Note that you can't
319 + Unix user name. In standard PostgreSQL, the database name defaults to your
320 + username too, but in this Debian version, when called through pg_wrapper,
321 + the database must be specified. Note that you can't
322 just connect to any database under any user name. Your database
323 administrator should have informed you about your access rights. To
324 save you some typing you can also set the environment variables
325 diff -ruN postgresql-7.4.6-orig/ipkg/libpq/CONTROL/control postgresql-7.4.6-3/ipkg/libpq/CONTROL/control
326 diff -ruN postgresql-7.4.6-orig/ipkg/libpq-dev/CONTROL/control postgresql-7.4.6-3/ipkg/libpq-dev/CONTROL/control
327 diff -ruN postgresql-7.4.6-orig/ipkg/pgsql-utils/CONTROL/control postgresql-7.4.6-3/ipkg/pgsql-utils/CONTROL/control
328 diff -ruN postgresql-7.4.6-orig/ipkg/rules postgresql-7.4.6-3/ipkg/rules
329 diff -ruN postgresql-7.4.6-orig/ipkg/version postgresql-7.4.6-3/ipkg/version
330 diff -ruN postgresql-7.4.6-orig/src/Makefile.global.in postgresql-7.4.6-3/src/Makefile.global.in
331 --- postgresql-7.4.6-orig/src/Makefile.global.in 2003-12-20 00:29:29.000000000 +0100
332 +++ postgresql-7.4.6-3/src/Makefile.global.in 2005-03-09 15:56:11.000000000 +0100
333 @@ -87,7 +87,7 @@
334 pkglibdir = $(libdir)
335 ifeq "$(findstring pgsql, $(pkglibdir))" ""
336 ifeq "$(findstring postgres, $(pkglibdir))" ""
337 -override pkglibdir := $(pkglibdir)/postgresql
338 +override pkglibdir := $(pkglibdir)/postgresql/lib
339 endif
340 endif
341
342 diff -ruN postgresql-7.4.6-orig/src/backend/libpq/pg_hba.conf.sample postgresql-7.4.6-3/src/backend/libpq/pg_hba.conf.sample
343 --- postgresql-7.4.6-orig/src/backend/libpq/pg_hba.conf.sample 2003-09-13 18:43:38.000000000 +0200
344 +++ postgresql-7.4.6-3/src/backend/libpq/pg_hba.conf.sample 2005-03-09 15:56:11.000000000 +0100
345 @@ -24,39 +24,77 @@
346 # DATABASE can be "all", "sameuser", "samegroup", a database name (or
347 # a comma-separated list thereof), or a file name prefixed with "@".
348 # USER can be "all", an actual user name or a group name prefixed with
349 -# "+" or a list containing either. IP-ADDRESS and IP-MASK specify the
350 -# set of hosts the record matches. CIDR-MASK is an integer between 0
351 -# and 32 (IPv6) or 128(IPv6) inclusive, that specifies the number of
352 -# significant bits in the mask, so an IPv4 CIDR-MASK of 8 is equivalent
353 -# to an IP-MASK of 255.0.0.0, and an IPv6 CIDR-MASK of 64 is equivalent
354 -# to an IP-MASK of ffff:ffff:ffff:ffff::. METHOD can be "trust", "reject",
355 -# "md5", "crypt", "password", "krb4", "krb5", "ident", or "pam". Note
356 -# that "password" uses clear-text passwords; "md5" is preferred for
357 +# "+", an include file prefixed with "@" or a list containing either.
358 +# IP-ADDRESS and IP-MASK specify the set of hosts the record matches.
359 +# CIDR-MASK is an integer between 0 and 32 (IPv6) or 128(IPv6)
360 +# inclusive, that specifies the number of significant bits in the
361 +# mask, so an IPv4 CIDR-MASK of 8 is equivalent to an IP-MASK of
362 +# 255.0.0.0, and an IPv6 CIDR-MASK of 64 is equivalent to an IP-MASK
363 +# of ffff:ffff:ffff:ffff::. METHOD can be "trust", "reject", "md5",
364 +# "crypt", "password", "krb5", "ident", or "pam". Note that
365 +# "password" uses clear-text passwords; "md5" is preferred for
366 # encrypted passwords. OPTION is the ident map or the name of the PAM
367 # service.
368 #
369 +# INCLUDE FILES:
370 +# If you use include files for users and/or databases (see PostgreSQL
371 +# documentation, section 19.1), these files must be placed in the
372 +# database directory. Usually this is /var/lib/postgres/data/, but
373 +# that can be changed in /etc/postgresql/postmaster.conf with the
374 +# POSTGRES_DATA variable. Putting them in /etc/postgresql/ will NOT
375 +# work since the configuration files are only symlinked from
376 +# POSTGRES_DATA.
377 +#
378 # This file is read on server startup and when the postmaster receives
379 # a SIGHUP signal. If you edit the file on a running system, you have
380 # to SIGHUP the postmaster for the changes to take effect, or use
381 # "pg_ctl reload".
382 -
383 +#
384 +# Upstream default configuration
385 +#
386 +# The following configuration is the upstream default, which allows
387 +# unrestricted access to amy database by any user on the local machine.
388 +#
389 +# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
390 +#
391 +#local all all trust
392 +# IPv4-style local connections:
393 +#host all all 127.0.0.1 255.255.255.255 trust
394 +# IPv6-style local connections:
395 +#
396 # Put your actual configuration here
397 # ----------------------------------
398 #
399 -# CAUTION: The default configuration allows any local user to connect
400 -# using any PostgreSQL user name, including the superuser, over either
401 -# Unix-domain sockets or TCP/IP. If you are on a multiple-user
402 -# machine, the default configuration is probably too liberal for you.
403 -# Change it to use something other than "trust" authentication.
404 +# This default configuration allows any local user to connect as himself
405 +# without a password, either through a Unix socket or through TCP/IP; users
406 +# on other machines are denied access.
407 #
408 # If you want to allow non-local connections, you need to add more
409 -# "host" records. Also, remember TCP/IP connections are only enabled
410 -# if you enable "tcpip_socket" in postgresql.conf.
411 -
412 +# "host" records before the final line that rejects all TCP/IP connections.
413 +# Also, remember TCP/IP connections are only enabled if you enable
414 +# "tcpip_socket" in /etc/postgresql/postgresql.conf.
415 +#
416 +# DO NOT DISABLE!
417 +# If you change this first entry you will need to make sure the postgres user
418 +# can access the database using some other method. The postgres user needs
419 +# non-interactive access to all databases during automatic maintenance
420 +# (see the vacuum command and the /usr/lib/postgresql/bin/do.maintenance
421 +# script).
422 +#
423 # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
424 +# Database administrative login by UNIX sockets
425 +local all postgres ident sameuser
426 +#
427 +# All other connections by UNIX sockets
428 +local all all ident sameuser
429 +#
430 +# All IPv4 connections from localhost
431 +host all all 127.0.0.1 255.255.255.255 ident sameuser
432 +#
433 +# All IPv6 localhost connections
434 +host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff ident sameuser
435 +host all all ::ffff:127.0.0.1/128 ident sameuser
436 +#
437 +# reject all other connection attempts
438 +host all all 0.0.0.0 0.0.0.0 reject
439
440 -local all all trust
441 -# IPv4-style local connections:
442 -host all all 127.0.0.1 255.255.255.255 trust
443 -# IPv6-style local connections:
444 -host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust
445 diff -ruN postgresql-7.4.6-orig/src/backend/storage/file/fd.c postgresql-7.4.6-3/src/backend/storage/file/fd.c
446 --- postgresql-7.4.6-orig/src/backend/storage/file/fd.c 2004-02-24 00:03:43.000000000 +0100
447 +++ postgresql-7.4.6-3/src/backend/storage/file/fd.c 2005-03-09 15:56:11.000000000 +0100
448 @@ -50,6 +50,9 @@
449 #include "storage/fd.h"
450 #include "storage/ipc.h"
451
452 +#ifdef CHECK_RLIMIT_NOFILE
453 +#include <sys/resource.h>
454 +#endif
455
456 /* Filename components for OpenTemporaryFile */
457 #define PG_TEMP_FILES_DIR "pgsql_tmp"
458 @@ -272,15 +275,28 @@
459 int used = 0;
460 int highestfd = 0;
461 int j;
462 +#ifdef CHECK_RLIMIT_NOFILE
463 + struct rlimit rlim;
464 +#endif
465
466 size = 1024;
467 fd = (int *) palloc(size * sizeof(int));
468
469 +#ifdef CHECK_RLIMIT_NOFILE
470 + getrlimit(RLIMIT_NOFILE, &rlim);
471 +#endif
472 +
473 /* dup until failure ... */
474 for (;;)
475 {
476 int thisfd;
477
478 +#ifdef CHECK_RLIMIT_NOFILE
479 + /* Don't go beyond RLIMIT_NOFILE */
480 + if (highestfd >= rlim.rlim_cur - 1)
481 + break;
482 +#endif
483 +
484 thisfd = dup(0);
485 if (thisfd < 0)
486 {
487 diff -ruN postgresql-7.4.6-orig/src/bin/initdb/initdb.sh postgresql-7.4.6-3/src/bin/initdb/initdb.sh
488 --- postgresql-7.4.6-orig/src/bin/initdb/initdb.sh 2004-05-05 18:09:56.000000000 +0200
489 +++ postgresql-7.4.6-3/src/bin/initdb/initdb.sh 2005-03-09 15:56:11.000000000 +0100
490 @@ -71,7 +71,6 @@
491 echo "$ret"
492 }
493
494 -
495 CMDNAME=`basename $0`
496
497 # Placed here during build
498 @@ -196,6 +195,7 @@
499 debug=
500 noclean=
501 show_setting=
502 +debian_conffile=
503
504 # Note: There is a single compelling reason that the name of the database
505 # superuser be the same as the Unix user owning the server process:
506 @@ -318,6 +318,14 @@
507 --lc-time=*)
508 PGLC_TIME=`echo $1 | sed 's/^[^=]*=//'`
509 ;;
510 +# Debian's initdb is going to try to symlink the files from $PGDATA to
511 +# /etc/postgres... but if you're initialising a database somewhere else,
512 +# you don't want this behaviour, so tell initdb to not do it.
513 + --debian-conffile)
514 + debian_conffile=yes
515 + echo "use debian conffile location"
516 + ;;
517 +
518
519 -*)
520 echo "$CMDNAME: invalid option: $1"
521 @@ -590,6 +598,8 @@
522 #
523 # CREATE CONFIG FILES
524
525 +if [ -z "$debian_conffile" ]
526 +then
527 $ECHO_N "creating configuration files... "$ECHO_C
528
529 sed -e "s/^#shared_buffers = 1000/shared_buffers = $nbuffers/" \
530 @@ -611,6 +621,32 @@
531 chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \
532 "$PGDATA"/postgresql.conf
533
534 +else
535 +
536 +# debian-conffile option set:
537 +# In a Debian primary installation, the config files go to /etc/postgresql/
538 +# rather than to $PGDATA.
539 +ln -sf /etc/postgresql/pg_hba.conf $PGDATA/pg_hba.conf || exit_nicely
540 +ln -sf /etc/postgresql/pg_ident.conf $PGDATA/pg_ident.conf || exit_nicely
541 +ln -sf /etc/postgresql/postgresql.conf $PGDATA/postgresql.conf || exit_nicely
542 +
543 +# Since postgresql.conf is a permanent file, rather than created with the
544 +# database, it must have the LC_ values replaced rather than just tacked
545 +# on the end.
546 +(
547 + grep -vE '^LC_(MESSAGES|MONETARY|NUMERIC|TIME) *=' /etc/postgresql/postgresql.conf
548 + for cat in MESSAGES MONETARY NUMERIC TIME; do
549 + echo "LC_$cat = '`pg_getlocale $cat`'"
550 + done
551 +) >/etc/postgresql/$$ || exit_nicely
552 +cat /etc/postgresql/$$ >/etc/postgresql/postgresql.conf || exit_nicely
553 +rm /etc/postgresql/$$
554 +
555 +chmod 0600 /etc/postgresql/pg_hba.conf /etc/postgresql/pg_ident.conf
556 +chmod 0644 /etc/postgresql/postgresql.conf
557 +
558 +fi
559 +
560 echo "ok"
561
562 ##########################################################################
563 @@ -1143,13 +1179,9 @@
564 # FINISHED
565
566 echo
567 -echo "Success. You can now start the database server using:"
568 -echo ""
569 -echo " $PGPATH/postmaster -D $PGDATA"
570 -echo "or"
571 -# (Advertise -l option here, otherwise we have a background
572 -# process writing to the terminal.)
573 -echo " $PGPATH/pg_ctl -D $PGDATA -l logfile start"
574 +echo "Success. The database server should be started automatically."
575 +echo "If not, you can start the database server using:"
576 echo
577 +echo " /etc/init.d/postgresql start"
578
579 exit 0
580 diff -ruN postgresql-7.4.6-orig/src/bin/pg_ctl/pg_ctl.sh postgresql-7.4.6-3/src/bin/pg_ctl/pg_ctl.sh
581 --- postgresql-7.4.6-orig/src/bin/pg_ctl/pg_ctl.sh 2004-10-22 02:24:27.000000000 +0200
582 +++ postgresql-7.4.6-3/src/bin/pg_ctl/pg_ctl.sh 2005-03-09 15:56:11.000000000 +0100
583 @@ -139,31 +139,72 @@
584 exit 0
585 ;;
586 -D)
587 - shift
588 + PGDATA="$2"
589 + if [ -z "$PGDATA" -o `echo x$PGDATA | cut -c1-2` = "x-" ]
590 + then
591 + echo "$CMDNAME: option '-D' specified without a data directory"
592 + exit 1
593 + fi
594 # we need to do this so -D datadir shows in ps display
595 - PGDATAOPTS="-D $1"
596 - PGDATA="$1"
597 + PGDATAOPTS="-D $PGDATA"
598 export PGDATA
599 + shift
600 ;;
601 -l)
602 logfile="$2"
603 + if [ -z "$logfile" -o `echo x$logfile | cut -c1-2` = "x-" ]
604 + then
605 + echo "$CMDNAME: option '-l' specified without a logfile"
606 + exit 1
607 + fi
608 shift;;
609 -l*)
610 logfile=`echo "$1" | sed 's/^-l//'`
611 + if [ -z "$logfile" -o `echo x$logfile | cut -c1-2` = "x-" ]
612 + then
613 + echo "$CMDNAME: option '-l' specified without a logfile"
614 + exit 1
615 + fi
616 ;;
617 -m)
618 shutdown_mode="$2"
619 + if [ -z "$shutdown_mode" -o `echo x$shutdown_mode | cut -c1-2` = "x-" ]
620 + then
621 + echo "$CMDNAME: option '-m' specified without a shutdown mode"
622 + exit 1
623 + fi
624 shift;;
625 -m*)
626 shutdown_mode=`echo "$1" | sed 's/^-m//'`
627 + if [ -z "$shutdown_mode" -o `echo x$shutdown_mode | cut -c1-2` = "x-" ]
628 + then
629 + echo "$CMDNAME: option '-m' specified without a shutdown mode"
630 + exit 1
631 + fi
632 ;;
633 -o)
634 + POSTOPTS="$2"
635 + if [ -z "$POSTOPTS" ]
636 + then
637 + echo "$CMDNAME: option '-o' specified without any passed options"
638 + exit 1
639 + fi
640 + if [ `echo x$POSTOPTS | cut -c1-2` != x- ]
641 + then
642 + echo "$CMDNAME: option -o must be followed by one or more further options
643 + to pass to the postmaster"
644 + exit 1
645 + fi
646 shift
647 - POSTOPTS="$1"
648 ;;
649 -p)
650 + po_path="$2"
651 + if [ -z "$po_path" -o `echo x$po_path | cut -c1-2` = "x-" ]
652 + then
653 + echo "$CMDNAME: option '-p' specified without a path"
654 + exit 1
655 + fi
656 shift
657 - po_path="$1"
658 ;;
659 -s)
660 silence_echo=:
661 diff -ruN postgresql-7.4.6-orig/src/bin/pg_dump/pg_dump.c postgresql-7.4.6-3/src/bin/pg_dump/pg_dump.c
662 --- postgresql-7.4.6-orig/src/bin/pg_dump/pg_dump.c 2004-05-26 20:27:23.000000000 +0200
663 +++ postgresql-7.4.6-3/src/bin/pg_dump/pg_dump.c 2005-03-09 15:56:11.000000000 +0100
664 @@ -135,6 +135,7 @@
665 bool schemaOnly;
666 bool dataOnly;
667 bool aclsSkip;
668 +bool convertNow;
669
670 /* obsolete as of 7.3: */
671 static Oid g_last_builtin_oid; /* value of the last builtin oid */
672 @@ -198,6 +199,7 @@
673 {"no-owner", no_argument, NULL, 'O'},
674 {"port", required_argument, NULL, 'p'},
675 {"schema", required_argument, NULL, 'n'},
676 + {"convert-now", no_argument, NULL, 'N'},
677 {"schema-only", no_argument, NULL, 's'},
678 {"superuser", required_argument, NULL, 'S'},
679 {"table", required_argument, NULL, 't'},
680 @@ -233,7 +235,7 @@
681 g_comment_end[0] = '\0';
682 strcpy(g_opaque_type, "opaque");
683
684 - dataOnly = schemaOnly = dumpData = attrNames = false;
685 + dataOnly = schemaOnly = dumpData = attrNames = convertNow = false;
686
687 progname = get_progname(argv[0]);
688
689 @@ -258,7 +260,7 @@
690 }
691 }
692
693 - while ((c = getopt_long(argc, argv, "abcCdDf:F:h:in:oOp:RsS:t:uU:vWxX:Z:",
694 + while ((c = getopt_long(argc, argv, "abcCdDf:F:h:in:NoOp:RsS:t:uU:vWxX:Z:",
695 long_options, &optindex)) != -1)
696 {
697 switch (c)
698 @@ -310,6 +312,10 @@
699 selectSchemaName = strdup(optarg);
700 break;
701
702 + case 'N': /* convert DEFAULT 'now' to DEFAULT now() */
703 + convertNow = true;
704 + break;
705 +
706 case 'o': /* Dump oids */
707 oids = true;
708 break;
709 @@ -535,6 +541,13 @@
710 exit_horribly(g_fout, NULL, "could not set extra_float_digits: %s",
711 PQerrorMessage(g_conn));
712 PQclear(res);
713 +
714 + /* Set datestyle to ISO to ensure portability */
715 + res = PQexec(g_conn, "SET DATESTYLE = ISO");
716 + if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
717 + exit_horribly(g_fout, NULL, "could not set datestyle to ISO: %s",
718 + PQerrorMessage(g_conn));
719 + PQclear(res);
720 }
721
722 /* Find the last built-in OID, if needed */
723 @@ -633,6 +646,7 @@
724 printf(_(" -d, --inserts dump data as INSERT, rather than COPY, commands\n"));
725 printf(_(" -D, --column-inserts dump data as INSERT commands with column names\n"));
726 printf(_(" -n, --schema=SCHEMA dump the named schema only\n"));
727 + printf(_(" -N, --convert-now convert DEFAULT 'now' to DEFAULT now()\n"));
728 printf(_(" -o, --oids include OIDs in dump\n"));
729 printf(_(" -O, --no-owner do not output commands to set object ownership\n"
730 " in plain text format\n"));
731 @@ -665,6 +679,19 @@
732 }
733
734 /*
735 + * handleConvertNow: called on DEFAULT arguments in table column definitions;
736 + * if conversion is enabled, returns now() instead of 'now'
737 + */
738 +const char*
739 +handleConvertNow(const char* value)
740 +{
741 + if( convertNow && !strcmp(value,"'now'"))
742 + return "now()";
743 + else
744 + return value;
745 +}
746 +
747 +/*
748 * selectDumpableNamespace: policy-setting subroutine
749 * Mark a namespace as to be dumped or not
750 */
751 @@ -5334,7 +5361,7 @@
752 !tbinfo->inhAttrDef[j] &&
753 !tbinfo->attisserial[j])
754 appendPQExpBuffer(q, " DEFAULT %s",
755 - tbinfo->adef_expr[j]);
756 + handleConvertNow( tbinfo->adef_expr[j] ) );
757
758 /*
759 * Not Null constraint --- suppress if inherited
760 diff -ruN postgresql-7.4.6-orig/src/bin/pg_dump/pg_dumpall.c postgresql-7.4.6-3/src/bin/pg_dump/pg_dumpall.c
761 --- postgresql-7.4.6-orig/src/bin/pg_dump/pg_dumpall.c 2004-01-22 20:09:48.000000000 +0100
762 +++ postgresql-7.4.6-3/src/bin/pg_dump/pg_dumpall.c 2005-03-09 15:56:11.000000000 +0100
763 @@ -86,6 +86,7 @@
764 {"globals-only", no_argument, NULL, 'g'},
765 {"host", required_argument, NULL, 'h'},
766 {"ignore-version", no_argument, NULL, 'i'},
767 + {"convert-now", no_argument, NULL, 'N'},
768 {"oids", no_argument, NULL, 'o'},
769 {"port", required_argument, NULL, 'p'},
770 {"password", no_argument, NULL, 'W'},
771 @@ -124,7 +125,7 @@
772 pgdumploc = findPgDump(argv[0]);
773 pgdumpopts = createPQExpBuffer();
774
775 - while ((c = getopt_long(argc, argv, "acdDgh:iop:sU:vWx", long_options, &optindex)) != -1)
776 + while ((c = getopt_long(argc, argv, "acdDgh:iNop:sU:vWx", long_options, &optindex)) != -1)
777 {
778 switch (c)
779 {
780 @@ -156,6 +157,10 @@
781 appendPQExpBuffer(pgdumpopts, " -%c", c);
782 break;
783
784 + case 'N':
785 + appendPQExpBuffer(pgdumpopts, " -N");
786 + break;
787 +
788 case 'p':
789 pgport = optarg;
790 appendPQExpBuffer(pgdumpopts, " -p '%s'", pgport);
791 @@ -243,6 +248,7 @@
792 printf(_(" -g, --globals-only dump only global objects, no databases\n"));
793 printf(_(" -i, --ignore-version proceed even when server version mismatches\n"
794 " pg_dumpall version\n"));
795 + printf(_(" -N, --convert-now convert DEFAULT 'now' to DEFAULT now()\n"));
796 printf(_(" -s, --schema-only dump only the schema, no data\n"));
797 printf(_(" -o, --oids include OIDs in dump\n"));
798 printf(_(" -v, --verbose verbose mode\n"));
799 diff -ruN postgresql-7.4.6-orig/src/include/Makefile postgresql-7.4.6-3/src/include/Makefile
800 --- postgresql-7.4.6-orig/src/include/Makefile 2003-11-25 20:10:15.000000000 +0100
801 +++ postgresql-7.4.6-3/src/include/Makefile 2005-03-10 23:38:56.000000000 +0100
802 @@ -79,8 +79,8 @@
803
804
805 uninstall:
806 - rm -f $(addprefix $(DESTDIR)$(includedir)/, pg_config.h pg_config_os.h postgres_ext.h libpq/libpq-fs.h)
807 - rm -f $(addprefix $(DESTDIR)$(includedir_internal)/, c.h postgres_fe.h lib/dllist.h libpq/pqcomm.h)
808 + rm -f $(addprefix $(DESTDIR)$(includedir)/, pg_config.h pg_config_manual.h pg_config_os.h postgres_ext.h libpq/libpq-fs.h)
809 + rm -f $(addprefix $(DESTDIR)$(includedir_internal)/, c.h port.h postgres_fe.h lib/dllist.h libpq/pqcomm.h)
810 # heuristic...
811 rm -rf $(addprefix $(DESTDIR)$(includedir_server)/, $(SUBDIRS) *.h)
812
813 diff -ruN postgresql-7.4.6-orig/src/include/pg_config_manual.h postgresql-7.4.6-3/src/include/pg_config_manual.h
814 --- postgresql-7.4.6-orig/src/include/pg_config_manual.h 2003-09-21 19:57:21.000000000 +0200
815 +++ postgresql-7.4.6-3/src/include/pg_config_manual.h 2005-03-09 15:56:11.000000000 +0100
816 @@ -165,7 +165,7 @@
817 * here's where to twiddle it. You can also override this at runtime
818 * with the postmaster's -k switch.
819 */
820 -#define DEFAULT_PGSOCKET_DIR "/tmp"
821 +#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql"
822
823 /*
824 * Defining this will make float4 and float8 operations faster by
825 diff -ruN postgresql-7.4.6-orig/src/include/port/linux.h postgresql-7.4.6-3/src/include/port/linux.h
826 --- postgresql-7.4.6-orig/src/include/port/linux.h 2003-10-26 02:41:10.000000000 +0100
827 +++ postgresql-7.4.6-3/src/include/port/linux.h 2005-03-09 15:56:11.000000000 +0100
828 @@ -48,4 +48,12 @@
829
830 #define HAS_TEST_AND_SET
831
832 +#elif defined(__hppa__)
833 +typedef struct
834 +{
835 + int sema[4];
836 +} slock_t;
837 +
838 +#define HAS_TEST_AND_SET
839 +
840 #endif
841 diff -ruN postgresql-7.4.6-orig/src/include/storage/s_lock.h postgresql-7.4.6-3/src/include/storage/s_lock.h
842 --- postgresql-7.4.6-orig/src/include/storage/s_lock.h 2003-11-04 10:43:56.000000000 +0100
843 +++ postgresql-7.4.6-3/src/include/storage/s_lock.h 2005-03-09 15:56:11.000000000 +0100
844 @@ -125,7 +125,7 @@
845 __asm__ __volatile__(
846 " xchg4 %0=%1,%2 \n"
847 : "=r"(ret), "=m"(*lock)
848 -: "r"(1), "1"(*lock)
849 +: "r"(1), "m"(*lock)
850 : "memory");
851
852 return (int) ret;
853 @@ -151,6 +151,29 @@
854
855 #endif /* __arm__ */
856
857 +#if defined(__hppa__)
858 +/*
859 + * * HP PA-RISC Linux
860 + * */
861 +#define TAS(lock) tas(lock)
862 +#define TAS_ACTIVE_WORD(lock) ((volatile int *) (((long) (lock) + 15) & ~15))
863 +#define S_UNLOCK(lock) (*TAS_ACTIVE_WORD(lock) = -1)
864 +
865 +static __inline__ int
866 +tas(volatile slock_t *lock)
867 +{
868 + volatile int *lockword = TAS_ACTIVE_WORD(lock);
869 + register int lockval;
870 +
871 + __asm__ __volatile__(
872 + " ldcwx 0(0,%2),%0 \n"
873 + : "=r"(lockval), "=m"(*lockword)
874 + : "r"(lockword));
875 + return (lockval == 0);
876 +}
877 +
878 +#endif /* __hppa__ */
879 +
880
881 #if defined(__s390__) && !defined(__s390x__)
882 /*
883 @@ -271,7 +294,7 @@
884 " tas %1 \n"
885 " sne %0 \n"
886 : "=d"(rv), "=m"(*lock)
887 -: "1"(*lock)
888 +: "m"(*lock)
889 : "cc");
890
891 return rv;
892 diff -ruN postgresql-7.4.6-orig/src/interfaces/libpq/Makefile postgresql-7.4.6-3/src/interfaces/libpq/Makefile
893 --- postgresql-7.4.6-orig/src/interfaces/libpq/Makefile 2003-09-27 17:32:48.000000000 +0200
894 +++ postgresql-7.4.6-3/src/interfaces/libpq/Makefile 2005-03-09 15:56:11.000000000 +0100
895 @@ -35,7 +35,7 @@
896 SHLIB_LINK += $(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(THREAD_LIBS)
897
898
899 -all: all-lib
900 +all: all-lib libpq3-config
901
902 # Shared library stuff
903 include $(top_srcdir)/src/Makefile.shlib
904 @@ -61,6 +61,8 @@
905 encnames.c wchar.c : % : $(backend_src)/utils/mb/%
906 rm -f $@ && $(LN_S) $< .
907
908 +libpq3-config:
909 + sed -e "s|%LIBRARIES%|$(SHLIB_LINK)|" <libpq3-config.in | sed "s/-L[^ ]\+ //" >libpq3-config
910
911 install: all installdirs install-lib
912 $(INSTALL_DATA) $(srcdir)/libpq-fe.h $(DESTDIR)$(includedir)
913 @@ -76,3 +78,4 @@
914
915 clean distclean maintainer-clean: clean-lib
916 rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c snprintf.c strerror.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
917 + rm -f libpq3-config
918 diff -ruN postgresql-7.4.6-orig/src/interfaces/libpq/libpq3-config.in postgresql-7.4.6-3/src/interfaces/libpq/libpq3-config.in
919 --- postgresql-7.4.6-orig/src/interfaces/libpq/libpq3-config.in 1970-01-01 01:00:00.000000000 +0100
920 +++ postgresql-7.4.6-3/src/interfaces/libpq/libpq3-config.in 2005-03-09 15:56:11.000000000 +0100
921 @@ -0,0 +1,3 @@
922 +#!/bin/bash
923 +
924 +echo %LIBRARIES%
925 diff -ruN postgresql-7.4.6-orig/src/makefiles/Makefile.linux postgresql-7.4.6-3/src/makefiles/Makefile.linux
926 --- postgresql-7.4.6-orig/src/makefiles/Makefile.linux 2003-06-05 18:07:25.000000000 +0200
927 +++ postgresql-7.4.6-3/src/makefiles/Makefile.linux 2005-03-09 15:56:11.000000000 +0100
928 @@ -5,11 +5,7 @@
929 allow_nonpic_in_shlib = yes
930 DLSUFFIX = .so
931
932 -ifeq "$(findstring sparc,$(host_cpu))" "sparc"
933 CFLAGS_SL = -fPIC
934 -else
935 -CFLAGS_SL = -fpic
936 -endif
937
938 %.so: %.o
939 $(CC) -shared -o $@ $<
940 diff -ruN postgresql-7.4.6-orig/src/pl/plperl/GNUmakefile postgresql-7.4.6-3/src/pl/plperl/GNUmakefile
941 --- postgresql-7.4.6-orig/src/pl/plperl/GNUmakefile 2004-01-21 20:25:11.000000000 +0100
942 +++ postgresql-7.4.6-3/src/pl/plperl/GNUmakefile 2005-03-09 15:56:11.000000000 +0100
943 @@ -9,6 +9,9 @@
944 shared_libperl = yes
945 endif
946
947 +# Line addded for Debian - needed for any Linux build, I believe
948 +CFLAGS += -D_GNU_SOURCE
949 +
950 # If we don't have a shared library and the platform doesn't allow it
951 # to work without, we have to skip it.
952 ifneq (,$(findstring yes, $(shared_libperl)$(allow_nonpic_in_shlib)))
953 diff -ruN postgresql-7.4.6-orig/src/test/regress/pg_regress.sh postgresql-7.4.6-3/src/test/regress/pg_regress.sh
954 --- postgresql-7.4.6-orig/src/test/regress/pg_regress.sh 2003-11-02 22:56:15.000000000 +0100
955 +++ postgresql-7.4.6-3/src/test/regress/pg_regress.sh 2005-03-09 15:56:11.000000000 +0100
956 @@ -382,6 +382,10 @@
957 (exit 2); exit
958 fi
959
960 +
961 + echo "unix_socket_directory = '/tmp'" >>$PGDATA/postgresql.conf
962 + psql_options="$psql_options --host=/tmp"
963 +
964
965 # ----------
966 # Start postmaster
967 diff -ruN postgresql-7.4.6-orig/src/tutorial/Makefile postgresql-7.4.6-3/src/tutorial/Makefile
968 --- postgresql-7.4.6-orig/src/tutorial/Makefile 2002-09-05 20:28:46.000000000 +0200
969 +++ postgresql-7.4.6-3/src/tutorial/Makefile 2005-03-09 15:56:11.000000000 +0100
970 @@ -6,15 +6,15 @@
971 # IDENTIFICATION
972 # $Header$
973 #
974 +# Please note that this Makefile was modified for Debian to allow
975 +# compilation in an arbitrary directory and without the complete
976 +# PostgreSQL source tree.
977 #-------------------------------------------------------------------------
978
979 -subdir = src/tutorial
980 -top_builddir = ../..
981 -include $(top_builddir)/src/Makefile.global
982 -
983 -override CFLAGS+= $(CFLAGS_SL)
984 -SHLIB_LINK = $(BE_DLLLIBS)
985 -
986 +DLSUFFIX=.so
987 +INCLUDES= -I/usr/include/postgresql/ -I/usr/include/postgresql/server/
988 +CC= gcc $(INCLUDES)
989 +
990 #
991 # DLOBJS are the dynamically-loaded object files. The "funcs" queries
992 # include CREATE FUNCTIONs that load routines from these files.
993 @@ -25,6 +25,9 @@
994
995 all: $(DLOBJS) $(QUERIES)
996
997 +%$(DLSUFFIX): %.c
998 + $(CC) -shared -o $@ $<
999 +
1000 %.sql: %.source
1001 rm -f $@; \
1002 C=`pwd`; \
1003 @@ -32,3 +35,5 @@
1004
1005 clean distclean maintainer-clean:
1006 rm -f $(DLOBJS) $(QUERIES)
1007 +
1008 +.PHONY: clean distclean maintainer-clean
1009 diff -ruN postgresql-7.4.6-orig/src/tutorial/README postgresql-7.4.6-3/src/tutorial/README
1010 --- postgresql-7.4.6-orig/src/tutorial/README 2001-10-26 22:45:33.000000000 +0200
1011 +++ postgresql-7.4.6-3/src/tutorial/README 2005-03-09 15:56:11.000000000 +0100
1012 @@ -2,10 +2,16 @@
1013 % make
1014 to compile all the scripts and C files for the user-defined functions
1015 and types. (make needs to be GNU make --- it may be named something
1016 -different on your system, often gmake)
1017 +different on your system, often gmake.) The package postgresql-dev
1018 +must be installed for the tutorials to compile.
1019
1020 Then, run psql with the -s (single-step) flag:
1021 % psql -s
1022
1023 From within psql, you can try each individual script file by using
1024 psql's \i <filename> command.
1025 +
1026 +Please note that you need database superuser privileges to execute the
1027 +examples which load dynamic libraries ('funcs' and 'complex') since
1028 +the language C is usually not 'trusted', i. e. may not be used by
1029 +normal users.