Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres 14-specific JSON syntax #119

Open
tacman opened this issue Sep 13, 2022 · 1 comment
Open

Postgres 14-specific JSON syntax #119

tacman opened this issue Sep 13, 2022 · 1 comment

Comments

@tacman
Copy link
Contributor

tacman commented Sep 13, 2022

In reviewing the documentation for Postgres 14, I saw this:

PostgreSQL has supported manipulating JSON data since the release of PostgreSQL 9.2, though retrieval of values used a unique syntax. PostgreSQL 14 now lets you access JSON data using subscripts, e.g. a query like SELECT ('{ "postgres": { "release": 14 }}'::jsonb)['postgres']['release']; now works. This aligns PostgreSQL with syntax that is commonly recognized for retrieving information from JSON data. The subscripting framework added to PostgreSQL 14 can be generally extended to other nested data structures, and is also applied to the hstore data type in this release.

Range types, also first released in PostgreSQL 9.2, now have support for noncontiguous ranges through the introduction of the "multirange" data type. A multirange is an ordered list of ranges that are nonoverlapping, which lets developers write simpler queries for dealing with complex sequences of ranges. The range types native to PostgreSQL (dates, times, numbers) support multiranges, and other data types can be extended to use multirange support.

Are there parts of this bundle that alter the query syntax based on version? This is probably a minor enhancement that would only be relevant for debugging, but I'm curious if there's any benefit, beyond the syntax change, to leveraging this new feature from postgres 14.

@martin-georgiev
Copy link
Owner

So far, the library doesn't consider different PostgreSQL versions with syntax sugar. I can see how v14 improvements can be beneficial; however, I can't currently commit time to bring this new PostgreSQL feature into the project. Please give it a go if you feel passionate about it. I'll ensure a PR is reviewed timely and, where suitable, released under a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants