-
Notifications
You must be signed in to change notification settings - Fork 422
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
Crash on dev ota server when requesting /records?min_target.version=53 #1217
Comments
|
Work around: put quotes around |
Is that a feature we support or a side effect? |
What? We want to use numeric comparison if both field and filter values are numeric, textual otherwise. |
I was talking about the fact of adding quotes in the querystring. |
It is not properly documented, so I guess we can classify as side effect :)) |
Do you think that something we should support? |
Refs #1216 and #1215. I think we're trying too hard to be clever with an ad-hoc string query syntax and IMO we should leave the current syntax in place ("simple" syntax, where anything that can be converted to a number is a number and everything else is a string) and add a robust syntax that can encode any value as well as its type. I'd propose JSON (so For comparison order, one reason I don't want to be too clever here is that I'm afraid of inventing an inconsistent order. E.g. 2.0 < 10 but 10 < "2.0b". Having a robust syntax doesn't completely avoid this problem because data in different records can be of different types, and we will have to order them somehow (if we get e.g. |
@glasserc I tried your idea of putting a JSON decoder there. But apparently it doesn't fix any of the issue we have. Because even if we decode the number as a number then if we do a Postgresql request with a numeric value on a row that contains string we still have the issue. |
There were two parts to this bug and the JSON decoder fixes the first one. Previously, this request would work "sometimes" depending on whether the data in the record looked numeric or not. Now, it never works, which is an improvement. The second part of the bug is about how we compare numbers to strings. Like I wrote originally, we already have that problem. You can put record1 = {"flavor": "1"} and record2 = {"flavor": 1} and then _sort=flavor. What order comes out? Does Postgres let you do that? I think the answer to those questions should guide our fix. |
It seems that Postgres's sorting order is all strings, followed by all numbers:
So I would say we should compare numbers as different from non-numerics, but compare them earlier. |
Do we have a case where we mix string and integer in the database? Cannot we use the schema to make sure a fields is always of type string even if that string contains only numbers? |
The storage is not aware of the data schema |
This is fixed by #1258 (thanks @leplatrem for adding tests to confirm!). |
The text was updated successfully, but these errors were encountered: