kylemaxxwell / rpostgresql

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

dbWriteTable not reporting failed table write #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
As of RPostgreSQL 0.1-7, dbWriteTable (postgresqlWriteTable) no longer returns 
FALSE or errors when table writes are unsuccessful:

## Here's an example where I try to insert the USArrests dataset into 
## table 'tmp' containing incompatible columns.
## Ex 0.1-7, write fails, but success is reported
> dbGetQuery(pcon, "CREATE TABLE tmp (a int, b varchar(5));")
> dbWriteTable(pcon, "tmp", USArrests, append=TRUE, overwrite=FALSE)
[1] TRUE
> dbGetQuery(pcon, "select * from tmp;")
data frame with 0 columns and 0 rows

## In 0.1-6, write fails, error and failure reported
> dbWriteTable(pcon, "tmp", USArrests, append=TRUE, overwrite=FALSE)
Error in postgresqlExecStatement(conn, statement, ...) :
  RS-DBI driver: (could not Retrieve the result : ERROR:  extra data after last expected column
CONTEXT:  COPY tmp, line 1: "Alabama    13.2    236     58      21.2"
)
Warning in postgresqlWriteTable(conn, name, value, ...) :
  could not load data into table
[1] FALSE

> R.version
               _                            
platform       x86_64-apple-darwin9.8.0     
arch           x86_64                       
os             darwin9.8.0                  
system         x86_64, darwin9.8.0          
status                                      
major          2                            
minor          11.1                         
year           2010                         
month          05                           
day            31                           
svn rev        52157                        
language       R                            
version.string R version 2.11.1 (2010-05-31)

Original issue reported on code.google.com by rmcge...@gmail.com on 26 Oct 2010 at 3:41

GoogleCodeExporter commented 9 years ago
Its true.  Current code did not do any meaningful check for the results of 
dbWriteTable.
To do this, separation of query submitting code and result retrieval code was 
necessary.

So, this will be done in meanwhile.

But, ensuring append=TRUE feature to work correct needs more work, as the order 
of the
fields can be different even if the name and type is consistent.

Original comment by tomoa...@kenroku.kanazawa-u.ac.jp on 2 Nov 2010 at 10:06

GoogleCodeExporter commented 9 years ago
fixed in r173; please check

Original comment by tomoa...@kenroku.kanazawa-u.ac.jp on 3 Nov 2010 at 6:11

GoogleCodeExporter commented 9 years ago
Confirmed--r173 works well. Thanks for the change.

Original comment by rmcge...@gmail.com on 5 Nov 2010 at 8:18

GoogleCodeExporter commented 9 years ago
Hi, I came across this issue as well. Great to see it is fixed in SVN. Is there 
any plan to release it to CRAN?

Original comment by foolish.android on 1 Jul 2011 at 3:39

GoogleCodeExporter commented 9 years ago
Hi, Thank you for the great package! I also was almost about to submit a bug 
report about the 'dbWriteTable', but found this discussion.. Looking forward to 
the CRAN update. 

Original comment by arho.vir...@gmail.com on 15 Aug 2011 at 6:34

GoogleCodeExporter commented 9 years ago
Based on the report this issue is closed.  If you see a similar problem, it 
will be regarded as a new issue.

Original comment by tomoa...@kenroku.kanazawa-u.ac.jp on 10 Oct 2011 at 7:30