If I remove comment from BackgroundWorkerInitializeConnection  
https://github.com/le0pard/pg_web/blob/master/src/pg_web.c#L179  and comment 
InitPostgres  https://github.com/le0pard/pg_web/blob/master/src/pg_web.c#L98 , 
I have the same errors in log:

2013-11-24 13:35:24 UTC ERROR:  stack depth limit exceeded
2013-11-24 13:35:24 UTC HINT:  Increase the configuration parameter 
"max_stack_depth" (currently 2048kB), after ensuring the platform's stack depth 
limit is adequate.
2013-11-24 13:35:24 UTC CONTEXT:  SQL statement "SELECT COUNT(*) FROM pg_class;"
2013-11-24 13:35:25 UTC LOG:  worker process: pg_web (PID 1957) exited with 
exit code 1
2013-11-24 13:35:26 UTC LOG:  starting background worker process "pg_web"
2013-11-24 13:35:26 UTC INFO:  Start web server on port 8080
If I change InitPostgres to BackgroundWorkerInitializeConnection and leave 
BackgroundWorkerInitializeConnection in bgw_main, I will have this error:

2013-11-24 13:39:58 UTC ERROR:  invalid processing mode in background worker
2013-11-24 13:39:58 UTC LOG:  worker process: pg_web (PID 2719) exited with 
exit code 1
2013-11-24 13:39:59 UTC LOG:  starting background worker process "pg_web"
Воскресенье, 24 ноября 2013, 14:06 +01:00 от Andres Freund <and...@anarazel.de>:
>Hi,
>
>On 2013-11-24 16:27:06 +0400, Олексій Васильєв wrote:
>> This is part where I try to connect to database:   
>> https://github.com/le0pard/pg_web/blob/master/src/pg_web.c#L92-L132 , but 
>> SPI functions give error in log (it is commented):
>> 
>> 2013-11-24 02:57:43 UTC ERROR:  stack depth limit exceeded
>> 2013-11-24 02:57:43 UTC HINT:  Increase the configuration parameter 
>> "max_stack_depth" (currently 2048kB), after ensuring the platform's stack 
>> depth limit is adequate.
>> 2013-11-24 02:57:43 UTC CONTEXT:  SQL statement "SELECT COUNT(*) FROM 
>> pg_class;"
>> 
>> Because I doing something in wrong way. I will appreciate for any help: 
>> where I doing wrong, link to the article how to do it, just a tip, pull 
>> request - anything. Google search and PostgreSQL sources reading  so far 
>> helped me to this point.
>
>At the very least you're calling InitPostgres() instead of
>BackgroundWorkerInitializeConnection() which you have commented out. And
>the latter should only be called once in every worker.
>
>Greetings,
>
>Andres Freund


Reply via email to