From: Tom Lane <tgl@sss.pgh.pa.us>
To: Erik Wienhold <ewie@ewie.name>
Cc: sciencewoken@gmail.com
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Documentation Chapter 16: 8.21
Date: Mon, 22 Apr 2024 10:24:21 -0400
Message-ID: <3042590.1713795861@sss.pgh.pa.us> (raw)
In-Reply-To: <plfzlyggyd5grlwtvtvrcllusjav66guzpytancgca7d4ly7a6@ogkqd3e7uavu>
References: <171361574464.679.18031157757894349513@wrigleys.postgresql.org>
<plfzlyggyd5grlwtvtvrcllusjav66guzpytancgca7d4ly7a6@ogkqd3e7uavu>
Erik Wienhold <ewie@ewie.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
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-docs@postgresql.org
Cc: tgl@sss.pgh.pa.us, ewie@ewie.name, sciencewoken@gmail.com, pgsql-docs@lists.postgresql.org
Subject: Re: Documentation Chapter 16: 8.21
In-Reply-To: <3042590.1713795861@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