Re: Duplicate tables information through metadata queries

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "ldh(at)laurent-hasson(dot)com" <ldh(at)laurent-hasson(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-jdbc(at)lists(dot)postgresql(dot)org" <pgsql-jdbc(at)lists(dot)postgresql(dot)org>
Subject: Re: Duplicate tables information through metadata queries
Date: 2021-09-08 22:04:49
Message-ID: ab5891c4-7c34-2986-7e15-80461401b4f1@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On 9/8/21 5:15 PM, ldh(at)laurent-hasson(dot)com wrote:
>
> SELECT *
> FROM pg_catalog.pg_class c
> LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
> LEFT JOIN pg_catalog.pg_description d ON (c.oid = d.objoid AND d.objsubid = 0)
> WHERE c.relname = 'contact'

Umm, that doesn't look right. For queries against pg_description you
need to specify the classoid (in this case 'pg_class'::regclass) as well
as the objoid (and possibly the objsubid). Remember, Oids are not unique
across the whole catalog. I looks to me like here one rwo is picking up
a description for an entry in some other catalog

See https://www.postgresql.org/docs/devel/catalog-pg-description.html

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message David G. Johnston 2021-09-08 22:08:40 Re: Duplicate tables information through metadata queries
Previous Message ldh@laurent-hasson.com 2021-09-08 22:00:37 RE: Duplicate tables information through metadata queries