-
Notifications
You must be signed in to change notification settings - Fork 562
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
Long error message get truncated #747
Comments
Increasing it in pyODBC won't help because there's another fixed-size buffer in the driver manager - I believe it is either 1k or 512 too. The real issue is with the driver returning excessively long error messages, if it is more than SQL_MAX_MESSAGE_LENGTH (that corresponds to the fixed-size buffer in the DM) it should be splitting them into multiple records. |
Ok, that I didn't know. Thanks for the information. A question to understand ODBC a bit better, I think, I saw that multiple records get concatenated with ";" in between which would indicate they are different error messages. Are records usually meant to be different error message? |
pyODBC will concatenate multiple error records together, since the driver can post more than one for each API call (and as mentioned, should do so if the total error message exceeds the limit.) |
Thanks. Hopefully, a last question. Line 269 in a3693bf
|
Looks like it doesn't, to work around a different ODBC driver's bug. Maybe @mkleehammer can consider making these workarounds optional/configurable. |
Just for info, the comment in the code was put there 11 years ago, so perhaps unixodbc and/or the Postgres drivers have been fixed by now to prevent those crashes from happening. Maybe the restriction doesn't apply anymore. |
I see a ton of issues about error messages here in PyODBC. #489 #640 . I think as mentioned in #489, driver awareness/dialecting would be useful for a number of scenarios. In this case, only call once if on windows with a postgres driver of a version that is broken--instead of crippling PyODBC for all OS/Driver Combos. Many drivers are broken in unique ways. Some drivers are closed source and others are like moving a glacier to get fixed. So, being able to react based upon OS, ODBC driver manager, and ODBC DB driver would allow for workarounds of these sorts. PyODBC is great, but it could be much better if these sort of issues could be worked around--hopefully driving further adoption of ODBC in general. |
This may be addressed and/or fixed with PR #881 . |
#881 has been merged. If this particular problem persists then please re-open. |
Environment
Issue
Observed behavior:
Expected behavior:
Suspected cause:
I also attached the odbc log of the driver in case it helps: exaodbc.log.
pyodbc/src/errors.cpp
Line 250 in a3693bf
Proposed solution:
I might try to build a test version of pyodbc with a large buffer to test this theory. If you need more information don't hesitate to contact me.
The text was updated successfully, but these errors were encountered: