-
Notifications
You must be signed in to change notification settings - Fork 1.3k
= ANY(array) support
#2670
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
= ANY(array) support
#2670
Conversation
katzyn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SQL Standard has is a syntax conflict between quantified comparison predicates and aggregate functions. This conflict is resolved in H2 via requirement to add parentheses around these functions.
ANY(array) is not a part of the SQL Standard, I'm not sure that we want to have such feature at all. We can accept this feature, but only with sane and non-intrusive implementation.
First of all, you don't need to touch aggregate functions. They aren't related here, the mentioned syntax conflict is already resolved it H2 and there is nothing to change.
Take a look on ConditionIn, ConditionInQuery, ConditionInConstantSet, and ConditionInParameter. You need to create an additional condition. This condition should work like ConditionInQuery, with its compareType parameter, but shouldn't inherit the PredicateWithSubquery. It should extend Condition instead and use the passed expression with array.
The another possible approach is to use the ConditionInQuery() with UNNEST(array) as a query.
|
The
[A] is clear in H2, but [B] and [C] is hard to distinct in parsing because column type is unknown. In most databases, however, I may close this and submit another pr. |
|
In H2 other data types may be used as boolean values. All other constructions are PostgreSQL-specific. H2 supports only You can add Actually this problem is really even more complicated than I thought initially, because we can't determine data type of expression early if it is not a constant expression. It looks like |
90b599b to
12988f8
Compare
12988f8 to
a9d208d
Compare
a9d208d to
2f28164
Compare
this can prevent HeidiSQL error on unique or composite keys
2f28164 to
e0a4e3e
Compare
|
Superseded by #3822. |
Mentioned in #2480 .
Convert
value = ANY(array)toARRAY_CONTAINS(array, value), and this feature can allow some PostgreSQL clients to get PK/UK frompg_constraint, mentioned in #2450 .The conversion is in
optimizestage, butSelect.setGroupQueryis inparsestage. If anyANYfunction detected, skipsetGroupQuery. ThensetGroupQueryfor real aggregateANYbefore execute query.