Skip to content

[BUG] exists, sample and extend cannot be used as unquoted identifiers #2772

Closed

Description

@fudianchn

JSqlParser version: master 8d12a5d7a (5.5-SNAPSHOT); extend has failed since 5.2, exists and sample have failed since these tokens were reserved. RDBMS: all.

The following statements fail on master although all three words are non-reserved in the common dialects:

SELECT tb_name, exists FROM entity ORDER BY exists;
SELECT * FROM sample;
UPDATE t SET extend = 'x' WHERE id = 1;

They reach JSqlParser through downstream SQL rewriting tools (baomidou/mybatis-plus#7029, #5956, #6504, #6871), where users cannot rename their columns or tables.

Root cause: K_EXISTS, K_SAMPLE and K_EXTEND are reserved tokens for specific operator positions (the EXISTS predicate and JSON_TABLE flag, Vertica table sampling, ksqDB pipe operators) but were never added to the reserved-keyword-as-identifier alternatives of RelObjectName(), unlike earlier dual-use keywords such as EXTENDED (#1525) or GROUPS (#2473).

A PR follows.

Activity

  1. fudianchn commented on Oct 15, 2026

    @fudianchn
    ContributorAuthor

    Fixed by #2773 (exists) and #2774 (sample, extend), both merged. Re-checked the three statements from this issue on current master (bdf8ac3): all of them parse now, and EXISTS (...) predicates are unaffected. Closing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions