Index: org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v
retrieving revision 1.18
diff -u -r1.18 AbstractJdbc2DatabaseMetaData.java
--- org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java	11 Jan 2005 08:25:45 -0000	1.18
+++ org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java	23 Feb 2005 17:28:50 -0000
@@ -3858,6 +3858,15 @@
             from = " FROM pg_class ct, pg_class ci, pg_index i, pg_attribute a, pg_am am ";
         }
 
+        if( connection.haveMinimumServerVersion("7.4"))
+        {
+            select += " CASE i.indexprs WHEN null THEN a.attname ELSE pg_get_indexdef(ci.oid,a.attnum,false) END AS COLUMN_NAME, ";
+        }
+        else
+        {
+            select += " a.attname AS COLUMN_NAME, ";
+        }
+
         String sql = select +
                      " ct.relname AS TABLE_NAME, NOT i.indisunique AS NON_UNIQUE, NULL AS INDEX_QUALIFIER, ci.relname AS INDEX_NAME, " +
                      " CASE i.indisclustered " +
@@ -3868,7 +3877,6 @@
                      " END " +
                      " END AS TYPE, " +
                      " a.attnum AS ORDINAL_POSITION, " +
-                     " a.attname AS COLUMN_NAME, " +
                      " NULL AS ASC_OR_DESC, " +
                      " ci.reltuples AS CARDINALITY, " +
                      " ci.relpages AS PAGES, " +
Index: org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v
retrieving revision 1.32
diff -u -r1.32 DatabaseMetaDataTest.java
--- org/postgresql/test/jdbc2/DatabaseMetaDataTest.java	11 Jan 2005 08:25:48 -0000	1.32
+++ org/postgresql/test/jdbc2/DatabaseMetaDataTest.java	23 Feb 2005 17:28:51 -0000
@@ -33,7 +39,7 @@
     protected void setUp() throws Exception
     {
         con = TestUtil.openDB();
-        TestUtil.createTable( con, "testmetadata", "id int4, name text, updated timestamp" );
+        TestUtil.createTable( con, "testmetadata", "id int4, name text, updated timestamp, colour text, quest text" );
         TestUtil.dropSequence( con, "sercoltest_b_seq");
         TestUtil.dropSequence( con, "sercoltest_c_seq");
         TestUtil.createTable( con, "sercoltest", "a int, b serial, c bigserial");
@@ -358,10 +364,46 @@
 
     public void testIndexInfo() throws SQLException
     {
-        // At the moment just test that no exceptions are thrown KJ
+        Statement stmt = con.createStatement();
+        stmt.execute("create index idx_id on testmetadata (id)");
+        stmt.execute("create index idx_func_single on testmetadata (upper(colour))");
+        stmt.execute("create index idx_func_multi on testmetadata (upper(colour), upper(quest))");
+        stmt.execute("create index idx_func_mixed on testmetadata (colour, upper(quest))");
+
         DatabaseMetaData dbmd = con.getMetaData();
         assertNotNull(dbmd);
-        ResultSet rs = dbmd.getIndexInfo(null, null, "pg_class", false, false);
+        ResultSet rs = dbmd.getIndexInfo(null, null, "testmetadata", false, false);
+
+        assertTrue(rs.next());
+        assertEquals("idx_func_mixed", rs.getString("INDEX_NAME"));
+        assertEquals(1, rs.getInt("ORDINAL_POSITION"));
+        assertEquals("colour", rs.getString("COLUMN_NAME"));
+
+        assertTrue(rs.next());
+        assertEquals("idx_func_mixed", rs.getString("INDEX_NAME"));
+        assertEquals(2, rs.getInt("ORDINAL_POSITION"));
+        assertEquals("upper(quest)", rs.getString("COLUMN_NAME"));
+
+        assertTrue(rs.next());
+        assertEquals("idx_func_multi", rs.getString("INDEX_NAME"));
+        assertEquals(1, rs.getInt("ORDINAL_POSITION"));
+        assertEquals("upper(colour)", rs.getString("COLUMN_NAME"));
+
+        assertTrue(rs.next());
+        assertEquals("idx_func_multi", rs.getString("INDEX_NAME"));
+        assertEquals(2, rs.getInt("ORDINAL_POSITION"));
+        assertEquals("upper(quest)", rs.getString("COLUMN_NAME"));
+
+        assertTrue(rs.next());
+        assertEquals("idx_func_single", rs.getString("INDEX_NAME"));
+        assertEquals(1, rs.getInt("ORDINAL_POSITION"));
+        assertEquals("upper(colour)", rs.getString("COLUMN_NAME"));
+
+        assertTrue(rs.next());
+        assertEquals("idx_id", rs.getString("INDEX_NAME"));
+        assertEquals(1, rs.getInt("ORDINAL_POSITION"));
+        assertEquals("id", rs.getString("COLUMN_NAME"));
+
         rs.close();
     }
 
