Skip to content

JSON parameter binding infers different numeric types than JSON literal casting #88925

@alex-clickhouse

Description

@alex-clickhouse

Company or project name

No response

Describe what's wrong

When creating a JSON object from a query parameter, ClickHouse infers numeric types differently than when parsing the same JSON literal with ::Json. This causes semantically identical JSON objects to compare as unequal.

Does it reproduce on the most recent release?

Yes

How to reproduce

curl 'http://localhost:8123/?param_x=%7B%22a%22%3A1%7D'   -d "SELECT {x:Json} as j1, '{\"a\":1}'::Json as j2, j1 = j2 as equals, JSONAllPathsWithTypes(j1), JSONAllPathsWithTypes(j2)"
{"a":1}	{"a":1}	0	{'a':'Int8'}	{'a':'Int64'}

Expected behavior

No response

Error message and/or stacktrace

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

potential bugTo be reviewed by developers and confirmed/rejected.

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions