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

[I] c/driver/postgresql: Support enum type [arrow-adbc]

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: issues-unsubscribe@arrow.apache.org.apache.org

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


Re: [I] c/driver/postgresql: Support enum type [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1483:
URL: https://github.com/apache/arrow-adbc/issues/1483#issuecomment-1906199495

   It would also be good to have a way to purge the cache or notice that we need to rebuild it, hmm


-- 
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


Re: [I] c/driver/postgresql: Support enum type [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #1483: c/driver/postgresql: Support enum type
URL: https://github.com/apache/arrow-adbc/issues/1483


-- 
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: issues-unsubscribe@arrow.apache.org

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