adbc icon indicating copy to clipboard operation
adbc copied to clipboard

Support `nil` as a query's input argument

Open vovayartsev-dice opened this issue 7 months ago • 2 comments

Reproducible in adbc v0.7.9

This works fine

Adbc.Connection.query(conn, "SELECT $1 as name", ["Alice"])

This fails

Adbc.Connection.query(conn, "SELECT $1 as name", [nil])
# => {:error, #Adbc.Error<message: "nanoarrow call failed: PostgresType::FromSchema(type_resolver, bind_schema->children[i], &type, &na_error) = (95) Operation not supported. Can't map Arrow type 'na' to Postgres type", vendor_code: 0, ...>}

Use-case

Similar to https://arrow.apache.org/adbc/main/python/recipe/postgresql.html#loading-csv-files-into-postgresql I actually was trying to perform INSERT INTO table (col1, col2) VALUES ($1, $2) but my dataset contains nils.

vovayartsev-dice avatar Jul 09 '25 00:07 vovayartsev-dice

A PR is welcome!

josevalim avatar Jul 09 '25 08:07 josevalim

It works with SQLite but not PostgreSQL, which indicates this is an issue with the postgres driver. You would have to report it upstream. :)

josevalim avatar Oct 24 '25 15:10 josevalim