odbc icon indicating copy to clipboard operation
odbc copied to clipboard

DBI::dbListObjects(conn) and odbc::odbcListObjects() disagree

Open kevinushey opened this issue 6 years ago • 1 comments

Issue Description and Expected Result

I would expect DBI::dbListObject() and odbc::odbcListObjects() to produce the same result. Or, at least, that DBI::dbListObject() would return schemas as well as tables.

Browse[2]> DBI::dbListObjects(conn)
                table is_prefix
1 <Id> table = mtcars     FALSE
Browse[2]> odbc::odbcListObjects(conn)
             name   type
1 pg_toast_temp_1 schema
2          public schema

Database

$ postgres --version
postgres (PostgreSQL) 10.5

Reproducible Example

library(odbc)
conn <- dbConnect(
   odbc::odbc(),
   .connection_string = "Driver={PostgreSQL Driver};Port=5432;",
   encoding = "utf8"
)

DBI::dbWriteTable(conn, "mtcars", mtcars, overwrite = TRUE)
DBI::dbListObjects(conn)
#>                 table is_prefix
#> 1 <Id> table = mtcars     FALSE
odbc::odbcListObjects(conn)
#>              name   type
#> 1 pg_toast_temp_1 schema
#> 2          public schema

Created on 2018-10-05 by the reprex package (v0.2.1)

Session Info
devtools::session_info()
Session info ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                                      
 version  R version 3.5.1 Patched (2018-09-14 r75325)
 system   x86_64, darwin15.6.0                       
 ui       RStudio (1.2.1026)                         
 language (EN)                                       
 collate  en_US.UTF-8                                
 tz       America/Los_Angeles                        
 date     2018-10-05                                 

Packages --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 package    * version date       source        
 assertthat   0.2.0   2017-04-11 CRAN (R 3.5.0)
 backports    1.1.2   2017-12-13 CRAN (R 3.5.0)
 base       * 3.5.1   2018-09-19 local         
 base64enc    0.1-3   2015-07-28 CRAN (R 3.5.0)
 bit          1.1-14  2018-05-29 CRAN (R 3.5.0)
 bit64        0.9-7   2017-05-08 CRAN (R 3.5.0)
 blob         1.1.1   2018-03-25 CRAN (R 3.5.0)
 callr        3.0.0   2018-08-24 CRAN (R 3.5.0)
 clipr        0.4.1   2018-06-23 CRAN (R 3.5.0)
 commonmark   1.6     2018-09-30 CRAN (R 3.5.1)
 compiler     3.5.1   2018-09-19 local         
 crayon       1.3.4   2017-09-16 CRAN (R 3.5.0)
 datasets   * 3.5.1   2018-09-19 local         
 DBI          1.0.0   2018-05-02 CRAN (R 3.5.0)
 devtools   * 1.13.6  2018-06-27 CRAN (R 3.5.0)
 digest       0.6.17  2018-09-12 CRAN (R 3.5.1)
 evaluate     0.11    2018-07-17 CRAN (R 3.5.0)
 fs           1.2.6   2018-08-23 CRAN (R 3.5.0)
 graphics   * 3.5.1   2018-09-19 local         
 grDevices  * 3.5.1   2018-09-19 local         
 hms          0.4.2   2018-03-10 CRAN (R 3.5.0)
 htmltools    0.3.6   2017-04-28 CRAN (R 3.5.0)
 httpuv       1.4.5   2018-07-19 CRAN (R 3.5.0)
 jsonlite     1.5     2017-06-01 CRAN (R 3.5.0)
 knitr      * 1.20    2018-02-20 CRAN (R 3.5.0)
 later        0.7.5   2018-09-18 CRAN (R 3.5.1)
 magrittr     1.5     2014-11-22 CRAN (R 3.5.0)
 memoise      1.1.0   2017-04-21 CRAN (R 3.5.0)
 methods    * 3.5.1   2018-09-19 local         
 mime         0.5     2016-07-07 CRAN (R 3.5.0)
 miniUI       0.1.1.1 2018-05-18 CRAN (R 3.5.1)
 odbc       * 1.1.6   2018-06-09 CRAN (R 3.5.0)
 packrat      0.4.9-3 2018-06-01 CRAN (R 3.5.0)
 pkgconfig    2.0.2   2018-08-16 CRAN (R 3.5.0)
 processx     3.2.0   2018-08-16 CRAN (R 3.5.0)
 promises     1.0.1   2018-04-13 CRAN (R 3.5.0)
 ps           1.1.0   2018-08-10 CRAN (R 3.5.0)
 R6           2.3.0   2018-10-04 CRAN (R 3.5.1)
 Rcpp         0.12.19 2018-10-01 CRAN (R 3.5.1)
 reprex       0.2.1   2018-09-16 CRAN (R 3.5.1)
 rlang        0.2.2   2018-08-16 CRAN (R 3.5.0)
 rmarkdown  * 1.10    2018-06-11 CRAN (R 3.5.0)
 roxygen2   * 6.1.0   2018-07-27 CRAN (R 3.5.0)
 rprojroot    1.3-2   2018-01-03 CRAN (R 3.5.0)
 rstudioapi   0.8     2018-10-02 CRAN (R 3.5.0)
 shiny      * 1.1.0   2018-05-17 CRAN (R 3.5.0)
 stats      * 3.5.1   2018-09-19 local         
 stringi      1.2.4   2018-07-20 CRAN (R 3.5.0)
 stringr      1.3.1   2018-05-10 CRAN (R 3.5.0)
 testthat   * 2.0.0   2017-12-13 CRAN (R 3.5.0)
 tools        3.5.1   2018-09-19 local         
 utils      * 3.5.1   2018-09-19 local         
 whisker      0.3-2   2013-04-28 CRAN (R 3.5.0)
 withr        2.1.2   2018-03-15 CRAN (R 3.5.0)
 xml2         1.2.0   2018-01-24 CRAN (R 3.5.0)
 xtable       1.8-3   2018-08-29 CRAN (R 3.5.0)

kevinushey avatar Oct 05 '18 16:10 kevinushey

It is possible we should add a dbListObjects() method that includes the schemas (with is_prefix == TRUE), but odbcListObjects() is intended to produce a different type of result in this case.

jimhester avatar Nov 22 '19 20:11 jimhester