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 1t3HLf-00Bc5V-1a for pgsql-general@arkaria.postgresql.org; Tue, 22 Oct 2024 16:03:07 +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 1t3HLd-0013iu-D8 for pgsql-general@arkaria.postgresql.org; Tue, 22 Oct 2024 16:03:05 +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 1t3HLd-0013il-1y for pgsql-general@lists.postgresql.org; Tue, 22 Oct 2024 16:03:05 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t3HLb-002PtW-4R for pgsql-general@lists.postgresql.org; Tue, 22 Oct 2024 16:03:04 +0000 Content-Type: multipart/alternative; boundary="------------HIY2Y8upHfnvvsECUKYMhaDs" Message-ID: <0e67ba23-2531-4ade-8dce-12873f46601c@cloud.gatewaynet.com> Date: Tue, 22 Oct 2024 19:02:59 +0300 MIME-Version: 1.0 Subject: Re: Regression in Postgres 17? To: pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Achilleas Mantzios In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------HIY2Y8upHfnvvsECUKYMhaDs Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Στις 22/10/24 18:54, ο/η Colin 't Hart έγραψε: > Hi, > > This works in Postgres 15: > > pg15> create function json_test(out value text, out json jsonb) > returns record > language sql > as > $$ >   select null::text, null::jsonb; > $$ > ; > CREATE FUNCTION > pg15> select * from json_test(); > ┌───────┬──────┐ > │ value │ json │ > ├───────┼──────┤ > │       │      │ > └───────┴──────┘ > (1 row) > > > In Postgres 17 trying to create the function yields an error: > > pg17> create function json_test(out value text, out json jsonb) > returns record > language sql > as > $$ >   select null::text, null::jsonb; > $$ > ; > ERROR:  syntax error at or near "jsonb" > LINE 1: create function json_test(out value text, out json jsonb) > > > Am I doing something wrong? Or is this a regression? Do this instead : create function json_test(out value text, out jsonparam jsonb) returns record language sql as $$  select null::text, null::jsonb; $$ ; CREATE FUNCTION apparently json is a reserved word (now) and won't be accepted as function parameter name. > > Thanks, > > Colin --------------HIY2Y8upHfnvvsECUKYMhaDs Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


Στις 22/10/24 18:54, ο/η Colin 't Hart έγραψε:
Hi,

This works in Postgres 15:

pg15> create function json_test(out value text, out json jsonb)
returns record
language sql
as
$$
  select null::text, null::jsonb;
$$
;
CREATE FUNCTION
pg15> select * from json_test();
┌───────┬──────┐
│ value │ json │
├───────┼──────┤
│       │      │
└───────┴──────┘
(1 row)


In Postgres 17 trying to create the function yields an error:

pg17> create function json_test(out value text, out json jsonb)
returns record
language sql
as
$$
  select null::text, null::jsonb;
$$
;
ERROR:  syntax error at or near "jsonb"
LINE 1: create function json_test(out value text, out json jsonb)


Am I doing something wrong? Or is this a regression?

Do this instead :

create function json_test(out value text, out jsonparam jsonb)
returns record
language sql
as
$$
 select null::text, null::jsonb;
$$
;
CREATE FUNCTION

apparently json is a reserved word (now) and won't be accepted as function parameter name.


Thanks,

Colin
--------------HIY2Y8upHfnvvsECUKYMhaDs--