preferred package for debugging query text?
See original GitHub issueHi, I’m wondering if there is a preferred package, extension, or method for providing more detail when you get a syntax error back from the parser (for instance, one that listed line number, column of the error)
for instance, right now:
error: syntax error at or near "as"
at Parser.parseErrorMessage (/home/collspec/projects/staff-portal/sprint-server/node_modules/pg-protocol/dist/parser.js:278:15)
desired behavior:
error: syntax error at or near "as", line 5, column 7
at Parser.parseErrorMessage (/home/collspec/projects/staff-portal/sprint-server/node_modules/pg-protocol/dist/parser.js:278:15)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Developing and Debugging PL/SQL using SQL Developer
Purpose. This tutorial shows you how to create, run, and debug a PL/SQL procedure using Oracle SQL Developer. Time to Complete. Approximately 30...
Read more >Kentico Xperience Xplorations: Quickly Debugging Queries in ...
In this post we'll be exploring how to quickly and easily debug our Kentico Xperience 13 queries with a .NET 5 Console application...
Read more >Coding and Debugging the Script Component - Microsoft Learn
To debug the code in your Script component, set at least one breakpoint in the code, and then close the VSTA IDE to...
Read more >About Queries | Testing Library
For debugging using testing-playground, screen exposes this convenient method which logs and returns a URL that can be opened in a browser.
Read more >Managing and debugging SQL queries in MS Access
For debugging, I edit them in a separate text editor that lets me format them sensibly. When I find I need to make...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Parsing errors returned from the PG package are almost useless since there is no info about file location where broken query is.
mysql2 package on the other hand do returns file location with broken query
For information, since version 8.4.0, you can import
DatabaseError
interface (see https://github.com/brianc/node-postgres/blob/54b87523e29ea53379d7b9a26e45f83886f371af/CHANGELOG.md#pg840)the DatabaseError has the following fields : https://github.com/brianc/node-postgres/blob/6121bd3bb0e0e8ef8ec8ad5d02f59fef86b2f992/packages/pg-protocol/src/messages.ts#L97 unit tests are there : https://github.com/brianc/node-postgres/blob/4b229275cfe41ca17b7d69bd39f91ada0068a5d0/packages/pg/test/integration/client/query-error-handling-tests.js#L81
offical docs about error properties : https://www.postgresql.org/docs/13/protocol-error-fields.html
official error codes : https://www.postgresql.org/docs/current/errcodes-appendix.html
Somebody has already converted these on js constants here : https://github.com/LinusU/pg-error-constants
but see LinusU/pg-error-constants#1