You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2021/07/07 14:36:50 UTC

[GitHub] [phoenix-queryserver] richardantal commented on pull request #71: PHOENIX-6407 phoenixdb for Python silently ignores placeholders < pla…

richardantal commented on pull request #71:
URL: https://github.com/apache/phoenix-queryserver/pull/71#issuecomment-875659269


   I think this ticket is about calling the cursor.execute with mismatching number of placeholders in phonixdb.
   
   I created a table 
   `cursor.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, username VARCHAR, name VARCHAR)")`
   and ran these upserts
   ```
   cursor.execute("UPSERT INTO users VALUES (?, ?, ?)", (1, '1', '1'))
   cursor.execute("UPSERT INTO users VALUES (?, ?, ?)", (2, '2', '2', '2'))
   cursor.execute("UPSERT INTO users VALUES (?, ?, ?)", (3, '3'))
   cursor.execute("UPSERT INTO users VALUES (?, ?, ?, ?)", (4, '4', '4'))
   cursor.execute("UPSERT INTO users VALUES (?, ?)", (5, '5', '5'))
   
   cursor.execute("UPSERT INTO users VALUES (?, ?)", (6, '6'))
   ```
   
   Without this change:
   1, 2, 5 and 6 was successful.
   the result of the select:
   ```
   `[[1, '1', '1'], [2, '2', '2'], [5, '5', None], [6, '6', None]]`
   3 -> InternalError: ('Parameter value unbound. Parameter 3 is unbound', 2004, 'INT05', None)
   4 -> ProgrammingError: ('Number of columns upserting must match number of values. Numbers of columns: 3. Number of values: 4 tableName=USERS', 1020, '42Y60', None)
   ```
   
   With my change
   only 1 and 6 is successful
   ```
   2 -> ProgrammingError: ('Number of placeholders (?) must match number of parameters. Number of placeholders: 3. Number of parameters: 4', None, None, None)
   3 -> ProgrammingError: ('Number of placeholders (?) must match number of parameters. Number of placeholders: 3. Number of parameters: 2', None, None, None)
   4 -> ProgrammingError: ('Number of columns upserting must match number of values. Numbers of columns: 3. Number of values: 4 tableName=USERS', 1020, '42Y60', None)
   5 -> ProgrammingError: ('Number of placeholders (?) must match number of parameters. Number of placeholders: 2. Number of parameters: 3', None, None, None)
   ```
    


-- 
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: issues-unsubscribe@phoenix.apache.org

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