Обсуждение: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

Поиск
Список
Период
Сортировка

broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Pavel Stehule
Дата:
Hi

The documentation (or this feature) is broken still

If dbname is NULL or dboid is InvalidOid, the session is not connected to any particular database, but shared catalogs can be accessed. If username is NULL or useroid is InvalidOid, the process will run as the superuser created during initdb. A background worker can only call one of these two functions, and only once. It is not possible to switch databases.

But it fails with error:

FATAL:  database 0 does not exist

I found some older thread related to this topic

http://www.postgresql.org/message-id/13994.1376145608@sss.pgh.pa.us

Regards

Pavel

Re: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Robert Haas
Дата:
On Thu, May 14, 2015 at 8:25 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> The documentation (or this feature) is broken still
>
> If dbname is NULL or dboid is InvalidOid, the session is not connected to
> any particular database, but shared catalogs can be accessed. If username is
> NULL or useroid is InvalidOid, the process will run as the superuser created
> during initdb. A background worker can only call one of these two functions,
> and only once. It is not possible to switch databases.
>
> But it fails with error:
>
> FATAL:  database 0 does not exist

Ugh.  I think that's a bug.

Patch attached.

The test code I used to verify that this works is also attached.

If there are no objections, I will commit and back-patch.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Robert Haas
Дата:
On Fri, May 15, 2015 at 3:53 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Thu, May 14, 2015 at 8:25 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> The documentation (or this feature) is broken still
>>
>> If dbname is NULL or dboid is InvalidOid, the session is not connected to
>> any particular database, but shared catalogs can be accessed. If username is
>> NULL or useroid is InvalidOid, the process will run as the superuser created
>> during initdb. A background worker can only call one of these two functions,
>> and only once. It is not possible to switch databases.
>>
>> But it fails with error:
>>
>> FATAL:  database 0 does not exist
>
> Ugh.  I think that's a bug.
>
> Patch attached.
>
> The test code I used to verify that this works is also attached.
>
> If there are no objections, I will commit and back-patch.

Oops.  Really attached this time.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Вложения

Re: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Alvaro Herrera
Дата:
Robert Haas wrote:
> On Fri, May 15, 2015 at 3:53 PM, Robert Haas <robertmhaas@gmail.com> wrote:

> > The test code I used to verify that this works is also attached.
> >
> > If there are no objections, I will commit and back-patch.
> 
> Oops.  Really attached this time.

We have spi_worker in src/test/modules now -- I think it makes sense to
add this one there too in master.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Robert Haas
Дата:
On Fri, May 15, 2015 at 4:07 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> Robert Haas wrote:
>> On Fri, May 15, 2015 at 3:53 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>
>> > The test code I used to verify that this works is also attached.
>> >
>> > If there are no objections, I will commit and back-patch.
>>
>> Oops.  Really attached this time.
>
> We have spi_worker in src/test/modules now -- I think it makes sense to
> add this one there too in master.

Really?  I was thinking of the test code as throwaway.  I just wanted
to fix the bug.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Alvaro Herrera
Дата:
Robert Haas wrote:
> On Fri, May 15, 2015 at 4:07 PM, Alvaro Herrera
> <alvherre@2ndquadrant.com> wrote:
> > Robert Haas wrote:
> >> On Fri, May 15, 2015 at 3:53 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> >
> >> > The test code I used to verify that this works is also attached.
> >> >
> >> > If there are no objections, I will commit and back-patch.
> >>
> >> Oops.  Really attached this time.
> >
> > We have spi_worker in src/test/modules now -- I think it makes sense to
> > add this one there too in master.
> 
> Really?  I was thinking of the test code as throwaway.  I just wanted
> to fix the bug.

Oh, that's fine then.  I thought you wanted to push it.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Robert Haas
Дата:
On Fri, May 15, 2015 at 4:15 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
>> Really?  I was thinking of the test code as throwaway.  I just wanted
>> to fix the bug.
>
> Oh, that's fine then.  I thought you wanted to push it.

Nah, sorry, I shoulda been more clear about that.  That was just so I
could actually be sure I had the fix right.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Alvaro Herrera
Дата:
Robert Haas wrote:
> On Fri, May 15, 2015 at 4:15 PM, Alvaro Herrera
> <alvherre@2ndquadrant.com> wrote:
> >> Really?  I was thinking of the test code as throwaway.  I just wanted
> >> to fix the bug.
> >
> > Oh, that's fine then.  I thought you wanted to push it.
> 
> Nah, sorry, I shoulda been more clear about that.  That was just so I
> could actually be sure I had the fix right.

I think you forgot to push this one ...

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: broken documentation: BackgroundWorkerInitializeConnection(NULL, NULL);

От
Robert Haas
Дата:
On Thu, May 21, 2015 at 11:47 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> Robert Haas wrote:
>> On Fri, May 15, 2015 at 4:15 PM, Alvaro Herrera
>> <alvherre@2ndquadrant.com> wrote:
>> >> Really?  I was thinking of the test code as throwaway.  I just wanted
>> >> to fix the bug.
>> >
>> > Oh, that's fine then.  I thought you wanted to push it.
>>
>> Nah, sorry, I shoulda been more clear about that.  That was just so I
>> could actually be sure I had the fix right.
>
> I think you forgot to push this one ...

Yeah, you're right.  Done now after two other people reminded me of
the same thing.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company