spring-projects / spring-projects/spring-data-relational

Generated invalid SQL identifiers for postgresql when specifying @Table(name=...)

Open
#1,124 3 comments 1 reaction 1 assignee View on GitHub

@schauder is already working on this.

Since Jan 10, 2022.

type: enhancement
Dominant language
Java
Stars
827
Forks
394
PR merge metrics
No merged PRs in 30d

Description

TL;DR: We should not always quote table/schema name, it hardly will be the right thing to do.

I have created github repository in order to demonstrate the problem we have encountered using spring-data-jdbc with Postgresql. This application will fail with

relation "SAMPLE_ENTITY" does not exist

The problem is that spring-data-jdbc use force quoting here, which is not always the right thing to do, you can read more in this Postgresql documentation section.

To summarize, as described in this documentation section, "SAMPLE_ENTITY" and SAMPLE_ENTITY is not the same identifier name.

My suggestion is to add couple of attributes into @Table annotations, like tableNameQuoted, schemaNameQuoted in order to allow user to specify quoting policy explicitly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.