Re: Get table catalog from pg_indexes

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Igor Korot <ikorot01(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Get table catalog from pg_indexes
Date: 2022-11-27 17:59:35
Message-ID: 1113989301.734580.1669571975787@office.mailbox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On 27/11/2022 18:22 CET Igor Korot <ikorot01(at)gmail(dot)com> wrote:
>
> Table pg_indexes does not contain a field for a catalog.
>
> So how do I get that?
>
> SELECT 1 FROM pg_indexes WHERE indexname = $1 AND tablename = $2 AND
> schemaname = $3

Use SELECT current_database() if you need to know the catalog.
pg_indexes only covers the current database[1].

[1] https://www.postgresql.org/docs/current/view-pg-indexes.html

--
Erik

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor Korot 2022-11-27 18:42:11 Re: Get table catalog from pg_indexes
Previous Message Igor Korot 2022-11-27 17:22:50 Get table catalog from pg_indexes