Skip to content

Spring JDBC: PostgreSQL 42.7.5: catalog name is treated as case insensitive #35064

Open
@frederikz

Description

@frederikz

Since the Postgres driver 42.7.5 PostgresTableMetaDataProvider no longer retrieves column metadata for databases which have an upper case in their name:
org.springframework.dao.InvalidDataAccessApiUsageException: Unable to locate columns for table 'XXX' so an insert statement can't be generated.
org.springframework.jdbc.core.metadata.TableMetaDataContext.createInsertString(TableMetaDataContext.java:351)

Before Postgres driver version 42.7.5 in method locateTableAndProcessMetaData of class GenericTableMetaDataProvider the table metadata returned no value for TABLE_CAT so later in processTableColumns also a null catalog name was provided and databaseMetaData.getColumns didn't filter by catalog name. Since 42.7.5 TABLE_CAT returns a value like abC which is then in processTableColumns transformed to abc by metaDataCatalogNameToUse and passed to databaseMetaData.getColumns . This then returns no value for a catalog name abc but would returnd columns with a catalog name abC.
As the Javadoc says "must match the catalog name as it is stored in the database" and other projects like liquibase/liquibase#6666 / pgjdbc/pgjdbc#3560 fixed it in their code I believe that it is a bug in Spring JDBC and not in the Postgres JDBC Driver and that metaDataCatalogNameToUse should not change the catalog name retrieved from table metadata.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: dataIssues in data modules (jdbc, orm, oxm, tx)status: waiting-for-triageAn issue we've not yet triaged or decided on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions