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

   **Describe the bug**
   I discovered that left() function incorrectly processes large negative 
integers below INT_MIN instead of throwing error.
   
   **How are you accessing AGE (Command line, driver, etc.)?**
   - Command line
   
   **What is the command that caused the error?**
   When a negative integer bigger than INT_MIN is used as the length of left() 
function, an error will be caused:
   ```pgsql
   SELECT * FROM cypher('test_graph', $$
   RETURN LEFT('abcdef', -2147483648) AS ref0
   $$) AS (ref0 agtype);
   ```
   ```
   ERROR:  left() negative values are not supported for length
   ```
   However, when executing query with large negative integer below -2147483648, 
the original text will be returned:
   ```pgsql
   SELECT * FROM cypher('test_graph', $$
   RETURN LEFT('abcdef', -2147483649) AS ref0, -2147483649 < 0 as ref1
   $$) AS (ref0 agtype, ref1 agtype);
   ```
   ```
      ref0   | ref1 
   ----------+------
    "abcdef" | true
   ```
   **Expected behavior**
   Both queries above should fail with an error.
   
   **Environment:**
   - Latest in Docker hub
   
   **Additional context**
   I also found this bug in neo4j. Here is the link: 
https://github.com/neo4j/neo4j/issues/13671
   


-- 
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: dev-unsubscr...@age.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to