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

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

User, date Message
Written by znayuvse
3 years ago
Category: Running SQL scripts
3 posts since Thu, 12 Jan 12
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.
Written by znayuvse
3 years ago
3 posts since Thu, 12 Jan 12
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
Written by imre
3 years ago
12 posts since Thu, 30 Dec 10
'ban-comment' is gets treated like regular text.
use `ban-comment`. works for me.
Written by imre
3 years ago
12 posts since Thu, 30 Dec 10
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.
Written by znayuvse
3 years ago
3 posts since Thu, 12 Jan 12
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.
Written by ansgar
3 years ago
4973 posts since Fri, 07 Apr 06
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.