avm19 opened a new issue, #3319:
URL: https://github.com/apache/arrow-adbc/issues/3319
### What happened?
Starting from 1.7.0, `cursor.executemany(operation, seq_of_parameters)`
throws `adbc_driver_manager.ProgrammingError: INVALID_ARGUMENT: [libpq] Failed
to execute query ...` when `seq_of_parameters` has length 0, e.g. an empty
list.
This is not such a big deal, but annoying, as did not have to worry about
this edge case in previous versions. I checked release notes and found no
mention of this change. I assume, this was unintentional and hence a bug.
### Stack Trace
```text
Traceback (most recent call last):
File "....bug_adbc_executemany_empty.py", line 17, in <module>
cursor.executemany(
~~~~~~~~~~~~~~~~~~^
"INSERT INTO test1 (id, val) VALUES ($1, $2);",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[], # FAILS IN 1.7.0 but works in 1.5.0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File ".../lib/python3.13/site-packages/adbc_driver_manager/dbapi.py", line
771, in executemany
self._rowcount = _blocking_call(
~~~~~~~~~~~~~~^
self._stmt.execute_update, (), {}, self._stmt.cancel
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "adbc_driver_manager/_lib.pyx", line 1674, in
adbc_driver_manager._lib._blocking_call_impl
File "adbc_driver_manager/_lib.pyx", line 1667, in
adbc_driver_manager._lib._blocking_call_impl
File "adbc_driver_manager/_lib.pyx", line 1391, in
adbc_driver_manager._lib.AdbcStatement.execute_update
File "adbc_driver_manager/_lib.pyx", line 261, in
adbc_driver_manager._lib.check_error
adbc_driver_manager.ProgrammingError: INVALID_ARGUMENT: [libpq] Failed to
execute query 'INSERT INTO test1 (id, val) VALUES ($1, $2);': ERROR: there is
no parameter $1
LINE 1: INSERT INTO test1 (id, val) VALUES ($1, $2);
^
. SQLSTATE: 42P02
```
### How can we reproduce the bug?
```python
with adbc_driver_postgresql.dbapi.connect(uri) as conn:
with conn.cursor() as cursor:
cursor.execute("CREATE TEMP TABLE test1 (id INTEGER, val INTEGER);")
# This works in 1.5.0, 1.6.0 and 1.7.0:
cursor.executemany("INSERT INTO test1 (id, val) VALUES ($1, $2);",
[(1, 1), (2, 2)])
# This fails for adbc_driver_manager==1.7.0, but works in previous
versions:
cursor.executemany("INSERT INTO test1 (id, val) VALUES ($1, $2);",
[])
```
### Environment/Setup
I use Postgres, but this might be irrelevant, not sure.
Out of these three combinations of versions, only the last one shows the bug:
```bash
pip install "adbc-driver-manager==1.6.0" "adbc-driver-postgresql==1.7.0";
pip install "adbc-driver-manager==1.6.0" "adbc-driver-postgresql==1.6.0";
pip install "adbc-driver-manager==1.7.0" "adbc-driver-postgresql==1.6.0";
```
--
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]