Query tab jumps to the top on error

blackcoffee's profile image blackcoffee posted 2 years ago in General Permalink

Hello,

I love HeidiSQL but there is one annoying thing. When debugging a very large query in the query tab and there is a syntax error, the editor jumps to the top when displaying the error dialog. Then always have to scroll back to the line when the error is which can be time consuming and super tiring when dealing with a 1000+ lines query.

Can this behavior be changed somehow and make the editor stay on the current scroll position?

ansgar's profile image ansgar posted 2 years ago Permalink

Is that happening in the latest v12.3?

blackcoffee's profile image blackcoffee posted 2 years ago Permalink

I have version 12.2. It is happening only on syntax errors, not other MySQL error (like unknown column).

blackcoffee's profile image blackcoffee posted 2 years ago Permalink

Just installed 12.3 and it's still happening.

ansgar's profile image ansgar posted 2 years ago Permalink

Yes I just see it in the code. If the returned error message matches this regexp:

for the right syntax to use near '(.+)' at line (\d+)

... then HeidiSQL tries to set the cursor to the position of the erroneous SQL portion. For me that works here as expected, even when executing only the current of many queries.

Is there something you do different than me? Are you executing one or multiple queries?

blackcoffee's profile image blackcoffee posted 2 years ago Permalink

I am executing single queries but sometimes with subqueries. For me this behaviour was always present.

ansgar's profile image ansgar posted 2 years ago Permalink

Probably it makes sense to add a checkbox to the error dialog: "Jump to error in query"?

blackcoffee's profile image blackcoffee posted 2 years ago Permalink

Usually the line number of the error from the MySQL error message matches the correct line number in the editor but after clicking OK on the error popup it always jumps to line 1.

Code modification/commit 3ce5672 from Ansgar Becker <anse@heidisql.com>, 2 years ago, revision 12.3.0.6595
Enhance user query error handling. See https://www.heidisql.com/forum.php?t=40085
* try to find error position in 1M of SQL instead of only 1KB
* do not reset cursor if position was not found
* paint red background on line with error, just until user presses any key
ansgar's profile image ansgar posted 2 years ago Permalink

There's a good chance my just pushes modification solves your issue. The cursor position was reset even if the text from the error message was not found in the editor. This should definitely be fixed now, and I believe this is what happened on your side - although I was not able to reproduce that, however.

Further stuff:

  • if wrong SQL is found in the editor, the line gets a red background and white foreground
  • 1M instead of 1KB of SQL is examined to search for the wrong SQL

Please login to leave a reply, or register at first.