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 · 1 comment
Closed

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

JohnMount opened this issue Mar 18, 2018 · 1 comment

Comments

@JohnMount
Copy link

JohnMount 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 as completed in e49d933 Mar 26, 2018
@github-actions
Copy link

github-actions bot commented Dec 7, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant