Skip to content

Fix source span for bare EXCEPT column modifiers - #351

Merged
git-hulk merged 1 commit into
AfterShip:masterfrom
git-hulk:fix/bare-except-source-span
Nov 26, 2026
Merged

git-hulk merged 1 commit into
AfterShip:masterfrom
git-hulk:fix/bare-except-source-span

Conversation

@git-hulk

Copy link
Copy Markdown
Member

Problem

FunctionExpr.End() always advances past the closing parenthesis. For a bare EXCEPT modifier, the parser stores the column's already exclusive end in that position, so the span includes one extra byte.

Reproduction

SELECT t.* EXCEPT b, c FROM t

The modifier's source slice is EXCEPT b, instead of EXCEPT b.

Fix

Use the column's exclusive end for bare modifiers. Parenthesized modifiers still include the closing parenthesis, and SQL formatting is unchanged.

Test

TestSourceSpansCoverReportedNodes checks both modifier forms.

Follow-up to #349.

Assistant-By OpenAI Codex

## Problem

`FunctionExpr.End()` always advances past the closing parenthesis.
For a bare `EXCEPT` modifier, the parser stores the column's already
exclusive end in that position, so the span includes one extra byte.

## Reproduction

```sql
SELECT t.* EXCEPT b, c FROM t
```

The modifier's source slice is `EXCEPT b,` instead of `EXCEPT b`.

## Fix

Use the column's exclusive end for bare modifiers. Parenthesized
modifiers still include the closing parenthesis, and SQL formatting
is unchanged.

## Test

`TestSourceSpansCoverReportedNodes` checks both modifier forms.

Follow-up to AfterShip#349.

Assistant-By OpenAI Codex
@git-hulk
git-hulk merged commit bc62517 into AfterShip:master Nov 26, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant