SQL/JSON: JSON_TABLE

Started by Nikita Glukhovover 8 years ago101 messageshackers
Jump to latest
#1Nikita Glukhov
n.gluhov@postgrespro.ru

Attached patches implementing JSON_TABLE.

This patchset depends on the 8th version of SQL/JSON functions patchset
that was posted in
/messages/by-id/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0012-json_table-v08.patchtext/x-patch; name=0012-json_table-v08.patchDownload+3694-27
0013-json_table-json-v08.patchtext/x-patch; name=0013-json_table-json-v08.patchDownload+1537-12
#2Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#1)
Re: SQL/JSON: JSON_TABLE

Attached 9th version of JSON_TABLE patches rebased onto the latest master.

Documentation drafts written by Oleg Bartunov:
https://github.com/obartunov/sqljsondoc

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0011-json_table-v09.patchtext/x-patch; name=0011-json_table-v09.patchDownload+3693-27
0012-json_table-json-v09.patchtext/x-patch; name=0012-json_table-json-v09.patchDownload+1537-12
#3Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#2)
Re: SQL/JSON: JSON_TABLE

Attached 10th version of JSON_TABLE patches rebased onto the latest master.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0013-json_table-v10.patchtext/x-patch; name=0013-json_table-v10.patchDownload+3693-27
0014-json_table-json-v10.patchtext/x-patch; name=0014-json_table-json-v10.patchDownload+1537-12
#4Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#3)
Re: SQL/JSON: JSON_TABLE

Attached 11th version of JSON_TABLE patches rebased onto the latest master.

Fixed PLAN DEFAULT flags assignment in gram.y.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0013-json_table-v11.patchtext/x-patch; name=0013-json_table-v11.patchDownload+3693-27
0014-json_table-json-v11.patchtext/x-patch; name=0014-json_table-json-v11.patchDownload+1537-12
#5Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#4)
Re: SQL/JSON: JSON_TABLE

Attached 12th version of JSON_TABLE patches rebased onto the latest master.

Fixed JSON_TABLE plan validation.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0014-json_table-v12.patchtext/x-patch; name=0014-json_table-v12.patchDownload+3731-27
0015-json_table-json-v12.patchtext/x-patch; name=0015-json_table-json-v12.patchDownload+1568-12
#6Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#5)
Re: SQL/JSON: JSON_TABLE

Attached 13th version of JSON_TABLE patches rebased onto the latest master.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0014-json_table-v13.patchtext/x-patch; name=0014-json_table-v13.patchDownload+3741-26
0015-json_table-json-v13.patchtext/x-patch; name=0015-json_table-json-v13.patchDownload+1568-12
#7Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#6)
Re: SQL/JSON: JSON_TABLE

Attached 15th version of JSON_TABLE patches.

Implicit root path name assignment was disabled (it is unclear from standard).
Now all JSON path names are required if the explicit PLAN clause is used.

The documentation for JSON_TABLE can be found now in a separate patch:
/messages/by-id/732208d3-56c3-25a4-8f08-3be1d54ad51b@postgrespro.ru

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0015-json_table-v15.patchtext/x-patch; name=0015-json_table-v15.patchDownload+3742-27
0016-json_table-json-v15.patchtext/x-patch; name=0016-json_table-json-v15.patchDownload+1568-12
#8Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#7)
Re: SQL/JSON: JSON_TABLE

Attached 16th version of JSON_TABLE patches.

