<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -175,6 +175,21 @@ public class Database {
     }
 
     /**
+     * Return the index names for indexes in the given table.
+     * 
+     * &lt;p&gt;If you have more than one
+     * schema, only tables in the current
+     * schema (as set by SET SCHEMA) are consulted.&lt;/p&gt;
+     * 
+     * &lt;p&gt;If a future version of Mayfly implements this functionality in
+     * java.sql.DatabaseMetaData, this method is likely to remain, as
+     * being more convenient than DatabaseMetaData.&lt;/p&gt;
+     */
+    public List&lt;String&gt; indexes(String tableName) {
+        return defaultConnection.indexes(tableName);
+    }
+
+    /**
      * Number of rows in given table.
      * 
      * This is a convenience method.  Your production code will almost</diff>
      <filename>src/net/sourceforge/mayfly/Database.java</filename>
    </modified>
    <modified>
      <diff>@@ -106,6 +106,11 @@ public class MayflyConnection {
         TableData tableData = database.dataStore().table(currentSchema, tableName);
         return tableData.rowCount();
     }
+    
+    public List&lt;String&gt; indexes(String tableName) {
+        TableData tableData = database.dataStore().table(currentSchema, tableName);
+        return tableData.indexes.names();
+    }
 
     public void setAutoCommit(boolean autoCommit) throws SQLException {
         this.autoCommit  = autoCommit;</diff>
      <filename>src/net/sourceforge/mayfly/MayflyConnection.java</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ import java.util.Set;
 
 public class Indexes implements Iterable&lt;Index&gt; {
 
-    private final ImmutableList&lt;Index&gt; indexes;
+    public final ImmutableList&lt;Index&gt; indexes;
     
     public Indexes() {
         this(new ImmutableList&lt;Index&gt;());
@@ -88,5 +88,13 @@ public class Indexes implements Iterable&lt;Index&gt; {
         }
         return false;
     }
+    
+    public List&lt;String&gt; names() {
+        List&lt;String&gt; result = new ArrayList&lt;String&gt;();
+        for (Index index : indexes) {
+            result.add(index.name());
+        }
+        return result;
+    }
 
 }</diff>
      <filename>src/net/sourceforge/mayfly/datastore/Indexes.java</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,7 @@ import java.io.Reader;
 import java.io.StringReader;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -86,6 +87,29 @@ public class DatabaseTest extends TestCase {
         }
     }
     
+    public void testIndexesOnNonexistentTable() throws Exception {
+        try {
+            database.indexes(&quot;nosuch&quot;);
+            fail();
+        }
+        catch (MayflyException e) {
+            assertEquals(&quot;no table nosuch&quot;, e.getMessage());
+        }
+    }
+    
+    public void testNoIndexes() throws Exception {
+        database.execute(&quot;create table foo(x integer)&quot;);
+        assertEquals(0, database.indexes(&quot;foo&quot;).size());
+    }
+    
+    public void testReturnIndexes() throws Exception {
+        database.execute(&quot;create table foo(x integer)&quot;);
+        database.execute(&quot;create index an_index_name on foo(x)&quot;);
+        List&lt;String&gt; indexes = database.indexes(&quot;foo&quot;);
+        assertEquals(1, indexes.size());
+        assertEquals(&quot;an_index_name&quot;, indexes.get(0));
+    }
+    
     public void testQueryAndSchema() throws Exception {
         database.execute(&quot;create table inAnonymousSchema (x integer)&quot;);
         database.execute(&quot;create schema mars authorization dba create table foo (y integer)&quot;);</diff>
      <filename>test/net/sourceforge/mayfly/DatabaseTest.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6eab092ccedee44519411c6da4ce1d4d284624a5</id>
    </parent>
  </parents>
  <author>
    <name>Jim Kingdon</name>
    <email>kingdon@panix.com</email>
  </author>
  <url>http://github.com/jkingdon/mayfly/commit/de11b332c2ba6990e66a1616bdf1bc8ea56f4404</url>
  <id>de11b332c2ba6990e66a1616bdf1bc8ea56f4404</id>
  <committed-date>2009-08-26T15:38:03-07:00</committed-date>
  <authored-date>2009-08-26T15:38:03-07:00</authored-date>
  <message>Add method to list the indexes for a table.</message>
  <tree>c69a7db0aa6c7e03f66eb90bdaa7fb661a930773</tree>
  <committer>
    <name>Jim Kingdon</name>
    <email>kingdon@panix.com</email>
  </committer>
</commit>
