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 1ri53d-00F1KW-Hi for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Mar 2024 04:08:37 +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 1ri53b-000ErZ-Gp for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Mar 2024 04:08:36 +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 1ri53b-000ErR-5V for pgsql-hackers@lists.postgresql.org; Thu, 07 Mar 2024 04:08:35 +0000 Received: from mail-ua1-x92a.google.com ([2607:f8b0:4864:20::92a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ri53Y-003FNw-1E for pgsql-hackers@postgresql.org; Thu, 07 Mar 2024 04:08:34 +0000 Received: by mail-ua1-x92a.google.com with SMTP id a1e0cc1a2514c-7db1a21e83fso246195241.2 for ; Wed, 06 Mar 2024 20:08:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709784512; x=1710389312; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qM/KGyeumy5zfkldoG0KgMJ/4VqljZFaZzPnT+0RED0=; b=KXXD6dIpIwUFqLJkhL6tt+1i6DWNhS494qyDYhmLrYYmOrTuQ+N7PIskL/llrqPJ98 rVzUKOL8CDBB7BOU8khegvobNzRY7RVRBx6MqpuNQuNAEWkAU2WR5ZzCE+U8gojGLTk+ d4JwGOEg8cbLYOT2w+0aivz+x2d34MPNTSxaOItZ98e12lIOGqJFPqRloj2yG16mRfCr +ZV5JitvJzTq7wge23LnAT7i0moqekQ8oOYW4Vk/DGTOLou4KdatamTPTxRE1gS0jhTX 78b1hBgYzfRR9wScb2wP1zRi2uFFWPa43Q4Gk3Rz+pNw0VOXVm6ilaNUtugVYVr526ih d+OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709784512; x=1710389312; h=content-transfer-encoding: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=qM/KGyeumy5zfkldoG0KgMJ/4VqljZFaZzPnT+0RED0=; b=YgF9VovVPHzb5FIIPQC5HvoQlEjMKwROMcVzVn55KDgBBAnanaWLFdOQt/fj/iQVmE sB7dErexzSvtv6GLd84XoxtklNZM4Ig9uXC70uALsORtHMO/JhKhubWWYMPgsIjmfZTl vLPIM7RegcmTqDIkkmtDh24Q+wzC/N70bTv/fpWj0pInJX8foL7O6+eW8OFrYWO+zfg1 xDfmMnYOdvGKhrU4oq6xii/pfyxJLNsjQIj/Za95QwBs79oRFeGD6ubJBB8+olnfmQnB cH85xcZq6pVSHPF3gnHUwbFauimeNTcTGNaCLYsQRv9spwibXuF3iZUG0PWi4bRevNBT 1+Xg== X-Forwarded-Encrypted: i=1; AJvYcCUblF2OnxAUyxmuBZoc1TpBRm+5Q5UNhnEypmzUlzdGI5GWz1bDezBS0FsS1JdTbkno4JJ6A+WmETiTR7I+k4Yqlxb9O0dylpnUgcKi X-Gm-Message-State: AOJu0YzVOZc9z+marF2EVc3yl1dEY855SX5iLYRl/VIuXqU1rpWkdIcN Zz/VQVq3DaoyjY+Wn+M2ebVK+G8WocFj2AvSZG8mh1G95cjRcbTnv3bcr7I2aEkUbSlPINcq1oe 24Or9HI2E0FojLqoJyvHwpAtZUGk= X-Google-Smtp-Source: AGHT+IHHrwm2QsaXmsMd5oHwjPvdoQHd1WKpKxGsLrZ0ECvKu2wd74rfy5WdPO65ZYmfjbzcSNmuhn6L+JXa/RA3xFE= X-Received: by 2002:a67:f549:0:b0:472:bc51:138a with SMTP id z9-20020a67f549000000b00472bc51138amr7035393vsn.12.1709784512260; Wed, 06 Mar 2024 20:08:32 -0800 (PST) MIME-Version: 1.0 References: <1cee81f3-312f-30e3-0282-c4df7ee72f93@xs4all.nl> <202403041503.5momp6knupgo@alvherre.pgsql> <87plw9b8h0.fsf@163.com> In-Reply-To: <87plw9b8h0.fsf@163.com> From: jian he Date: Thu, 7 Mar 2024 12:08:21 +0800 Message-ID: Subject: Re: remaining sql/json patches To: Andy Fan Cc: Amit Langote , Alvaro Herrera , Erik Rijkers , Andres Freund , Andrew Dunstan , PostgreSQL-development , pgsql-hackers@lists.postgresql.org, Peter Eisentraut Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Mar 5, 2024 at 12:38=E2=80=AFPM Andy Fan wr= ote: > > > In the commit message of 0001, we have: > > """ > Both JSON_VALUE() and JSON_QUERY() functions have options for > handling EMPTY and ERROR conditions, which can be used to specify > the behavior when no values are matched and when an error occurs > during evaluation, respectively. > > All of these functions only operate on jsonb values. The workaround > for now is to cast the argument to jsonb. > """ > > which is not clear for me why we introduce JSON_VALUE() function, is it > for handling EMPTY or ERROR conditions? I think the existing cast > workaround have a similar capacity? > I guess because it's in the standard. but I don't see individual sql standard Identifier, JSON_VALUE in sql_features.txt I do see JSON_QUERY. mysql also have JSON_VALUE, [1] EMPTY, ERROR: there is a standard Identifier: T825: SQL/JSON: ON EMPTY and ON ERROR clauses [1] https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#func= tion_json-value