Replies: 1 comment 6 replies
-
Awesome!
I think in this case it's coming from pyarrow, which picks int64 as its default inference of an arbitrary Python integer: It's a great point that the default conversion to BIGINT is likely to cause some problems. I forget from when I was working on this whether libpq gives us the opportunity to query the parameter types that it thinks we should be using from an arbitrary query (it looks like it isn't implemented from our side, anyway): arrow-adbc/c/driver/postgresql/statement.cc Lines 763 to 766 in 5721207 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Running the following in Python for a PostgreSQL database, querying generate_subscripts with the dimension parameter from a bound argument:
results in an error:
But when I query without the bound parameter
there is no error.
Or when I use a bound parameter with psycopg (that apparently uses server-side binding and so presumably has to assign a PostgreSQL type to parameters?)
there is no error as well
It looks like adbc_driver_postgresql might be assuming that the
1
parameter is a BIGINT, and since there isn't a matching generate_subscripts function https://www.postgresql.org/docs/current/functions-srf.html, it errors? How can I get ADBC to assume that it's just an INT? I know I can put a cast into the SQL itself, but...The context is that I'm making a SQLAlchemy Dialect for PostgreSQL/ADBC https://github.com/michalc/pgarrow, and querying generate_subscripts is actually coming from SQLAlchemy's base PostgreSQL dialect that I'm extending from https://github.com/sqlalchemy/sqlalchemy/blob/4e4c5a76fce2c13891cb405fe6d2e06c5d3406c1/lib/sqlalchemy/dialects/postgresql/base.py#L4126. Ideally "it would just work" and I wouldn't have to override it to put in some casts.
Beta Was this translation helpful? Give feedback.
All reactions