|
33 | 33 | * ENHANCEMENTS, OR MODIFICATIONS.
|
34 | 34 | *
|
35 | 35 | * IDENTIFICATION
|
36 |
| - * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.37 2003/07/25 23:37:28 tgl Exp $ |
| 36 | + * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.38 2003/07/31 18:36:28 tgl Exp $ |
37 | 37 | *
|
38 | 38 | **********************************************************************/
|
39 | 39 |
|
@@ -101,6 +101,7 @@ static void plperl_init_all(void);
|
101 | 101 | staticvoidplperl_init_interp(void);
|
102 | 102 |
|
103 | 103 | Datumplperl_call_handler(PG_FUNCTION_ARGS);
|
| 104 | +voidplperl_init(void); |
104 | 105 |
|
105 | 106 | staticDatumplperl_func_handler(PG_FUNCTION_ARGS);
|
106 | 107 |
|
@@ -128,12 +129,15 @@ perm_fmgr_info(Oid functionId, FmgrInfo *finfo)
|
128 | 129 | }
|
129 | 130 |
|
130 | 131 | /**********************************************************************
|
131 |
| - * plperl_init_all()- Initialize all |
| 132 | + * plperl_init()- Initialize everything that can be |
| 133 | + * safely initialized during postmaster |
| 134 | + * startup. |
| 135 | + * |
| 136 | + * DO NOT make this static --- it has to be callable by preload |
132 | 137 | **********************************************************************/
|
133 |
| -staticvoid |
134 |
| -plperl_init_all(void) |
| 138 | +void |
| 139 | +plperl_init(void) |
135 | 140 | {
|
136 |
| - |
137 | 141 | /************************************************************
|
138 | 142 | * Do initialization only once
|
139 | 143 | ************************************************************/
|
@@ -168,6 +172,26 @@ plperl_init_all(void)
|
168 | 172 | plperl_firstcall=0;
|
169 | 173 | }
|
170 | 174 |
|
| 175 | +/********************************************************************** |
| 176 | + * plperl_init_all()- Initialize all |
| 177 | + **********************************************************************/ |
| 178 | +staticvoid |
| 179 | +plperl_init_all(void) |
| 180 | +{ |
| 181 | + |
| 182 | +/************************************************************ |
| 183 | + * Execute postmaster-startup safe initialization |
| 184 | + ************************************************************/ |
| 185 | +if (plperl_firstcall) |
| 186 | +plperl_init(); |
| 187 | + |
| 188 | +/************************************************************ |
| 189 | + * Any other initialization that must be done each time a new |
| 190 | + * backend starts -- currently none |
| 191 | + ************************************************************/ |
| 192 | + |
| 193 | +} |
| 194 | + |
171 | 195 |
|
172 | 196 | /**********************************************************************
|
173 | 197 | * plperl_init_interp() - Create the Perl interpreter
|
@@ -222,10 +246,9 @@ plperl_call_handler(PG_FUNCTION_ARGS)
|
222 | 246 | Datumretval;
|
223 | 247 |
|
224 | 248 | /************************************************************
|
225 |
| - * Initialize interpreter on first call |
| 249 | + * Initialize interpreter |
226 | 250 | ************************************************************/
|
227 |
| -if (plperl_firstcall) |
228 |
| -plperl_init_all(); |
| 251 | +plperl_init_all(); |
229 | 252 |
|
230 | 253 | /************************************************************
|
231 | 254 | * Connect to SPI manager
|
|