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 1qSwfZ-007rih-Jg for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Aug 2023 09:36:57 +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 1qSwfX-008Iot-9l for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Aug 2023 09:36:55 +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 1qSwfW-008Iol-UJ for pgsql-hackers@lists.postgresql.org; Mon, 07 Aug 2023 09:36:55 +0000 Received: from mail-vs1-xe2e.google.com ([2607:f8b0:4864:20::e2e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qSwfV-0014Eu-8u for pgsql-hackers@postgresql.org; Mon, 07 Aug 2023 09:36:54 +0000 Received: by mail-vs1-xe2e.google.com with SMTP id ada2fe7eead31-447805165e9so1557814137.1 for ; Mon, 07 Aug 2023 02:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691401012; x=1692005812; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Phg+26EGJ23I51mM8g+MXvntCEXfF2vaeVOkYNQwq7I=; b=d9b7LyBkFCM5xoas9Epbw9BsDtIsW39/EqobVpAP0oTGdTRqtNgB9PxzvOkRw+EobG G5Pmsr82icNiI2UZoVTgk/W5UH7tm6rl1IWYJCgUTG24afYe5TtUva+ehDt3zQ4P2nZl IBNlf9/lfvZH0hRQL3bWIznTQBQe1uQz4GAPQWhTOr4Kvc4kqfwPpvVFXFulPY5LovOm 1USKPqqxm8zrq2NxEHElmUr3Etpo2dwHjNsm+4bJRy6vdNr0BdBjqcyjSIhSpg+i89ar oApw/UE/T7t5MszSrmmJ2MPPHu2gJKQ84KB3XD2a4K1cgbwLpdSO8caHRYgc1wMsiP9Q fM/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691401012; x=1692005812; 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=Phg+26EGJ23I51mM8g+MXvntCEXfF2vaeVOkYNQwq7I=; b=HZo5dlCEbYzSOfky6Qe62qWuqlYDFJ+BozhxrNmqG2wERdIBhAxY2Vgei2FGBtyMWU bETaxrItO/mlUhUnWTta0J6g7EB2Xx4sHH02CA9Q8q8HTOc3NPK1acl/KteIRDl8UViq sDxHWdEFy7agXa20RNaEQNqFVQ6IjvwdaMY6tiI2VKycBMo9/yKeK1IgpheLAl7Rlqkl ot5+4E3CehkPT5rDAc/RIxqq7h0XqWks9RyIxyAeHz+H2k1HPbICm3IzcOLbe1v+4wWf QgSY9JWZJd1fro0S3OzDuES/7OMm3r4n7WfsED6BG2i7D76KHB+ZMZwN5a2q+t3VQzU+ uyFg== X-Gm-Message-State: AOJu0YzHRHURdxTb3fXrodRV9fkpPgxqRq6JaT0p8muRBmHWKJTRbRGA MGDaIKzZPCI/oDx1zP8gLNLiSMhu7G0KCSRo+AKt1WTyPLNi0A== X-Google-Smtp-Source: AGHT+IGfF/Xk8ReD8akc1fSzU32x0W2+/d6WY2kirlTjVwl6lM5FoyWvFb5hnFNYVNkdFLaifoc56EcRhgyARW1PLn0= X-Received: by 2002:a67:f598:0:b0:440:b7df:767b with SMTP id i24-20020a67f598000000b00440b7df767bmr3490277vso.11.1691401011624; Mon, 07 Aug 2023 02:36:51 -0700 (PDT) MIME-Version: 1.0 References: <3507485.1691090027@sss.pgh.pa.us> In-Reply-To: From: jian he Date: Mon, 7 Aug 2023 17:36:40 +0800 Message-ID: Subject: Re: Extract numeric filed in JSONB more effectively To: Andy Fan Cc: Pavel Stehule , Tom Lane , pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi. +Datum +jsonb_object_field_type(PG_FUNCTION_ARGS) +{ + Jsonb *jb = PG_GETARG_JSONB_P(0); + text *key = PG_GETARG_TEXT_PP(1); + Oid targetOid = PG_GETARG_OID(2); compared with jsonb_numeric. I am wondering if you need a free *jb. elog(INFO,"jb=%p arg pointer=%p ", jb, PG_GETARG_POINTER(0)); says there two are not the same.