Re: FOR PORTION OF gram.y target_location seems wrong

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: jian he <jian.universality@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Paul A Jungwirth <pj@illuminatedcomputing.com>
Date: 2026-04-27T10:04:54Z
Lists: pgsql-hackers
On 24.04.26 03:10, jian he wrote:
> Hi.
> 
> | FOR PORTION OF ColId FROM a_expr TO a_expr
>      {
>          ForPortionOfClause *n = makeNode(ForPortionOfClause);
>          n->range_name = $4;
>          n->location = @4;
>          n->target_start = $6;
>          n->target_end = $8;
>          n->target_location = @5;
>          $$ = (Node *) n;
>      }
> 
> n->target_location = @5;
> 
> Should be
> 
> n->target_location = @6;

I think the existing code is fine.  The target consists of the start and 
the end value.  If we pointed to @6 then one could be confused into 
thinking that only the start value is meant.