Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 96c102f

Browse files
committed
Install server-side language PL/pgSQL by default.
1 parent be3a24d commit 96c102f

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

doc/src/sgml/installation.sgml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.333 2009/12/15 22:59:53 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.334 2009/12/18 21:28:42 momjian Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -2266,14 +2266,14 @@ hosts=local4,bind4
22662266
is <command>createlang</command> failing with unusual errors.
22672267
For example, running as the owner of the PostgreSQL installation:
22682268
<screen>
2269-
-bash-3.00$ createlang plpgsql template1
2270-
createlang: language installation failed: ERROR: could not load library "/opt/dbs/pgsql748/lib/plpgsql.so": A memory address is not in the address space for the process.
2269+
-bash-3.00$ createlang plperl template1
2270+
createlang: language installation failed: ERROR: could not load library "/opt/dbs/pgsql748/lib/plperl.so": A memory address is not in the address space for the process.
22712271
</screen>
22722272
Running as a non-owner in the group posessing the PostgreSQL
22732273
installation:
22742274
<screen>
2275-
-bash-3.00$ createlang plpgsql template1
2276-
createlang: language installation failed: ERROR: could not load library "/opt/dbs/pgsql748/lib/plpgsql.so": Bad address
2275+
-bash-3.00$ createlang plperl template1
2276+
createlang: language installation failed: ERROR: could not load library "/opt/dbs/pgsql748/lib/plperl.so": Bad address
22772277
</screen>
22782278
Another example is out of memory errors in the PostgreSQL server
22792279
logs, with every memory allocation near or greater than 256 MB

src/bin/initdb/initdb.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.179 2009/12/18 18:45:50 tgl Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.180 2009/12/18 21:28:42 momjian Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -176,6 +176,7 @@ static void setup_dictionary(void);
176176
static void setup_privileges(void);
177177
static void set_info_version(void);
178178
static void setup_schema(void);
179+
static void load_plpgsql(void);
179180
static void vacuum_db(void);
180181
static void make_template0(void);
181182
static void make_postgres(void);
@@ -1893,6 +1894,31 @@ setup_schema(void)
18931894
check_ok();
18941895
}
18951896

1897+
/*
1898+
* load PL/pgsql server-side language
1899+
*/
1900+
static void
1901+
load_plpgsql(void)
1902+
{
1903+
PG_CMD_DECL;
1904+
1905+
fputs(_("loading PL/pgSQL server-side language ... "), stdout);
1906+
fflush(stdout);
1907+
1908+
snprintf(cmd, sizeof(cmd),
1909+
"\"%s\" %s template1 >%s",
1910+
backend_exec, backend_options,
1911+
DEVNULL);
1912+
1913+
PG_CMD_OPEN;
1914+
1915+
PG_CMD_PUTS("CREATE LANGUAGE plpgsql;\n");
1916+
1917+
PG_CMD_CLOSE;
1918+
1919+
check_ok();
1920+
}
1921+
18961922
/*
18971923
* clean everything up in template1
18981924
*/
@@ -3134,6 +3160,8 @@ main(int argc, char *argv[])
31343160

31353161
setup_schema();
31363162

3163+
load_plpgsql();
3164+
31373165
vacuum_db();
31383166

31393167
make_template0();

src/bin/pg_dump/pg_dump.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.556 2009/12/14 00:39:11 itagaki Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.557 2009/12/18 21:28:42 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -32,6 +32,7 @@
3232

3333
#include "access/attnum.h"
3434
#include "access/sysattr.h"
35+
#include "access/transam.h"
3536
#include "catalog/pg_cast.h"
3637
#include "catalog/pg_class.h"
3738
#include "catalog/pg_default_acl.h"
@@ -4599,8 +4600,10 @@ getProcLangs(int *numProcLangs)
45994600
"(%s lanowner) AS lanowner "
46004601
"FROM pg_language "
46014602
"WHERE lanispl "
4603+
/* do not dump initdb-installed languages */
4604+
"AND oid >= %u "
46024605
"ORDER BY oid",
4603-
username_subquery);
4606+
username_subquery, FirstNormalObjectId);
46044607
}
46054608
else if (g_fout->remoteVersion >= 80300)
46064609
{
@@ -4610,9 +4613,10 @@ getProcLangs(int *numProcLangs)
46104613
"lanvalidator, lanacl, "
46114614
"(%s lanowner) AS lanowner "
46124615
"FROM pg_language "
4613-
"WHERE lanispl "
4616+
"WHERE lanispl%s"
46144617
"ORDER BY oid",
4615-
username_subquery);
4618+
username_subquery,
4619+
binary_upgrade ? "\nAND lanname != 'plpgsql'" : "");
46164620
}
46174621
else if (g_fout->remoteVersion >= 80100)
46184622
{

src/test/regress/GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
77
# Portions Copyright (c) 1994, Regents of the University of California
88
#
9-
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.79 2009/10/26 21:11:22 petere Exp $
9+
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.80 2009/12/18 21:28:42 momjian Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -138,7 +138,7 @@ tablespace-setup:
138138
## Run tests
139139
##
140140

141-
pg_regress_call = ./pg_regress --inputdir=$(srcdir) --dlpath=. --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
141+
pg_regress_call = ./pg_regress --inputdir=$(srcdir) --dlpath=. --multibyte=$(MULTIBYTE) $(NOLOCALE)
142142

143143
check: all
144144
$(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF)

0 commit comments

Comments
 (0)