Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uTiGQ-008d5i-V4 for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jun 2025 14:35:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uTiGO-003Wp7-So for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jun 2025 14:35:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uTiGO-003Wou-EL for pgsql-hackers@lists.postgresql.org; Mon, 23 Jun 2025 14:35:13 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uTiGN-003Yko-1M for pgsql-hackers@postgresql.org; Mon, 23 Jun 2025 14:35:12 +0000 Received: by mail-pf1-x441.google.com with SMTP id d2e1a72fcca58-7426c44e014so3687141b3a.3 for ; Mon, 23 Jun 2025 07:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750689310; x=1751294110; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9Ory2jPlfVD6EyjPFjj5vrh7OrJtVJyXzSXC6gsLpoA=; b=QydD23gOFKQaWEqR3ihNd2Avx51rMk2agvYevzgAtCOMEcnVoP4wkPQ2BJwU0A8Zk8 5AP4pcaEoxQl+PYMbHLXnocx7dYCERyNLnbbzlSmrvrn3hPdjLgLXzIT7mrLx54xJSog 4CW1yIAAGRIpfj9iPq/r3TK7tkdOL1dR615KpqZBzu7dgUTilHRJiFhdPgNPP7/PfeMn /DKXe/qXMB5QVrIF88jSmuem6T9gEwwO7Usg2yepxkwSMzkBZSYNLGxrSaaL3sBFucl9 h3/Kc6Uvy6ZvYhagIEGelCeOgrrozzg8jMpRhxhG2EDfFVXUb5GZSPGHLv6oe1RnPkK8 yJWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750689310; x=1751294110; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9Ory2jPlfVD6EyjPFjj5vrh7OrJtVJyXzSXC6gsLpoA=; b=QKsRSu6DZAk0ylYZspDniXVN3vBvLO2DDYv3O+jxx9UJPzaaQDiGOzsDApgP1tAHDS P1hp77t342LuimGwd3eIbs4bCsCZXESaW72aRiK1ttcRxNb9imRNDiwwSurwomd8VUfE mRAlgONcUIXouIVKaThgCpsHP39aJZ7yXd5Va0uNx6wJEJgbe/w6YbY43uCbRo5ejfdn S/LzdPDiW9gtSF8ifgX5u5eD9ODq8pvjTXd1xzQR05PirR8YY8SHl77H8ZVK4rXdkkNK aVG4EdgSfuyX+Y46kUQ/qVqDh3I9nd0pQeonQG544o9XW9hQn3lYCdDTkwPz29yR2P9k lABA== X-Forwarded-Encrypted: i=1; AJvYcCWRA9B7KapLaBqvfkHxBWP4+EyOwBLzZ1XPPdvbpNcLXnNKG0f7pIL3aj3qKD/YlIbr/to4YlrkB9pPRMES@postgresql.org X-Gm-Message-State: AOJu0YyAvZ2ckFrH6PztUiHeILPfQCp+8bSfwF/Y8T51j7089WSMWOI/ jfDoSsh2cHhgSsR2d4QJHP8Ub4AIbGEBQYuk446fK+/Ug2pM6H2BIi96eD4yYEve8WvUyA7lON9 UqNjS4RD8Mt8aFTivdWzJTnwrwq5LDRA= X-Gm-Gg: ASbGnctm3LwGEFSVP1lmAugAl2TjNrTAnMIuhHC+jEN+PxDljG8djYqkQWaTBF1wqA2 zt6+3WQPiAYJkRiFYO4l0xaj4i4JS68fl3BJpQWAlhlTxPrJx96TTJ3B3PE/3Y2mlja6I2C6cxg jRY0uFZ1hvRen/gz/5LITqRsBJ12mSCgLf6bEsWS3NLsxDQYfjIgQU898X1QnEVJaWWVJKnmDJy 23zhg== X-Google-Smtp-Source: AGHT+IEGvJOm1hpjhTK4qTTW49SA/TiB2U6CsLSDnE5mRvOFqOVSMDK6ue8iOUjtY9YUOvMRdKhv+hes1f1e6HyoKnI= X-Received: by 2002:a05:6a00:139c:b0:748:f41d:69d2 with SMTP id d2e1a72fcca58-7490d4e369fmr19933618b3a.4.1750689310391; Mon, 23 Jun 2025 07:35:10 -0700 (PDT) MIME-Version: 1.0 References: <21fa36b4-6d56-4556-b524-9e3955b922c8@eisentraut.org> In-Reply-To: From: Alexandra Wang Date: Mon, 23 Jun 2025 16:34:34 +0200 X-Gm-Features: AX0GCFvWWF5X0ZwSFTBvTJ9ePaJIyd80mHH4NFpZ917HI-ONtE6K09OskcwcbJU Message-ID: Subject: Re: SQL:2023 JSON simplified accessor support To: Nikita Malakhov Cc: Vik Fearing , Mark Dilger , Matheus Alcantara , Peter Eisentraut , Andrew Dunstan , Nikita Glukhov , PostgreSQL Hackers , "David E. Wheeler" , jian he Content-Type: multipart/alternative; boundary="00000000000075417a06383e1e6e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000075417a06383e1e6e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Nikita, Thank you so much for reviewing! On Wed, Apr 23, 2025 at 6:54=E2=80=AFPM Nikita Malakhov = wrote: > Hi Alex! > > Glad you made so much effort to develop this patch set! > I think this is an important part of Json functionality. > > I've looked into you patch and noticed change in behavior > in new test results: > > postgres@postgres=3D# create table t(x int, y jsonb); > insert into t select 1, '{"a": 1, "b": 42}'::jsonb; > insert into t select 1, '{"a": 2, "b": {"c": 42}}'::jsonb; > insert into t select 1, '{"a": 3, "b": {"c": "42"}, "d":[11, 12]}'::jsonb= ; > CREATE TABLE > Time: 6.373 ms > INSERT 0 1 > Time: 3.299 ms > INSERT 0 1 > Time: 2.532 ms > INSERT 0 1 > Time: 2.453 ms > > Original master: > postgres@postgres=3D# select (t.y).b.c.d.e from t; > ERROR: column notation .b applied to type jsonb, which is not a composit= e > type > LINE 1: select (t.y).b.c.d.e from t; > ^ > Time: 0.553 ms > > Patched (with v11): > postgres@postgres=3D# select (t.y).b.c.d.e from t; > e > --- > > > > (3 rows) > > Is this correct? > This is correct. With this patch, the query should return 3 empty rows. We expect dot notation to behave the same as the json_query() below in lax mode with NULL ON EMPTY. postgres=3D# select json_query(y, 'lax $.b.c.d.e' WITH CONDITIONAL ARRAY WRAPPER NULL ON EMPTY NULL ON ERROR) from t; json_query ------------ (3 rows) Best, Alex --00000000000075417a06383e1e6e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Nikita,

