-
Notifications
You must be signed in to change notification settings - Fork 173
Closed
Description
What happened?
An empty string is inserted as null in postgresql when it's passed as a parameter
Stack Trace
Traceback (most recent call last):
File "file.py", line 268, in <module>
assert res == [('',), ('',)], res
^^^^^^^^^^^^^^^^^^^^^
AssertionError: [('',), (None,)]
How can we reproduce the bug?
from adbc_driver_postgresql.dbapi import connect
url = 'postgresql://scott:tiger@localhost/test'
with connect(url) as conn:
with conn.cursor() as cur:
cur.execute('''CREATE TABLE text_table (text_data TEXT)''')
with conn.cursor() as cur:
cur.execute("INSERT INTO text_table VALUES ('')")
cur.execute("INSERT INTO text_table VALUES ($1)", ('',))
with conn.cursor() as cur:
cur.execute("SELECT text_data FROM text_table")
res = cur.fetchall()
print(res)
assert res == [('',), ('',)], resthe issue seems to be on the postgresql side, since trying the same code with sqlite works without errors
from adbc_driver_sqlite.dbapi import connect
with connect() as conn:
with conn.cursor() as cur:
cur.execute('''CREATE TABLE text_table (text_data TEXT)''')
with conn.cursor() as cur:
cur.execute("INSERT INTO text_table VALUES ('')")
cur.execute("INSERT INTO text_table VALUES ($1)", ('',))
with conn.cursor() as cur:
cur.execute("SELECT text_data FROM text_table")
res = cur.fetchall()
print(res)
assert res == [('',), ('',)], resEnvironment/Setup
adbc_driver_manager = 1.8.0
adbc_driver_postgresql = 1.8.0
Metadata
Metadata
Assignees
Labels
Type: bugSomething isn't workingSomething isn't working