public inbox for [email protected]
help / color / mirror / Atom feedFOR PORTION OF gram.y target_location seems wrong
2+ messages / 2 participants
[nested] [flat]
* FOR PORTION OF gram.y target_location seems wrong
@ 2026-04-24 01:10 jian he <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: jian he @ 2026-04-24 01:10 UTC (permalink / raw)
To: pgsql-hackers; +Cc: Paul A Jungwirth <[email protected]>
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;
It's not reachable because of queries like:
UPDATE for_portion_of_test
FOR PORTION OF valid_at FROM NULL TO NULL
SET name = 'NULL to NULL';
won't reach
ereport(ERROR,
(errmsg("FOR PORTION OF target was null")),
executor_errposition(estate, forPortionOf->targetLocation));
typedef struct ForPortionOfClause
{
NodeTag type;
char *range_name; /* column name of the range/multirange */
ParseLoc location; /* token location, or -1 if unknown */
ParseLoc target_location; /* token location, or -1 if unknown */
Node *target; /* Expr from FOR PORTION OF col
(...) syntax */
Node *target_start; /* Expr from FROM ... TO ... syntax */
Node *target_end; /* Expr from FROM ... TO ... syntax */
} ForPortionOfClause;
Generally, we place ParseLoc at the end of the node, putting it
elsewhere should be fine.
But here, we have two comments, ``/* token location, or -1 if unknown */``.
The "token" is ambiguous, perhaps it's worth the trouble to enhance it?
--
jian
https://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: FOR PORTION OF gram.y target_location seems wrong
@ 2026-04-27 10:04 Peter Eisentraut <[email protected]>
parent: jian he <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Peter Eisentraut @ 2026-04-27 10:04 UTC (permalink / raw)
To: jian he <[email protected]>; pgsql-hackers; +Cc: Paul A Jungwirth <[email protected]>
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-04-27 10:04 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-24 01:10 FOR PORTION OF gram.y target_location seems wrong jian he <[email protected]>
2026-04-27 10:04 ` Peter Eisentraut <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox