kylemaxxwell / rpostgresql

Automatically exported from code.google.com/p/rpostgresql
0 stars 0 forks source link

dbWriteTable segfaults on an admittedly weird data.frame with raw/bytea fields #60

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

 dbGetQuery(con,"CREATE TABLE byteatable (name text NOT NULL, val bytea, PRIMARY KEY (name))")
  sample.object <- list("one","two"); 
  ser <- serialize(sample.object,NULL,ascii=F);

  df <- data.frame(name=c("first","second"),stringsAsFactors=F);
  df$val <- list(ser,ser)

  dbWriteTable(con,"byteatable",df,append=T,row.names=F)

What is the expected output? What do you see instead?
All this was for a bytea insertion attempt. Instead, this happens:

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
 1: .Call("RS_PostgreSQL_CopyInDataframe", conId, dataframe, nrow,     p, PACKAGE = .PostgreSQLPkgName)
 2: postgresqlCopyInDataframe(new.con, value)
 3: postgresqlWriteTable(conn, name, value, ...)
 4: is(object, Cl)
 5: is(object, Cl)
 6: .valueClassTest(standardGeneric("dbWriteTable"), "logical", "dbWriteTable")
 7: dbWriteTable(con, "byteatable", df, append = T, row.names = F)

What version of the product are you using? On what operating system?

Please provide any additional information below.
1. Postgres 9.1 (don't know if matters)
> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] PKI_0.1-1       base64enc_0.1-1 RPostgreSQL_0.5 DBI_0.2-7      

loaded via a namespace (and not attached):
[1] compiler_2.15.3 tools_2.15.3   

Original issue reported on code.google.com by peter.kh...@gmail.com on 29 Jan 2014 at 9:41

GoogleCodeExporter commented 8 years ago
I have exactly the same problem on Ubuntu 14.04 with the newest R packages from 
CRAN.

Original comment by madsurge...@gmail.com on 27 May 2014 at 6:15