# psqlODBC release notes

## psqlODBC 09.03.0400 Release

Changes:

1. Rip out broken retry/timeout logic in SOCK_wait_for_ready.
At a quick glance, the logic looked like retry with progressive timeout, but it was horribly broken. First of all, the timeout was only used if retry_count was passed as 0. And in that case, the timeout was 0. So retry_count == 0 actually meant "check if data can be read/written without blocking", while retry_count > 0 meant "sleep until data is available". There was also some code to handle retry_count < 0, but that was dead code because none of the callers passed a negative value. The hardcoded max. retry count of 30 retries was quite bogus too. Filling the output buffer more 30 times is not necessary an error, and it's not clear that the ssl library could not return SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE more than 30 times. Unlikely, yes, but possible. So, just rip out the retry_count and progressive timeout logic. Replace the retry_count argument with a simple "should block?" argument. I didn't dare to remove the condition that we always wait if SSL is enabled, although I don't understand that at all. But perhaps there's some well-hidden reason for that. Per report from Prakash Itnal, although this just removes the broken code, and won't enable the kind of a timeout that he wanted.
2. Clean up Windows makefiles.
Get rid of the CPU and CPUTYPE variables in win64.mak. Instead, assume that the TARGET_CPU variable has been set correctly in the environment. TARGET_CPU is set by "setenv" script that comes with the Microsoft Visual Studio C compiler package. It never worked to pass a "CPU=x86" and using a x64 compiler, for example, so seems better to determine the correct target from the environment, than fail with a cryptic error message if the CPU argument and the environment don't match. To build 32-bit binaries with win64.mak, simply do "setenv /x86" before running "nmake -f win64.mak". Similarly, to build 64-bit binaries, use "setenv /x64". It should now be possible to build both 32-bit and 64-bit binaries with win64.mak. Ideally, we could now remove win32.mak altogether, but there are small differences between win64.mak and win32.mak in the build options that they use. I don't understand the differences enough to dare to remove win32.mak yet. The CPU=AMD64 alias for x64 is no longer supported (as the whole parameter is now gone). Also do whitespace & other cosmetic fixes to win32.mak and win64, to make them more similar. This helps when comparing the two with "diff". Remove remains of the long-gone "MULTIBYTE" setting (it was misspelled in win64.mak, anyway)
3. Fix crash if connection is closed while sending a query to the server.
Some functions reset conn->sock to NULL on a socket error, so we must not keep a copy of it in a local variable. Also, SOCK_get_id should check for NULL argument like all the rest of the SOCK_get/put_* functions.
4. Rewrite the conversion functions between strings and SQL_NUMERIC_STRUCT.
Aside from making the functions more readable and faster, this fixes a number of bugs:

1. When converting a large number from decimal to binary, the least significant byte might be wrong.
   reported by Walter Couto.
2. In binary->decimal conversion, a number with small precision but large scale caused a "Floating point exception".
3. In binary->decimal conversion, building the final string was wrong, picking up "digits" from outside the reserved stack space, if scale was larger than 40
4. The param_string buffer allocated for the result of binary->decimal conversion was too small.

