jrgemignani commented on issue #1008:
URL: https://github.com/apache/age/issues/1008#issuecomment-1614918120
@AbdulSamad4068 Unfortunately, you can't really pre-validate the inputs to
AND or OR. As an example, look at the following cypher commands -
```
CREATE ({field: 1});
CREATE ({field: false});
CREATE ({field: "Name"});
MATCH (u) RETURN (true OR u.field);
MATCH (u) RETURN (false AND u.field);
```
In the above example we have 3 vertices, each with a **differently typed
value** for the same key: field. None of this is known until the execution
phase. Specifically, the type is not known until `u.field` has been evaluated -
**after** - getting a value for **u**.
Additionally, in the execution phase, the logic for T_BoolExpr will skip
over any extra input once the result of AND or OR is determined. For OR, just
one true will suffice for an output of true. For AND, just one false will
suffice for an output of false.
The only way to potentially resolve this is to write a completely different
path for the execution of Booleans in AGE.
However, per PostgreSQL docs, using side effects to determine other outcomes
is not recommended. Meaning, `true OR` is always true and `false AND` is always
false. It is not good form to have a function error out (side effect) to break
this. At least, that was my understanding of what they stated.
See this link for more -
https://www.postgresql.org/docs/15/sql-expressions.html#SYNTAX-EXPRESS-EVAL
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]