-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Endless loop with foo in arraycolumn
#3642
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
Comments
Michael Bayer (@zzzeek) wrote:
→ e0a580b |
Michael Bayer (@zzzeek) wrote:
(cherry picked from commit e0a580b) → 69f6a8d |
Changes by Michael Bayer (@zzzeek):
|
Michael Bayer (@zzzeek) wrote: thanks for reporting! not sure I agree with "contains -> contains()", since the keyword used is "in", which people are reallly going to think is SQL IN. The in/contains mismatch across SQL / Python is a good reason to leave this area explicitly not supported. |
Adrian (@thiefmaster) wrote: Hm, assuming there are no cases where an actual SQL |
Michael Bayer (@zzzeek) wrote: im sorry emit what for any() ? |
Adrian (@thiefmaster) wrote: the same SQL that's emitted by |
Michael Bayer (@zzzeek) wrote: As I don't really use ARRAY types myself, I'm sure I'm not understanding. any() right now emits the operator "ANY" (and in 1.1 has been enhanced to also work with MySQL's ANY operator). If someone wants "@>", they use "contains". Why would we remove support entirely for one of these operators and make the two functions emit the same thing? |
Adrian (@thiefmaster) wrote:
That's why I'm suggesting to always use the more efficient operator for this (assuming there are really no differences besides the index usage) |
Michael Bayer (@zzzeek) wrote: also, ANY (http://www.postgresql.org/docs/9.4/static/functions-comparisons.html) and @> (http://www.postgresql.org/docs/9.4/static/functions-array.html) don't appear to be equivalent at all. The left-hand datatype is completely different. |
Michael Bayer (@zzzeek) wrote: Then why does Postgresql have ANY ? Why can't they run this optimization on their end? Isn't this a bug in Postgresql ? |
Adrian (@thiefmaster) wrote:
I guess that's a usecase where SQL ANY is actually needed, but for "simple" argument types (i.e. not queries) you could still go for the more efficient |
Michael Bayer (@zzzeek) wrote: yeah we dont really make decisions like that because it's just a surprise for the user who is doing somethign where this suddenly doesn't work. The SQL Core remains as 1-1 mapped to SQL as possible. |
Migrated issue, originally created by Adrian (@thiefmaster)
This example never terminates:
Traceback on ^C:
From looking at the code
__contains__
is not supported, but it should result in an exception and not in a hang.Also, I think it would be useful to implement
__contains__
to callself.contains([value])
. Using.any(123)
is not an option since it does not make use of a GIN index on the table, while.contains([123])
does even though both do the same thing.The text was updated successfully, but these errors were encountered: