From 72ebe0143047d7354d7da7e7ac337ccd547d04f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 26 Sep 2021 23:21:52 +0200 Subject: [PATCH 1/2] Use immediate = TRUE for running initial queries --- R/PqConnection.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/PqConnection.R b/R/PqConnection.R index a2ca894a..f40b28d3 100644 --- a/R/PqConnection.R +++ b/R/PqConnection.R @@ -204,13 +204,13 @@ setMethod("dbConnect", "PqDriver", on.exit(dbDisconnect(conn)) # set datestyle workaround - https://github.com/r-dbi/RPostgres/issues/287 - dbExecute(conn, "SET datestyle to iso, mdy") + dbExecute(conn, "SET datestyle to iso, mdy", immediate = TRUE) if (!is.null(timezone)) { # Side effect: check if time zone valid - dbExecute(conn, paste0("SET TIMEZONE = ", dbQuoteString(conn, timezone))) + dbExecute(conn, paste0("SET TIMEZONE = ", dbQuoteString(conn, timezone)), immediate = TRUE) } else { - timezone <- dbGetQuery(conn, "SHOW timezone")[[1]] + timezone <- dbGetQuery(conn, "SHOW timezone", immediate = TRUE)[[1]] } # Check if this is a valid time zone in R: @@ -224,7 +224,7 @@ setMethod("dbConnect", "PqDriver", conn@timezone <- timezone conn@timezone_out <- timezone_out - conn@typnames <- dbGetQuery(conn, "SELECT oid, typname FROM pg_type") + conn@typnames <- dbGetQuery(conn, "SELECT oid, typname FROM pg_type", immediate = TRUE) on.exit(NULL) conn From 0fe0bac61d59d98795c30a23fca999b1b65f3875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 Dec 2021 15:14:07 +0100 Subject: [PATCH 2/2] Unrelated: skip reason --- tests/testthat/test-checkInterrupts.R | 2 ++ tests/testthat/test-immediate.R | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/tests/testthat/test-checkInterrupts.R b/tests/testthat/test-checkInterrupts.R index d46ecbfc..d2ccccb2 100644 --- a/tests/testthat/test-checkInterrupts.R +++ b/tests/testthat/test-checkInterrupts.R @@ -9,6 +9,8 @@ test_that("check_interrupts = TRUE works with queries > 1 second (#244)", { test_that("check_interrupts = TRUE interrupts immediately (#336)", { skip_if_not(postgresHasDefault()) skip_if(Sys.getenv("R_COVR") != "") + + # https://github.com/r-lib/processx/issues/319 skip_on_os("windows") session <- callr::r_session$new() diff --git a/tests/testthat/test-immediate.R b/tests/testthat/test-immediate.R index 812b94f6..232fe553 100644 --- a/tests/testthat/test-immediate.R +++ b/tests/testthat/test-immediate.R @@ -108,6 +108,8 @@ SELECT 1 AS a test_that("immediate with interrupts after notice", { skip_if_not(postgresHasDefault()) skip_if(Sys.getenv("R_COVR") != "") + + # https://github.com/r-lib/processx/issues/319 skip_on_os("windows") session <- callr::r_session$new() @@ -153,6 +155,8 @@ $$ test_that("immediate with interrupts before notice", { skip_if_not(postgresHasDefault()) skip_if(Sys.getenv("R_COVR") != "") + + # https://github.com/r-lib/processx/issues/319 skip_on_os("windows") session <- callr::r_session$new()