paleolimbot opened a new issue, #1483:
URL: https://github.com/apache/arrow-adbc/issues/1483

   It looks like the postgres enum type is not quite supported yet, although 
there is a workaround:
   
   ``` r
   library(adbcdrivermanager)
   
   db <- adbc_database_init(
     adbcpostgresql::adbcpostgresql(),
     uri = 
"postgresql://localhost:5432/postgres?user=postgres&password=password") 
   
   db |> 
     execute_adbc("CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy')")
   
   db |> 
     adbc_database_release()
   
   # Have to recreate the database after because that's where we cache the types
   con <- db <- adbc_database_init(
       adbcpostgresql::adbcpostgresql(),
       uri = 
"postgresql://localhost:5432/postgres?user=postgres&password=password"
     ) |> 
     adbc_connection_init()
   
   con |> 
     execute_adbc("CREATE TABLE x (a mood)") |> 
     execute_adbc("INSERT INTO x VALUES ('sad')") |> 
     execute_adbc("INSERT INTO x VALUES ('ok')")
   
   # Currently returned as binary (i.e., COPY output)
   con |> 
     read_adbc("SELECT * from x") |> 
     as.data.frame() |> 
     dplyr::pull(a) |> 
     unclass() |> 
     vapply(rawToChar, character(1))
   #> [1] "sad" "ok"
   ```
   
   <sup>Created on 2024-01-23 with [reprex 
v2.0.2](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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to