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

Include failed statement's file and line in stderr #167

Closed
aleclarson opened this issue Sep 1, 2024 · 3 comments · Fixed by #172
Closed

Include failed statement's file and line in stderr #167

aleclarson opened this issue Sep 1, 2024 · 3 comments · Fixed by #172

Comments

@aleclarson
Copy link

Currently, there's no hint as to which statement is failing, at least as far as filename and line number. It'd be awesome to have those!

@Navbryce
Copy link

Navbryce commented Sep 2, 2024

Is this when you're generating the plan?

@aleclarson
Copy link
Author

aleclarson commented Sep 5, 2024

Yes it is. In this case, the error message is syntax-related:

Error: generating plan: getting new schema: running DDL: ERROR: syntax error at or near "%" (SQLSTATE 42601)

@bplunkett-stripe
Copy link
Collaborator

That makes sense! I'll try to put up something tomorrow for this. Unfortunately, it probably won't include line number because that would require us to parse the entire SQL AST. When reading in SQL from a file, it's read-in and executed as one large SQL statement and Postgres handles splitting it into individual statements.

Naively splitting on ";" will not work because you can imagine ";" could be present in escaped identifiers, strings, comments.

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 a pull request may close this issue.

3 participants