You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I was reading RFC-0007, I had remembered some of the coercion rules applicable to the RHS of a FROM clause in the PartiQL Specification. Specifically, from the PartiQL Specification:
In the following cases the expression in the FROM clause item has the wrong type. Under the type checking option, all of these cases raise an error and the query fails. Under the permissive option, the cases proceed as follows:
Iteration over a scalar value: Consider the query:
FROM s AS v AT p
or the query:
FROM s AS v
where s is a scalar value. Then s coerces into the bag << s >>, i.e., the bag that has a single element, the s. The
rest of the semantics is identical to what happens when the lhs of the FROM item is a bag.
The PartiQL Specification states that, in strict mode, coercion does NOT occur when attempting to execute FROM <scalar>. However, in permissive mode, coercion to a bag will occur. As I was reading RFC-0007, I see the following coercion rules for OUTER <BAG OP>:
V1 OUTER UNION ALL V2 = SQL_UNION(F(V1), F(V2))
V1 OUTER INTERSECT ALL V2 = SQL_INTERSECT(F(V1), F(V2))
V1 OUTER EXCEPT ALL V2 = SQL_EXCEPT(F(V1), F(V2))
V1 OUTER UNION DISTINCT V2 = DISTINCT(SQL_UNION(F(V1), F(V2)))
V1 OUTER INTERSECT DISTINCT V2 = DISTINCT(SQL_INTERSECT(F(V1), F(V2)))
V1 OUTER EXCEPT DISTINCT V2 = DISTINCT(SQL_EXCEPT(F(V1), F(V2)))
The coercion function F is defined for all PartiQL values (Appendix C) by:
F(absent_value) -> << >>
F(scalar_value) -> << scalar_value >> # singleton bag
F(tuple_value) -> << tuple_value >> # singleton bag, see future extensions
F(array_value) -> bag_value # discard ordering
F(bag_value) -> bag_value # identity
So, my question is: is the coercion function applied in both typing modes? To me, it would seem odd to coerce in strict mode -- as the behavior seems inconsistent with the behavior of the FROM clause.
The text was updated successfully, but these errors were encountered:
As I was reading RFC-0007, I had remembered some of the coercion rules applicable to the RHS of a FROM clause in the PartiQL Specification. Specifically, from the PartiQL Specification:
The PartiQL Specification states that, in strict mode, coercion does NOT occur when attempting to execute
FROM <scalar>
. However, in permissive mode, coercion to a bag will occur. As I was reading RFC-0007, I see the following coercion rules forOUTER <BAG OP>
:So, my question is: is the coercion function applied in both typing modes? To me, it would seem odd to coerce in strict mode -- as the behavior seems inconsistent with the behavior of the FROM clause.
The text was updated successfully, but these errors were encountered: