Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryuau-0014jK-VW for pgsql-docs@arkaria.postgresql.org; Mon, 22 Apr 2024 14:24:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ryuat-004chR-FQ for pgsql-docs@arkaria.postgresql.org; Mon, 22 Apr 2024 14:24:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryuat-004ch1-7a for pgsql-docs@lists.postgresql.org; Mon, 22 Apr 2024 14:24:31 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryuaq-002LDX-KQ for pgsql-docs@lists.postgresql.org; Mon, 22 Apr 2024 14:24:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 43MEOLrC3042591; Mon, 22 Apr 2024 10:24:21 -0400 From: Tom Lane To: Erik Wienhold cc: sciencewoken@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Documentation Chapter 16: 8.21 In-reply-to: References: <171361574464.679.18031157757894349513@wrigleys.postgresql.org> Comments: In-reply-to Erik Wienhold message dated "Mon, 22 Apr 2024 14:38:48 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3042589.1713795861.1@sss.pgh.pa.us> Date: Mon, 22 Apr 2024 10:24:21 -0400 Message-ID: <3042590.1713795861@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Erik Wienhold 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