Also add a test cases for all of these bugs.
5. Fix ODBC function escape for SPACE function.
6. Make sure that the psqlodbc ANSI driver is ODBC3.5.
7. Register 64bit XA DLL on installation
Changes by a patch from Craig Ringer
8. Fix potentially uninitialized local pointer access which causes.
fatal compilation errors on vs2012/2013 reported by Craig Ringer.
9. Fixed ctype_length() is missing the length for SQL_C_BIGINT and SQL_C_NUMERIC.
patch by John Smith.
10. Fix access to unallocated memory in IAsyncPG.
IAsyncPG was deleting its self, then returning an instance variable by value. This is probably going to be safe pretty much all the time, but it's still a memory error, and DrMemory (a Windows valgrind-alike)
11. SQL_NUMERIC_STRUCT was not available until ODBC 3.0.
Also add a prototype for ResolveNumericParam for readability.
12. Increase digits used to convert from REAL/DOUBLEs to strings so that the reverse conversions can recover original values.
Patch originally by John Smith.
13. Clear errors for prepared statement for subsequent exections.
14. Fix the problems using SQLFetch on prepared INSERT with RETURNING clause.
reported by John Smith.
15. Fix use of server-queried version before connection.
psqlODBC attempted to use the version that's queried from the server before it was obtained from the server during the connection setup. Because the server version is initialized to 0.0, tests for "server version >= 7.4" or "server version >= 6.4" using the PG_VERSION_LT macro were always returning false. Instead, use PROTOCOL_64 and PROTOCOL_74 tests against conninfo. These don't offer any "greater than" form, so just test both. There's little point adding anything prettier when it can all be removed when v1/v2 protocol support is removed soon anyway. The main symptom of this issue was that psqlODBC was sending an invalid protocol message for the v3 protocol, "Q \0", causing the server to wait for the second half of the length word forever. At connection close, the server would emit:
unexpected EOF within message length word
This issue was observed while tracking down problems with XA transactions in MSDTC failing to commit after a successful prepare because an isolated tx created via getLockedXAConn() got stuck here, but is not confined to that problem.
16. Don't use PG_VERSION_xx() macros in original_CC_connect().
it's not obtained from the server yet. This may fix another cause of the problem Craig Ringer reported.
17. Fix bug in SQLCancel().
If one thread was busy executing a savepoint statement, while another thread calls SQLCancel() on the statement, SQLCancel() would try to release the locks held by the other thread. That's extremely racy; if the other thread tries to increment/decrement the lock_CC_for_rb counter at the same time, we could end up releasing the lock to many times or too few times. Also, releasing a pthread mutex from a different thread than the one who acquired it is undefined behavior. AFAICS the DiscardStatementSvp() call in SQLCancel() can be safely removed. It's outright wrong and dangerous if the statement is busy executing in a different thread, and the other codepaths in PGAPI_Cancel() already call DiscardStatementSvp(). Bug report by Jade Koskela.
18. Fixes a NULL pointer dereference occurring when connecting.
using SSPI authentication (without kerberos, a local Windows user trying to connect to postgres instance on same host). Patch originally by Nikhil R Deshpande.
19. Fix bug with UseDeclareFetch=1 when a transaction is committed before fetch.
If a server cursor is closed before the application has fetched any rows from the result set, the "base" of the result set's cached rowset was off-by-one. Also add a regression test for the same. This fixes the bug reported by Jan-Peter Seifert.
20. Fix driver name mismatch between 32-bit ODBC app and 64-bit MSDTC host.
If the 32-bit driver runs on a 64-bit host within a 32-bit app running under SysWow64 then XA transactions will fail to recover. That's because recovery is done by pgxalib.dll which runs with in MSDTC.exe - a 64-bit application. It connects to a DSN supplied by psqlODBC in EnlistInDtc_1pipe during DTC enlistment by the XA resource manager. This DSN uses the driver name of the client's ODBC driver - which is fine so long as the client and MSDTC architectures match. If they don't then MSDTC will fail to connect to Pg, so it'll never resolve transactions. Traces of MSDTC will show RM_COMMIT_DELIVERY_FAILED_DUE_TO_CONNECTION_DOWN events. Traces of pgxalib.dll will show xa_recover(..) being entered, followed by "SQLDriverConnect return=-1".
21. Remove PgDtc_set_property(.., prepareRequestded, 0) which causes a crash in case PREPARE TRANSACTION error.
The property prepareRequested isn't set anywhere.
22. Add KeepaliveTime and KeepaliveInterval options to specify time or interval for keepalive.
23. Fix a memory leak check qresult.
Per report by Pluto Cobain.
24. Get rid of copy and paste code in installer/ and unify them.
The powershell scripts had lots of duplication. Make the unified code instead. Original patch was provided by Craig Ringer.
25. Clear unused stuff from PgDtc_isolate() function.
Also add CC_initialize_pg_version() call after CC_copy_conninfo() so as to avoid the trouble caused by early PG_VERSION_xx() calls.
26. Fix race condition in getting the current decimal separator.
The code to get the current decimal separator was not thread-safe. If two threads concurrently saw that the locale had changed, they might both try to free() the same string. This isn't a perfect fix, there's still a race condition if a thread changes the locale while another thread is running the psqlodbc code. But at least this eliminates the race condition when the locale was changed earlier, not concurrently, and even if it is changed concurrently, this is less likely to crash, depending on the way localeconv() is implemented in libc.
27. Fix bug in building an abbreviated connection string.
Introduced by the keepalive-patch, which accidentally removed a line from sprintf format string. Caught by a compiler warning.
28. Fix buffer overflow in SQLGetData.
If a PostgreSQL timestamp column is fetched using SQLGetData, into a SQL_C_CHAR output variable, with size of 20-22 bytes, the driver might overrun the buffer by a few bytes with unusual timestamp values, with year < 0 or > 10000. While at it, fix the truncation behavior for date/time/timestamp values so that if the output buffer is too small, we still write what fits and truncate, instead of writing nothing. This is something that one might do on purpose, e.g. if you only want to fetch the year part of a date, you might call SQLGetData() on a date column, with only 4 bytes long output buffer. (although we haven't heard any complaints from the field). Also, if the output buffer is of type SQL_C_WCHAR, but the buffer length is odd, and we have to truncate, we didn't NULL-terminate the string. Using an odd-sized buffer with SQL_C_WCHAR is a pretty unlikely thing to do, but nevertheless I think this is more correct behavior.
29. The function SC_setInsertedTable() prepares an info for subsequent 'select @@IDENTITY' command.
Take table name like catalog.schema.table into account in the function. Fix the bug reported by Phillippe Champignon.
30. Improve pgxalib.dll(MSDTC support).

1. Add an option which lets xa_open() try to connect to the database immediately. This would cause an error at enlistment in dtc when the authentication method depends not only on the db user but also on the OS user, which means the automatic transaction recovery is unavailable.
2. Log the error message in case of SQLDriverConnect() error.
3. Improve the logging.

31. Fix the regkey search bug when XARMcreate() causes an error at enlistmentvin DTC.
32. Additonal improvement on MSDTC enlistment.
Unfortunately the current pgxalib.dll can't recover transactions which use sslmode verify-[ca|full] or whose authentication is SSPI, certificate or ident. When MSDTC.exe tries to connect to PostgreSQL it does so under Windows user NETWORKSERVICE, which won't match the username the original user connected to PostgreSQL as. So PostgreSQL will reject the connection.
33. Fix SQLTables column names to be ODBC version 3 compliant.
In ODBC3, TABLE_QUALIFIER was renamed to TABLE_CAT, and TABLE_OWNER to TABLE_SCHEM. Per report David Hedberg.
34. Add a new dialog page to the setup program and allow the setting of PREFERLIBPQ and XAOPT option.
35. Add a powershell script buildBootStrapper.ps1 which builds bootStrapper program with some optional parameters.
Quote the version number of bootstrapper from the configuration xml file unless specified. Also change the name of 32bit MSI in the bootstrapper according to changes of 32bit installer build system. Change buildInstallers.ps1 build the bootstrapper together. Change ALLUSERS from "2" to "1" of the 64bit installer.

## psqlODBC 09.03.0300 Release

Changes:

1. Fix implicit casts between SQLCHAR and char. Don't rely on -Wno-pointer-sign.
2. Pass the argument to isalpha/isspace etc. routines as unsigned char.
Per the C standard, the routine should be passed an int, with a value that's representable as an unsigned char or EOF. Passing a signed char is wrong, because a negative value is not representable as an unsigned char. Unfortunately no compiler warns about that.
3. Use "function(void)" instead of "function()" to declare 0-arg functions.
"function(void)" is the correct syntax in a function declaration, although in practice compilers accept the latter too. It's OK in a function definition, but change those too for consistency. This fixed by Michael Paquier.
4. Add missing function declarations.
These are not actually used outside of pgtypes.c, but let's be consistent and declare them in pgtypes.h This fixed by Michael Paquier.
5. Use the PG_CONFIG setting from ./configure cmd line in regression tests.
If compiling without libpq (configure --without-libpq), then you still need to have pg_config in path to build the regression tests, or specify PG_CONFIG at the make command line.
6. Add more test cases.
Add a new test case to test ODBC functions deprecated in ODBC 3.0, ODBC catalog functions, SQLGetConnectOption and Avoid deprecated SQLAllocStmt/SQLFreeStmt in regression tests. and more. Per Michael Paquier
7. Don't clear error number when SQLGetDiagRec is called.
Calls to SQLGetDiagRec are supposed to be nondestructive, per ODBC spec. Also add a test case for that.
8. Fix two UseDeclareFetch bugs.

1. NOTICE messages were not delivered to the application, if they arrived as response to the DECLARE CURSOR statement.
2. Array-bound parameters on SELECT-queries caused a "cursor already open" error.

These bugs were found by running the regression suite with UseDeclareFetch=1. It's now clean.
9. Fix crash if connection is closed during CC_send_query_append function.
This fixed Malcolm MacLeod

## psqlODBC 09.03.0210 Release

Changes:

1. SSL verify[-(ca|full)] is avaiable since 8.4.
There seems no need to check it. Also there's no need to call lt_dlopen currentl y.
2. Update EXTRA_DIST in Makefile.am
Files for the new lfconversion test case were missing.
3. Fix locking in SC_set_prepared
added ENTER/LEAVE_CRIT_CS calls in SC_set_prepared.
4. Add test case for CTE queries (WITH ...)
None of the existing test cases covered that. This test case gives a different e rror message than the original one, but it'sthe same underlying issue.
5. Silence compiler warning.
SQLGUID format and conn_settings cannot be NULL.
This fixed by Michael Paquier.
6. Fixed POSTGRES_RESOURCE_VERSION variable.
Pass the content of POSTGRES_RESOURCE_VERSION variable to the resource compiler correctly so that FileVersion and ProductVersion are properly set.
7. Change regression test positioned-update
Use "exit(1);" instead of "return;" to exit from main().
This fixed by Michael Paquier, at least some compiler on OS X didn't like it.

## psqlODBC 09.03.0200

Changes:

1. Set TCP keepalive by default.
2. Fix cursors test case on big-endian systems.
The SQL_CURSOR_COMMIT_BEHAVIOR property is a SQLUSMALLINT, not SQLUINTEGER. On a little-endian system, you wouldn't notice, provided that the target variable was initialized to 0 before the SQLGetInfo call.
Per report from Christoph Berg that the cursors test was failing on mipsel and other big-endian architectures.
3. Add regression test for SQLBindCol.
We were already doing SQLBindCol as part of the positioned-update test, but seems good to have one explicitly for it.
4. The driver takes SQL_C_LONG to mean SQLINTEGER rather than "long".
The regression test was failing on the s390x architecture because of that.
It's big-endian, with sizeof(long) == 8.
5. Revert "When LF->CR+LF conversion causes an buffer truncation, supress the conversion (in case of unicode)."
6. Refactor utf8_to_ucs_lf.
A macro is difficult to debug, so turn it into a regular function.
Also, add a new test case for LF->CR+LF conversion, to test the bug that Nils Go"sche reported (which was already fixed).
7. Add locking to SQLFreeStmt and SQLFreeHandle.
This fixes a race condition, where SQLFreeStmt is called while the connection is busy executing another statement.
SC_set_prepared would see that the connection is busy (CONN_EXECUTING), and not issue a DEALLOCATE statement to free the prepared statement in the backend, leaking it.
8. The 2dn argument of SC_set_prepared() is int(enum) not BOOL.
9. Change to supply non-NULL parameters for SC_set_error().

## psqlODBC 09.03.0100

Changes:

1. Fix uninitialized use of 'allocbuf' variable, in case of out-of-memory.
Compiler warned about this. If ENLARGE_NEWSTATEMENT macro ran out of memory, it would jump to cleanup routine.
The cleanup would check if allocbuf isNULL, and try to free() it if not.
allocbuf needs to be initialized to NULL before the first ENLARGE_NEWSTATEMENT macro invocation.
2. SQL_C_SLONG stands for SQLINTEGER not long.
3. Change SQL_ATTR_PARAMS_PROCESSED_PTR attribute which is set by SQLSetStmtAttr() from (SQLUINTEGER *) to (SQLULEN *).
This fixes the bug reported by Christopf Berg.
Also verify similar attributes which were changed from SQL(U)INTEGER (*) to SQL(U)LEN (*) when 64bit ODBC was introduced.
4. Reduce the memory usage of ConnectinClass objects by changing their large fixed length text fields to variable ones.
Because changes are applied to percent-encoded fields this time, password field is also a target of this.
5. Revise MSDTC support.
Remove pointlessly complicated AsyncThreads stuff. Instead use _beginthread() to clean up threads.
Make pgenlist.dll from the structure change of ConnectionClass.
The driver dlls exports the functions described in connexp.h which are used by pgenlist.dll.
Isolate the current communication path if necessary.
While an IAsyncPG object is alive, a ConnectionClass object (hereinafter refered to as conn-obj) is assigned to it.
The assignment has to be changed in the following cases.

1. SQLDisconnect() is called for the current connection handle which is assigned to an IAsyncPG object.
Allocate another conn-obj and move the current communication path (*sock* member of the current conn-obj) to the new conn-obj. The communicaation path is lost from the current conn-obj and the new conn-obj is assigned to the IAsyncPG object.
2. Another (global) transaction is about to begin but the current global transaction is not PREPARED yet.
Same as case a) but will open a new communication path for the current conn-obj for the subsequent ODBC API calls.
3. Another (global) transaction is about to begin and the current global transaction is already PREPARED.
Allocate another conn-obj and open a new communication path for the conn-obj. The new conn-obj is assigned to the IAsyncPG object only to issue COMMIT/ROLLBACK PREPARED command. communication pass (*sock* member of the current ConnectionClass object) to the new object and change the state of the current object NOT CONNECTED. The IAsyncPG object uses new object instead of the current object. In case b) the current object will open a new communication path.

6. Ignore automatically-generated files in source code with .gitignore.
This is useful to prevent accidental commit of files that are not wanted in the remote repository.
The original patch was provided by MichaelPaquier. I also added files genearated by VC build tools or WIX tools to .gitignore.
7. The first cut of psqlodbc setup project. It builds a setup program which can't be done by a single MSI.
It would install VC++ redistributable, 32 bit psqlodbc driver and 64 bit psqlodbc driver (on 64 bit windows).
8. Change the configure.ac

1. Change checking SIZEOF_LONG not SIZEOF_LONG_INT.
2. with_xxxxx (xxxxx is the package name) variables directly instead of the withval variable.
3. Improve the help message of configure script.
4. Stop linking lib(i)odbc library because the library is unnecessary and rather harmful.
Per report from Pavel Raiskup(postgresql.org/message-id/1769926.65KUyECjFr@nb.usersys.redhat.com).
5. Move -Wall -Wno-pointer-sign CFLAGS option specified in Makefile.am to configure.ac.
6. ODBC_CONFIG is set when neither unixODBC nor iODBC is explicitly specified.

9. Silence misc compiler warnings. Also a few comment typo and whitespace fixes.
10. CC_Copy is needed if _HANDLE_ENLIST_IN_DTC_ is used, regardless of CLEANUP_CONN_BEFORE_ISOLATION.
That caused compilation on Windows to fail.
11. Remove some dead code.(SOCK_clear_error, SOCK_skip_n_bytes)
12. Handle turning standard_conforming_strings to off in mid-session.
We already watched for a ParameterStatus response indicating that standard_conforming_strings was turned on, and acted accordingly, but if it was turned off, we did nothing.
13. Remove common.o on "make clean"
14. Change the default for UseServerSidePrepare to 1.
The docs have recommended UseServerSidePrepare=1 for server versions 7.4 onwards, so it seems prudent to change the default so that people don't needto remember to specify it manually.
With UseServerSidePrepare=1, the "insertreturning" regression test case behaves better, ie.
SQLNumResultCols() correctly returns the number of columns for an INSERT RETURNING statement, even when called before SQLExecute().
15. Remove useless 'sync' parameter from prepareParameters() function. It was always passed as TRUE.
16. Don't issue a BEGIN when running VACUUM in auto-commit mode.
Normally in auto-commit mode the driver begins a new transaction implicitly at the first statement, by sending a BEGIN statement. However, some commands, like VACUUM, cannot be run in a transaction block, and you will get an error like "VACUUM cannot run inside a transaction block" from the server. In UseServerSidePrepare=0 mode, the code looks at the first word of the query to determine if the statement is one of the special ones, and if so, didn't begin a new transaction even when auto-commit mode is disabled. However, in UseServerSidePrepare=1 mode, when using SQLPrepare/ SQLExecute to run the VACUUM, that check was not made. Fix that. There was one more related inconsistency between UseServerSidePrepare modes. Without server-side-prepares, if you issued an explicit BEGIN in auto-commit mode, the implicit BEGIN was ont sent. But without server-side prepares, it was. It seems best to send the implicit BEGIN in both cases, because then you get a warning from the backend about the second BEGIN. That's a good thing, because a sane ODBC application should be using the ODBC function SQLEndTran() for transaction control, not explicit BEGIN/COMMIT.
17. When LF->CR+LF conversion causes an buffer truncation, supress the conversion (in case of unicode).
18. Handle SSL client certificate authentication in Windows Schannel security support provider.
You have to place the certificate file postgresql.pfx (PFX or PKCS12 format) in %APPDATA%\postgresql folder instead of postgresql.crt and postgresql.key (I wasn't able to find the way to handle PEM format using Cryptography API unfortunately).
You can create the file using the following command.
openssl pkcs12 -export -in postgresql.crt -inkey postgresql.key -out postgresql.pfx (with empty password).
19. Change Windows installer build system for the next release.
Change to specify ProductCode for each version so as not to forget to change ProductCode in case of major version up. Remove VC runtime merge modules from the installer(runtime dlls will be installed via psqlodbc setup program).
[64bit version only] Use libpq by default Remove GSSAPI support by default
20. Concentrate the settings of Windows build system to an xml file and build binaries or installers with reference to it.
(configuration.xml) xml file to specify the setting of the build environment. It is automatically generated in winbuild folder as a copy of winbuild/configuration_template.xml when you invoke editConfiguration script firstly.
.winbuild/configuration.ps1 modules to handle the configuration file
.winbuild/editConfiguration.ps1 edit configuration file (GUI)
.winbuild/editConfiguration.bat same as above with a minimized console window
.buildx86.ps1 build 32bit binary
.buildx64.ps1 build 64bit binary
.installer/buildx86-installer.ps1 build 32bit installer
.installer/buildx64-installer.ps1 build 64bit installer
21. handle private keys of PEM form using CryptoAPI.
Certificates of PFX form are no longer needed for SSL client certificate authntication.
22. Fix a bug in CC_copy_conninfo() that free()s password item of input source unexpectedly.
Change CC_copy_conninfo() and copy_globals() so that they copy each item one by one.
23. Fix the newly-introduced CORR_STRCPY and CORR_VALCPY macros.
They were broken, did not compile. This fixed by Michael Paquier.
24. Add support for verify-ca/full sslmode using Windows Schannel Security Service Provider.
Root CAs must be installed into Windows Root certificate store beforehand.
25. VOID is not defined on all systems. Use void insted.
This fixed by Christoph Berg.
26. winres.h instead of afxres.h.
There are some cases (VS 2012 express etc) when afxres.h doesn't exist.
27. Avoid double-free() bug.
Spotted by Fortify static analysis tool.
28. Escape double-quotes in table name correctly.
When constructing the select/update/delete for current row in a rowset, and the schema or table name contained double-quotes, they were not correctly escaped in the constructed SQL statement. That lead to errors when doing positioned updates. Also, use snprintf and snprintf_add instead of sprintf and strcat in more places. Makes these things look less like buffer overflows to static analysis tools, and make for more readable code anyway.
29. Construct ctid string correctly for block no > 2^31.
Block number is unsigned. Other places where we construct ctid strings we got this right, but not this one. I'm not sure how to trigger this codepath, but I'm sure something funny would happen if you tried to use these functions on large enough tables (> 16 TB).
30. Fix buffer overflow in interval parsing.
Flagged by Fortify static analysis tool.
31. Check return value of stdup() for out-of-memory.
There are a lot of little bugs like this throughout the code, but it's start...
32. Replace calls to my_strcat and my_strcat with snprintf_add.
my_strcat didn't check for buffer overflow, which Fortify static analysis tool flagged as an issue.
33. Fix buffer overflow in handling of SQLTables params.
34. Use snprintf() instead of sprintf() for safety.
I believe these instances were in fact safe, because a cursor name has a maximum length.
35. bufferoverflowu.lib seems no longer needed in recent versions of VC environment.
removed it from win64.mak. Speocify CUSTOMLINKLIBS=bufferoverflowu.lib from the command line when it is neccessary in old VC environment.
36. Fix memset() call, meant to clear the whole struct.
Per compiler warning.(psqlodbc.c)
37. socket: speedup also ipv6 connection
Call getaddrinfo() with AI_NUMERICHOST if it is ipv4/ipv6 address. For that reason the inet_pton() is better than inet_addr().
This fixed by Pavel Raiskup
38. Call getaddrinfo() with AI_NUMERICSERV because the service is a port number.
39. Fixed lost mylog.h in Makefile.am.
This fixed by Pavel Raiskup

## psqlODBC 09.02.0100

Changes:
1.) Protect shared connection list when making cleanup tasks in EN_Destructor using the patch provided by Michael Kocherov.
2.) Fix a lot of compiler warnings. Most of them were harmless, but some pointed to real, but rare, bugs.
3.) Check SIZEOF_LONG_INT, rather than SIZEOF_VOID_P, when deciding whether SQLROWSETSIZE exists. That's consistent with unixodbc's sqltypes.h.
4.) Check BUILD_LEGACY_64_BIT_MODE instead of BUILD_REAL_64_BIT_MODE. This makes us choose correctly whether we're building a 32-bit or 64-bit version, when building with unixODBC version 2.2.13 or higher.
5.) Fix handling of some out-of-memory situations.
6.) Eliminate recursion when freeing result sets of queries with array-bound parameters. This avoids running out of stack space on SQLFreeHandle, and speeds it up considerably.
7.) Fix memory leak, e.g when SQLNumResultCols is called on a non-SELECT query. This was caused by unintentional multiple evaluation of macro arguments.
8.) Move psqlodbc website's main page, FAQ, and howto pages to a separate git repository. They are no longer included in psqldbc release tarballs.
9.) Fix bug with binding a 5-bytes long string as VARCHAR parameter, with UseServerSidePrepare=0 and BoolsAsChar=1. That combination produced an extra empty result set on execution.
10.) Make the MSI build process of 32bit drivers available in 64bit.
11.) Fix bug with DeUseDeclareFetch=1 and UseServerSidePrepare=1, issue COMMIT commands properly in case of AUTOCOMMIT on mode. per reported by Jack Wilson(ljwilson@digitalav.com).
12.) Don't #include errno.h on Windows. VC10 or later intentionally changed the values of error numbers like EINTR, EWOULDBLOCK.
13.) Allow special characters in the password value of a connection string by enclosing the value by braces({}).
14.) Fixed conflict between winsock2.h and winsock.h in socket.c.
15.)Apply blank date <-> null conversion functionality to timestamp type as well.
16.) Fix the *cursor XXXXXXXX already exists* error when handling *with cte* statements reported by Joe Conway.
17.) Fixed the problem *Segmentation Fault in Postgres server when using psqlODBC* reported by Joshua Berry.
18.) Fixed the problem *UseDeclareFetch=1, Fetch=100, UseServerSidePrepare=1 causes Windows client to intermittently hang* reported by Jack Wilson.

## psqlODBC 09.01.0200

Changes:
1.) Use int instead of size_t when condition >=0 is used.
2.) Add a necessary break in a switch statement etc.
3.) Fix missing constant(SQL_ATTR_PGOPT_FETCH).
4.) Fix a bug about reference count handling for columns info (Bug report by B.Goebel).
5.) Improve the handling of ARRAY type.
6.) Fix a compilation error etc when MULTITHREAD support is disabled.
7.) Don't discard the result of unnamed statements for later SQLDescribeCol or SQLColAttribute calls.(Bug report by Alexandre).
8.) Set rowstart_in_cache properly when closing eof cursors.(Bug report by Alexandre).
9.) Remove columns info of dropped tables ASAP.
10.) Fix the bug which causes a segfault in SQLSpecialColumns when table name is null string (bug report by Terrence Enger).
11.) Fix the bug that when the show OID column option is enabled, SQLColumns() returns "oid" column info even when the column name parameter which is different from "oid" is specified (bug report from Seifert, Jan-Peter).
12.) Take care of an environment variable PGKRBSRVNAME.

## psqlODBC 09.01.0100

Changes:
1.) SQLStatistics() sets 'D' for the collation column when an reverse index is used.
2.) Fix the bug that PostgreSQL's function calls in queries cause a crash on SQL Server linked servers.
3.) Fix the bug that the first fetch operation doesn't work properly when the operation is SQL_FETCH_ABSOLUTE or SQL_FETCH_LAST.
4.) Revise the handling of decimal point.
5.) Adjust the operations after closing eof-detected cursors.
6.) Before dropping the statement, sync and discard the response from the server for the pending extended query.
7.) Clear col_info(columns info) cache ehen DROP/ALTER TABLE is called so that later SQLDescribeCol() etc work properly.
8.) Improve the handling of BYTEA type.
9.) Don't clear the columns cache info when they are referenced.
10.) Correct the column size of interval types.

## psqlODBC 09.00.0310

Changes:
1.) Let SC_forget_unnamed() clear the result in case the statement is not executed yet. It would fix the bug reported by Silvio Brandani.
2.) Fix the bug that strings are copied to a null pointer.
3.) Don't clear the parsed plan in SC_recycle_statement().
4.) Now SQLDescribeCol() can detect the changes of column type or size.
5.) Handle *with or without oids* correctly.
6.) Take the environment variable into account.
7.) Use SOCK_get_next_n_bytes() instead of SOCK_get_next_byte().
8.) Add some driver specific options for SQLSetConnectAttr().
9.) Fix compilation errors in case ODBC 2.5.
10.) Fix compilation error on different ODBCVER.
11.) Correct the behavior of SQLSetConnectAttr() for the driver specific options.

## psqlODBC 09.00.0300

Changes:
1.) Don't propgate the connection level statment options to the internal statements. This fixes an infinite loop reported by Nelson Andre.
2.) Improved a mylog output.
3.) Fix the bug introduced by the previous change reprted by Adrien de Croy.
4.) Divide SC_returns_rows() macro into several categories and make SQLResultNumCols(), SQLDescribeCol() or SQLColAttribute() available
for insert/update/delete .. returning statements.
5.) Initialize flags member in QResultClass before calling QR_set_rowstart_in_cache() per report from Arno Moore.
6.) Applied a patch by Taizo Ito and correct the length of BIT type in Postgres.
7.) Change to read and skip the rest of result data when out of memory occurs while reading tuples so that we can continue to use the connection.
8.) Fix the bug that Access autonumber fields are not detected in 9.0.0200 reported by Arnaud Lesauvage.
9.) Convert large integer strings properly.
10.) Fix the trouble introduced by the change *Return 0 for the column size when the size of numeric items are unknown* per report from Marco Gaiarin.
11.) Remove a meaningless if clause. This had a problem with ltdl function.

## psqlODBC 09.00.0200

Changes:
1.) Fix a bug about sizeof() at idx_fake_oid of info.
2.) Return 0 for the column size when the size of numeric items are unknown.
Also improve the calculation of scale of numeric items when it is not explicitly specified.
3.) Change to use 'if' instead of an inappropriate 'else if' at cursor of convert.
4.) Remember to set permanent flag to holdable cursors on commit with no precedent rollback (to savepoint) operations.
This fixes a crash bug in case of cursor operations across transaction.
5.) Fix a bug about the handling of the SQL_RETRIEVE_DATA option.
Per report by Andreas.
6.) Fix cursor bug introduced by the previous change.
Per report by Andreas.
7.) Move the setting of folder name of libpq or gssapi related dlls from .wxs file to .bat file.
8.) Fix a bug which returns incorrect values for SQL_DATETIME_SUB.

## psqlODBC 09.00.0101

Changes:
1.) Fix build source of Windows 64bit environment.

## psqlODBC 09.00.0100

Changes:
1.) Allow password which contains special characters like {,},=,;.
2.) Add a new data source option which makes it possible to use Kerberos for Windows library to reply to GSSAPI authentication request.
3.) Native support for SSPI Kerberos or Negaotiate service. It may be useful for the 64-bit drivers.
4.) Fix an oversight of Memory overflow handling.
5.) Removed "#define SQL_WCHART_CONVERT" which causes a trouble on some platforms.
6.) Removed the use of misused strcat_s together with snprintf_s (bug report from Jap-Peter Seifert) and use strlcat instead of strncat.
7.) Fix a bug about pre-execute behavior in case of protocol v2 or earlier.
8.) Use poll() instead of select() when it's available.
9.) Take comments or line comments in a query into account.
10.) Fix a crash bug on authentication failures.
11.) Take --without-iodbc(unixODBC) configure option into account.
12.) Apply the patch by Peter Crabtree which fixes a crash bug.
13.) Improve the handling of bools_as_char case.
14.) Fix a bug when creating a connection string.
15.) Use pg_get_expr(adbin, ..) instead of unreliable adsrc in pg_attrdef so as to know the sequence name associated with serial items.
16.) Added 64-bit version of installer files.
17.) Introduce pgtype_attr_xxxx functions which take a typmod parameter as well as a type oid parameter as an extension of pgtype_xxxx functions so that SQLColumns and SQLDescribeCol(SQLColAttrinute) could use common functions.
18.) Call PQconnectdbParams instead of PQconnectdb when it's available.
19.) Make cursor open check at transaction end a little more effective.
20.) Added code for SQL_INTERVAL support and refcursor support though they are disabled.
21.) Correct the handling of dynamic cursors so that they are substituted by keyset-driven ones.
22.) Remove a compilation error and some compiler warnings under unixdODBC 2.3 environment.
23.) Make sure the support of the backward-compatibility version of getaddrinfo() family even when _WIN32_WINNT is supplied.
24.) Update win64.mak so that gssapi support is available without libpq.

## psqlODBC 08.04.0200

Changes:
1.) Fix a column uodatability problem reported by Tom Goodman.
2.) Display SSL mode list properly on setup dialog.
3.) Don't truncate the result of msgtowstr()/wstrtomsg().
4.) Implement ConfigDriver() function.
5.) check of the SQLLEN definition by the unixODBC version by SQLColAttribute.
6.) Take WITH cte staments into account.
7.) Fix a bug about UTF8 handling.
8.) Wait a ReadyForQuery Message after errors correctly.
9.) Fix a problem with {call procedure reported by Wolfgang Pasche.
10.) Cleanups about the handing of unnamed parsed statements and the handling of ODBC escape { .
11.)Link ws2_32.lib in case the compilation environment #defines _WIN32_WINNT and the value >= 0x0501.
12) Added --with(out)-libpq[=DIR} option to configure.
13) Revise autoconf/automake so that libpq/ssl header/libs are resolved at configure phase.
14) Use md5.c directly instead of win_md5.c.
15) Suppress some compiler warnings.
16) Fix memory leaks on connection failure (Shouji morimoto).
17) Suppress some compilation errors and warnings.
18) Fix SSL connection timeout.

## psqlODBC 08.04.0100

Changes:
1.) Avoid a crash on exit when using SSL connections by resetting CRTPTO_xx_callbacks before unloding libpq.
2.) Correct the funtion name DiscardRollbackState pointed out by Zoltan Boszormenyi.
3.) Correct the value of INDEX_QUALIFIER column which returned by SLQSTATISTICS();
4.) Take domain types into account in SQLColumns() (Thanks to Luiz K. Matsumura).
5.) Take RESTRICT actions into account in SQLForeignKeys() (report from Farid Zidan).
6.) Fix a bug that small negative decimal values are mistaken for non-negative (bug report from Dominic Smith).
7.) Use MSG_NOSIGNAL/MSG_NOSIGPIPE option on send()/recv() to avoid crash on SIGPIPE (bug report from Brian Feldman).
8.) Remove a spurious "." with no trailing digits in timestamp representation (bug report from Brian Feldman).
9.) Rename trim() funtion in order to avoid conflict of function name(report from Dominic Smith).
10.) Put back the change to add *read only* clause for read only cursors.
11.) Improve pgtype_transfer_octet_length().
12.) Fix a bug reported by Milen Manev that SQLExec *select for a table* -> SQLDescribeCol() -> add a column to the table -> SQLExec *select for the table* -> SQLDescribeCol() for the added column causes a bad result.
13.) Use strncpy_null() instead of strncpy().
14.) Close (holdable) cursors on commit if possible.
15.) Recycle columns cache info if the size becomes pretty large.
16.) Add a 'verify-ca' and 'verify-full' to the sslmode option via libpq of version 8.4.
17.) Add a functionality to change the directory for logging.
18.) Correct the error code for communication errors.
19.) Correct the conversion between UTF-16 and UTF-8 for non UCS2 characters.
20.) Try to convert (especially connection error) messages using local conversions when they are not valid unicode characters.
21.) Add a textbox to setup dialog to change the directory for logging.
22.) Allow multiple Connsettings statements in connection string by enclosing them by braces({}).
23.) Improve the transactional control under useDeclareFetch mode.
24.) Take the platforms where char is unsigned into account per report from Alex Goncharov.
25.) Improve the handling of UUID type especially to support IMPORT or LINK in MS Access.

## psqlODBC 08.03.0400

Changes:
1.) GUID forgot to set the value to the buffer.
2.) -Wall was taken as gcc limitation.

## psqlODBC 08.03.0300

Changes:
1.) SQLGUID type support thanks to Jan-Willem Goossens.
2.) Fix a bug about silently adding a *for read only* clause.
3.) Fix a 64bit mode bug about handling of arrays of parameters.
4.) Change the implemetatin of SQLForeignKeys() for 8.3+ servers.
5.) Not commit the transaction too early in useDeclareFetch mode.
6.) Add a cursor open check for SQLPrepare().
7.) Reset the column binding information after SQLMoreResults().
8.) Save the rowset size properly for the FETCH_NEXT operation in case of >= 3.0 drivers.
9.) Support FE/BE communications on Big Endian platform.
10.) Check strerror_r function's return type.
11.) Suppress some compiler warnings.

## psqlODBC 08.03.0200

Changes:
1.) Fix a bug in socket which uses a socket variable.
2.) Support column alias without "as" so that links from the SQLServer work.
3.) Take ';' into account when the driver adds "for read only" clause.
4.) Use the E'.. ' notation not only in '=' expressions but also in LIKE expressions.
5.) Change to return milliseconds parts for timestamp fields.
6.) Change to return a specific sqlstate in case of multiple parameters.
7.) Fix bug of the selection not using SSL.

## psqlODBC 08.03.0100

Changes:
1.) Correct the flow of trial of multi protocols and fix related bugs about handling of connection errors.
2.) Use SSPI service for SSL support when libpq is unavailable.
3.) Fix a bug in copy_and_convert_field() when fetching bookmark columns. This bug could occur in case no suitable? lo type is found.
4.) Improve the parse statement operation so that it detect srf in (from clause).
5.) Correct the COLUMN_LENGTH return value of SQLColumns() for varchar/bpchar type columns (Unicode driver).
6.) Change to not return database name if case of MS Query.
7.) The first cut to use Windows SSPI. The trial to use Schannel service for SSL support.
8.) Be more careful about in UseDeclareFetch mode. "for read only" clause for read only queries for 8.3 or later servers for safety.

## psqlODBC 08.02.0500

Changes:
1.) Correct the format of Bind message under 64bit environment.
2.) Fixed build of without OpenSSL.

## psqlODBC 08.02.0403

Changes:
1.) Support SQLColAttribute for MS specific SQL_CA_SS_COLUMN_KEY. Some MS applications use this.
2.) Improve the check of updatability of queries by checking if they have multiple tables.
3.) Reduce the round trip overhead in FE/BE communications(especially in useDeclareFetch mode).
4.) Fix a bug in ResolveOneParam() pointed out by Rainer Bauer.
5.) Add a flag which lets SQLTables() show only accessible tables.
6.) The unicode driver now can handle utf-16 surrogate pairs.

## psqlODBC 08.02.0402

Changes:
1.) Fix some bugs in case without MSDTC support.
2.) Refine the realloc handling.
3.) Put back the @@IDENTITY implementation so as not to use lastval().
4.) Change SQLColumns() to return correct column length in the Unicode driver.
5.) Remove the connection count limitation.
6.) Fix Protocol=7.4--1 notation (should be Protocol=7.4).
7.) Fix a typo in socket.c (bug report from Rainer bauer).
8.) Add CC_set_autocommit to psqlodbc(a).def files.
9.) Handle Standard_conforming_strings.
10.) Handle standard_conforming_strings also in case via libpq.
11.) Fix a bug which doesn't free connection list properly.
12.) Fix DelayLoadDLL was made explicit of psqlodbc.proj file.

## psqlODBC 08.02.0401

Changes:
1.) Fix a bug which checking join is confused by CR+LF.
2.) Handle AUTOCOMMIT mode more carefully in a distributed transaction so as not to issue COMMIT unexpectedly.
3.) Allow the UNIX domain configuration (the same as libpq).
4.) Fixed the automake/autoconf scripts.(by Peter Eisentraut)

## psqlODBC 08.02.0400

Changes:
1.) Fixed control binding of SetField problem.
2.) Fixed pgenlist.h losts to the release package.

## psqlODBC 08.02.0300

Changes:
1.) Allow non-admin or Vista users to create log fils in the home directory.
2.) Fix an index over bug which causes a crash or an unexpected result.

## psqlODBC 08.02.0205

Changes:
1.) Append DETAIL messages to GetDiag...() messages.
2.) Use SQL_SUCCEEDED macros so as to simplify the code.
3.) Use lastval() function to replace IDENTITY on 8.1 or later servers.
4.) Remove WSAStartup() and WSACleanup() from DllMain.
5.) Load libpq from the driver's folder.
6.) Use QR_get_value_backend_int/_text() funcs instead of QR_get_value_backend_row().
7.) Improve the implemetation of SQLSetPos(.., SQL_ADD/SQL_UPDATE) using the 8.2 new feature INSERT/UPDATE .. returning.
8.) Seaparate DTC code as a Delayload DLL.

## psqlODBC 08.02.0204

