Re: Get table catalog from pg_indexes

Поиск
Список
Период
Сортировка
От Igor Korot
Тема Re: Get table catalog from pg_indexes
Дата
Msg-id CA+FnnTxVpKiusfntzfEaYPm8g0=VBk0h+URebXdUtFNcp2RNiQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Get table catalog from pg_indexes  (Erik Wienhold <ewie@ewie.name>)
Ответы Re: Get table catalog from pg_indexes  (Christophe Pettus <xof@thebuild.com>)
Re: Get table catalog from pg_indexes  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Get table catalog from pg_indexes  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Hi, Erik,

On Sun, Nov 27, 2022 at 11:59 AM Erik Wienhold <ewie@ewie.name> wrote:
>
> > On 27/11/2022 18:22 CET Igor Korot <ikorot01@gmail.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].

From the lin yo referenced:

[quote]
The view pg_indexes provides access to useful information about each
index in the database.
[/quote]

It doesn't say anything about "current" DB - only the DB.

However, I think I can try "SELECT 1 FROM <catalog>.pg_indexes...".
Will this work?

Thank you.

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



В списке pgsql-general по дате отправления:

Предыдущее
От: Erik Wienhold
Дата:
Сообщение: Re: Get table catalog from pg_indexes
Следующее
От: Christophe Pettus
Дата:
Сообщение: Re: Get table catalog from pg_indexes