Re: Fix missing semicolon in pl_gram.y for option_value rule

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: shaobo zhang <zshaoo224(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix missing semicolon in pl_gram.y for option_value rule
Date: 2026-06-11 18:42:05
Message-ID: 67901ad6-44a2-49f2-83c9-351cfc13115e@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10.06.26 19:03, Tom Lane wrote:
> Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
>> The release notes of bison 3.0 say
>
>> Missing semicolons at the end of actions are no longer added (as announced
>> in the release 2.5).
>
>> But apparently that is not in fact happening?
>
> I might be wrong, but I think that is saying that bison will no
> longer add a semicolon at the end of the C code for an action.
> If you do this:
>
> diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
> index 5009e59a78f..238c8ca80f1 100644
> --- a/src/pl/plpgsql/src/pl_gram.y
> +++ b/src/pl/plpgsql/src/pl_gram.y
> @@ -415,8 +415,9 @@ option_value : T_WORD
> }
> | unreserved_keyword
> {
> - $$ = pstrdup($1);
> + $$ = pstrdup($1)
> }
> + ;
>
> opt_semi :
> | ';'
>
> it doesn't compile. I don't have a pre-3.0 bison to compare to
> though.

Yes, this appears to be correct. With bison 2.3, the above compiles.
The generated code looks like

case 11:
#line 417 "../src/pl/plpgsql/src/pl_gram.y"
{
(yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword))
;}
break;

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-06-11 18:48:46 Re: [PATCH] REPLICA IDENTITY USING INDEX accepts column with invalid NOT NULL
Previous Message Peter Eisentraut 2026-06-11 18:35:22 Re: Make SPI_prepare argtypes argument const