Skip site navigation (1) Skip section navigation (2)

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

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: cannot read pg_class without having selected a database / is this a bug?
Date: 2011-12-04 21:04:40
Message-ID: 4EDBE068.4020302@fuzzy.cz (view raw or flat)
Thread:
Lists: pgsql-hackers
On 4.12.2011 17:10, Tom Lane wrote:
> Tomas Vondra <tv(at)fuzzy(dot)cz> writes:
>> Anyway, the code I posted does not fail because of pg_stat_activity, it
>> fails because it attempts for find the dbname/username for the backends
>> (read from pg_stat_activity).
> 
> Well, get_database_name tries to do a syscache lookup, and the syscache
> infrastructure isn't working yet.  It is possible to read a shared
> catalog at this stage, but you have to use lower-level access mechanisms
> --- for an example with some comments, look at GetDatabaseTuple in
> postinit.c.

Great, this seems to work perfectly.

What about the pg_stat_activity - is it safe to access that from auth
hook or is that just a coincidence that it works (and might stop working
in the future)?

Tomas

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2011-12-04 21:16:02
Subject: Re: why local_preload_libraries does require a separate directory ?
Previous:From: Heikki LinnakangasDate: 2011-12-04 20:53:37
Subject: Re: [PATCH] Caching for stable expressions with constant arguments v3

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group