From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Avery Fischer <biggerfisch@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Cannot create canonicalization function for user-defined range type
Date: Wed, 20 Jan 2021 10:51:31 -0500
Message-ID: <596023.1611157891@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwbFCY_YHwRBa=wbAygutyBKd2TmGvsLLwXUUyKA8OyLtQ@mail.gmail.com>
References: <CAOfPeiGnB7Ef1geTKuP7hTmr=+dZs6nLh310NmvgQt+gE-1dnw@mail.gmail.com>
<CAKFQuwbFCY_YHwRBa=wbAygutyBKd2TmGvsLLwXUUyKA8OyLtQ@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wed, Jan 20, 2021 at 5:00 AM Avery Fischer <biggerfisch@gmail.com> wrote:
>> ERROR: PL/pgSQL functions cannot return type myrange
>> Am I misunderstanding the docs, or are they out-of-date, or is something
>> else going on? How can I create a canonicalization function for my range
>> type?
> Thus one needs to write a C language function if one wishes to implement a
> custom range.
Yeah, that's the only way at the moment. We've not seen much use-case
for writing canonicalization functions in PLs, because of (a) performance
and (b) circularity concerns --- the latter meaning that the PL's own
infrastructure is likely to expect that it can manipulate scalar values
without incurring recursion. These are pretty much the same reasons
why a datatype's I/O functions can't be written in a PL.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, biggerfisch@gmail.com
Subject: Re: Cannot create canonicalization function for user-defined range type
In-Reply-To: <596023.1611157891@sss.pgh.pa.us>
References: <CAOfPeiGnB7Ef1geTKuP7hTmr=+dZs6nLh310NmvgQt+gE-1dnw@mail.gmail.com> <CAKFQuwbFCY_YHwRBa=wbAygutyBKd2TmGvsLLwXUUyKA8OyLtQ@mail.gmail.com> <596023.1611157891@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