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 1vfLEn-001ADP-1v for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Jan 2026 16:57:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vfLEm-001Dnw-2W for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Jan 2026 16:57:53 +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.96) (envelope-from ) id 1vfLEm-001Dno-11 for pgsql-hackers@lists.postgresql.org; Mon, 12 Jan 2026 16:57:52 +0000 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vfLEk-0003OK-0K for pgsql-hackers@lists.postgresql.org; Mon, 12 Jan 2026 16:57:51 +0000 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-65d0f5fb26aso3064326eaf.2 for ; Mon, 12 Jan 2026 08:57:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768237070; x=1768841870; darn=lists.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=4ni+scqOgEkdaPdKwN0HsLaXFampz68mj6UunAzn5dM=; b=DtQugqmeYLZYXE5hIYELXfpED4mNcVo7PxSuz6xTgJoHIHkdR34WlQ9YNhBe4w4+ck P56EkhNqo4iB0tdLTnlmQpCYcI1HjijE7a3DTKKgNFcnSaIB+eAUqZRRMJOEDQ/plM9R QdlwP3oAEP3kidsH35L4RswssdwVsrryCVsy9RG1gtKk2L+aqAxyqjSaK2X79I55XbvN oZijL3ji52zLRdl3gCDyERtQeabbeSyAV9NnXbrMCGgrzwLFrlR8AvC8/jMH5X0QhGgh WO4rnBLNiD87Tc/9fD9oNNgiN5VM8Jb/UK7OQX5y2lWbQkhofwol7Dvg/MeY+ACXOQzp wwrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768237070; x=1768841870; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4ni+scqOgEkdaPdKwN0HsLaXFampz68mj6UunAzn5dM=; b=o7yVDzWrP1HCjMkxujxYhQVusXFrtVJTkTTV0l+ppNzjKEBrrGpiBFB3i3ki2OGTAb EOHvn78CZPLcO2SQie1VINQRdENoDDlo469yHhGVW9rN0ecgeofndXTwJ6MnpsibXNTj wG4v3YJQz6Pg6xMkRyETtWK4VV0fE9P4sm7TRrwqxLe/r+WrKVW5xJEDcd6PhqNKd257 i96sWEBLGPu4ko/ybNkiB0BinsTMIhIcWNoRw6YJ9HLBjpV1gmRceXDUZRTXjh0BtKMu NYFdD2fRulZ0vds77cFglQ9jT69nGkqIrNjOgi6jwtDGm/ov4rWyYWhXIK/XCMdr/Lvn HdeQ== X-Forwarded-Encrypted: i=1; AJvYcCU7RGeXvRZCwKuVJOtxaRV3krfzQR7jpGDitOkoJRvcd67TWVedPVZSGQ9N/z2MpCQLAQXOFOiKGtd83b3V@lists.postgresql.org X-Gm-Message-State: AOJu0Yx+wTwmbOadyGQNQfynCIyB58dNfvXRHNVEpf7XBSiJGiRY65uc 8CnGduZ87NwKbKbAI0FbVJIAZX/sJ4vmWQkJcMwjAYv5f97ixx5Y4SJzzX90M27ycTdVxeJx7bj c3lq5IX2WUqKw4gmNoHhgKFyrF4BEnCg= X-Gm-Gg: AY/fxX46NZ2DCNolmkJANBwNV7xns9kYWDRgwpn2jk5NValS+84ReZDy+J6uvo0hQDT 5Jz4r7R3468nTYcJ0eP48jiaH9YV8u3fBOW+uJz2gy0bSQk7CLFjJ1VZdwsYKlt9qva+iiHygeR IZkQe0R6vCZv/y/Oy59ADeuQYtqekl29mpsKmbU0crBm5gLMTDpQ4UUlBp7i7YFoiKghezfoRRw bf5jhbVOpyJApp1azw7I6ZkRCfHm+paJ+bOw6+w3102nX8E8KqFqvYwrqId1hSfsfz+GeZJ/gEc vEY/MnxL0pkkqzAOZBqzwbTkNT8= X-Google-Smtp-Source: AGHT+IEoV+6SpzEuljAQ/MN75rPBQB0MX+LSXadgbvSrC352gI1pnzJ+Bhbcah2AC9B6wXg3J4dZBsDRNGabNRT8dus= X-Received: by 2002:a4a:a70a:0:b0:65c:f545:c05a with SMTP id 006d021491bc7-65f54ef65c1mr6673477eaf.27.1768237070150; Mon, 12 Jan 2026 08:57:50 -0800 (PST) MIME-Version: 1.0 References: <04afcd1f-ed7d-4c0a-add1-50e3719ccbf9@postgresfriends.org> <762ae707-7fdc-43d8-a77a-3a10d12ce21d@postgresfriends.org> In-Reply-To: From: Corey Huinker Date: Mon, 12 Jan 2026 11:57:37 -0500 X-Gm-Features: AZwV_QjNDCZaX96lHKsP0mIGcfawZO65LDVLkPBgNgh24sTFS9bGQPJSPorFU1Y Message-ID: Subject: Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions To: jian he Cc: Amul Sul , Kirill Reshke , Vik Fearing , Isaac Morland , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000071f195064833c6f4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000071f195064833c6f4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 5, 2026 at 1:01=E2=80=AFAM jian he wrote: > On Fri, Jan 2, 2026 at 2:08=E2=80=AFPM Amul Sul wrote= : > > > > Hi, > > > > I am still thinking through a design that avoids having two different > > code paths for type casting. Can't we avoid adding a new SafeTypeCast > > structure by simply adding a raw_default variable (name could be > > simply default) to the existing TypeCast structure? If we do that, we > > would need to update transformTypeCast() and other places (like > > ExecInterpExpr()) to handle the raw_default. This approach would allow > > us to avoid the extra code required for a new node structure (e.g., > > T_SafeTypeCastExpr) and a separate EEOP_SAFETYPE_CAST step. > > > If that code path requires all casting operations to have the overhead of safety, then that may be a significant performance regression and a non-starter. I think we should continue with the design as-is, and if it turns out later than we can merge the safe/unsafe code paths without impacting performance, then we'll do it. Jian, can you rebase the patch-set? I tried applying it today, without luck= . --00000000000071f195064833c6f4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Jan 5, 2026 at 1:01=E2=80=AFAM jian h= e <jian.universality@gmai= l.com> wrote:
On Fri, Jan 2, 2026 at 2:08=E2=80=AFPM Amul Sul <sulamul@gmail.com> wrote:
>
> Hi,
>
> I am still thinking through a design that avoids having two different<= br> > code paths for type casting. Can't we avoid adding a new SafeTypeC= ast
> structure by simply adding a raw_default variable (name could be
> simply default) to the existing TypeCast structure? If we do that, we<= br> > would need to update transformTypeCast() and other places (like
> ExecInterpExpr()) to handle the raw_default. This approach would allow=
> us to avoid the extra code required for a new node structure (e.g., > T_SafeTypeCastExpr) and a separate EEOP_SAFETYPE_CAST step.
>

If that code path requires all cas= ting operations to have the overhead=20 of safety, then that may be a significant performance regression and a=20 non-starter. I think we should continue=C2=A0with the design as-is, and if = it turns out later than we can merge the safe/unsafe code paths without imp= acting performance, then we'll do it.

Jian, ca= n you rebase the patch-set? I tried applying it today, without luck.
<= /div>
--00000000000071f195064833c6f4--