Skip to content

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

Closed

Description

@JohnMount

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)

Activity

  1. github-actions commented on Dec 7, 2020

    @github-actions
    Contributor

    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.

  2. locked and limited conversation to collaborators on Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions