Skip to content

[Bug] Rootless "simple syntax" json paths silently drop their first segment #74700

@eshishki

Description

@eshishki

Steps to reproduce:

SELECT get_json_string('{"order": {"id": 42}, "id": 7}', 'order.id');

Expected: 42 (order.id is the documented "simple syntax" for $.order.id)
Actual: 7 — the value of the top-level id field.

The same applies everywhere jsonpaths are accepted: a routine load / stream load job with "jsonpaths" = "[\"order.id\"]" silently loads the top-level id into the target column instead of order.id — no error, no filtered row, just wrong data. A single-token path ('k2') fails as an "empty json path" instead of selecting k2.

Root cause: JsonFunctions::_get_parsed_paths supports paths without the leading $ by inserting an implicit root segment — but it continues over the first token while doing so, so the token is never parsed into the path. "order.id" becomes [root, id], and every consumer iterates from segment 1.

Affected: get_json_string/get_json_int/get_json_double on VARCHAR, jsonpaths in stream load / routine load (JSON). (json_query and the JSON type use a different parser and are not affected.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions