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 1rQmOI-003Wn5-J1 for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jan 2024 10:46:27 +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 1rQmOH-008jZC-Fo for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jan 2024 10:46:25 +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 1rQmOH-008jZ4-3f for pgsql-hackers@lists.postgresql.org; Fri, 19 Jan 2024 10:46:25 +0000 Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rQmOE-002Iv8-FX for pgsql-hackers@postgresql.org; Fri, 19 Jan 2024 10:46:23 +0000 Received: by mail-vs1-xe35.google.com with SMTP id ada2fe7eead31-467fc249208so160897137.2 for ; Fri, 19 Jan 2024 02:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705661181; x=1706265981; 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=6zh/u04iGFp487rABDOloX/hU4w2nhj2lNwYK+0J/tU=; b=Q2soI2jjS/FCz2e+ZqWCZVccKQ7qPaN6iwDgo70qPEdpYJ2aInIA8pyp7hm5Nln8z8 KnF7TbE9JI6hK/vK2c50wAiVuo1n7wIsUBJtsTXund54cEUEbCllRRU7Yvq/kFM9uV6X Za50erWkmGzT16pLczus/+bLkiNhf9J415dNHEdYP+9zduTcBsYFjpmkQayh4KpPbtKC vusSIQSbqfHWUXlPN5fD/o5kBQ8/Dbh34OtY2EqIYaPdn3+wMKZhS6qacGbXEnBzP432 Sqt6zejwv8cdrQYcDS78WfJuVXYQ729S3C/WsIvsvw8O8xiWXNwgjsKPYRpEHEOS6bg/ X4Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705661181; x=1706265981; 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=6zh/u04iGFp487rABDOloX/hU4w2nhj2lNwYK+0J/tU=; b=h5cJdmaELqW5kD72Yxo/N13KHw4TbRwm0Dc8jbh7FHkbptkhhMuXfkHAIuc3Fnfy8t KIWzWG8alenjixS7h3dRjusvcAHhlVSX5hIfyK8BSMZie6qn3JheQK1cwXt+gRoG+0hS y2X7lMa3CFZqXy9g452PsTU/8IcFJUYYL8Qv3VMh7h7Y3UemUXIG0TsGhqm9vc3K1w8w Wk0TbAk4us88OvEAiFxz2vJXjfU3nDSkVKdChdlYKFgzyCMdefF4cTZF7bvLPBRmxOqt HVhS/ZRC7TcECHHlFxQSN7busrzKLCMkHAEKFVjEDKmiMi5NtfpA/OBTVIu+jScSKjgw eXoA== X-Gm-Message-State: AOJu0Yx2S9gEE72Qqzq9RudwnV8oZ+oZNPraiQRCIjwE4jmJxA7cYi1d wyJqoYQACPOlEU5JYm6Gn7AhL/F5mz5SoGfAaRuwWxekbTQ9MrcUkOo3YMns8yBAh4c1aWEoBRd SO2IAC/IIgNq9evmBK/Y3Bhruito= X-Google-Smtp-Source: AGHT+IEOC/mU6bzSaNoxet6eF2SNnvYhJ5jkLHzdNEcd+u0VWowDq9ET7snduJOk2tagVdUhrPcUNhHeW660XLlqRj8= X-Received: by 2002:a67:f8cf:0:b0:467:f722:55d1 with SMTP id c15-20020a67f8cf000000b00467f72255d1mr2009906vsp.11.1705661181387; Fri, 19 Jan 2024 02:46:21 -0800 (PST) MIME-Version: 1.0 References: <202401181146.fuoeskfzriq7@alvherre.pgsql> <202401181711.qxjxpnl3ohnw@alvherre.pgsql> In-Reply-To: From: jian he Date: Fri, 19 Jan 2024 18:46:09 +0800 Message-ID: Subject: Re: remaining sql/json patches To: Amit Langote Cc: Alvaro Herrera , Andres Freund , Erik Rijkers , Andrew Dunstan , PostgreSQL-development Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk play with domain types. in ExecEvalJsonCoercion, seems func json_populate_type cannot cope with domain type. tests: drop domain test; create domain test as int[] check ( array_length(value,1) =2 and (value[1] = 1 or value[2] = 2)); SELECT * from JSON_QUERY(jsonb'{"rec": "{1,2,3}"}', '$.rec' returning test omit quotes); SELECT * from JSON_QUERY(jsonb'{"rec": "{1,11}"}', '$.rec' returning test keep quotes); SELECT * from JSON_QUERY(jsonb'{"rec": "{2,11}"}', '$.rec' returning test omit quotes error on error); SELECT * from JSON_QUERY(jsonb'{"rec": "{2,2}"}', '$.rec' returning test keep quotes error on error); SELECT * from JSON_QUERY(jsonb'{"rec": [1,2,3]}', '$.rec' returning test omit quotes ); SELECT * from JSON_QUERY(jsonb'{"rec": [1,2,3]}', '$.rec' returning test omit quotes null on error); SELECT * from JSON_QUERY(jsonb'{"rec": [1,2,3]}', '$.rec' returning test null on error); SELECT * from JSON_QUERY(jsonb'{"rec": [1,11]}', '$.rec' returning test omit quotes); SELECT * from JSON_QUERY(jsonb'{"rec": [2,2]}', '$.rec' returning test omit quotes); Many domain related tests seem not right. like the following, i think it should just return null. +SELECT JSON_QUERY(jsonb '{"a": 1}', '$.b' RETURNING sqljsonb_int_not_null); +ERROR: domain sqljsonb_int_not_null does not allow null values --another example SELECT JSON_QUERY(jsonb '{"a": 1}', '$.b' RETURNING sqljsonb_int_not_null null on error); Maybe in node JsonCoercion, we don't need both via_io and via_populate, but we can have one bool to indicate either call InputFunctionCallSafe or json_populate_type in ExecEvalJsonCoercion.