Re: Cannot create canonicalization function for user-defined range type - Mailing list pgsql-general

From Tom Lane
Subject Re: Cannot create canonicalization function for user-defined range type
Date
Msg-id 596023.1611157891@sss.pgh.pa.us
Whole thread Raw
In response to Re: Cannot create canonicalization function for user-defined range type  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
"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



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Cannot create canonicalization function for user-defined range type
Next
From: Michael Lewis
Date:
Subject: Re: upgrade using logical replication