pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: SQL/JSON: add standard JSON constructor functions
2+ messages / 1 participants
[nested] [flat]

* pgsql: SQL/JSON: add standard JSON constructor functions
@ 2023-03-29 10:13 Alvaro Herrera <alvherre@alvh.no-ip.org>
  2023-03-31 08:07 ` Re: pgsql: SQL/JSON: add standard JSON constructor functions Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Alvaro Herrera @ 2023-03-29 10:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

SQL/JSON: add standard JSON constructor functions

This commit introduces the SQL/JSON standard-conforming constructors for
JSON types:

JSON_ARRAY()
JSON_ARRAYAGG()
JSON_OBJECT()
JSON_OBJECTAGG()

Most of the functionality was already present in PostgreSQL-specific
functions, but these include some new functionality such as the ability
to skip or include NULL values, and to allow duplicate keys or throw
error when they are found, as well as the standard specified syntax to
specify output type and format.

Author: Nikita Glukhov <n.gluhov@postgrespro.ru>
Author: Teodor Sigaev <teodor@sigaev.ru>
Author: Oleg Bartunov <obartunov@gmail.com>
Author: Alexander Korotkov <aekorotkov@gmail.com>
Author: Amit Langote <amitlangote09@gmail.com>

Reviewers have included (in no particular order) Andres Freund, Alexander
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.

Discussion: https://postgr.es/m/CAF4Au4w2x-5LTnN_bxky-mq4=WOqsGsxSpENCzHRAzSnEd8+WQ@mail.gmail.com
Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru
Discussion: https://postgr.es/m/20220616233130.rparivafipt6doj3@alap3.anarazel.de
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7081ac46ace8c459966174400b53418683c9fe5c

Modified Files
--------------
doc/src/sgml/func.sgml                             | 286 +++++++-
src/backend/executor/execExpr.c                    |  91 +++
src/backend/executor/execExprInterp.c              |  50 ++
src/backend/jit/llvm/llvmjit_expr.c                |   6 +
src/backend/jit/llvm/llvmjit_types.c               |   1 +
src/backend/nodes/makefuncs.c                      |  69 ++
src/backend/nodes/nodeFuncs.c                      | 221 ++++++
src/backend/optimizer/util/clauses.c               |  55 ++
src/backend/parser/gram.y                          | 257 ++++++-
src/backend/parser/parse_expr.c                    | 770 +++++++++++++++++++++
src/backend/parser/parse_target.c                  |  18 +
src/backend/parser/parser.c                        |  26 +
src/backend/utils/adt/json.c                       | 434 ++++++++++--
src/backend/utils/adt/jsonb.c                      | 236 +++++--
src/backend/utils/adt/jsonb_util.c                 |  56 +-
src/backend/utils/adt/ruleutils.c                  | 275 +++++++-
src/include/catalog/catversion.h                   |   2 +-
src/include/catalog/pg_aggregate.dat               |  22 +
src/include/catalog/pg_proc.dat                    |  74 ++
src/include/executor/execExpr.h                    |  26 +
src/include/nodes/makefuncs.h                      |   6 +
src/include/nodes/parsenodes.h                     | 107 +++
src/include/nodes/primnodes.h                      |  85 +++
src/include/parser/kwlist.h                        |   8 +
src/include/utils/json.h                           |   6 +
src/include/utils/jsonb.h                          |   9 +
src/interfaces/ecpg/preproc/parse.pl               |   2 +
src/interfaces/ecpg/preproc/parser.c               |  22 +
src/interfaces/ecpg/test/ecpg_schedule             |   1 +
src/interfaces/ecpg/test/expected/sql-sqljson.c    | 203 ++++++
.../ecpg/test/expected/sql-sqljson.stderr          |  69 ++
.../ecpg/test/expected/sql-sqljson.stdout          |   6 +
src/interfaces/ecpg/test/sql/Makefile              |   1 +
src/interfaces/ecpg/test/sql/meson.build           |   1 +
src/interfaces/ecpg/test/sql/sqljson.pgc           |  44 ++
src/test/regress/expected/json.out                 |  11 +-
src/test/regress/expected/opr_sanity.out           |   6 +-
src/test/regress/expected/sqljson.out              | 756 ++++++++++++++++++++
src/test/regress/parallel_schedule                 |   2 +-
src/test/regress/sql/opr_sanity.sql                |   6 +-
src/test/regress/sql/sqljson.sql                   | 284 ++++++++
src/tools/pgindent/typedefs.list                   |   1 +
42 files changed, 4470 insertions(+), 141 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: SQL/JSON: add standard JSON constructor functions
  2023-03-29 10:13 pgsql: SQL/JSON: add standard JSON constructor functions Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2023-03-31 08:07 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2023-03-31 08:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

On 2023-Mar-29, Alvaro Herrera wrote:

> SQL/JSON: add standard JSON constructor functions
> 
> This commit introduces the SQL/JSON standard-conforming constructors for
> JSON types:
> 
> JSON_ARRAY()
> JSON_ARRAYAGG()
> JSON_OBJECT()
> JSON_OBJECTAGG()

> Author: Nikita Glukhov <n.gluhov@postgrespro.ru>
> Author: Teodor Sigaev <teodor@sigaev.ru>
> Author: Oleg Bartunov <obartunov@gmail.com>
> Author: Alexander Korotkov <aekorotkov@gmail.com>
> Author: Amit Langote <amitlangote09@gmail.com>

I forgot to include Andrew Dunstan <andrew@dunslane.net> in the list of
authors for this commit -- he spent a lot of time polishing it before I
took over.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-03-31 08:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 10:13 pgsql: SQL/JSON: add standard JSON constructor functions Alvaro Herrera <alvherre@alvh.no-ip.org>
2023-03-31 08:07 ` Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox