Skip to content

db2: Fix exception during temp table lookup #910

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion R/driver-db2.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
tryCatch({
dfTempTables <- dbGetQuery(conn, query)
# NULL as colname is not well liked by DB2 it seems. Hack here.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# NULL as colname is not well liked by DB2 it seems. Hack here.
# NULL as colname is not well liked by DB2 it seems. Hack here. (#905).

This will provide a clickable link in RStudio/Positron, making for easier navigation to the relevant GitHub archaelogy.

dfTempTables$table_remarks <- NA_character_
if (nrow(dfTempTables)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (nrow(dfTempTables)) {
if (nrow(dfTempTables) > 0) {

I admit that we don't apply this consistently throughout the repo, but I tend to prefer not leaning on the "positive number evaluates to TRUE" in if statements" trick, and this seems to be the norm in the tidyverse.

dfTempTables$table_remarks <- NA_character_
}

Check warning on line 73 in R/driver-db2.R

View check run for this annotation

Codecov / codecov/patch

R/driver-db2.R#L71-L73

Added lines #L71 - L73 were not covered by tests
}, odbc_database_error = function(e) {
cli::cli_warn("Unable to query for temporary tables in SYSIBMADM.ADMINTEMPTABLES")
})
Expand Down
Loading