Skip to content

SqlServerDialect should always quote identifiers #1216

@neutrino1911

Description

@neutrino1911

Description

Microsoft SQL Server has reserved keywords such as order that cannot be used as identifiers unless they are quoted

This works in spring-data 2.1.x. Unfortunately in #914 identifiers quoting was disabled by default for this dialect. That made it impossible to migrate from 2.1.x to 2.2+

When I declare an entity like this:

@Table
data class MyEntity(
    @Id
    val id: Long? = null,
    val order: Int,
)

then SQL Servers throws exceptions like this one:
com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'order'.

Solution proposal

I suggest create new IdentifierProcessing type QUOTED = create(Quoting.ANSI, LetterCasing.AS_IS) and use it in SqlServerDialect.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions