X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E443A8B9F56 for ; Sat, 19 Feb 2005 05:54:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51588-03 for ; Sat, 19 Feb 2005 05:54:22 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 013BB8B9F20 for ; Sat, 19 Feb 2005 05:54:22 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1J5sJdH014459; Sat, 19 Feb 2005 00:54:19 -0500 (EST) To: Kris Jurka Cc: peter royal , pgsql-jdbc@postgresql.org Subject: Re: DatabaseMetaData.getIndexInfo and function-based indexes In-reply-to: References: <2BDB6E76-8200-11D9-8AAF-000A95AC787E@pace2020.com> Comments: In-reply-to Kris Jurka message dated "Fri, 18 Feb 2005 23:07:03 -0500" Date: Sat, 19 Feb 2005 00:54:19 -0500 Message-ID: <14458.1108792459@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/132 X-Sequence-Number: 12312 Kris Jurka 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