Highligh error in code when possible

Hi guys, this is just a small feature but it would simplify hugely my work.

99% of the times I have an error, I have a problem related to some conditions or missing code in a specific position, in this image "Position: 2633".


It would be really nice if you could highlight the faulty code that produces an error in the SQL, or at least show the position you are referring to straight in the code.

So far, I don't have a clue on where "Position: 2633" and this wastes me a lot of time in fixing.

Hopefully you like this suggestion :wink:

Thanks

1 Like

So just a clarifying question: Is the context for this when you are making native SQL queries?

Yes, it happens when writing native SQL queries. Sorry for not being clear.

Related issue #625.
The error message is highly dependent on the underlying database, and there is no standard on how these are formed. From what I remember when looking at it, sometimes a position is present, sometimes not. PostgreSQL is perhaps the only database providing structured information on where the error occured, which could be used reliably to pinpoint the position.

Metabase highlighting the error position is one of the most desired features I hear around me from SQL-users, I hope this can be implemented at some point.

I completely understand your point.
Maybe though this could help: I use another software to write queries in postgresql, it's called Postico.

Whenever I have an error the message I get is a little more detailed than the one on Metabase... not extremely detailed, but just enough to understand where to start looking (pic as reference)
27
Even just a simple hint like this one helps me a lot when I have a series of AND/OR conditions or other conditions that change by only the slightest part and are difficult to debug.

1 Like

Looks like the Metabase core team already identified it themselves (it’s in fact the oldest still open issue). Here’s a deep link to the place in the issue where they mark it Help Wanted and say that it has to be solved driver by driver for each database:

If you guys scroll further down in the issue you see that if someone in the community is willing and able to do some Clojure work it looks like it’s fairly within reach for PostgreSQL, but less so for e.g. MySQL.