Re: ❓ JSON Path Dot Precedence

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Erik Wienhold <ewie(at)ewie(dot)name>
Subject: Re: ❓ JSON Path Dot Precedence
Date: 2024-07-08 16:11:58
Message-ID: 77C42535-4C92-44B1-A21B-EFF0A4180343@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jul 8, 2024, at 12:05, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> If we go down this path wouldn't the correct framing be: do not allow accessors after scalars ? The same argument applies to false/"john" and other scalar types since by definition none of them have subcomponents to be accessed.

Yes, excellent point.

> That said, the parser has a lax mode which somewhat implies it doesn't expect the jsonpath type to perform much in the way of validation of the semantic correctness of the encoded path expression.

My understanding is that lax mode means it ignores where the JSON doesn’t abide by expectations of the path expression, not that the path parsing is lax.

> I like the idea of a smarter expression-holding type and would even wish to have had this on day one. Retrofitting is less appealing. We document a similarity with regular expressions here where we, for better and worse, have lived without a regexppath data type forever and leave it to the executor to tell the user their pattern is invalid. Leaning on that precedence here makes accepting the status quo more reasonable. Though strict/lax modes and, I think, variables, motivates me to put my vote toward the "do more validation" group.

This feels different from a documented difference in behavior as an implementation choice, like path regex vs. Spencer. In this case, the expression is technically meaningless, but there’s never so much as an error thrown.

> Does the standard even have a separate type here or is that our implementation detail invention?

Sorry, separate type for what?

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-07-08 16:17:09 Re: ❓ JSON Path Dot Precedence
Previous Message David E. Wheeler 2024-07-08 16:09:15 Re: Patch bug: Fix jsonpath .* on Arrays