Skip to content

Fix JDBI named bind params being uppercased and losing spaces in DBeaver SQL formatter#2899

Open
zeepnguyen wants to merge 1 commit intodiffplug:mainfrom
zeepnguyen:zeenguyen/jdbi-named-param-keyword-case
Open

Fix JDBI named bind params being uppercased and losing spaces in DBeaver SQL formatter#2899
zeepnguyen wants to merge 1 commit intodiffplug:mainfrom
zeepnguyen:zeenguyen/jdbi-named-param-keyword-case

Conversation

@zeepnguyen
Copy link
Copy Markdown

@zeepnguyen zeepnguyen commented Apr 8, 2026

Problem

When using JDBI named bind params that collide with SQL keywords (e.g. :limit, :offset, :set), the DBeaver SQL formatter would incorrectly uppercase them (:limit:LIMIT) and strip the space before them (LIMIT :limitLIMIT:limit). Both of these break the resulting SQL.

Changes

  • Keyword case: When applying keyword case transformation, skip any KEYWORD token that is immediately preceded by a : symbol — it's a JDBI named bind param, not a SQL keyword.
  • Spacing: When inserting spaces between tokens, allow a space before : when it is preceded by a keyword or name token. Spaces before : are still suppressed when preceded by a symbol (e.g. =:param remains unchanged).

Test

Extended the existing jdbi-params test resource with a query using :limit and :offset to cover both fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant