Open lschneiderbauer opened 3 weeks ago
Huh. Thanks for the thorough issue description!
Triple checking the cli inline markup here (and that it's tested thoroughly) and not seeing anything that jumps out to me. I'm wondering if there's some nonstandard formatting in the driver message from Hana DB that introduces issues with cli. Trying to inline some numbers in different substitutions to trigger that "unexpected numeric constant" error but no dice.
Could you please run the following code before your code that triggers the error and then paste your console output here?
library(odbc)
testthat::local_mocked_bindings(
rethrow_database_error = function(msg, call = "") {
print(dput(msg))
print(call)
invisible()
},
.package = "odbc"
)
Hi, my apologies for the delayed response.
I managed to get a sample, I censored IP adresses, session IDs and the SQL statement itself in the hope that those parts don't contain the crucial bits.
"nanodbc/nanodbc.cpp:1722: S1000\n[SAP AG][LIBODBCHDB DLL][HDBODBC] General error;403 internal error: Error opening the cursor for the remote database <***.***> [SAP AG][LIBODBCHDB SO][HDBODBC] Connection not open;-10807 Connection down: [89013] Socket closed by peer {***.**.*.**:***** -> ***.**.***.**:***** TenantName:(none) SiteVolumeID:1:3 SiteType:PRIMARY ConnectionID:****** SessionID:************}\n \n<SQL> 'SELECT DISTINCT\n \"po_id\", ***CENSORED*** \n'"
[1] "nanodbc/nanodbc.cpp:1722: S1000\n[SAP AG][LIBODBCHDB DLL][HDBODBC] General error;403 internal error: Error opening the cursor for the remote database <***.***> [SAP AG][LIBODBCHDB SO][HDBODBC] Connection not open;-10807 Connection down: [89013] Socket closed by peer {***.**.*.**:***** -> ***.**.***.**:***** TenantName:(none) SiteVolumeID:1:3 SiteType:PRIMARY ConnectionID:****** SessionID:************}\n \n<SQL> 'SELECT DISTINCT\n \"po_id\",\n ***CENSORED*** \n'"
[1] ""
When a query fails in
DBI::dbGetQuery()
a useless error message is shown instead of quoting the error message that is issued by the remote data base:Since the error depends on the remote system (HANA DB) and a failing query the issue is hard to reproduce, so I cannot share a useful reprex.
It looks like some problems when parsing the remote error message (see https://rlang.r-lib.org/reference/topic-condition-formatting.html#transitioning-from-abort-to-cli-abort-) in this code piece: https://github.com/r-dbi/odbc/blob/bd6686766a503dc69040d19e99c03a9ad3a73967/R/utils.R#L162-L178
Stack trace