Subject | Re[2]: [Firebird-Architect] ORs in Where statement |
---|---|
Author | Daniel Rail |
Post date | 2003-06-14T14:59:48Z |
Hello David,
Saturday, June 14, 2003, 3:02:27 AM, you wrote:
DS> By SQL, the SELECT statement must return the same result,
DS> regardless of whether "a=1" or "b=0" is evaluated first.
DS> The order of evaluation is specified as indeterminate
DS> by SQL (I'm not even sure if SQL allows the order of evaluation
DS> to be vendor-determined).
Here's the definition found in the SQL-92 specs(the same text can be
found in SQL-99 under sub-section 6.2.3.4):
[...Start Quote...]
3.3.4.4 Rule evaluation order
A conforming implementation is not required to perform the exact
sequence of actions defined in the General Rules, but shall achieve
the same effect on SQL-data and schemas as that sequence. The term
effectively is used to emphasize actions whose effect might be
achieved in other ways by an implementation.
The Syntax Rules and Access Rules for contained syntactic elements
are effectively applied at the same time as the Syntax Rules and
Access Rules for the containing syntactic elements. The General
Rules for contained syntactic elements are effectively applied
before the General Rules for the containing syntactic elements.
Where the precedence of operators is determined by the Formats of
this International Standard or by parentheses, those operators are
effectively applied in the order specified by that precedence.
Where the precedence is not determined by the Formats or by
parentheses, effective evaluation of expressions is generally
performed from left to right. However, it is
implementation-dependent whether expressions are actually evaluated
left to right, particularly when operands or operators might cause
conditions to be raised or if the results of the expressions can be
determined without completely evaluating all parts of the
expression.
In general, if some syntactic element contains more than one other
syntactic element, then the General Rules for contained elements
that appear earlier in the production for the containing syntactic
element are applied before the General Rules for contained elements
that appear later.
For example, in the production:
<A> ::= <B> <C>
the Syntax Rules and Access Rules for <A>, <B>, and <C> are
effectively applied simultaneously. The General Rules for <B> are
applied before the General Rules for <C>, and the General Rules for
<A> are applied after the General Rules for both <B> and <C>.
If the result of an expression or search condition can be deter-
mined without completely evaluating all parts of the expression or
search condition, then the parts of the expression or search
condition whose evaluation is not necessary are called the
inessential parts.
If the Access Rules pertaining to inessential parts are not
satisfied, then the syntax error or access rule violation exception
condition is raised regardless of whether or not the inessential
parts are actually evaluated. If evaluation of the inessential parts
would cause an exception condition to be raised, then it is
implementation-dependent whether or not that exception condition is
raised.
[...End Quote...]
--
Best regards,
Daniel Rail
Saturday, June 14, 2003, 3:02:27 AM, you wrote:
DS> By SQL, the SELECT statement must return the same result,
DS> regardless of whether "a=1" or "b=0" is evaluated first.
DS> The order of evaluation is specified as indeterminate
DS> by SQL (I'm not even sure if SQL allows the order of evaluation
DS> to be vendor-determined).
Here's the definition found in the SQL-92 specs(the same text can be
found in SQL-99 under sub-section 6.2.3.4):
[...Start Quote...]
3.3.4.4 Rule evaluation order
A conforming implementation is not required to perform the exact
sequence of actions defined in the General Rules, but shall achieve
the same effect on SQL-data and schemas as that sequence. The term
effectively is used to emphasize actions whose effect might be
achieved in other ways by an implementation.
The Syntax Rules and Access Rules for contained syntactic elements
are effectively applied at the same time as the Syntax Rules and
Access Rules for the containing syntactic elements. The General
Rules for contained syntactic elements are effectively applied
before the General Rules for the containing syntactic elements.
Where the precedence of operators is determined by the Formats of
this International Standard or by parentheses, those operators are
effectively applied in the order specified by that precedence.
Where the precedence is not determined by the Formats or by
parentheses, effective evaluation of expressions is generally
performed from left to right. However, it is
implementation-dependent whether expressions are actually evaluated
left to right, particularly when operands or operators might cause
conditions to be raised or if the results of the expressions can be
determined without completely evaluating all parts of the
expression.
In general, if some syntactic element contains more than one other
syntactic element, then the General Rules for contained elements
that appear earlier in the production for the containing syntactic
element are applied before the General Rules for contained elements
that appear later.
For example, in the production:
<A> ::= <B> <C>
the Syntax Rules and Access Rules for <A>, <B>, and <C> are
effectively applied simultaneously. The General Rules for <B> are
applied before the General Rules for <C>, and the General Rules for
<A> are applied after the General Rules for both <B> and <C>.
If the result of an expression or search condition can be deter-
mined without completely evaluating all parts of the expression or
search condition, then the parts of the expression or search
condition whose evaluation is not necessary are called the
inessential parts.
If the Access Rules pertaining to inessential parts are not
satisfied, then the syntax error or access rule violation exception
condition is raised regardless of whether or not the inessential
parts are actually evaluated. If evaluation of the inessential parts
would cause an exception condition to be raised, then it is
implementation-dependent whether or not that exception condition is
raised.
[...End Quote...]
--
Best regards,
Daniel Rail