zihaozeng0021 opened a new issue, #2264:
URL: https://github.com/apache/age/issues/2264

   ### Configuration
   AGE Version: `apache/age:latest` (pulled 2025-12-07)
   
   Operating System: WSL2 – Ubuntu 24.04.1 LTS
   
   Installation Method: Docker
   
   
   ---
   
   ### Steps to reproduce
   
   1. Start AGE via Docker
   ```
   docker run \
     --name age \
     -p 5455:5432 \
     -e POSTGRES_USER=postgresUser \
     -e POSTGRES_PASSWORD=postgresPW \
     -e POSTGRES_DB=postgresDB \
     -d \
     apache/age:latest
   ```
   
   2. Connect with psql
   ```
   PGPASSWORD='postgresPW' psql -h localhost -p 5455 -U postgresUser -d 
postgresDB
   ```
   
   3. Run the following query
   ```
   CREATE EXTENSION IF NOT EXISTS age;
   LOAD 'age';
   SET search_path = ag_catalog, "$user", public;
   
   SELECT create_graph('test');
   
   
   SELECT * FROM cypher('test', $$
     RETURN true OR 1
   $$) AS (a agtype);
   
   SELECT * FROM cypher('test', $$
     RETURN false AND 1
   $$) AS (a agtype);
   
   SELECT * FROM cypher('test', $$
     RETURN 1 OR true
   $$) AS (a agtype);
   
   SELECT * FROM cypher('test', $$
     RETURN 1 AND false
   $$) AS (a agtype);
   
   ```
   
   ---
   
   ### Expected behaviour
   All four statements involving mixed-type boolean operators should fail with 
a type mismatch error. The operand order should not change whether a type error 
is raised.
   ### Actual behaviour
   The actual result is as the following:
   ```
     a
   ------
    true
   (1 row)
   
      a
   -------
    false
   (1 row)
   
   ERROR:  cannot cast agtype integer to type boolean
   
   ERROR:  cannot cast agtype integer to type boolean
   ```
   
   Key points:
   1. Order-dependent behavior suggests short-circuit evaluation is masking a 
type error when the boolean literal is the left operand.
   
   2. `true OR 1` and `false AND 1` should not succeed if mixed-type boolean 
operands are intended to be rejected.


-- 
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]

Reply via email to