Re: Documentation Chapter 16: 8.21

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erik Wienhold <ewie(at)ewie(dot)name>
Cc: sciencewoken(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Documentation Chapter 16: 8.21
Date: 2024-04-22 14:24:21
Message-ID: 3042590.1713795861@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Erik Wienhold <ewie(at)ewie(dot)name> writes:
> On 2024-04-20 14:22 +0200, PG Doc comments form wrote:
>> I tryed to implement a safe_cast function with 2 parameters and a return of
>> type "any" but it failed.
>> And if there is a data type "any" in postgres too, how should it work as
>> parameter and wheres the difference to "anyelement"?

> "any" is like "anyelement" just without the polymorphic[1] behavior.
> So an argument of type "any" does not determine the result type for
> "anyarray" as "anyelement" would.

By the same token, there is just about no use-case for a function
declared to return "any". The parser will not infer some other
data type the way it would do for "anyelement", so you'll end up
with an object that you can't do anything with.

regards, tom lane

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2024-04-23 12:40:34 No documentation on how pg_ctl is installed
Previous Message Erik Wienhold 2024-04-22 12:38:48 Re: Documentation Chapter 16: 8.21