vscode-postgres
vscode-postgres copied to clipboard
Feature Request: tell which line is causing the error
In my case, where I have a bunch of "VALUES":
I can't really know which one is this error talking about:
Ok, I just realized what was the mistake. But anyways the feature request still valid.
So all errors (whether the squiggles or during actual query running) come from the PostgreSQL server itself. If PostgreSQL does not return positional data it can't be shown.
So all errors (whether the squiggles or during actual query running) come from the PostgreSQL server itself. If PostgreSQL does not return positional data it can't be shown.
Postgres returns additional info for each error, exact querry part, position and other stuff, however extension shows only message part of error object, if you could change to show all object instead, that would be perfect.
Not always... like I said, if it returns positional data, I attempt to use it.
Interesting that I tried replicating the type of the errors in the queries (multiple statements with no semi-colon to separate them, multiple VALUES
keywords in a single statement, and missing commas between values) - and it did seem to highlight (granted it can only grab the first error).
What version of postgres are you connected to?
if we talk about highlighting it is not working for me, because I probably not doing something correctly.
When I open new query, everything is mostly fine, some simple errors it can show even before I run it:
But once I save it (as .psql) then it does not work anymore
Probobly problem is in some configuarion in my case. But anyway, if whole error object would be displayed, it would help in in some situations (not in this one, as there is only one '<' but in others), or at least to make message something like pgadmin:
My version is 13.6
interesting... do you have any error logs for the postgres language service?
Any idea where to find them? Windows 10
Output tab from vscode
c:....vscode\extensions\ckolkman.vscode-postgres-1.4.0\out\language\server.js:341 source: dbConnOptions.host ^
TypeError: Cannot read properties of null (reading 'host')
at c:....vscode\extensions\ckolkman.vscode-postgres-1.4.0\out\language\server.js:341:47
at Generator.throw (
interesting.... based on that error it looks like the language server is losing connection in the middle of validating the statement.
Might be tricky to replicate, but maybe it has something to do with the act of saving the query clearing the connection.
I checked again, and problem why error (position) was not showing was because I just copied this query at end of other query without "; " Once I separated them, it shows where error is (before I run it). I guess this is just limitation that everyone need to understand when writing multiple separate queries in one file, and running only one of it by selection -it might not show error, if it is not separated from last query. In pg_admin it will show error position and extra info no matter what is before that query, so this is not intuitive thing to think about when running querries.