noahxzhu commented on issue #1722:
URL: https://github.com/apache/age/issues/1722#issuecomment-2041038580

   I'm testing some cases with the python driver, the behavior like below
   
   # Case 1
   ```
   def test(p: str):
       prepared_statement = """
           MERGE (n1:`TEST` {id: %s})
       """
   
       ag.execCypher(prepared_statement, params=(p,))
       ag.commit()
   
   
   test("a's")
   ```
   GOT
   ```
   psycopg2.errors.SyntaxError: syntax error at or near "'s'"
   LINE 1: SELECT * from cypher(NULL,NULL) as (v agtype);
   ```
   
   # Case 2
   ```
   def test(p: str):
       prepared_statement = """
           MERGE (n1:`TEST` {id: %s})
       """
   
       ag.execCypher(prepared_statement, params=(p,))
       ag.commit()
   
   
   test('a"s')
   ```
   GOT
   ```
   psycopg2.errors.SyntaxError: unexpected character at or near "\"
   LINE 1: SELECT * from cypher(NULL,NULL) as (v agtype);
   ```
   
   # Case 3
   I think we shouldn't add quotes for the params, right?
   
   ```
   def test(p: str):
       prepared_statement = """
           MERGE (n1:`TEST` {id: '%s'})
       """
   
       ag.execCypher(prepared_statement, params=(p,))
       ag.commit()
   
   
   test('a"s')
   
   ```
   GOT
   ```
   psycopg2.errors.SyntaxError: unexpected character at or near "\"
   LINE 1: SELECT * from cypher(NULL,NULL) as (v agtype);
   ```
   
   # Case 4
   ```
   def test(p: str):
       prepared_statement = """
           MERGE (n1:`TEST` {id: '%s'})
       """
   
       ag.execCypher(prepared_statement, params=(p,))
       ag.commit()
   
   
   test("a's")
   ```
   GOT
   ```
   psycopg2.errors.SyntaxError: syntax error at or near "a"
   LINE 1: SELECT * from cypher(NULL,NULL) as (v agtype);
   ```
   
   # Case 5
   ```
   def test(p: str):
       prepared_statement = """
           MERGE (n1:`TEST` {id: "%s"})
       """
   
       ag.execCypher(prepared_statement, params=(p,))
       ag.commit()
   
   
   test("a's")
   ```
   GOT Succeed but the data like this
   ```
   {"id": "'a''s'"}
   
   ![CleanShot 2024-04-06 at 18 11 
00@2x](https://github.com/apache/age/assets/8643866/9c0e314a-20b9-45a5-bc23-773839ada0da)
   
   ```
   
   # Case 6
   ```
   def test(p: str):
       prepared_statement = """
           MERGE (n1:`TEST` {id: "%s"})
       """
   
       ag.execCypher(prepared_statement, params=(p,))
       ag.commit()
   
   
   test('a"s')
   
   GOT
   ```
   psycopg2.errors.SyntaxError: syntax error at or near "s"
   LINE 1: SELECT * from cypher(NULL,NULL) as (v agtype);
   ```


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

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

Reply via email to