pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Joe Conway <mail@joeconway.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Error-safe user functions
Date: Wed, 07 Dec 2022 12:17:34 -0500
Message-ID: <4038712.1670433454@sss.pgh.pa.us> (raw )
In-Reply-To: <CADkLM=dKX013AF0LWKkFnoVEP+EXNKPMcnLDUZCYhyEP1px3rA@mail.gmail.com >
References: <20221205174231.6wpmbuxafnfzlbuh@alvherre.pgsql >
<85e40849-4458-bbb9-62ee-d9e7faf0c7dc@dunslane.net >
<3323802.1670263204@sss.pgh.pa.us >
<3496391.1670276406@sss.pgh.pa.us >
<20221205234734.sab3fuxy6q2sokjd@alap3.anarazel.de >
<3518534.1670285891@sss.pgh.pa.us >
<20221206005607.lxcrazckoalptwds@alap3.anarazel.de >
<3523582.1670288815@sss.pgh.pa.us >
<40ff1ed1-4245-e343-bffa-c7755b031492@dunslane.net >
<CADkLM=coVJ0Hy-yYtXbN_dhfc453zs_BUTTPHmJqv12Urkd79g@mail.gmail.com >
<3889877.1670358069@sss.pgh.pa.us >
<a6e7ac7e-30ec-5c9d-5134-16072aefc0d7@dunslane.net >
<4009543.1670422833@sss.pgh.pa.us >
<CADkLM=dKX013AF0LWKkFnoVEP+EXNKPMcnLDUZCYhyEP1px3rA@mail.gmail.com >
Corey Huinker <corey.huinker@gmail.com> writes:
> In my attempt to implement CAST...DEFAULT, I noticed that I immediately
> needed an
> OidInputFunctionCallSafe, which was trivial but maybe something we want to
> add to the infra patch, but the comments around that function also somewhat
> indicate that we might want to just do the work in-place and call
> InputFunctionCallSafe directly. Open to both ideas.
I'm a bit skeptical of that. IMO using OidInputFunctionCall is only
appropriate in places that will be executed just once per query.
Otherwise, unless you have zero concern for performance, you should
be caching the function lookup. (The test functions in my 0003 patch
illustrate the standard way to do that within SQL-callable functions.
If you're implementing CAST as a new kind of executable expression,
the lookup would likely happen in expression compilation.)
I don't say that OidInputFunctionCallSafe won't ever be useful, but
I doubt it's what we want in CAST.
regards, tom lane
view thread (175+ messages) latest in thread
Message-ID: <4038712.1670433454@sss.pgh.pa.us>
Permalink: ../4038712.1670433454@sss.pgh.pa.us/
Also on: postgresql.org/message-id/4038712.1670433454@sss.pgh.pa.us
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, corey.huinker@gmail.com, andrew@dunslane.net, andres@anarazel.de, alvherre@alvh.no-ip.org, mail@joeconway.com, robertmhaas@gmail.com, n.gluhov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
Subject: Re: Error-safe user functions
In-Reply-To: <4038712.1670433454@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox