Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPostgres appears to not write integer64 to database as long int #178

Closed
JohnMount opened this issue Mar 18, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@JohnMount
Copy link

commented Mar 18, 2018

RPostgres appears to not write integer64 to database as long int.

By-hand reprex below.

Notice the table created appears to have a floating point type.

packageVersion("RPostgres")


    ## [1] '1.0.4'


db <- DBI::dbConnect(
  RPostgres::Postgres(),
  host = 'localhost',
  port = 5432,
  user = 'johnmount',
  password = '')


    ## Warning: multiple methods tables found for 'dbQuoteLiteral'


d <- DBI::dbGetQuery(
  db, 
  "SELECT COUNT(1) FROM pg_catalog.pg_tables")

str(d)


    ## 'data.frame':    1 obs. of  1 variable:
    ##  $ count:integer64 189


DBI::dbWriteTable(db, "d", d, 
                  temporary = TRUE, 
                  overwrite = TRUE)
DBI::dbGetQuery(db, "
                SELECT 
                  column_name, 
                  data_type, 
                  numeric_precision, 
                  numeric_precision_radix,
                  udt_name
                FROM 
                  information_schema.columns 
                WHERE 
                  table_name = 'd'
                ")


    ##   column_name data_type numeric_precision numeric_precision_radix udt_name
    ## 1       count      real                24                       2   float4


d2 <- DBI::dbReadTable(db, "d")

str(d2)


    ## 'data.frame':    1 obs. of  1 variable:
    ##  $ count: num 189


DBI::dbDisconnect(db)

@krlmlr krlmlr closed this in e49d933 Mar 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.