Description of problem: The convert_from_pgbinary functions in convert.c for the Postgre7.1 and PostgreSQL drivers in unixODBC handle \nnn octal quoting, but they fail to handle \\ for quoting of the backslash character. I have been assured by a local user that it should be doing so, but I have not independently confirmed this. Version-Release number of selected component (if applicable): 2.2.11-7.1. Bug applies to straight upstream 2.2.11 as well as newer 2.2.12. I'm attaching a patch for both versions. Unfortunately, I do not have a recipe for reproducing the problem at this time. The patch is "obvious", but I cannot guarantee that it is correct. I am not myself a user of unixODBC. I am reporting this bug on behalf of another user. I can say that we have been running in production with this patch for two years. Ideally, someone should forward this bug report to unixODBC upstream. I may try to do that myself if I can find out how. The best way seems to be with an email message. I'm attaching two patches. One applies cleanly to 2.2.11 (the version in RHEL), and the other applies cleanly to 2.2.12, the latest upstream version, released in 2006.
Created attachment 312828 [details] patch relative to 2.2.11
Created attachment 312829 [details] patch relative to 2.2.12
I've really got no interest in fixing the built-in postgres (and mysql) drivers in unixODBC; they are horrendously obsolete and unmaintained, and I believe upstream is just going to rip them out in their next release. You should be using the separately distributed postgresql-odbc package, instead. See the package description for unixODBC.
Thanks for this helpful response. I had overlooked this information. I'll try to find the person who made the patch and get them to switch to the external postgres odbc drivers. Feel free to close this if you wish. I also emailed the patch to the unixODBC-dev mailing list, so we'll see what they do. If there are better postgres and mysql drivers, I hope they will drop the built-in ones since it obviously causes confusion.
I have checked the source code for postgresql-odbc and have verified that bug fixed by these patch is in fact fixed in that code, and it is fixed in exactly the same way. I would say that this both confirms the correctness of the patch and its irrelevance. I will leave this bug open for the moment, however, suggesting that the patch either be included in the unixODBC rpm or the drivers be dropped entirely. However, if someone decided to ahead and mark this as WONTFIX, I would consider that a suitable resolution under the circumstances.
I am sorry, but it is now too late in the RHEL-5 release cycle. RHEL-5.10 (the next RHEL-5 minor release) is going to be the first production phase 2 [1] release of RHEL-5. Since phase 2 we'll be addressing only security and critical issues. As per comments #3 and #5, I am closing the bug as WONTFIX.