You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2024/08/12 02:18:23 UTC

Re: [I] c/driver/postgresql: Cursor.adbc_ingest() throws an error when an empty table is passed [arrow-adbc]

paleolimbot commented on issue #2071:
URL: https://github.com/apache/arrow-adbc/issues/2071#issuecomment-2283010913

   Thanks for reporting!
   
   This seems to work with arrays that have zero items (but not stream with zero arrays):
   
   ``` r
   library(adbcdrivermanager)
   #> Warning: package 'adbcdrivermanager' was built under R version 4.3.3
   
   con <- adbc_database_init(
     adbcpostgresql::adbcpostgresql(), 
     uri = "postgresql://localhost:5432/postgres?user=postgres&password=password"
   ) |> 
     adbc_connection_init()
   
   con |> 
     execute_adbc("DROP TABLE IF EXISTS no_integers")
   
   # Works (stream with one zero-size array)
   data.frame(x = integer()) |> 
     write_adbc(con, "no_integers")
   
   # Fails (stream with zero arrays)
   nanoarrow::basic_array_stream(
     list(), 
     nanoarrow::na_struct(list(x = nanoarrow::na_int32()))
   ) |> 
     write_adbc(con, "no_integers")
   #> Error in adbc_statement_execute_query(stmt): INVALID_ARGUMENT: [libpq] Failed to create table: ERROR:  relation "no_integers" already exists
   #> 
   #> Query was: CREATE TABLE "public" . "no_integers" ("x" INTEGER)
   ```
   
   <sup>Created on 2024-08-11 with [reprex v2.1.0](https://reprex.tidyverse.org)</sup>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org