Query to retrieve the index columns when a function is used.

From: "Sterpu Victor" <victor(at)caido(dot)ro>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Query to retrieve the index columns when a function is used.
Date: 2020-03-09 13:15:49
Message-ID: em08be29fe-acfd-417d-99c5-1e98146b2922@victor-pc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2020-03-09 13:48:39 Re: Who mades the inserts?
Previous Message Durumdara 2020-03-09 12:52:51 Who mades the inserts?