Re: cannot read pg_class without having selected a database / is this a bug?

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: cannot read pg_class without having selected a database / is this a bug?
Дата
Msg-id 4EDAAA7C.9090501@fuzzy.cz
обсуждение исходный текст
Ответ на Re: cannot read pg_class without having selected a database / is this a bug?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: cannot read pg_class without having selected a database / is this a bug?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 3.12.2011 23:37, Robert Haas wrote:
> 2011/12/3 Tomas Vondra <tv@fuzzy.cz>:
>> psql: FATAL:  cannot read pg_class without having selected a database
>>
>> I've found this happens because the extension defines a client auth hook
>> that reads pg_stat_activity. The really interesting thing is that this
>> happens only when I start several backends 'at the same time' right
>> after the cluster is started. From that time, everything works just fine.
> 
> I'm surprised this ever works.  To read pg_stat_activity, you need a
> relcache entry for it.  And how will you build one without selecting a
> database?

What do you mean by selecting a database?

I do select a database when executing a psql, but I guess you mean
something that initializes the relcache entry and that's probably
executed after the auth hook.

That might explain why it fails at first and then works just fine,
although it's a bit strange. Wouldn't that mean you can't access any
catalogs from the auth hook?

Tomas


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: cannot read pg_class without having selected a database / is this a bug?
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64