From 84c8e3b5c4c9a3e48921ebc961f7c9cfd8d22e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 1 Apr 2024 17:52:13 +0200 Subject: [PATCH 1/3] feat!: Avoid appending a numeric suffix to duplicate column names --- R/dbColumnInfo_PqResult.R | 1 - R/dbFetch_PqResult.R | 2 +- R/names.R | 32 -------------------------------- 3 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 R/names.R diff --git a/R/dbColumnInfo_PqResult.R b/R/dbColumnInfo_PqResult.R index 1b1cd159..24792b4a 100644 --- a/R/dbColumnInfo_PqResult.R +++ b/R/dbColumnInfo_PqResult.R @@ -3,7 +3,6 @@ dbColumnInfo_PqResult <- function(res, ...) { rci <- result_column_info(res@ptr) rci <- cbind(rci, .typname = type_lookup(rci[[".oid"]], res@conn), stringsAsFactors = FALSE) - rci$name <- tidy_names(rci$name) rci } diff --git a/R/dbFetch_PqResult.R b/R/dbFetch_PqResult.R index 88630691..a49ff8f1 100644 --- a/R/dbFetch_PqResult.R +++ b/R/dbFetch_PqResult.R @@ -13,7 +13,7 @@ dbFetch_PqResult <- function(res, n = -1, ..., row.names = FALSE) { ret <- convert_bigint(ret, res@bigint) ret <- finalize_types(ret, res@conn) ret <- fix_timezone(ret, res@conn) - set_tidy_names(ret) + ret } #' @rdname postgres-query diff --git a/R/names.R b/R/names.R deleted file mode 100644 index 48bc2120..00000000 --- a/R/names.R +++ /dev/null @@ -1,32 +0,0 @@ -set_tidy_names <- function(x) { - new_names <- tidy_names(names2(x)) - names(x) <- new_names - x -} - -names2 <- function(x) { - name <- names(x) - if (is.null(name)) { - name <- rep("", length(x)) - } - name -} - -tidy_names <- function(name) { - name[is.na(name)] <- "" - append_pos(name) -} - -append_pos <- function(name) { - need_append_pos <- duplicated(name) | name == "" - if (any(need_append_pos)) { - rx <- "[.][.][1-9][0-9]*$" - has_suffix <- grepl(rx, name) - name[has_suffix] <- gsub(rx, "", name[has_suffix]) - need_append_pos <- need_append_pos | has_suffix - } - - append_pos <- which(need_append_pos) - name[append_pos] <- paste0(name[append_pos], "..", append_pos) - name -} From 134b0444da3491300214acaf042d1d8c9bd9bc4b Mon Sep 17 00:00:00 2001 From: krlmlr Date: Mon, 1 Apr 2024 15:53:46 +0000 Subject: [PATCH 2/3] Auto-update from GitHub Actions Run: https://github.com/r-dbi/RPostgres/actions/runs/8510247012 --- DESCRIPTION | 1 - 1 file changed, 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index c059dc3c..5d7976fd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -101,7 +101,6 @@ Collate: 'dbWriteTable_PqConnection_character_data.frame.R' 'default.R' 'export.R' - 'names.R' 'quote.R' 'show_PqConnection.R' 'sqlData_PqConnection.R' From a69fce026e16d929938b51a6f8a3eaa49dbbd646 Mon Sep 17 00:00:00 2001 From: krlmlr Date: Tue, 2 Apr 2024 01:35:40 +0000 Subject: [PATCH 3/3] Bump version to 1.4.6.9006 --- DESCRIPTION | 4 ++-- NEWS.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5d7976fd..377bd1d8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: RPostgres Title: C++ Interface to PostgreSQL -Version: 1.4.6.9005 -Date: 2024-01-24 +Version: 1.4.6.9006 +Date: 2024-04-02 Authors@R: c( person("Hadley", "Wickham", role = "aut"), person("Jeroen", "Ooms", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 6967ac70..59000d05 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,40 @@ +# RPostgres 1.4.6.9006 (2024-04-02) + +## Bug fixes + +- `dbWriteTable()` correctly handles name clashes between temporary and permanent tables (#402, #431). + +- Fix `dbQuoteIdentifier()` for `Id()` objects to no longer rely on names (#460). + +## Features + +- Breaking change: Avoid appending a numeric suffix to duplicate column names (#463). + +## Chore + +- Refactor `dbListTables()` et al. (@dpprdan, #413). + +- Refactor `list_fields()` (#462). + +- Use `Id` in `exists_table()` (#461). + +- Add Aviator configuration. + +## Documentation + +- Use dbitemplate (@maelle, #456). + +## Testing + +- Test for columns in `dbQuoteIdentifier()` (@dpprdan, #263, #372). + +## Breaking changes + +- Breaking change: Avoid appending a numeric suffix to duplicate column names (#463). + + # RPostgres 1.4.6.9005 (2024-01-24) - Internal changes only.