diff --git a/R/dbListObjects_PqConnection_ANY.R b/R/dbListObjects_PqConnection_ANY.R index e617e185..0a94fa29 100644 --- a/R/dbListObjects_PqConnection_ANY.R +++ b/R/dbListObjects_PqConnection_ANY.R @@ -14,11 +14,11 @@ dbListObjects_PqConnection_ANY <- function(conn, prefix = NULL, ...) { } query <- paste0( "SELECT ", null_varchar, " AS schema, table_name AS table FROM ( \n", - list_tables(order_by = "table_type, table_name"), + list_tables(conn = conn, order_by = "table_type, table_name"), ") as table_query \n", "UNION ALL\n", "SELECT DISTINCT table_schema AS schema, ", null_varchar, " AS table FROM ( \n", - list_tables(where_schema = "true"), + list_tables(conn = conn, where_schema = "true"), ") as schema_query;" ) } else { @@ -38,6 +38,7 @@ dbListObjects_PqConnection_ANY <- function(conn, prefix = NULL, ...) { query <- paste0( "SELECT table_schema AS schema, table_name AS table FROM ( \n", list_tables( + conn = conn, where_schema = where_schema, order_by = "table_type, table_name" ), diff --git a/R/dbListTables_PqConnection.R b/R/dbListTables_PqConnection.R index 8db8ab44..2d408a9f 100644 --- a/R/dbListTables_PqConnection.R +++ b/R/dbListTables_PqConnection.R @@ -1,7 +1,7 @@ #' @rdname postgres-tables #' @usage NULL dbListTables_PqConnection <- function(conn, ...) { - query <- list_tables(order_by = "table_type, table_name") + query <- list_tables(conn = conn, order_by = "table_type, table_name") dbGetQuery(conn, query)[["table_name"]] } diff --git a/R/tables.R b/R/tables.R index b81810bf..b2cf637f 100644 --- a/R/tables.R +++ b/R/tables.R @@ -120,7 +120,7 @@ db_append_table <- function(conn, name, value, copy, warn) { nrow(value) } -list_tables <- function(where_schema = NULL, where_table = NULL, order_by = NULL) { +list_tables <- function(conn, where_schema = NULL, where_table = NULL, order_by = NULL) { query <- paste0( # information_schema.table docs: https://www.postgresql.org/docs/current/infoschema-tables.html @@ -161,7 +161,7 @@ exists_table <- function(conn, id) { } query <- paste0( "SELECT EXISTS ( \n", - list_tables(where_schema = where_schema, where_table = where_table), + list_tables(conn, where_schema = where_schema, where_table = where_table), ")" ) dbGetQuery(conn, query)[[1]]