Re[2]: [HACKERS] Connect from background worker thread to database

From: Alexey Vasiliev <leopard_ne(at)inbox(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re[2]: [HACKERS] Connect from background worker thread to database
Date: 2013-11-24 17:10:16
Message-ID: 1385313016.650836817@f42.i.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Воскресенье, 24 ноября 2013, 14:06 +01:00 от Andres Freund <andres(at)anarazel(dot)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

Fixed by using PQconnectdb from "libpq-fe.h". Thanks.

--
Alexey Vasiliev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2013-11-24 17:15:38 Re: Sequence Access Method WIP
Previous Message Simon Riggs 2013-11-24 17:06:55 Re: autovacuum_work_mem