Although nobody paid an attention, it seems to me a problem to be fixed.

The attached patch fixes the problem using a simple idea which adds
process_shared_preload_libraries() at PostgresMain() when we launched
it in single-user mode.

Thanks,

(2010/08/05 15:08), KaiGai Kohei wrote:
> I found out "shared_preload_libraries" setting is ignored when we launch
> postgres in single user mode.
> 
> In this case, postgres command is launched with "--single" argument,
> then the main() directly invokes PostgresMain(); without going through
> PostmasterMain() which calls process_shared_preload_libraries().
> 
> I think we should put the following code block on somewhere within
> PostgresMain() to fix up it.
> 
>    /*
>     * If not under postmaster, shared preload libraries are not
>     * loaded yet, so we try to load them here.
>     */
>    if (!IsUnderPostmaster)
>        process_shared_preload_libraries();
> 
> The reason why I want to use modules in single user mode is to assign
> initial security labels on database objects just after initdb.
> But, the GUC is ignored, we cannot invokes the routines in the module. :(
> 
> Thanks,

-- 
KaiGai Kohei <kai...@ak.jp.nec.com>
*** a/src/backend/tcop/postgres.c
--- b/src/backend/tcop/postgres.c
***************
*** 3479,3484 **** PostgresMain(int argc, char *argv[], const char *username)
--- 3479,3494 ----
  	}
  
  	/*
+ 	 * Load shared preload libraries on single-user mode.
+ 	 * Because this routine is not invoked from PostmasterMain() that
+ 	 * loads shared preload libraries prior to fork the backend process,
+ 	 * the 'shared_preload_libraries' shall be implicitly ignored.
+ 	 * So, we need to load them on single-user mode.
+ 	 */
+ 	if (!IsUnderPostmaster)
+ 		process_shared_preload_libraries();
+ 
+ 	/*
  	 * You might expect to see a setsid() call here, but it's not needed,
  	 * because if we are under a postmaster then BackendInitialize() did it.
  	 */
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to