distal-attribute
distal-attribute
distal-attribute
distal-attribute

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

znayuvse posted 3 years ago in Running SQL scripts
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.
znayuvse posted 3 years ago
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
imre posted 3 years ago
'ban-comment' is gets treated like regular text.
use `ban-comment`. works for me.
imre posted 3 years ago
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.
znayuvse posted 3 years ago
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 posted 3 years ago
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.