Repository navigation
Report the right error position after multibyte characters - #245
Merged
Merged
Conversation
Owner
Owner
|
Sigh, no, that is not enough... |
Owner
|
Ok, I think the problem is gone. |
Owner
|
I'm surprised by your finding 🤔 ... are you saying that the whole |
PostgreSQL gives the position of an error as a 1-based character index, but it was treated as an offset in the UTF-8 encoded bytes and converted once more, so with multibyte characters before the error the reported index was too small.
R3gardless
force-pushed
the
fix-error-position-v7
branch
from
October 28, 2026 05:03
209871a to
2ba9887
Compare
Contributor
Author
|
Thanks for the quick fix, I rebased this on top of v7. Sorry for the confusion, I should have explained it better. No, While rebasing I also removed a leftover |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PostgreSQL gives the position of a syntax error as a 1-based character index, but the parser functions treat it as an offset in the UTF-8 bytes and convert it once more, so with multibyte characters before the error the reported index is too small:
where
FROMis at index 13. This uses the position as it comes, so the reported index changes only when there are non-ASCII characters before the error. For plain ASCII statements it stays the same.Since v7 has the same problem, I based this on v7 to save you the transplant. The regenerated
parser.cis in a separate commit.