Skip to content

sql: decide on JSON ordering before 23.2 release #105668

@rafiss

Description

@rafiss

#101260 was created for the following reason:

Currently, #97928 and #99275 are responsible for laying out
a lexicographical ordering for JSON columns to be forward
indexable in nature. This ordering is based on the rules
posted by Postgres and is defined here: #99849

However, Postgres currently sorts the empty JSON array
before any other JSON values. An issue has been opened:
postgresql.org/message-id/17873-826fdc8bbcace4f1%40postgresql.org

Thus, this PR intends on replicating this behaviour until
the issue has been identified and resolved by Postgres.

However, @mgartner says:

Before this is merged, we'd like to check the SQL 2023 spec which reportedly defines the ordering of JSON values. If the ordering in the spec does not follow this empty array inconsistency of Postgres, we're probably fine with sticking with the current ordering. If the spec defines an ordering completely different than Postgres, we'll have to reconsider our options. This needs to be done before v23.2 is shipped.

This issue tracks that decision, and is a release blocker, since it will be a headache to change the ordering after the release goes out.

Epic: CRDB-24501

Jira issue: CRDB-29144

Metadata

Metadata

Assignees

Labels

A-sql-encodingRelating to the SQL/KV encoding.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)GA-blockerT-sql-queriesSQL Queries Teambranch-masterFailures and bugs on the master branch.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions