Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add line/column/position details to Postgres migration/rollback query error messages #495

Merged
merged 1 commit into from Nov 16, 2023

Conversation

dossy
Copy link
Collaborator

@dossy dossy commented Nov 15, 2023

Postgres's database driver returns the character position where a syntax error occurs, so dbmate can use that information to calculate the line and column within the query that the position refers to.

This PR supersedes the work from PR #204, simplifying the implementation a bit by minimizing the amount of code change required, plus adding additional tests, including SQL queries with UTF-8 characters present.

… error messages

Postgres's database driver returns the character position where a syntax
error occurs, so dbmate can use that information to calculate the line
and column within the query that the position refers to.

Co-authored-by: Jae B <doogie1012@gmail.com>
Co-authored-by: Adrian Macneil <adrian@adrianmacneil.com>
@amacneil
Copy link
Owner

Nice work, thank you @dossy and @silbinarywolf

@amacneil amacneil merged commit d74b06f into amacneil:main Nov 16, 2023
9 checks passed
@dossy dossy deleted the feature/add-detailed-error-message branch November 16, 2023 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors during migration lack line numbers
2 participants