Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable errors on missing fields (change auto-quoting mechanism in SQLite sql formatting) #984

Closed
springmeyer opened this issue Dec 5, 2011 · 2 comments

Comments

@springmeyer
Copy link
Member

Breaking out standalone issue from #792, as this may need further review.

Basically, we double quote all field names in the sqlite plugin to ensure they don't conflict with reserved sql words and still work properly if they contain invalid characters. This seems like good practice and works great for the postgis plugin.

But it appears that if column names are double or single quoted and don't exist this prompts sqlite to silently coerce the field name reference to a string literal: https://gist.github.com/1435230

So for a table containing 2 rows a query like: select doesnotexist from table; returns 2 rows of results of simply the string doesnotexist. Insane!

Instead in Mapnik we wish for this to throw and be consistent with other datasources as per #792.

@springmeyer
Copy link
Member Author

The two options I see are:

  1. Do not quote column names and deal with the fallout
  2. Quote column names using either [] or "`", which are valid quoting mechanism in sqlite but which do not trigger coersion to string literals: http://www.sqlite.org/lang_keywords.html

@springmeyer
Copy link
Member Author

went with [] in 17852d5.

kkaefer pushed a commit to kkaefer/mapnik that referenced this issue Feb 16, 2012
…y switching quoting character to brackets - closes mapnik#984 - refs mapnik#792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant