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

Named filters (ie. &foo=1) are always cast as strings in where clause #8

Merged
merged 3 commits into from
Feb 16, 2017

Conversation

timwis
Copy link
Owner

@timwis timwis commented Feb 15, 2017

?foo=1&bar=test used to result in WHERE foo = 1 AND bar = 'test'.
This PR makes it result in WHERE foo = '1' AND bar = 'test'.

closes CityOfPhiladelphia/soda-carto#23

@andrewbt
Copy link

@timwis Checked with "the experts" and this approach should generally be safe. However, before we merge, does this account for cases where params[key] might have single or double quotes within itself? Like the string Philadelphia's district ?

@timwis
Copy link
Owner Author

timwis commented Feb 16, 2017

Great point @andrewbt. This definitely didn't accommodate that. Just pushed 2 commits to account for inner quotes, as well as surrounding quotes in named filters. A bit confusing because postgres doesn't accept backslashes to escape quotes; you have to use a quote twice. Hope this is right.

@timwis timwis merged commit 94ccc78 into master Feb 16, 2017
@timwis timwis deleted the filters-strings branch February 16, 2017 11:37
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

Successfully merging this pull request may close these issues.

Basic filters may misinterpret numeric types, which will fail in postgres
2 participants