Re: DatabaseMetaData.getIndexInfo and function-based indexes

From: Kris Jurka <books(at)ejurka(dot)com>
To: peter royal <proyal(at)pace2020(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: DatabaseMetaData.getIndexInfo and function-based indexes
Date: 2005-02-19 04:07:03
Message-ID: Pine.BSO.4.56.0502182250570.26663@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 18 Feb 2005, peter royal wrote:

> create index my_index on my_Table (upper(my_field) );
>
> it is possible to retrieve the fact that the field is upper(my_field)
> via DMD.getIndexInfo() ?
>
> With 7.4 (and the associated JDBC driver) the column name shows up as
> pg_expression_1 (or something very close to that

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.

Kris Jurka

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2005-02-19 05:54:19 Re: DatabaseMetaData.getIndexInfo and function-based indexes
Previous Message peter royal 2005-02-18 22:55:22 DatabaseMetaData.getIndexInfo and function-based indexes