We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Searching for records with array field contain other array using @> (e.g Post.query("tags @> ?", tags) does not yield any result.
@>
Post.query("tags @> ?", tags)
The text was updated successfully, but these errors were encountered:
contains
is contained by
<@
I think the problem lies in these two functions:
https://github.com/anykeyh/clear/blob/master/src/clear/expression/expression.cr#L127 https://github.com/anykeyh/clear/blob/master/src/clear/expression/expression.cr#L112
array ["a", "b", "c"] will be escaped as '{''a'', ''b'', ''c''}' instead of '{"a", "b", "c"}' (first one is two ' instead of a single ").
["a", "b", "c"]
'{''a'', ''b'', ''c''}'
'{"a", "b", "c"}'
'
"
Sorry, something went wrong.
change method def self.safe_literal(x : Enumerable(AvailableLiteral)) body to
def self.safe_literal(x : Enumerable(AvailableLiteral))
{"ARRAY[", x.map { |item| self.safe_literal(item) }.join(", "), "]"}.join
solve the problem for me.
No branches or pull requests
Searching for records with array field contain other array using
@>
(e.gPost.query("tags @> ?", tags)
does not yield any result.The text was updated successfully, but these errors were encountered: