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

2011-12-05 Thread Robert Haas
On Mon, Dec 5, 2011 at 10:46 AM, Tom Lane wrote: > Robert Haas writes: >> I'm still puzzled that Tomas got it working at all.  If MyDatabaseId >> hasn't been set yet, the how did we manage to build a relcache entry >> for anything - let alone an unshared catalog? > > Well, he wasn't actually issu

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

2011-12-05 Thread Tom Lane
Robert Haas writes: > I'm still puzzled that Tomas got it working at all. If MyDatabaseId > hasn't been set yet, the how did we manage to build a relcache entry > for anything - let alone an unshared catalog? Well, he wasn't actually issuing a SQL query, just calling some of the pgstat.c subrout

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

2011-12-05 Thread Robert Haas
On Sun, Dec 4, 2011 at 4:26 PM, Tom Lane wrote: > Tomas Vondra writes: >> 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)? > > It doesn't seem like a good thing to rely on.  There's

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

2011-12-04 Thread Tom Lane
Tomas Vondra writes: > 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)? It doesn't seem like a good thing to rely on. There's certainly no testing being done that would cause us to n

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

2011-12-04 Thread Tomas Vondra
On 4.12.2011 17:10, Tom Lane wrote: > Tomas Vondra 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 look

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

2011-12-04 Thread Tom Lane
Tomas Vondra writes: > On 4.12.2011 05:19, Tom Lane wrote: >> It should be possible to access shared catalogs from an auth hook. >> pg_stat_activity is neither shared nor a catalog. Like Robert, >> I find it astonishing that this works ever, because the info needed >> simply isn't available until

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

2011-12-04 Thread Tomas Vondra
On 4.12.2011 05:19, Tom Lane wrote: > Tomas Vondra writes: >> 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? > > It should be possible to access shared catalogs from an auth

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

2011-12-03 Thread Tom Lane
Tomas Vondra writes: > 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? It should be possible to access shared catalogs from an auth hook. pg_stat_activity is neither shared nor

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

2011-12-03 Thread Tomas Vondra
On 3.12.2011 23:37, Robert Haas wrote: > 2011/12/3 Tomas Vondra : >> 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 >> happ

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

2011-12-03 Thread Robert Haas
2011/12/3 Tomas Vondra : > 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