R/dbExistsTable_PqConnection_character.R

Defines functions dbExistsTable_PqConnection_character

Documented in dbExistsTable_PqConnection_character

#' @rdname postgres-tables
#' @usage NULL
dbExistsTable_PqConnection_character <- function(conn, name, ...) {
  stopifnot(length(name) == 1L)
  # use (Un)QuoteIdentifier roundtrip instead of Id(table = name)
  # so that quoted names (possibly incl. schema) can be passed to `name` e.g.
  # name = dbQuoteIdentifier(conn, Id(schema = "sname", table = "tname"))
  quoted <- dbQuoteIdentifier(conn, name)
  id <- dbUnquoteIdentifier(conn, quoted)[[1]]
  exists_table(conn, id)
}

#' @rdname postgres-tables
#' @export
setMethod("dbExistsTable", c("PqConnection", "character"), dbExistsTable_PqConnection_character)

Try the RPostgres package in your browser

Any scripts or data that you put into this service are public.

RPostgres documentation built on May 29, 2024, 3:12 a.m.