1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#' @include backend-postgres.R
NULL
# nocov start
# Use dbplyr edition 1 for custom method dispatch on RPostgreSQL connections
#' @export
dbplyr_edition.PostgreSQLConnection <- function(con) {
1L
}
#' @export
db_write_table.PostgreSQLConnection <- function(con, table, types, values,
temporary = TRUE, overwrite = FALSE, ....) {
if (!isFALSE(temporary)) {
cli_abort(c(
"RPostgreSQL backend does not support creation of temporary tables",
i = "Either set {.code temporary = FALSE} or switch to {.pkg RPostgres}"
))
}
dbWriteTable(
con,
name = table,
value = values,
field.types = types,
overwrite = overwrite,
row.names = FALSE
)
table
}
#' @export
db_query_fields.PostgreSQLConnection <- function(con, sql, ...) {
fields <- build_sql(
"SELECT * FROM ", sql_subquery(con, sql), " WHERE 0=1",
con = con
)
qry <- dbSendQuery(con, fields)
on.exit(dbClearResult(qry))
dbGetInfo(qry)$fieldDescription[[1]]$name
}
#' @export
db_connection_describe.PostgreSQLConnection <- db_connection_describe.PqConnection
#' @export
sql_translation.PostgreSQLConnection <- sql_translation.PqConnection
#' @export
sql_expr_matches.PostgreSQLConnection <- sql_expr_matches.PqConnection
#' @export
sql_query_explain.PostgreSQLConnection <- sql_query_explain.PqConnection
#' @export
supports_window_clause.PostgreSQLConnection <- function(con) {
TRUE
}
#' @export
sql_query_insert.PostgreSQLConnection <- sql_query_insert.PostgreSQL
#' @export
sql_query_upsert.PostgreSQLConnection <- sql_query_upsert.PostgreSQL
# nocov end
|