Re: Regression in Postgres 17?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Colin 't Hart <colinthart(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Regression in Postgres 17?
Date: 2024-10-22 16:03:05
Message-ID: 6eded364-8072-4ca4-9ba7-1003a120c2b8@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/22/24 08:54, Colin 't Hart wrote:
> 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?

Yes you are doing something wrong, naming an argument with a type
name(json) is not a good idea. Guessing you got caught by this:

https://www.postgresql.org/docs/16/sql-keywords-appendix.html

JSON non-reserved reserved

https://www.postgresql.org/docs/17/sql-keywords-appendix.html

JSON non-reserved (cannot be function or type) reserved

> Thanks,
>
> Colin

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2024-10-22 16:12:46 Re: Regression in Postgres 17?
Previous Message Achilleas Mantzios 2024-10-22 16:02:59 Re: Regression in Postgres 17?