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.96) (envelope-from ) id 1w9jeE-001hDN-1M for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 13:05:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9jeC-008UNG-32 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 13:05:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <9erthalion6@gmail.com>) id 1w9jeC-008UN8-26 for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 13:05:45 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from <9erthalion6@gmail.com>) id 1w9jeA-00000000twW-1cvy for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 13:05:44 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-59dea72099eso4103454e87.0 for ; Mon, 06 Apr 2026 06:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775480741; x=1776085541; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QNl1KWVGlsmdmfiWgjU/aiP/D7TKRQNWHcjUfDhxRIQ=; b=qW8HWgFR7i9cqC9Qt5swmp6HhNpvMiieRrzPElCMYxKL2B5THD24sj9x+/KcLE4yXM NsySHVMwHYbW/jxwAUdEdVexddiMf5jNrvHz9ImcufEPMGITCT8andoDAtI3SZMNhysX 71CulEvnpwPmim9hesZmdePWloWUp6NjVcDjhBfm6ppBXFRcAUL6EYbNct+ghULC9/RF Fscm5PTWVsAuBz3kCuJjL9hwEb01eQbvQ694bHbQ5yaHoW73M27SgAT/ldXR9McKMTDR B347tBDELVXhp5wD2UEEEBbQOgPkXMSrk1hQobS0I1c1XcJk27eTS8thjl6ddbOEM5Sb XkSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775480741; x=1776085541; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QNl1KWVGlsmdmfiWgjU/aiP/D7TKRQNWHcjUfDhxRIQ=; b=XInHqD0TPBUZPGPSyQNbJ605OR+AtnP2nfIlF/gVYeSizKUo4pqTwW2+J1S19vNDsR FTxiVv2vCDfTz8C/bGFW8DE0EaxxORGEWWwj8kt3AWy/9pVbC6p8n37qXv3XETohIvi4 3k+YTAredzTq/nL5qN/APLx9ZcvGYwTGqZ+NFzdkgO4+Faj9KsczHIY/t+NZFZh+XO94 n6Q1Vr8VweTfFrFpYi9N1FLiJR2xRJyemESq83UaPfl+TIqJ5Id6YPGETkLQfbWSTvsn sj3Zsq7nvjPrkehBOOAU4QmxOVaN0c1+4PtWMm2dCl2wK1ZfHgX4UuFzETIVYLpBZlCS oA7A== X-Forwarded-Encrypted: i=1; AJvYcCXwfUoJMdohWIWcShXrrz33hPaPQBg5dtOLkabXTd4dtJu7FxlFgb3vrqPE0KJckh64BSzIPDSiDNrC+6GY@lists.postgresql.org X-Gm-Message-State: AOJu0YzI5qrJhUl+qmbExw2Cui/ivnWXFw4P1WIZMUUwgyyNvPfDNNcp AK3IW6a/xXAFmJ4GZy8ZUKfcDImBO+bSA/Uefkl1bIKPDQISusKqhCA2 X-Gm-Gg: AeBDievpSqj/7cOYgh7vOjCPyUzGWEkhXociTakqm/2NFE/Y15DmJebM1S0mxPENdiW IUkWkqYwhuDiG8JCcB3knLSTHVy4Zd7b/mshC/zdMsGNLgboENkr4+awhtUuHt72zs8iW3cF8G+ 2epVk8z94Ha1D9m87SZjqj03zkqRhp9a6yy4fXF1uL2VhaJTepmiYsAwA1L+8h8RwVWBL+mkx6v tuH/wene9j2uz1dJAolaENK4VdPPYkM5P2UpcHcoAMCHo8hP6fqqGb+Bg135zqBTnuQ3OrfHN2s +se0NX1yo2r6ybxVh7UiH2H3L0MDe0VJ5E9D3uQMO56uI8q1RaZUgVIleTNrTi8LCrUItPF67vU 0bJMYvCAjtX7cf90NTEhC2J/rm8Tz9alREXoOZrNk+56h9dKB8t1pHznbEzZxjMSj4wse4aljSQ knA7UBClt+skYeAUJrXEYz83Tk46ptX/rbcFyMltNusickQFV7QZsLX+mkK23djHWpsNm/6Ux9e 0MyZaZmOJKhEMaaWgaHCTLSQ5gm416/QD0h9Q== X-Received: by 2002:ac2:4422:0:b0:5a3:d306:297 with SMTP id 2adb3069b0e04-5a3d3060311mr1773025e87.13.1775480740241; Mon, 06 Apr 2026 06:05:40 -0700 (PDT) Received: from ddolgov-thinkpadt14sgen1.rmtde.csb (dslb-084-056-106-044.084.056.pools.vodafone-ip.de. [84.56.106.44]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a2c6ccca2dsm3333986e87.60.2026.04.06.06.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2026 06:05:39 -0700 (PDT) Date: Mon, 6 Apr 2026 15:05:37 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Haibo Yan Cc: David Rowley , Andy Fan , Peter Eisentraut , Amit Langote , Alvaro Herrera , jian he , Chapman Flack , pgsql-hackers@lists.postgresql.org Subject: Re: Extract numeric filed in JSONB more effectively Message-ID: References: <875xx197bp.fsf@163.com> <87ttk0lgcx.fsf@163.com> <8734m5fua1.fsf@163.com> <87a5dx4cfb.fsf@163.com> <7487A577-7BDC-4B94-9FFA-741E95439BFC@gmail.com> <40442A5A-C7BF-4742-9F88-1068686EC174@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40442A5A-C7BF-4742-9F88-1068686EC174@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Fri, Apr 03, 2026 at 09:42:20AM -0700, Haibo Yan wrote: Thanks for picking it up, the patch looks good. > One small thing: the UI looks a bit odd on my side. It does not seem to have picked my attachment, and is instead showing your older attachment there. But cfbot appears to have picked up mine, so I think it may just be a UI issue. It takes some time, as far as I can see currently the correct patch is shown. > + /* > + * Identify the inner extraction expression. It may appear as > + * either a FuncExpr or an OpExpr; accept both forms. > + */ > + if (IsA(arg, FuncExpr)) > + { > + FuncExpr *inner = (FuncExpr *) arg; > + > + inner_funcid = inner->funcid; > + inner_args = inner->args; > + location = inner->location; > + } > + else if (IsA(arg, OpExpr)) > + { > + OpExpr *inner = (OpExpr *) arg; > + > + inner_funcid = inner->opfuncid; > + inner_args = inner->args; > + location = inner->location; > + } > + else > + PG_RETURN_POINTER(NULL); It may also appear as a SubscriptingRef expression if we use subscription over jsonb. SELECT test_json['field7']::bool FROM test_jsonb WHERE json_type = 'object'; Seems to be worth handling this case as well, since it doesn't lead to an interface explosion.