Changed only results of regression tests after the implicit coercion via I/O
was removed from JSON_VALUE.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0015-json_table-v16.patchtext/x-patch; name=0015-json_table-v16.patchDownload+3740-27
0016-json_table-json-v16.patchtext/x-patch; name=0016-json_table-json-v16.patchDownload+1568-12
#9Dmitry Dolgov
9erthalion6@gmail.com
In reply to: Nikita Glukhov (#8)
Re: SQL/JSON: JSON_TABLE

On Tue, Jul 3, 2018 at 4:50 PM Nikita Glukhov <n.gluhov@postgrespro.ru> wrote:

Attached 16th version of JSON_TABLE patches.

Changed only results of regression tests after the implicit coercion via I/O
was removed from JSON_VALUE.

Thank you for working on this patch! Unfortunately, the current version of
patch 0015-json_table doesn't not apply anymore without conflicts, could you
please rebase it? In the meantime I'll try to provide some review.

#10Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Dmitry Dolgov (#9)
Re: SQL/JSON: JSON_TABLE

On 26.11.2018 15:55, Dmitry Dolgov wrote:

On Tue, Jul 3, 2018 at 4:50 PM Nikita Glukhov <n.gluhov@postgrespro.ru> wrote:

Attached 16th version of JSON_TABLE patches.

Changed only results of regression tests after the implicit coercion via I/O
was removed from JSON_VALUE.

Thank you for working on this patch! Unfortunately, the current version of
patch 0015-json_table doesn't not apply anymore without conflicts, could you
please rebase it? In the meantime I'll try to provide some review.

Attached 20th version of the patches rebased onto the current master.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0010-JSON_TABLE-v20.patchtext/x-patch; name=0010-JSON_TABLE-v20.patchDownload+3748-28
0011-JSON_TABLE-for-json-type-v20.patchtext/x-patch; name=0011-JSON_TABLE-for-json-type-v20.patchDownload+1568-13
#11Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#10)
Re: SQL/JSON: JSON_TABLE

Attached 21st version of the patches rebased onto the current master.

You can also see all SQL/JSON v21 patches successfully applied in our GitHub
repository on the following branches:
https://github.com/postgrespro/sqljson/tree/sqljson_v21 (one commit per patch)
https://github.com/postgrespro/sqljson/tree/sqljson (original commit history)

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0012-JSON_TABLE-v21.patchtext/x-patch; name=0012-JSON_TABLE-v21.patchDownload+3748-28
0013-JSON_TABLE-for-json-type-v21.patchtext/x-patch; name=0013-JSON_TABLE-for-json-type-v21.patchDownload+1568-13
#12Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#11)
Re: SQL/JSON: JSON_TABLE

Attached 34th version of the patches.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0009-Implementation-of-JSON_TABLE-v34.patchtext/x-patch; name=0009-Implementation-of-JSON_TABLE-v34.patchDownload+5334-28
#13Robert Haas
robertmhaas@gmail.com
In reply to: Nikita Glukhov (#12)
Re: SQL/JSON: JSON_TABLE

On Thu, Feb 28, 2019 at 8:19 PM Nikita Glukhov <n.gluhov@postgrespro.ru> wrote:

Attached 34th version of the patches.

Kinda strange version numbering -- the last post on this thread is v21.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

#14Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Robert Haas (#13)
Re: SQL/JSON: JSON_TABLE

On 01.03.2019 19:17, Robert Haas wrote:

On Thu, Feb 28, 2019 at 8:19 PM Nikita Glukhov <n.gluhov@postgrespro.ru> wrote:

Attached 34th version of the patches.

Kinda strange version numbering -- the last post on this thread is v21.

For simplicity of dependence tracking, version numbering of JSON_TABLE patches
matches the version numbering of the patches on which it depends -- jsonpath
and SQL/JSON. The corresponding jsonpath patch has version v34 now.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

#15Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#14)
Re: SQL/JSON: JSON_TABLE

Attached 36th version of patches rebased onto jsonpath v36.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0001-Implementation-of-SQL-JSON-path-language.patch.gzapplication/gzip; name=0001-Implementation-of-SQL-JSON-path-language.patch.gzDownload+5-1
0002-JSON_TABLE.patch.gzapplication/gzip; name=0002-JSON_TABLE.patch.gzDownload
#16Pavel Stehule
pavel.stehule@gmail.com
In reply to: Nikita Glukhov (#15)
Re: SQL/JSON: JSON_TABLE

Hi

so 29. 6. 2019 v 7:26 odesílatel Nikita Glukhov <n.gluhov@postgrespro.ru>
napsal:

Attached 36th version of patches rebased onto jsonpath v36.

I cannot to apply these patches on master. Please, can you check these
patches?

Regards

Pavel

Show quoted text

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

#17Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Pavel Stehule (#16)
Re: SQL/JSON: JSON_TABLE

On 29.06.2019 8:40, Pavel Stehule wrote:

Hi

so 29. 6. 2019 v 7:26 odesílatel Nikita Glukhov
<n.gluhov@postgrespro.ru <mailto:n.gluhov@postgrespro.ru>> napsal:

Attached 36th version of patches rebased onto jsonpath v36.

I cannot to apply these patches on master. Please, can you check these
patches?

Attached 37th version of patches rebased onto current master.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

0001-SQLJSON-functions-v37.patch.gzapplication/gzip; name=0001-SQLJSON-functions-v37.patch.gzDownload+3-3
0002-JSON_TABLE.patch.gzapplication/gzip; name=0002-JSON_TABLE.patch.gzDownload+1-1
#18Pavel Stehule
pavel.stehule@gmail.com
In reply to: Nikita Glukhov (#17)
Re: SQL/JSON: JSON_TABLE

Hi

út 16. 7. 2019 v 16:06 odesílatel Nikita Glukhov <n.gluhov@postgrespro.ru>
napsal:

On 29.06.2019 8:40, Pavel Stehule wrote:

Hi

so 29. 6. 2019 v 7:26 odesílatel Nikita Glukhov <n.gluhov@postgrespro.ru>
napsal:

Attached 36th version of patches rebased onto jsonpath v36.

I cannot to apply these patches on master. Please, can you check these
patches?

Attached 37th version of patches rebased onto current master.

I got warning

ar crs libpgcommon.a base64.o config_info.o controldata_utils.o d2s.o
exec.o f2s.o file_perm.o ip.o keywords.o kwlookup.o link-canary.o md5.o
pg_lzcompress.o pgfnames.o psprintf.o relpath.o rmtree.o saslprep.o
scram-common.o string.o unicode_norm.o username.o wait_error.>
...skipping...
clauses.c:1076:3: warning: this ‘if’ clause does not guard...
[-Wmisleading-indentation]
1076 | if (ExecEvalJsonNeedsSubTransaction(jsexpr, NULL))
| ^~
clauses.c:1078:4: note: ...this statement, but the latter is misleadingly
indented as if it were guarded by the ‘if’
1078 | return true;
| ^~~~~~
gcc -Wall -Wmissing-protot

Regress tests diff is not empty - see attached file

some strange fragments from code:

    deparseExpr(node->arg, context);
-   if (node->relabelformat != COERCE_IMPLICIT_CAST)
+   if (node->relabelformat != COERCE_IMPLICIT_CAST &&
+       node->relabelformat == COERCE_INTERNAL_CAST)

Now, "format" is type_func_name_keyword, so when you use it, then nobody
can use "format" as column name. It can break lot of application. "format"
is common name. It is relatively unhappy, and it can touch lot of users.

This patch set (JSON functions & JSON_TABLE) has more tha 20K rows. More,
there are more than few features are implemented.

Is possible to better (deeper) isolate these features, please? I have
nothing against any implemented feature, but it is hard to work intensively
(hard test) on this large patch. JSON_TABLE has only 184kB, can we start
with this patch?

SQLJSON_FUNCTIONS has 760kB - it is maybe too much for one feature, one
patch.

Pavel

Show quoted text

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

regression.diffsapplication/octet-stream; name=regression.diffsDownload+0-4
#19Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Nikita Glukhov (#17)
Re: SQL/JSON: JSON_TABLE

Now this is one giant patchset ... and at least the first patch seems to
have more than one thing within -- even the commit message says so. It
seems clear that this is going to take a long time to digest; maybe if
we can get it in smaller pieces we can try to have a little at a time?
In other words, may I suggest to split it up in pieces that can be
reviewed and committed independently?

v37 no longer applies so it requires a rebase, and also typedefs.list
was wrongly merged.

Please update.

--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

#20Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Alvaro Herrera (#19)
Re: SQL/JSON: JSON_TABLE

On 03.09.2019 20:29, Alvaro Herrera wrote:

Now this is one giant patchset ... and at least the first patch seems to
have more than one thing within -- even the commit message says so. It
seems clear that this is going to take a long time to digest; maybe if
we can get it in smaller pieces we can try to have a little at a time?
In other words, may I suggest to split it up in pieces that can be
reviewed and committed independently?

Patch 0001 is simply a squash of all 7 v38 patches from the thread
"SQL/JSON: functions". These patches are preliminary for JSON_TABLE.

Patch 0002 only needs to be review in this thread.

v37 no longer applies so it requires a rebase, and also typedefs.list
was wrongly merged.

typedefs.list was fixed.

Please update.

Attached 38th version of the patches.

--
Nikita Glukhov
Postgres Professional:http://www.postgrespro.com The Russian Postgres Company

Attachments:

0001-SQLJSON-functions-v38.patch.gzapplication/gzip; name=0001-SQLJSON-functions-v38.patch.gzDownload+1-2
0002-JSON_TABLE-v38.patch.gzapplication/gzip; name=0002-JSON_TABLE-v38.patch.gzDownload
#21Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Pavel Stehule (#18)
#22Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Nikita Glukhov (#21)
#23Pavel Stehule
pavel.stehule@gmail.com
In reply to: Nikita Glukhov (#22)
#24Pavel Stehule
pavel.stehule@gmail.com
In reply to: Pavel Stehule (#23)
#25Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Pavel Stehule (#24)
#26Pavel Stehule
pavel.stehule@gmail.com
In reply to: Nikita Glukhov (#25)
#27Pavel Stehule
pavel.stehule@gmail.com
In reply to: Pavel Stehule (#26)
#28Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Pavel Stehule (#27)
#29Pavel Stehule
pavel.stehule@gmail.com
In reply to: Nikita Glukhov (#28)
#30Pavel Stehule
pavel.stehule@gmail.com
In reply to: Nikita Glukhov (#28)
#31Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Pavel Stehule (#30)
#32Pavel Stehule
pavel.stehule@gmail.com
In reply to: Nikita Glukhov (#31)
#33Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Pavel Stehule (#32)
#34Pavel Stehule
pavel.stehule@gmail.com
In reply to: Nikita Glukhov (#33)
#35Pavel Stehule
pavel.stehule@gmail.com
In reply to: Pavel Stehule (#34)
#36Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Pavel Stehule (#35)
#37Justin Pryzby
pryzby@telsasoft.com
In reply to: Nikita Glukhov (#36)
#38Michael Paquier
michael@paquier.xyz
In reply to: Justin Pryzby (#37)
#39Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Michael Paquier (#38)
#40Zhihong Yu
zyu@yugabyte.com
In reply to: Nikita Glukhov (#39)
#41Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Zhihong Yu (#40)
#42David Steele
david@pgmasters.net
In reply to: Nikita Glukhov (#41)
#43Andrew Dunstan
andrew@dunslane.net
In reply to: David Steele (#42)
#44Erik Rijkers
er@xs4all.nl
In reply to: Andrew Dunstan (#43)
#45Andrew Dunstan
andrew@dunslane.net
In reply to: Erik Rijkers (#44)
#46Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Andrew Dunstan (#45)
#47Erik Rijkers
er@xs4all.nl
In reply to: Nikita Glukhov (#46)
#48Nikita Glukhov
n.gluhov@postgrespro.ru
In reply to: Erik Rijkers (#47)
#49Erik Rijkers
er@xs4all.nl
In reply to: Nikita Glukhov (#48)
#50Erik Rijkers
er@xs4all.nl
In reply to: Nikita Glukhov (#46)
#51Andrew Dunstan
andrew@dunslane.net
In reply to: Erik Rijkers (#50)
#52Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#51)
#53Erik Rijkers
er@xs4all.nl
In reply to: Andrew Dunstan (#52)
#54Erik Rijkers
er@xs4all.nl
In reply to: Erik Rijkers (#53)
#55Daniel Gustafsson
daniel@yesql.se
In reply to: Andrew Dunstan (#52)
#56Andrew Dunstan
andrew@dunslane.net
In reply to: Erik Rijkers (#54)
#57Erik Rijkers
er@xs4all.nl
In reply to: Andrew Dunstan (#56)
#58Andrew Dunstan
andrew@dunslane.net
In reply to: Erik Rijkers (#57)
#59Erik Rijkers
er@xs4all.nl
In reply to: Andrew Dunstan (#58)
#60Pavel Stehule
pavel.stehule@gmail.com
In reply to: Erik Rijkers (#59)
#61Andrew Dunstan
andrew@dunslane.net
In reply to: Erik Rijkers (#59)
#62Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#61)
#63Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#62)
#64Julien Rouhaud
rjuju123@gmail.com
In reply to: Andrew Dunstan (#63)
#65Andrew Dunstan
andrew@dunslane.net
In reply to: Julien Rouhaud (#64)
#66Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#65)
#67Himanshu Upadhyaya
upadhyaya.himanshu@gmail.com
In reply to: Andrew Dunstan (#66)
#68Andrew Dunstan
andrew@dunslane.net
In reply to: Himanshu Upadhyaya (#67)
#69Erik Rijkers
er@xs4all.nl
In reply to: Andrew Dunstan (#68)
#70Andrew Dunstan
andrew@dunslane.net
In reply to: Erik Rijkers (#69)
#71Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#70)
#72Andrew Dunstan
andrew@dunslane.net
In reply to: Himanshu Upadhyaya (#67)
#73Matthias Kurz
m.kurz@irregular.at
In reply to: Andrew Dunstan (#72)
#74Oleg Bartunov
oleg@sai.msu.su
In reply to: Matthias Kurz (#73)
#75Andrew Dunstan
andrew@dunslane.net
In reply to: Oleg Bartunov (#74)
#76Matthias Kurz
m.kurz@irregular.at
In reply to: Andrew Dunstan (#75)
#77Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Andrew Dunstan (#75)
#78Daniel Gustafsson
daniel@yesql.se
In reply to: Andrew Dunstan (#75)
#79Oleg Bartunov
oleg@sai.msu.su
In reply to: Andrew Dunstan (#75)
#80Andrew Dunstan
andrew@dunslane.net
In reply to: Alvaro Herrera (#77)
#81Andrew Dunstan
andrew@dunslane.net
In reply to: Daniel Gustafsson (#78)
#82Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#80)
#83Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#71)
#84Andrew Dunstan
andrew@dunslane.net
In reply to: Daniel Gustafsson (#78)
#85Zhihong Yu
zyu@yugabyte.com
In reply to: Andrew Dunstan (#84)
#86Erik Rijkers
er@xs4all.nl
In reply to: Andrew Dunstan (#84)
#87Andrew Dunstan
andrew@dunslane.net
In reply to: Erik Rijkers (#86)
#88Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#83)
#89Bruce Momjian
bruce@momjian.us
In reply to: Andrew Dunstan (#88)
#90Andrew Dunstan
andrew@dunslane.net
In reply to: Bruce Momjian (#89)
#91Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#88)
#92Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andres Freund (#91)
#93Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#91)
#94Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#93)
#95Stephen Frost
sfrost@snowman.net
In reply to: Andrew Dunstan (#94)
#96Andrew Dunstan
andrew@dunslane.net
In reply to: Stephen Frost (#95)
#97Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#96)
#98Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#97)
#99Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#97)
#100Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#99)
#101Andres Freund
andres@anarazel.de
In reply to: Stephen Frost (#95)