spring-projects / spring-projects/spring-data-relational
Generated invalid SQL identifiers for postgresql when specifying @Table(name=...)
@schauder is already working on this.
Since Jan 10, 2022.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.