Thank you so much= for reviewing!

<= div dir=3D"ltr" class=3D"gmail_attr">On Wed, Apr 23, 2025 at 6:54=E2=80=AFP= M Nikita Malakhov <hukutoc@gmail.co= m> wrote:
Hi Alex!

Glad you mad= e so much effort to develop this patch set!
I think this is an im= portant part of Json functionality.

I've looke= d into you patch and noticed change in behavior
in new test resul= ts:

postgres@postgres=3D# create table t(x int, y = jsonb);
insert into t select 1, '{"a": 1, "b": 4= 2}'::jsonb;
insert into t select 1, '{"a": 2, "b&= quot;: {"c": 42}}'::jsonb;
insert into t select 1, '{&= quot;a": 3, "b": {"c": "42"}, "d&qu= ot;:[11, 12]}'::jsonb;
CREATE TABLE
Time: 6.373 ms
INSERT 0 1<= br>Time: 3.299 ms
INSERT 0 1
Time: 2.532 ms
INSERT 0 1
Time: 2.= 453 ms

Original master:
postgres@postgre= s=3D# select (t.y).b.c.d.e from t;
ERROR: =C2=A0column notation .b appli= ed to type jsonb, which is not a composite type
LINE 1: select (t.y).b.c= .d.e from t;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^Time: 0.553 ms

Patched (with v11):
pos= tgres@postgres=3D# select (t.y).b.c.d.e from t;
=C2=A0e
---


(3 rows)

Is this correct?
<= /blockquote>

This is correct.

W= ith this patch, the query should return 3 empty rows. We expect
dot nota= tion to behave the same as the json_query() below in lax mode
with NULL = ON EMPTY.

<= /div>
postgres=3D# select j= son_query(y, 'lax $.b.c.d.e' WITH CONDITIONAL ARRAY WRAPPER NULL ON= EMPTY NULL ON ERROR) from t;
=C2=A0json_query
------------


(3 rows)

Best,
Alex
--00000000000075417a06383e1e6e--