Re: Cannot create canonicalization function for user-defined range type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Avery Fischer <biggerfisch(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Cannot create canonicalization function for user-defined range type
Date: 2021-01-20 15:51:31
Message-ID: 596023.1611157891@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Wed, Jan 20, 2021 at 5:00 AM Avery Fischer <biggerfisch(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Lewis 2021-01-20 19:37:09 Re: upgrade using logical replication
Previous Message David G. Johnston 2021-01-20 14:41:58 Re: Cannot create canonicalization function for user-defined range type