Undefined Variable Behavior #90
Replies: 2 comments 1 reply
-
Last time I looked into |
Beta Was this translation helpful? Give feedback.
-
My opinion here is that undefined variables should be static errors. It is a misfeature in our implementations that we have any kind of dynamic scoping (and I am probably to blame for some of that in Kotlin). It was a relic when PartiQL had more loose dynamic scoping rules that we quickly got rid of for query stability. |
Beta Was this translation helpful? Give feedback.
-
Overview
I have a PR (partiql/partiql-tests#124) to fix several conformance tests that deal with a common theme: undefined variables. Before this PR, identifiers that were not resolved to environment bindings or to a database name would return MISSING -- it would not fail compilation. This PR fixes this by failing compilation in these scenarios.
The PartiQL Team has conflicting views on this topic, and I hope that this discussion may bring forth an actionable conclusion.
Specification
From my reading of the PartiQL Specification, a database type environment exists and always "knows" which "names" are present (regardless of whether the value itself is schema-less). From the PartiQL Specification:
Therefore, even in a schema-less database, a binding's name must be present in the database type environment.
In Section 10.1, the specification elaborates on references to variables and database names:
The PartiQL Specification states that the "query fails compilation" if an identifier cannot be resolved to either an environment variable or a database name.
Other Relevant Issues
PLK, for reasons unbeknownst to me, has added an API called UndefinedVariableBehavior. The conformance tests use the MISSING variant of this enum.
Question
UndefinedVariableBehavior
for compatibility purposes?Beta Was this translation helpful? Give feedback.
All reactions