-
Notifications
You must be signed in to change notification settings - Fork 419
cockroachdb crdb - enums not working with prepared statements #658
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
Comments
I've done some digging, it seems that the sql that is blowing up is the introspection that is being run. It seems that CTEs aren't fully implemented in crdb, for example: It would seem that major restructuring of the introspection would be required. I will look for a quick workaround to punch through the data that is being sought. |
Actually, in my case it's okay not to avoid using prepared parameter for the enum type, while still using prepared parameters for the rest of the arguments. i'm using prepared statements as a security method, not for any performance improvement, so this doesn't introduce any complexity on my end. |
Hitting the same issue with introspection. I'm running asyncpg v0.22.0 against cockroach v20.2.4. |
Can replicate this same issue with Cockroach DB v21.1.5 Enums work fine until passed into a prepared statement, which results in |
Version 21.2 of CockroachDB will support correlated CTEs (cockroachdb/cockroach#63956) -- hopefully that will help. |
Same happens with
|
I think generally Cockroach isn't interoperable w/ asyncpg for non-typical queries (LEFT JOIN LATERAL, SELECT DISTINCT, etc...) from testing it on a project that require prepared staments |
Just to clarify, what is the error you get with the
query? |
the issue with a local PostgreSQL install?:
uvloop?: didn't test uvloop
enums have just been added to crdb. testing asyncpg shows an issue with prepared statements.
running this:
await conn.execute("INSERT INTO accounts2 (id, balance, mode) VALUES ($1, $2, $3)", 9, 2000, "active", )
throws
the prepared statement works fine in pgsql. enums work fine without prepared statements.
I have a silly bug exerciser, but needs some cleanup, you can see the relevant test2 functions if you need working code. i've tested psycopg2 and asyncpg against crdb and pgsql and out of the four runs, only asyncpg+crdb shows an issue.
crdbissues.py.txt
The text was updated successfully, but these errors were encountered: