[R-sig-DB] dbWriteTable() is renaming the 'end' column

Gabor Grothendieck ggrothend|eck @end|ng |rom gm@||@com
Wed Sep 30 00:33:20 CEST 2009


end is a reserved SQL keyword.

2009/9/29 Hervé Pagès <hpages using fhcrc.org>:
> Hi,
>
> Consider the following data:
>
>  mydata <- data.frame(start=1:5, end=11:15)
>
> Then storing and retrieving the data shows that the 'end'
> column was renamed:
>
>  drv <- dbDriver("SQLite")
>  con <- dbConnect(drv, dbname=":memory:")
>
>  > dbWriteTable(con, "mydata", mydata)
>  [1] TRUE
>  > dbReadTable(con, "mydata")
>    start end__1
>  1     1     11
>  2     2     12
>  3     3     13
>  4     4     14
>  5     5     15
>
> The culprit doesn't seem to be dbReadTable():
>
>  > dbGetQuery(con, "SELECT * FROM mydata")
>    row_names start end__1
>  1         1     1     11
>  2         2     2     12
>  3         3     3     13
>  4         4     4     14
>  5         5     5     15
>
> and using the sqlite3 client from outside R confirms this.
>
> Looks like a bug in dbWriteTable().
>
> Cheers,
> H.
>
> --
> Hervé Pagès
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N, M2-B876
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpages using fhcrc.org
> Phone:  (206) 667-5791
> Fax:    (206) 667-1319
>
> _______________________________________________
> R-sig-DB mailing list -- R Special Interest Group
> R-sig-DB using stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-db
>




More information about the R-sig-DB mailing list