Error with SQL Query when Heidi starts a new line after symbol - in column name

[expired user #6155]'s profile image [expired user #6155] posted 12 years ago in Running SQL scripts Permalink
SQL Error (1054): Unknown column 'ban-
comment' in 'where clause

So the error occurs when Heidi creates a new line in the SQL query text box. It splits column name 'ban-comment' to 'ban- at the end of the line and to comment' at the beginning of the new line.
[expired user #6155]'s profile image [expired user #6155] posted 12 years ago Permalink
Often it happens when I' trying to apply a Filter.

It adding query like this:

SELECT FROM `table` WHERE `column` LIKE '%text%' OR 'ban-
comment' LIKE '%text%'

^ error
[expired user #5421]'s profile image [expired user #5421] posted 12 years ago Permalink
'ban-comment' is gets treated like regular text.
use `ban-comment`. works for me.
[expired user #5421]'s profile image [expired user #5421] posted 12 years ago Permalink
actually this is simple: you can have newlines in column names but there does not appear to be one in your table. these are different names.
[expired user #6155]'s profile image [expired user #6155] posted 12 years ago Permalink
it's a Heidi's mistake, actually its:

...OR `ban-date` LIKE '%text%' OR `ban-count` LIKE '%text%' OR `ban-comment` LIKE ...

but Heidi shows error with ' symbols instead of `

So the problem appears when:

1. Click on Filter
2. Enter any text in "Create multi column filter" text box
3. Press Apply Filter

Heidi creates SQL query automatically and split it to a few lines but in case of Heidi's window size it past new after - symbol in column name like that: `ban-
comment`

... and error appears.

Here is a screenshot: http://clip2net.com/s/1tQKo

I guess it is necessary to prvent these errors by making one of two thing:

1. Do not split column names
2. Do not past new line in SQL query if column name was splitted and moved to a new line.
ansgar's profile image ansgar posted 12 years ago Permalink
Got it now. Yes, Heidi inserts new lines at appropriate places to keep the filter readable. As we have the "wrap long lines" button this is superfluous, so I'll remove that line-end inserting, which then fixes your problem.

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