Re: SQL/JSON path issues/questions
Alexander Korotkov <a.korotkov@postgrespro.ru>
From: Alexander Korotkov <a.korotkov@postgrespro.ru>
To: Thom Brown <thom@linux.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-06-28T02:50:15Z
Lists: pgsql-hackers
On Thu, Jun 27, 2019 at 4:57 PM Thom Brown <thom@linux.com> wrote: > On Wed, 19 Jun 2019 at 20:04, Alexander Korotkov > <a.korotkov@postgrespro.ru> wrote: > > On Wed, Jun 19, 2019 at 7:07 PM Thom Brown <thom@linux.com> wrote: > > > On Thu, 13 Jun 2019 at 14:59, Thom Brown <thom@linux.com> wrote: > > > Also, this example doesn't work: > > > > > > '$.track ? (@.segments[*] ? (@.HR > 130)).segments.size()' > > > > > > This gives me: > > > > > > psql: ERROR: syntax error, unexpected $end at end of jsonpath input > > > LINE 13: }','$.track ? (@.segments[*]'); > > > ^ > > > > Perhaps it should be following: > > > > '$.track ? (exists(@.segments[*] ? (@.HR > 130))).segments.size()' > > I'm not clear on why the original example doesn't work here. It doesn't work because filter expression should be predicate, i.e. always return bool. In the original example filter expression selects some json elements. My original idea was that it was accidentally come from some of our extensions where we've allowed that. But it appears to be just plain wrong example, which never worked. Sorry for that. ------ Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
Commits
-
Fixes for jsonpath filter expression elements table in docs
- 1ed89826b82c 12.0 landed
- 0cea6eb5a5f2 13.0 landed
-
Assorted fixes for jsonpath documentation
- a5c2f3a346fc 12.0 landed
- 5a7d697a3936 13.0 landed
-
Fix description for $varname jsonpath variable
- dfd79e2d0e8f 12.0 landed
-
Improve documentation for jsonpath like_regex predicate
- 1ff8dc9f19dd 12.0 landed
-
Support 'q' flag in jsonpath 'like_regex' predicate
- 261a5c192856 12.0 landed