Skip to content

Can't use rows_*() for Postgres inside a transaction #1183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mgirlich opened this issue Mar 9, 2023 · 0 comments · Fixed by #1184
Closed

Can't use rows_*() for Postgres inside a transaction #1183

mgirlich opened this issue Mar 9, 2023 · 0 comments · Fixed by #1184

Comments

@mgirlich
Copy link
Collaborator

mgirlich commented Mar 9, 2023

library(dbplyr, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)

con <- DBI::dbConnect(RPostgres::Postgres())

# the table must be big enough to trigger this issue...
DBI::dbWriteTable(
  con,
  "df_x",
  tibble(a = 1:100e3, b = 2, x = "a"),
  temporary = TRUE
)

DBI::dbWithTransaction(
  con, {
    dbplyr:::get_col_types(con, "df_x", rlang::current_env())
    DBI::dbGetQuery(con, "SELECT * FROM df_x LIMIT 1")
  }
)
#> Error: Failed to prepare query: ERROR:  current transaction is aborted, commands ignored until end of transaction block

Created on 2023-03-09 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant