pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
11+ messages / 4 participants
[nested] [flat]

* [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2024-12-22 17:32 "ldhasson (@ldhasson)" <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: ldhasson (@ldhasson) @ 2024-12-22 17:32 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

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:
```sql
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:
```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:
```log
   - 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.



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2024-12-30 03:57 ` "Shanayshah44 (@Shanayshah44)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: Shanayshah44 (@Shanayshah44) @ 2024-12-30 03:57 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

The "REMARKS" field does not exist as a direct part of the metadata but can be retrieved from the pg_class and pg_description tables.But if you use the other than the Postgres like Oracle or any other it is directly available in the metadata.

Here how you can fetch the "REMARKS".

"SELECT pg_class.relname AS index_name, 
        pg_description.description AS comment 
        FROM pg_class 
        LEFT JOIN pg_description ON pg_description.objoid = pg_class.oid 
        JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace 
        WHERE pg_class.relname = test_xxx_main AND pg_namespace.nspname = 'public'";

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2024-12-30 04:09 ` "ldhasson (@ldhasson)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: ldhasson (@ldhasson) @ 2024-12-30 04:09 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Hello! Thank you!

I know about the alternative query, but that becomes PG-only. It's also a second query to run. Isn't this something that just should be supported at the JDBC level?


Thank you,
Laurent Hasson


________________________________
From: Shanay Shah ***@***.***>
Sent: Sunday, December 29, 2024 22:57
To: pgjdbc/pgjdbc
Cc: ***@***.***; Author
Subject: Re: [pgjdbc/pgjdbc] DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property (Issue #3467)


The "REMARKS" field does not exist as a direct part of the metadata but can be retrieved from the pg_class and pg_description tables.But if you use the other than the Postgres like Oracle or any other it is directly available in the metadata.

Here how you can fetch the "REMARKS".

"SELECT pg_class.relname AS index_name,
pg_description.description AS comment
FROM pg_class
LEFT JOIN pg_description ON pg_description.objoid = pg_class.oid
JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
WHERE pg_class.relname = test_xxx_main AND pg_namespace.nspname = 'public'";

—
Reply to this email directly, view it on GitHub<https://github.com/pgjdbc/pgjdbc/issues/3467#issuecomment-2565000122;, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AADEHBZQFT3JBMWIWD3XTJT2IDADDAVCNFSM6AAAAABUB2ZFOG...;.
You are receiving this because you authored the thread.Message ID: ***@***.***>


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2024-12-30 04:12 ` "Shanayshah44 (@Shanayshah44)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: Shanayshah44 (@Shanayshah44) @ 2024-12-30 04:12 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Yes of course this should be supported at the JDBC level

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2024-12-30 05:12 ` "ldhasson (@ldhasson)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: ldhasson (@ldhasson) @ 2024-12-30 05:12 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Ok. Your previous message seemed to imply this would not be part of the JDBC metadata and so one should use the alternate query.

It would be nice to have this covered in an upcoming release. Seems like it would be a low-impact addition/fix.


Thank you,
Laurent Hasson


________________________________
From: Shanay Shah ***@***.***>
Sent: Sunday, December 29, 2024 23:12
To: pgjdbc/pgjdbc
Cc: ***@***.***; Author
Subject: Re: [pgjdbc/pgjdbc] DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property (Issue #3467)


Yes of course this should be supported at the JDBC level

—
Reply to this email directly, view it on GitHub<https://github.com/pgjdbc/pgjdbc/issues/3467#issuecomment-2565006997;, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AADEHB25V2RIN27UHZQNFOD2IDB4LAVCNFSM6AAAAABUB2ZFOG...;.
You are receiving this because you authored the thread.Message ID: ***@***.***>


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2024-12-30 10:23 ` "davecramer (@davecramer)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: davecramer (@davecramer) @ 2024-12-30 10:23 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@ldhasson Here https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getIndexInfo-java.lang.Stri...- is the javadoc for getIndexInfo. I do not see a `REMARKS` field. 

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2024-12-30 14:21 ` "ldhasson (@ldhasson)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: ldhasson (@ldhasson) @ 2024-12-30 14:21 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

This is interesting. I thought i remember Oracle having that property. I don't have an Oracle database in hand now. But i see from the 4.3 standard that REMARKS is available in most places, but not for indices.

Is this an "enhancement" the team might consider? Or are you sticking strictly to the standard? In 2024, it still feels like JDBC is missing really basic capabilities that most databases support 🙁

Thank you.
Laurent.




________________________________
From: Dave Cramer ***@***.***>
Sent: Monday, December 30, 2024 5:23 AM
To: pgjdbc/pgjdbc ***@***.***>
Cc: ***@***.*** ***@***.***>; Mention ***@***.***>
Subject: Re: [pgjdbc/pgjdbc] DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property (Issue #3467)


@ldhasson<https://github.com/ldhasson; Here https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getIndexInfo-java.lang.Stri...- is the javadoc for getIndexInfo. I do not see a REMARKS field.

—
Reply to this email directly, view it on GitHub<https://github.com/pgjdbc/pgjdbc/issues/3467#issuecomment-2565289064;, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AADEHB6VVZ3ABXO5UFXA4KT2IENL3AVCNFSM6AAAAABUB2ZFOG...;.
You are receiving this because you were mentioned.Message ID: ***@***.***>


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2024-12-30 14:36 ` "davecramer (@davecramer)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: davecramer (@davecramer) @ 2024-12-30 14:36 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

We generally stick to the standard, but I see no reason not to include it. PR's are welcome

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2025-02-06 12:20 ` "raminorujov (@raminorujov)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: raminorujov (@raminorujov) @ 2025-02-06 12:20 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

> We generally stick to the standard, but I see no reason not to include it. PR's are welcome

Hi, @davecramer is it worth to merge my PR(https://github.com/pgjdbc/pgjdbc/pull/3513) or should I close it?

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2025-02-06 14:04 ` "raminorujov (@raminorujov)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: raminorujov (@raminorujov) @ 2025-02-06 14:04 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@ldhasson can you close this issue? I fixed it in my PR.

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property
@ 2025-02-06 14:11 ` "ldhasson (@ldhasson)" <[email protected]>
  9 siblings, 0 replies; 11+ messages in thread

From: ldhasson (@ldhasson) @ 2025-02-06 14:11 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Wonderful to hear. Thanks team!!! Looking forward to playing with it.

^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2025-02-06 14:11 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-22 17:32 [pgjdbc/pgjdbc] issue #3467: DatabaseMetaData.getIndexInfo() doesn't return "REMARKS" property "ldhasson (@ldhasson)" <[email protected]>
2024-12-30 03:57 ` "Shanayshah44 (@Shanayshah44)" <[email protected]>
2024-12-30 04:09 ` "ldhasson (@ldhasson)" <[email protected]>
2024-12-30 04:12 ` "Shanayshah44 (@Shanayshah44)" <[email protected]>
2024-12-30 05:12 ` "ldhasson (@ldhasson)" <[email protected]>
2024-12-30 10:23 ` "davecramer (@davecramer)" <[email protected]>
2024-12-30 14:21 ` "ldhasson (@ldhasson)" <[email protected]>
2024-12-30 14:36 ` "davecramer (@davecramer)" <[email protected]>
2025-02-06 12:20 ` "raminorujov (@raminorujov)" <[email protected]>
2025-02-06 14:04 ` "raminorujov (@raminorujov)" <[email protected]>
2025-02-06 14:11 ` "ldhasson (@ldhasson)" <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox