2016-04-26 15:48 GMT+02:00 <da...@andl.org>: > Solved. The sample can indeed be loaded at startup (although it emits some > strange LOG messages). > > > > But to load it dynamically requires this SQL: > > > > CREATE OR REPLACE FUNCTION worker_spi_launch(i INT) RETURNS INT > > AS '<filename>' LANGUAGE C; > > SELECT * FROM worker_spi_launch(<arg>); > > > > It would be helpful to add this to the documentation. From this point on, > it looks pretty straightforward, but getting here was not easy. > > > > I’m still wondering how to do a clean restart of the server without > pg_ctl. Restarting the service is a bit brutal. >
server, service are equivalent for Postgres. There are not any difference. Regards Pavel > > > Regards > > David M Bennett FACS > *------------------------------* > > *Andl - A New Database Language - andl.org <http://andl.org>* > > > > > > *From:* pgsql-general-ow...@postgresql.org [mailto: > pgsql-general-ow...@postgresql.org] *On Behalf Of *da...@andl.org > *Sent:* Tuesday, 26 April 2016 4:04 PM > *To:* pgsql-general@postgresql.org > *Subject:* [GENERAL] Problems running the WorkerSpi sample > > > > I’ve been trying to get the WorkerSpi sample working on a Windows > installation, VS 2015, x64. So far, the following problems. > > > > 1. Does not compile OOB. Added the following lines. > > PGDLLEXPORT void _PG_init(void); > > PGDLLEXPORT Datum worker_spi_launch(PG_FUNCTION_ARGS); > > PGDLLEXPORT void worker_spi_main(Datum); > > 2. Two warnings about int usage. Ignored. > > 3. Documentation is a bit light on, but copying the control file > into the right folder makes the extension visible. > > 4. Extension installs but does nothing. No log messages. No schema. > No table. > > The variable worker_spi.naptime appears in pg_settings but > worker_spi.total_workers does not. > > 5. Extension uninstalls without error, but does not release the DLL. > > 6. Tried to restart server with pg_ctl but it does nothing. No > error, no log message, nada. [Is this a known problem with Windows?] > > 7. Restarted server using Task Manager. And so back to the > beginning and try again. > > > > The worker_spi.c code contains this sequence: > > > > DefineCustomIntVariable("worker_spi.naptime", > > "Duration between each check (in > seconds).", > > <omitted> > > if (!process_shared_preload_libraries_in_progress) > > return; > > DefineCustomIntVariable("worker_spi.total_workers", > > "Number of workers.", > > > > From this I deduce that process_shared_preload_libraries_in_progress was > false. So this appears to be an extension that must be preloaded. That does > not seem to be documented anywhere. > > > > It would be helpful to get some suggestions about what changes would be > needed to allow it to be loaded on demand. > > > > Regards > > David M Bennett FACS > *------------------------------* > > *Andl - A New Database Language - andl.org <http://andl.org>* > > >