pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Sterpu Victor <victor@caido.ro>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Query to retrieve the index columns when a function is used.
Date: Wed, 11 Mar 2020 18:29:00 -0400
Message-ID: <5284.1583965740@sss.pgh.pa.us> (raw)
In-Reply-To: <CAApHDvqF+L5gWvBXPtTi9viXpm7o61c0Aah2FtkRi-yAiosSfg@mail.gmail.com>
References: <em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc>
	<CAApHDvqF+L5gWvBXPtTi9viXpm7o61c0Aah2FtkRi-yAiosSfg@mail.gmail.com>

David Rowley <dgrowleyml@gmail.com> writes:
> On Tue, 10 Mar 2020 at 02:16, Sterpu Victor <victor@caido.ro> wrote:
>> How can I retrieve this detail?

> Those details are in the indexprs column.  There's an item there for
> each 0 valued indkey. It's not going to be particularly easy for you
> to parse that from SQL.  Internally in PostgreSQL, we have functions
> that could give you that information easily, but to access those from
> SQL you'd need to write something in C.

You could use pg_get_indexdef().  I agree that parsing indexprs from
SQL is not to be recommended --- aside from being very complex, it
would break on a regular basis, because we change those structs often.

			regards, tom lane





view thread (3+ messages)

Message-ID: <5284.1583965740@sss.pgh.pa.us>
Permalink:  ../5284.1583965740@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5284.1583965740@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, victor@caido.ro
  Subject: Re: Query to retrieve the index columns when a function is used.
  In-Reply-To: <5284.1583965740@sss.pgh.pa.us>
  References: <em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc> <CAApHDvqF+L5gWvBXPtTi9viXpm7o61c0Aah2FtkRi-yAiosSfg@mail.gmail.com> <5284.1583965740@sss.pgh.pa.us>

* 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