Skip to content

DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property #3467

@ldhasson

Description

@ldhasson

Please read https://stackoverflow.com/help/minimal-reproducible-example

Describe the issue
Querying the meta-data for indices doesn't return the comment. A property called "REMARKS" is expected as for tables, views and columns.

Driver Version?
postgresql-42.7.4.jar

Java Version?
21

OS Version?
Windows 11

PostgreSQL Version?
PostgreSQL 15.1
PostgreSQL 17.1

To Reproduce
Database:

CREATE TABLE Test_XXX(id BIGINT);
CREATE UNIQUE INDEX IF NOT EXISTS Test_XXX_main ON Test_XXX("id" ASC) where id > 0;
COMMENT ON INDEX Test_XXX_main IS E'Blah blah blah';

Java:

        DatabaseMetaData meta = C.getMetaData();
        ResultSet RS = meta.getIndexInfo(null, null, "test_xxx", false, true);
        while (RS.next() == true)
          {
            int count = RS.getMetaData().getColumnCount();            
            for (int i = 1; i <= count; ++i)
              {
                String Name = RS.getMetaData().getColumnName(i);
                String Val = RS.getString(i);
                System.out.println("   - "+Name+": "+Val);
              }
          }

Output:

   - TABLE_CAT: null
   - TABLE_SCHEM: public
   - TABLE_NAME: test_xxx
   - NON_UNIQUE: t
   - INDEX_QUALIFIER: null
   - INDEX_NAME: test_xxx_main
   - TYPE: 3
   - ORDINAL_POSITION: 1
   - COLUMN_NAME: id
   - ASC_OR_DESC: A
   - CARDINALITY: 0
   - PAGES: 1
   - FILTER_CONDITION: (id > 0)

Expected behaviour
The meta-data should return a property called "REMARKS" containing the comment on the index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions