-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't call a procedure with postgres_execute after retrieving an attached table in a transaction #222
Comments
After further tests, any call to import duckdb
con = duckdb.connect(database=':memory:')
con.execute("""ATTACH 'dbname=postgresscanner' AS s (TYPE postgres);""")
tr = con.begin()
tr.sql("""SELECT * FROM s.public.log;""").fetchall()
tr.execute("CALL postgres_execute('s', 'SELECT 1;')")
# tr.execute("CALL postgres_execute('s', 'CALL test()')")
# tr.execute("CALL postgres_execute('s', 'CREATE TABLE log2(id INT)')")
tr.commit() Throws |
Thanks for the report! Could you try running |
Same issue if I add at the start con = duckdb.connect(database=':memory:')
con.execute("""SET pg_connection_cache = false""") |
I am also seeing the Use case: I have an attached postgres database with a queue table, I have multiple workers running at once reading/writing/updating/deleting from the queue. I would like to interface directly between postgres and duckdb without having to pop out to Python which is executing the duckdb commands. My postgres table has been created with:
I attach the remote postgres instance with My overall query flow looks like:
Open a transaction on the attached postgres database
Fetch
Use
I would be happy to hear I am approaching this the incorrect way, but the behavior seems like it should be supported/work |
Fix #222: use PQexec instead of PQsendQuery for postgres_execute
This should now be fixed in #258 - essentially there is some odd internal state in |
What happens?
In a transaction, when calling a procedure (via
postgres_execute
) after retrieving from a table there is the following error:To Reproduce
Create procedure and table on postgres instance (db:
postgresscanner
):Launch the following python script:
OS:
Archlinux
PostgreSQL Version:
16.2
DuckDB Version:
10.2
DuckDB Client:
Python
Full Name:
Christopher Meier
Affiliation:
HEIG-VD
Have you tried this on the latest
main
branch?Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
The text was updated successfully, but these errors were encountered: