Bug report #8880

Mysql Query builder

Added by Nils Graustiņš over 10 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Expressions
Affected QGIS version:2.0.1 Regression?:No
Operating System:windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:not reproducable
Crashes QGIS or corrupts data:No Copied to github as #:17560

Description

On clicking on fields in Query builder in where clause a column name appears included in double quotes,
but values - not. To get a right clause, there must be a column names not in quotes and values quoted.
Such, as Weight = 2 OR Name= "City"

History

#1 Updated by Jukka Rahkonen over 10 years ago

Hi,

I am sorry but I do not know MySQL nor QGIS well and I want to ask why "there must be a column names not in quotes and values quoted" ? Does this requirement come from MySQL or QGIS side?

If the query was plain ANSI SQL then both alternatives are a bit wrong. Strings are always delimited by single quotes and if delimited identifiers are used then identifiers are between double quotes. From http://www.ibphoenix.com/resources/documents/design/doc_152:

"In the ANSI SQL standard, a string constant can only be delimited by single quotes and a SQL delimited identifier is delimited by double quotes. SQL delimited identifier is case sensitive. For example, table "foo" is different from from table "FoO". But in the case of regular SQL identifier, table fOo is same same table FOO and it is also the same as table "FOO"."

Therefore an ANSI-aware query would look like
SELECT "Algorithm" AS "Algorithm",
"NodeFrom" AS "NodeFrom"
FROM "way_net2"
WHERE "Name" = 'DASF';

But as I said, your comment may not deal with SQL at all.

Regards,

Jukka Rahkonen

#2 Updated by Paolo Cavallini about 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - High Priority

#3 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#4 Updated by Giovanni Manghi about 6 years ago

  • Status changed from Open to Feedback

Please test with a recent QGIS release (2.18 or 3), if the issue/request is still valid change the affected version accordingly, if is fixed/implemented then close the ticket. Thanks!

#5 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to not reproducable
  • Status changed from Feedback to Closed
  • Description updated (diff)

Closing for lack of feedback.

Also available in: Atom PDF