pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] issue #3722: spring jdbc causes problems with uppercase db names since 42.7.5
6+ messages / 2 participants
[nested] [flat]

* [pgjdbc/pgjdbc] issue #3722: spring jdbc causes problems with uppercase db names since 42.7.5
@ 2025-07-08 10:31 "frederikz (@frederikz)" <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: frederikz (@frederikz) @ 2025-07-08 10:31 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

I'm using spring jdbc which lookups up table metadata with ``DatabaseMetaData.getTables`` and then uses the returned information to get column metadata via ``DatabaseMetaData.getColumns``.
Before 42.7.5 the table metadata returned no value for ``TABLE_CAT`` and so the query for column metadata also didn't include a catalog.
Since 42.7.5 the table metadata returns a value for ``TABLE_CAT`` e.g. ``abC``. Spring doesn't use this value directly. It queries ``DatabaseMetaData.storesLowerCaseIdentifiers`` which returns true and as it returns true ``abC`` is transformed to ``abc``. The query for column metadata is now done for a catalog with the name ``abc`` which doesn't return any value as an exact case match is done agains the current database name which is ``abC`` and not ``abc``.

I have also reported the issue to the spring team https://github.com/spring-projects/spring-framework/issues/35064 as I'm unsure which side is causing the problem.
Why does ``DatabaseMetaData.storesLowerCaseIdentifiers`` return true when database names are not treated case insensitive or if it returns true why do methods like ``DatabaseMetaData.getColumns`` not accept lowercase names for a database?
I would expect ``DatabaseMetaData.storesLowerCaseIdentifiers`` to return false or methods like ``DatabaseMetaData.getColumns`` to accecpt a lowercase database name even if the database name was created with uppercase letters.

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

* Re: [pgjdbc/pgjdbc] issue #3722: spring jdbc causes problems with uppercase db names since 42.7.5
@ 2025-07-09 12:39 ` "davecramer (@davecramer)" <[email protected]>
  4 siblings, 0 replies; 6+ messages in thread

From: davecramer (@davecramer) @ 2025-07-09 12:39 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

`DatabaseMetaData.storesLowerCaseIdentifiers` refers to normal queries. https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getTables-java.lang.String-...- specifically states that columns are returned in UPPERCASE. I do see an argument where we would lowercase them, but the de facto standard seems to be to return them in UPPERCASE

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

* Re: [pgjdbc/pgjdbc] issue #3722: spring jdbc causes problems with uppercase db names since 42.7.5
@ 2025-07-09 13:29 ` "frederikz (@frederikz)" <[email protected]>
  4 siblings, 0 replies; 6+ messages in thread

From: frederikz (@frederikz) @ 2025-07-09 13:29 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Of course, you have to retrieve the results of ``DatabaseMetaData.getColumns`` with upper case column names like ``TABLE_CAT`` but that wasn't the point. The point is that the value returned by the ``TABLE_CAT`` column is case sensitive, So for my database ``abC`` it returns exactly that value ``abC`` and that value has to be used unchanged to call other methods like ``DatabaseMetaData.getColumns``. 
I would understand that ``DatabaseMetaData.storesLowerCaseIdentifiers`` doesn't apply to these metadata methods but then the spring team is using it wrong.
So your understanding of the API is that the return values of ``DatabaseMetaData.getTables`` like catalog have to be used as they are when then querying other metadata methods like ``DatabaseMetaData.getColumns`` and settings like ``DatabaseMetaData.storesLowerCaseIdentifiers`` do not apply to them? It would be nice if you could state something like that, so I could contact the Spring team again. On the postgres side it would then be only somewhat unfortunate that in a minor release we see a change of the value for ``TABLE_CAT`` (previously returning nothing since 42.7.5 returning a value) that causes a problem in other products.

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

* Re: [pgjdbc/pgjdbc] issue #3722: spring jdbc causes problems with uppercase db names since 42.7.5
@ 2025-07-31 10:11 ` "davecramer (@davecramer)" <[email protected]>
  4 siblings, 0 replies; 6+ messages in thread

From: davecramer (@davecramer) @ 2025-07-31 10:11 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Sorry for my late reply.

As to the change being in a minor release. It's somewhat fuzzy. We considered it a bug as we were just fixing it to adhere to the spec.

As to storesLowerCaseIdentifiers: This is what the javadoc says:
```

boolean | storesLowerCaseIdentifiers() | Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in lower case.

boolean | Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in lower case.
boolean | Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in mixed case.
boolean | Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in mixed case.

boolean	[storesLowerCaseIdentifiers](https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#storesLowerCaseIdentifiers-...)	
Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in lower case.
boolean	[storesLowerCaseQuotedIdentifiers](https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#storesLowerCaseQuotedIdenti...)	
Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in lower case.
boolean	[storesMixedCaseIdentifiers](https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#storesMixedCaseIdentifiers-...)	
Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in mixed case.
boolean	[storesMixedCaseQuotedIdentifiers](https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#storesMixedCaseQuotedIdenti...)	
Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in mixed case.


AFAICT, we are correct in saying  storesLowerCaseIdentifiers = true as that is what PostgreSQL does.

Seems the problem may be with spring

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

* Re: [pgjdbc/pgjdbc] issue #3722: spring jdbc causes problems with uppercase db names since 42.7.5
@ 2025-07-31 10:35 ` "frederikz (@frederikz)" <[email protected]>
  4 siblings, 0 replies; 6+ messages in thread

From: frederikz (@frederikz) @ 2025-07-31 10:35 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Thanks for your reply and confirming that you think the implementation is according to the spec. Based on your reply the spring team already changed their code and their lastest version works again even with newer pgjdbc drivers.

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

* Re: [pgjdbc/pgjdbc] issue #3722: spring jdbc causes problems with uppercase db names since 42.7.5
@ 2025-07-31 22:11 ` "davecramer (@davecramer)" <[email protected]>
  4 siblings, 0 replies; 6+ messages in thread

From: davecramer (@davecramer) @ 2025-07-31 22:11 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

> Thanks for your reply and confirming that you think the implementation is according to the spec. Based on your reply the spring team already changed their code and their lastest version works again even with newer pgjdbc drivers.

cool! Thanks for the reply

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


end of thread, other threads:[~2025-07-31 22:11 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-08 10:31 [pgjdbc/pgjdbc] issue #3722: spring jdbc causes problems with uppercase db names since 42.7.5 "frederikz (@frederikz)" <[email protected]>
2025-07-09 12:39 ` "davecramer (@davecramer)" <[email protected]>
2025-07-09 13:29 ` "frederikz (@frederikz)" <[email protected]>
2025-07-31 10:11 ` "davecramer (@davecramer)" <[email protected]>
2025-07-31 10:35 ` "frederikz (@frederikz)" <[email protected]>
2025-07-31 22:11 ` "davecramer (@davecramer)" <[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