2

I am using R version noted below:

R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[R.app GUI 1.70 (7463) x86_64-apple-darwin15.6.0]

I am using macOS Sierra Version 10.12.6 (16G1314). Using a 3.1 GHz Intel Core i7 processor, memory 16 GB 1867 MHz DDR3, graphics card is an Intel Iris Graphics 6100 1536 MB.

Here is my R code that crashes. I've taken the host names, ports, database name, username, and password out for security reasons. The con assignment is what crashes. I am trying to connect to Redshift cluster using a code example within my organization.

library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(
    drv,
    host = "<host name>",
    port = "<four digit port>"
    dbname = "'dbname = <database name> ssl=require'",
    user = "<user name>",
    password = "<password>"
)

Here is my R session info up until the con assignment

R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] RPostgreSQL_0.6-2 DBI_0.8          

loaded via a namespace (and not attached):
[1] compiler_3.4.3

Here is the crash report with stuff removed for security reasons:

 *** caught segfault ***
address 0x0, cause 'memory not mapped'

Traceback:
 1: .Call(RS_PostgreSQL_newConnection, drvId, con.params)
 2: postgresqlNewConnection(drv, ...)
 3: dbConnect(drv, host = "<hostname>", port = "<port>",     dbname = "'dbname = <database name> ssl=require'", user = "<user name>",     password = "<password>")
 4: dbConnect(drv, host = "<hostname>", port = "<port>",     dbname = "'dbname = <database name> ssl=require'", user = "<user name>",     password = "<password>")

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

I've tried it with two Redshift clusters and ran into the same issue.

Question: How can I resolve this issue so I connect to my Redshift cluster via R?

Bonus question: Is it just me or have R releases been buggy lately?

Brash Equilibrium
  • 1,357
  • 4
  • 14
  • 35

1 Answers1

1

I quickly searched for and skimmed the Amazon docs for Redshift. They suggest you use a JDBC or ODBC driver. The RPostgreSQL package uses the libpq driver, so I wouldn't expect it to work with Redshift.

I suggest you use RODBC, RJDBC, or odbc, depending on which best suits your setup.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418