Changes:
1.) Configure the combination of time.h and sys/time.h.
2.) Treat the tables in information_schema as system tables.
3.) Correct the precision of SQL_NUMERIC_STRUCT.
4.) Change the default max varchar size from 254 to 255.
5.) Reset the fields information properly in case of SQLMoreResults.
6.) Implement SQLDescribeParam() also in case of multi-command queries.
7.) Handle dollar-quotes more properly.
8.) Provide a make option to link dynamic multithread library.
9.) Set the default nullablity to TRUE.
10.) Parse command delimiters(;) more correctly.
11.) Use QR_get_value_backend_text() or QR_get_value_backend_int()
12.) instead of QR_get_value_backend_row().
13.) Apply Parse statement or disallow premature properly.
14.) Reset current_schema cache in case 'set search_path ..' command is issued.

## psqlODBC 08.02.0203

Changes:
1) Fix a bug which forgets unnamed plans too early especially when handling large objects.
2) Don't treat charcters whose value >= 128 as alphanumeric in case of conversion of binary data to bytea.
3) Change ConfigDSN() so that it takes the options in Setup Dialog page 1 into account.
4) Simplify the memory management of statements'columns info so as to prevent memory leaks or a crash in parse_statement etc.
5) SQLTables("", SQL_ALL_SCHEMAS. "", ..) now returns a list of valid schemas.
6) SQLTables("", "", "", SQL_ALL_TABLE_TYPES) now returns a list of valid table types.
7) SQLGetInfo SQL_DATABASE_NAME now returns the database name.
8) Improve the automatic setting mechanism of the client_encoding for Windows code page 125x (ANSI drivers only).

## psqlODBC 08.02.0202

Changes:
1) Change to use NULL indicator instead of the length buffer in SQLFetch.
2) Fix long -> serial conversion error in MS Access.

## psqlODBC 08.02.0201

Changes:
1) Ditinguish the indicaitor and the octet_length field of APD clcearly.
2) Handle @@IDENTITY more generally.
3) Take outer join into account so as to evaluate nullability.
4) Fix a bug about Keyset-driven cursors.

## psqlODBC 08.02.0200

Changes:
1) Fix some bugs or warnings on 64 bit OS.
2) Avoid backend crash caused by Execute Requests for committed holdable cursors.

## psqlODBC 08.02.0105

Changes:
1) SQLStatistics now returns indices based on expression also.
2) Add a TEST button on the setup dialog.

## psqlODBC 08.02.0104

Changes:
1) Take 64bit mode into account for the format parameter of (s(n))printf, sscanf etc.
2) getpid() instead of _getpid()
3) SQLGetInfo(SQL_NULL_COLLATION) now returns SQL_NC_HIGH instead of SQL_NC_END
4) Remove the function SQLParamOptions from ODBC3.0.

## psqlODBC 08.02.0103

Changes:
1) Improve the handling of connection error messages.
2) Add an option to convert empty strings to NULL.
3) Handle domain type as the basetype.
4) Fake MSS in case of not only SQLExecute but also SQLParamData.
5) Prevent SQLColumns from displaying system columns.
6) Unload delayLoaded libraries on dll detach (not on disconnect time).
7) Fix a SQLGetDiagField crash bug.
8) Fix a insertion count bug.
9) Take win98 cases into account a little.

## psqlODBC 08.02.0102

Changes:
1) Compensate a loss of report of being Jet when using MS Access.
2) Add NULL <-> "" date converion function for FOXPRO and
revise parse/describe/execute mechanism.
3) Miscellaneous type changes for 64 bit drivers.

## psqlODBC 08.02.0101

Changes:
1) Delayload import XOLEHLP.dll so that the driver can be loaded
without the existence of the dll.
2) Fix a simple password authentication bug.
3) Fix a buffer overrun bug which prevented the connection phase
from retrying another version appropriately.
4) Handle multi-addresses of a specified host properly.
5) Refine the socket handling(connect, recv, send).
6) Display more appropriate error messages in the connection phase.

## psqlODBC 08.02.0100

Changes:
1) Return to Unicode/ANSI driver distribution as some users still find one works better than the other for them.
2) Improve connection error message in case of invalid protocol characters.
3) Initial value has set MSDTC=no of VC6 (Support of MSDTC is only VC7 and VC8)
4) Addition which is a driver name in a resource (Unicode or ANSI)

## psqlODBC 08.02.0007

Changes:
1) Fix some SQLPrimaryKey, SQLForeignKey bugs.
Fill PK_NAME or FK_NAME columns.
Return right update_rule values.
Remove duplicates.
2) Handle SQL_ALL_SCHEMAS parameter in SQLTables.
3) Handle unaligned indicator/length buffers more properly.
4) Fix a bug in ProcedureColumns in case of set returning functions.
5) Fix a buffer overrun in handle_notice_message (Bart Samuel)
6) Fix a output parameters problem (Bart Samuel)
7) Hold the connection lock while a rollbackable statement running.
8) Add Extra Opts option to the DSN option setupdialog.

## psqlODBC 08.02.0006

Changes:
1) Add an option to fake Microsoft SQL Server which would improve SERIAL type handling.
2) Add support for LOGIN_TIMEOUT.
3) Improve Statement error handling about the reference of Connection error.
4) Improve the handling BIGINT type in the OSs without having strtoll().
5) Support ODBC CONVERT scalar functions in some cases.
6) Close qlog, mylog files on detach dll.
7) Improve comunication performance in case of the driver's original socket.
8) Fix send a close
9) Support of IPV6.
8.2.0003-8.2.0005 was skipped by the situation.

## psqlODBC 08.02.0002

Changes:
1) SQL injections via ODBC catalog function calls.
2) Fix SQLNumParams problem related to literal or dollar quote.
3) Call libpq in case of Kerberos authentication.
4) Add E' before literal for after 8.1 severs.
5) Return the correct error message in case of no password.
6) Take E'...' literal expression into account.
7) Fix an SQL_C_WCHAR -> numeric type conversion problem.
8) Refine the handling of io or output parameters.
9) Refine the dollar quote handling.
10) Fix the client_encoding mismatch problem.
11) Fix for SQLStatistics returns UNKNOWN instead of real column names.

## psqlODBC 08.02.0001

Changes:
1) updated CVS tip to the REL-07_03_ENHANCED branch
2) updated the installer for the single driver distribution
3) standardised various filenames that were previously based on build types
4) standardised the build on ODBC version 3.51

Release notes for older versions are here