From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Japin Li <japinli(at)hotmail(dot)com> |
Cc: | Julien Rouhaud <rjuju123(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: proposal - plpgsql - support standard syntax for named arguments for cursors |
Date: | 2025-02-08 11:28:34 |
Message-ID: | CAFj8pRDMfk4KA7BB6wZYEw8kcD5ZDXpT8qM7t6jUaqxeoTP6aA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
so 8. 2. 2025 v 11:27 odesílatel Japin Li <japinli(at)hotmail(dot)com> napsal:
> On Sat, 08 Feb 2025 at 16:34, Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
> > Hi,
> >
> > On Sat, Feb 08, 2025 at 07:47:23AM +0100, Pavel Stehule wrote:
> >> Hi
> >>
> >> when I worked on strict expr check patch I found so syntax for named
> >> arguments of cursors supports only our legacy proprietary syntax
> `argname
> >> := value`
> >>
> >> https://www.postgresql.org/docs/current/plpgsql-cursors.html
> >>
> >> I propose to enhancing to ANSI/SQL standard syntax for named arguments
> >> `argname => value`
> >
> > Seems sensible to me.
> >
> >> The patch is almost trivial
> >
> > Documentation and tests are updated, and the patch LGTM.
>
> Maybe we should also update the comments?
>
> diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
> index 867017d8ed9..43186c8e85e 100644
> --- a/src/pl/plpgsql/src/pl_gram.y
> +++ b/src/pl/plpgsql/src/pl_gram.y
> @@ -3911,7 +3911,7 @@ read_cursor_args(PLpgSQL_var *cursor, int until,
> YYSTYPE *yylvalp, YYLTYPE *yyll
> tok2;
> int arglocation;
>
> - /* Check if it's a named parameter: "param := value" */
> + /* Check if it's a named parameter: "param := value" or
> "param => value" */
> plpgsql_peek2(&tok1, &tok2, &arglocation, NULL, yyscanner);
> if (tok1 == IDENT && (tok2 == COLON_EQUALS || tok2 ==
> EQUALS_GREATER))
> {
> @@ -3939,7 +3939,7 @@ read_cursor_args(PLpgSQL_var *cursor, int until,
> YYSTYPE *yylvalp, YYLTYPE *yyll
>
> parser_errposition(*yyllocp)));
>
> /*
> - * Eat the ":=". We already peeked, so the error
> should never
> + * Eat the ":=" and "=>". We already peeked, so
> the error should never
> * happen.
> */
> tok2 = yylex(yylvalp, yyllocp, yyscanner);
>
good idea
done
Regards
Pavel
> --
> Regrads,
> Japin Li
>
Attachment | Content-Type | Size |
---|---|---|
v20250208-2-0001-allow-to-use-standard-syntax-for-named-arguments-for.patch | text/x-patch | 4.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michail Nikolaev | 2025-02-08 13:46:00 | Re: Why doesn't GiST VACUUM require a super-exclusive lock, like nbtree VACUUM? |
Previous Message | Álvaro Herrera | 2025-02-08 10:32:58 | Re: pgbench with partitioned tables |