GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [BUG] JSQLParser 5.4-SNAPSHOT : ClickHouse : Parametric type Nullable(Decimal(p, s)) not supported as CAST target · Issue #2441 · JSQLParser/JSqlParser

[BUG] JSQLParser 5.4-SNAPSHOT : ClickHouse : Parametric type Nullable(Decimal(p, s)) not supported as CAST target #2441

New issue
Copy link
New issue
Copy link
Closed
#2451
Closed
[BUG] JSQLParser 5.4-SNAPSHOT : ClickHouse : Parametric type Nullable(Decimal(p, s)) not supported as CAST target#2441
#2451
Copy link

Description

@tomershay
tomershay
opened on Jul 12, 2026
Issue body actions

Failing SQL Feature

ClickHouse supports parametric (constructor-style) data types as the target of a CAST, including nested ones such as Nullable(Decimal(10, 2)). Here Decimal(10, 2) declares a decimal with precision 10 and scale 2, and Nullable(...) wraps it so the column can also hold NULL. JSQLParser fails to parse this type expression when it is used as the target type of a CAST(... AS ...).

See the ClickHouse docs:

  • https://clickhouse.com/docs/en/sql-reference/data-types/nullable
  • https://clickhouse.com/docs/en/sql-reference/data-types/decimal

Full SQL Example

CREATE TABLE cast_demo (id UInt32, x Float64) ENGINE = MergeTree ORDER BY id;
INSERT INTO cast_demo (id, x) VALUES (1, 10.5), (2, 3.14159), (3, 1234567.891), (4, 0);
SELECT CAST(x AS Nullable(Decimal(10, 2))) FROM cast_demo;

Parsing Error

ParseException: Encountered: <OPENING_BRACKET> / "(", at line 3, column 25, in lexical state DEFAULT.
Was expecting one of these terminals within expansion starting at 9127:5:
    <K_FORMAT> (inside 9125:5) ...
    <CLOSING_BRACKET> (inside 9127:5) 

Tested with ClickHouse version: 25.8

Activity

  1. fudianchn commented on Aug 7, 2026

    @fudianchn
    fudianchn
    on Aug 7, 2026
    Contributor
    More actions

    Thanks for the report. The root cause is that the argument production of ColDataType only accepted atomic tokens (numbers, string literals, bare identifiers/keywords), so a nested parametric type such as Decimal(10, 2) inside Nullable(...) was rejected at its inner (.

    Opened #2451 to allow an argument that is itself a parametric type (DATA_TYPE or identifier immediately followed by an argument list) to be parsed as a nested ColDataType. SELECT CAST(x AS Nullable(Decimal(10, 2))) FROM cast_demo and LowCardinality(Decimal(10, 2)) now parse and round-trip; the full test suite (4647 tests) passes with no regressions.

  2. manticore-projects
    closed this as completedin 3997ba4on Aug 7, 2026
  3. pull
    added a commit that references this issue on Aug 7, 2026

    fix: support nested parametric data types as CAST target (JSQLParser#…

    This issue will close once commit 3997ba4 is merged into the 'master' branch.
    3997ba4
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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.