pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sterpu Victor <victor@caido.ro>
To: pgsql-general@lists.postgresql.org
Subject: Query to retrieve the index columns when a function is used.
Date: Mon, 09 Mar 2020 13:15:49 +0000
Message-ID: <em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc> (raw)

      Hello

I'm testing on Postgresql 12.1 and I have a index like this:
"check_dates_gist" EXCLUDE USING gist (id_test1 WITH =, id_test2 WITH =, 
tsrange(valid_from::timestamp without time zone, valid_to::timestamp 
without time zone) WITH &&)

When I run this query:
"select pc.relname, pi.indisunique, pi.indisprimary, 
array_agg(a.attname) as attname
FROM pg_class pc
JOIN pg_index pi ON pc.oid = pi.indexrelid AND pc.oid IN
(SELECT indexrelid FROM pg_index, pg_class WHERE pg_class.relname='test' 
AND pg_class.oid=pg_index.indrelid)
JOIN pg_attribute a ON a.attrelid = pc.oid
GROUP BY pc.relname,pi.indisunique, pi.indisprimary;"
I retrieve the index but there is no detail about the columns valid_from 
and valid_to.

How can I retrieve this detail?
Thank you.

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

view thread (3+ messages)  latest in thread

Message-ID: <em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc>
Permalink:  ../em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc/
Also on:    postgresql.org/message-id/em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc

 · 

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: victor@caido.ro
  Subject: Re: Query to retrieve the index columns when a function is used.
  In-Reply-To: <em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc>
  References: <em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc>

* 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