aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plperl/plperl.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-07-31 18:36:46 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-07-31 18:36:46 +0000
commit8b1ea2f58b5f6c65a06781250ef38418c20796a1 (patch)
tree7ecf8db773370daad151a5b977b2210755db3204 /src/pl/plperl/plperl.c
parent8488f25425fa9edb4d1264224c43053680232d47 (diff)
downloadpostgresql-8b1ea2f58b5f6c65a06781250ef38418c20796a1.tar.gz
postgresql-8b1ea2f58b5f6c65a06781250ef38418c20796a1.zip
Cause library-preload feature to report error if specified initialization
function is not found. Also, make all the PL libraries have initialization functions with standard names. Patch from Joe Conway.
Diffstat (limited to 'src/pl/plperl/plperl.c')
-rw-r--r--src/pl/plperl/plperl.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index fcbe55c9c2e..7edcac6c68b 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.37 2003/07/25 23:37:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.38 2003/07/31 18:36:28 tgl Exp $
*
**********************************************************************/
@@ -101,6 +101,7 @@ static void plperl_init_all(void);
static void plperl_init_interp(void);
Datum plperl_call_handler(PG_FUNCTION_ARGS);
+void plperl_init(void);
static Datum plperl_func_handler(PG_FUNCTION_ARGS);
@@ -128,12 +129,15 @@ perm_fmgr_info(Oid functionId, FmgrInfo *finfo)
}
/**********************************************************************
- * plperl_init_all() - Initialize all
+ * plperl_init() - Initialize everything that can be
+ * safely initialized during postmaster
+ * startup.
+ *
+ * DO NOT make this static --- it has to be callable by preload
**********************************************************************/
-static void
-plperl_init_all(void)
+void
+plperl_init(void)
{
-
/************************************************************
* Do initialization only once
************************************************************/
@@ -168,6 +172,26 @@ plperl_init_all(void)
plperl_firstcall = 0;
}
+/**********************************************************************
+ * plperl_init_all() - Initialize all
+ **********************************************************************/
+static void
+plperl_init_all(void)
+{
+
+ /************************************************************
+ * Execute postmaster-startup safe initialization
+ ************************************************************/
+ if (plperl_firstcall)
+ plperl_init();
+
+ /************************************************************
+ * Any other initialization that must be done each time a new
+ * backend starts -- currently none
+ ************************************************************/
+
+}
+
/**********************************************************************
* plperl_init_interp() - Create the Perl interpreter
@@ -222,10 +246,9 @@ plperl_call_handler(PG_FUNCTION_ARGS)
Datum retval;
/************************************************************
- * Initialize interpreter on first call
+ * Initialize interpreter
************************************************************/
- if (plperl_firstcall)
- plperl_init_all();
+ plperl_init_all();
/************************************************************
* Connect to SPI manager