Re: select results on pg_class incomplete

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: select results on pg_class incomplete
Date: 2024-03-14 20:03:14
Message-ID: CAApHDvqd9qgFZb7ZB93wwL1sAC6w-uiNMx4Wiwp+2Zsi=rVEEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 15 Mar 2024 at 07:13, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Thu, Mar 14, 2024, 11:08 Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz> wrote:
>>
>> Thanks for the enlightenment. A pity. I suppose, there is no working
>> around this?
>
> Write a script to do the query in a loop on all databases - that catalog is global.

Yeah, maybe dblink and a LATERAL join might be an easy way. Something like:

create extension dblink;
select d.datname,c.relname from pg_database d, lateral (select * from
dblink('dbname='||d.datname,$$select relname from pg_class where
relname = 'pg_class';$$) c(relname text)) c
(relname) where d.datallowconn;
datname | relname
------------+----------
postgres | pg_class
template1 | pg_class
regression | pg_class
(3 rows)

David

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Rowley 2024-03-15 00:26:21 Re: Seeing high query planning time on Azure Postgres Single Server version 11.
Previous Message hassan rafi 2024-03-14 19:01:05 Re: Seeing high query planning time on Azure Postgres Single Server version 11.