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 1qWrdh-004YGI-Im for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Aug 2023 05:03:13 +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 1qWrdg-008KK7-2m for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Aug 2023 05:03:12 +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.94.2) (envelope-from ) id 1qWrdf-008KJz-N3 for pgsql-hackers@lists.postgresql.org; Fri, 18 Aug 2023 05:03:11 +0000 Received: from mail-ua1-x92c.google.com ([2607:f8b0:4864:20::92c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qWrdd-000nI5-1y for pgsql-hackers@postgresql.org; Fri, 18 Aug 2023 05:03:11 +0000 Received: by mail-ua1-x92c.google.com with SMTP id a1e0cc1a2514c-79a31d66002so188331241.3 for ; Thu, 17 Aug 2023 22:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692334987; x=1692939787; 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=Y9PVQ8pWQHh0ajLPr6gErges2BSPuWC74dgk2J8YYk8=; b=p+1qCX5wKwh1g6leB2dozRFdZW8REtq9Jru9LdROfh2S9oiDRlYNze6EvqCCM3vsVa nhcroaVSo203sop8jYmBpUzGk8stIByC65yfdVORKfeydDH9kx5b3pjXxOI7QEo/RsuU CGfDB6kb9wN2BbskJr4P2ihpC0vDBHTbN5FC/Fz8W4OcNivy4Br7/wDK7alg2v8HjF8I vCeabifty08x+NY32FxtS/JnKX5vLUBoIelkUXNU7IYFojtnp2DKQWv0G/oa+viK+Fjz oSOnf8a4uIUH9zJHFB1IoBskXraNOLc8J4oewYfIgH+RM2MUbByCE0hy1yFunbBDo/2h qaJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692334987; x=1692939787; 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=Y9PVQ8pWQHh0ajLPr6gErges2BSPuWC74dgk2J8YYk8=; b=Dc55xnWZDgll3E4gnKE8RHJblFlAhVAfbGDaD7XZIUy2+ohtkHal6VEXQ+/7Dcx+IR xCKQIFD71uznS6WvATfoHIpSjIUl0Pf7HAPmAHX+VNe8X+9Mv8bQKVeDz3GGep9gg2Ga HfQtmZwkdw5GmdY/tlrrkRYfNmvCSpGUNS4HRVUhK5oOHxaBAxYXCiEy3oI5Xgp6Tg3u KbAJQbnx86JQArEPelVUqduyYLhOdAZplp9qHHv2SC524ay5Kej7vfyiF1k7uofGyG8J SIv2y1iMVg1XuwvlU3DnfgRIVcm/lEpcQ93DVwq/jJxDcbUBt8MgH1ho2dMsSj9MhhCK +xnA== X-Gm-Message-State: AOJu0YxEQc+rYCBTn681aqmxHlav7G0Dy8N0Iyhl0/S3bD/m141igqUV MiXSn6hjG2ISvlu1+oahNJ4nPWGyX2PeQVEFyAo= X-Google-Smtp-Source: AGHT+IH5ZC0EfMuD7e1r+WLmk99b7jsQyXfQZIlfTnMgszgw+/pETWGga+YpYIpVf/9qMhJkjErZyWqmmWK0huHAPsQ= X-Received: by 2002:a67:e316:0:b0:44a:ae24:ee50 with SMTP id j22-20020a67e316000000b0044aae24ee50mr2139134vsf.10.1692334986902; Thu, 17 Aug 2023 22:03:06 -0700 (PDT) MIME-Version: 1.0 References: <3507485.1691090027@sss.pgh.pa.us> <900892914fdc3f477b101d699efb40e0@anastigmatix.net> <903341.1692022214@sss.pgh.pa.us> <4b97f1a1dd9b6e45443d24870d3be698@anastigmatix.net> In-Reply-To: From: jian he Date: Fri, 18 Aug 2023 13:02:55 +0800 Message-ID: Subject: Re: Extract numeric filed in JSONB more effectively To: Chapman Flack Cc: Andy Fan , Pavel Stehule , Tom Lane , pgsql-hackers 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 Fri, Aug 18, 2023 at 10:55=E2=80=AFAM Chapman Flack wrote: > > > Again, all of that complication stems from the choice to use the > anyelement return type and rely on polymorphic type resolution > to figure the oid out, when we already have the oid to begin with > and the oid is all we want. > you want jsonb_object_field_type(internal, jsonb, text)? because on sql level, it's safe. The return data type is determined when we are in jsonb_cast_support. we just need to pass the {return data type} information to the next function: jsonb_object_field_type.