Skip to content

Remove initial $ PathSegment from JsonScalarExpression/JsonQueryExpression #30747

@roji

Description

@roji

In JsonScalarExpression and JsonQueryExpression, we currently have an initial $ path segment. While JSONPATH expressions do indeed start with $, that's a specific detail of JSONPATH, and therefore SQL generation; the expression itself shouldn't contain it. For example, PostgreSQL doesn't use JSONPATH at all to drill into JSON documents, and SQLite has a simplified non-JSONPATH syntax when there's only one path segment (e.g. `JsonColumn ->> 'foo').

In addition, we shouldn't produce empty Json{Scalar,Query}Expression (which we then ignore in SQL generation). The code creating these expressions should simply not create them when there's no path.

See #30745 (comment)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions