pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: Igor Korot <ikorot01@gmail.com>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Get table catalog from pg_indexes
Date: Sun, 27 Nov 2022 18:59:35 +0100 (CET)
Message-ID: <1113989301.734580.1669571975787@office.mailbox.org> (raw)
In-Reply-To: <CA+FnnTxHT4K+oRrVytEDVMmG1nLcH9zkMb-_wx-FyKJOJ__zTQ@mail.gmail.com>
References: <CA+FnnTxHT4K+oRrVytEDVMmG1nLcH9zkMb-_wx-FyKJOJ__zTQ@mail.gmail.com>

> 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].

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

--
Erik





view thread (18+ messages)  latest in thread

Message-ID: <1113989301.734580.1669571975787@office.mailbox.org>
Permalink:  ../1113989301.734580.1669571975787@office.mailbox.org/
Also on:    postgresql.org/message-id/1113989301.734580.1669571975787@office.mailbox.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ewie@ewie.name, ikorot01@gmail.com
  Subject: Re: Get table catalog from pg_indexes
  In-Reply-To: <1113989301.734580.1669571975787@office.mailbox.org>
  References: <CA+FnnTxHT4K+oRrVytEDVMmG1nLcH9zkMb-_wx-FyKJOJ__zTQ@mail.gmail.com> <1113989301.734580.1669571975787@office.mailbox.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox