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 1sts6l-002Jel-26 for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Sep 2024 17:16:51 +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 1sts6j-00BRNK-Ft for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Sep 2024 17:16:49 +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 1sts6i-00BRIP-Vv for pgsql-hackers@lists.postgresql.org; Thu, 26 Sep 2024 17:16:49 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sts6c-001BjZ-SQ for pgsql-hackers@postgresql.org; Thu, 26 Sep 2024 17:16:45 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5e1b72fc5f3so663879eaf.2 for ; Thu, 26 Sep 2024 10:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1727371002; x=1727975802; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=CFpaktxCi8lnvcfAP2TXKNF+Rtb/88a1DY/g67Vw/HQ=; b=pI+wtm3zz5EZ4A69cTdGEBMFLEJUY/7r0SKt9FSJtlVF8ty2YPdB+cpVc4B8PL7/OE xfkvaRJWvoxV9FTF40Mh9TgeHgO5UFiML0pPanxIPlnVohWVBOBxtCyh8c7nhucj/BgT B2bjsuGubbuzaaWSGfsa7VNq0T+JuEYKXds9+pHNBCe2fKegOnOTfrWK2F0w13nDzMG7 adYF3gIYMn+GSA3vbisY9N8L4C8qOzOV8lVNhkv2tLK5QOw873T8pmPadnwz3MmF8gAO XiVHO1/6QCCTMhfnBX1Qjvd7gz4YZDbdLLQjejtjlfaZlrzlajSFhTX9dzg5U4UBTdXi 76Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727371002; x=1727975802; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CFpaktxCi8lnvcfAP2TXKNF+Rtb/88a1DY/g67Vw/HQ=; b=hmsQtRqpKaZYwOT/f9RC4zEozfhBMEmozsdlGXVa4uYxqpiauMGUq84bIZdrJs4juI /PRVaifKvl+l+SjcFhGUX0tD3b+csTxUcFuVaE6RgZy3Z/hnbqrq3oLgWkMSfrzUh0dD VuYDYMU2Sq4hKfqTJxM5BNEPjMkKYDeayfcivHVW4AMYv4Xp8wkI1dlCfK4D/HsZnLi9 jabv6n4k/DI9fLWnQNh5fVGknfjfgYNY5lptNk5UWtGRPL0M3OJPlKSWGJsFVwTaZGPg SFEbCzpGH6bNQOs3D9YGAu0C1TrW0egUSLpjiZo4QbmEk6MhS459q/FLuNoxxNYjw/Mi e6fw== X-Gm-Message-State: AOJu0Yxb2jiygxY1sbFB41qyO/Fp6fhV9X7eUKRTEsqsdwsmqUVwj4jB rh3DSPhFNRFAs0nW1hpWXj9faCjQDziKWWTgPS8RXELrEqekUgPwIo6u0FH3gqk= X-Google-Smtp-Source: AGHT+IHNsUc9bU6yNb8W/l7o9nwoO4PiAknh2icyfp6FPsOTrKGFGl0MXoETuC7p39BQw2ugiivhjA== X-Received: by 2002:a05:6358:7e55:b0:1b3:8960:9876 with SMTP id e5c5f4694b2df-1becbb61d8cmr57568555d.7.1727371001713; Thu, 26 Sep 2024 10:16:41 -0700 (PDT) Received: from ?IPV6:2605:a601:9180:9800::2bb? ([2605:a601:9180:9800::2bb]) by smtp.googlemail.com with ESMTPSA id af79cd13be357-7ae3785840fsm8141185a.130.2024.09.26.10.16.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Sep 2024 10:16:41 -0700 (PDT) Message-ID: <9be7b272-aca6-485b-bec7-386997c7970c@dunslane.net> Date: Thu, 26 Sep 2024 13:16:38 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SQL:2023 JSON simplified accessor support To: Alexandra Wang , Peter Eisentraut Cc: PostgreSQL Hackers References: From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNJEFuZHJldyBEdW5zdGFuIDxhbmRyZXdAZHVuc2xhbmUubmV0PsLAmwQTAQgARQIbAwIX gAIZAQULCQgHAgMiAgEGFQoJCAsCBBYCAwECHgcWIQTkPlhGHfx8v0RpFaWZ+n/LWfw7gQUC ZFlxxwUJGVGAbgAKCRCZ+n/LWfw7gXikB/9ZdcUy6CTBFIIuL/bVsc1eLEW/gJBjJBF6HxNY xgEkAgXAp4Lg4A5U+QB9GouFr7+GYxF0BU4hzoG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2ZPs In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-09-26 Th 11:45 AM, Alexandra Wang wrote: > Hi, > > I didn’t run pgindent earlier, so here’s the updated version with the > correct indentation. Hope this helps! This is a really nice feature, and provides a lot of expressive power for such a small piece of code. I notice this doesn't seem to work for domains over json and jsonb. andrew@~=# create domain json_d as json; CREATE DOMAIN andrew@~=# create table test_json_dot(id int, test_json json_d); CREATE TABLE andrew@~=# insert into test_json_dot select 1, '{"a": 1, "b": 42}'::json; INSERT 0 1      |          | andrew@~=# select (test_json_dot.test_json).b, json_query(test_json, 'lax $.b' WITH CONDITIONAL WRAPPER NULL ON EMPTY NULL ON ERROR) as expected from test_json_dot; ERROR:  column notation .b applied to type json_d, which is not a composite type LINE 1: select (test_json_dot.test_json).b, json_query(test_json, 'l... I'm not sure that's a terribly important use case, but we should probably make it work. If it's a domain we should get the basetype of the domain. There's some example code in src/backend/utils/adt/jsonfuncs.c cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com