From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kris Jurka <books@ejurka.com>
Cc: peter royal <proyal@pace2020.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: DatabaseMetaData.getIndexInfo and function-based indexes
Date: Sat, 19 Feb 2005 00:54:19 -0500
Message-ID: <14458.1108792459@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSO.4.56.0502182250570.26663@leary.csoft.net>
References: <2BDB6E76-8200-11D9-8AAF-000A95AC787E@pace2020.com>
<Pine.BSO.4.56.0502182250570.26663@leary.csoft.net>
Kris Jurka <books@ejurka.com> writes:
> This is what is actually stored in the pg_attribute table as the column
> name for the index. Determining what the actual expression is would
> involve decoding the pg_index.indexpr column with pg_get_expr, which could
> be done, but then some manual parsing would need to be done to split this
> into multiple columns for something like (upper(a), lower(b)). So the
> driver can figure this information out, but doesn't presently.
FYI, pg_get_indexdef makes that pretty simple in PG >= 7.4:
regression=# create table t1 (f1 text, f2 text);
CREATE TABLE
regression=# create index t1i on t1(upper(f1), lower(f2));
CREATE INDEX
regression=# select pg_get_indexdef('t1i'::regclass, 1, false);
pg_get_indexdef
-----------------
upper(f1)
(1 row)
regression=# select pg_get_indexdef('t1i'::regclass, 2, false);
pg_get_indexdef
-----------------
lower(f2)
(1 row)
and before 7.4 we don't support multicolumn functional indexes anyway.
regards, tom lane
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-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, books@ejurka.com, proyal@pace2020.com
Subject: Re: DatabaseMetaData.getIndexInfo and function-based indexes
In-Reply-To: <14458.1108792459@sss.pgh.pa.us>
References: <2BDB6E76-8200-11D9-8AAF-000A95AC787E@pace2020.com> <Pine.BSO.4.56.0502182250570.26663@leary.csoft.net> <14458.1108792459@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