# psqlODBC release notes

## psqlODBC 09.06.0400 Release

Changes:

1. Reorganize the language conversion between the current locale and unicode.
2. Make a function setup_getdataclass() separating from long confusing if-block in convert_text_field_to_sql_c() and clarify the parameters.
3. Implement SC_get_localtime() and reduce time()/localtime() calls.
4. Visual C++ 14 provides snprintf().
5. Fix a crash bug in SQLBulkOperations() under use_declare/fetch off mode.
6. Clean up the use of 'internal' member of StatementClass.
7. Fix an infinite loop of CC_on_commit. The loop occurs when checking whether cursors are alive using 'MOVE 0' in CC_clear_cursors().
8. Fix the bug, skip malloc(0) in build_libpq_bind_params(). malloc(0) seems to return NULL on AIX, whereas it returns non-NULL on Windows or linux.
Per reported by Keith Handlon.
9. Add support for foreign tables and matviews in SQLTables.
10. Documentation fix for the 'PROTOCOL=' option. It's out of sync with the current driver behavior (since 09.05.0100).
Patch by Jan Wieck.
11. Fix more bugs with returning NULL for malloc(0).
Patch by TAKATSUKA Haruka.

## psqlODBC 09.06.0310 Release

Changes:

1. Fix a crash bug when connecting from MSACCESS(Microsoft Jet)
Per reported by Robert Ball.
This occurs when MSACCESS(Jet) calls SQLConnectAttr(.., 30002, ..) => ucs2_to_utf8() and about to call mylog() with a NULL derefernced pointer parameter.

## psqlODBC 09.06.0300 Release

Changes:

1. Implement SQLSet/GetConnectAttr() for some driver specific options.
2. Modify the code about UNKNOWNS_AS_LONGEST of the Unknown Sizes option so that it works properly.
3. Revise the handling of show oid column and row versioning option.
4. Revise the use of pgtype_xxxx() in catalog functions.
5. Replace pgtype_xxxx() whose 1st parameter is StatementClass with pgtype_attr_xxxx().
Also use macros for pgtype_xxxx() calls which have PG_ATP_UNSET, PG_ADT_UNSET or PG_UNKNOWNS_UNSET parameters.
6. Remove the use of PG_STATIC and UNKNOWNS_AS_DEFAULT.
7. Remove UNKNOWNS_AS_CATALOG of Unknown Sizes option.
8. Use symbols defined in catfunc.h instead of literal column numbers in SQLGetTypeInfo(), SQLSpecialColumns() and SQLTablePrivileges().
9. Fixes about SQLDescribeCol() or SQLColAttribute().

1. Report the size of constant strings using Unknown Sizes as Longest.
2. Correct the inconsistency between the sqltype of PG_TYPE_TEXT or PG_TYPE_UNKNOWN and the size in case of Unknown Sizes as Longeset.

10. Fix a bug about Unicode driver for ansi apps.
11. Fix a dangling reference in CC_lookup_characterset() introduced.
12. Simple implementation of get_environment_setting() on non-Windows platforms. If the codeset part of the current locale is UTF8, set the client_encoding to 'UTF8'. Take * set client_coding='...' * into account in check_client_coding().
13. Revise the handling of client encoding so as not to forget the update of related items(ccsc or mb_maxbyte_per_char).
14. Change the max byte per char of UTF8 from 6 to 4.
15. For Unicode drivers, when SQLConnect() or SQLDriverConnect() instead of SQLConnectW or SQLDriverConnectW is called, use the same client encoding as ANSI version of drivers use.Stop using percent-encoding to store the conn_settings option in odbc.ini.
16. Stop using percent-encoding to store the conn_settings option in odbc.ini.
17. Add #ifdef UNICODE_SUPPORT where there should be.
18. Introduce locale_encoding which corresponds to the locale. For non-Windows platforms determine the locale encodings from the current locale.
19. Make a function convert_text_field_to_sql_c() simply extracting from long confusing code and clarify the parameters for subsequent modifications.
20. Handle locales in non-Windows platforms and overhaule the language system.
21. convert bad to use lf_conv here.
22. Add __STDC_ISO_10646__ check to confirm that wchar_t means unicode.
23. Error out when SQLSetPos() skips updates.
24. Don't reset the status of Keyset in case of updates.
This fixes the bug about repeated updates using SQLSetPos().
25. Correct the inappropriate use of set_nullfield_int2().
26. Review the handling of OUTPUT parameters in SQLProcedureColumns().

1. If there are OUT, INOUT or TABLE arguments, ignore RETURN values.
2. OUT parameters of functions with returning SETOF should be treated as SQL_RESULT_COL rather than SQL_PARAM_OUTPUT.
3. Also treat table output arguments as SQL_RESULT_COL because functions returning table are equivalent to using one or more OUT parameters plus marking the function as returning SETOF record (or SETOF a single output parameter's type).

27. Use the same CPPFLAGS as well as CFLAGS/LDFLAGS to build regression tests as used to build driver.Also uchar.h header checking for later use.
Fix a crash bug when the locale isn't set connection.

## psqlODBC 09.06.0200 Release

Changes:

1. Start transactons first before calling SQLEndTran().
2. The failure of libpq_bind_exec() which returns NULL doesn't mean a FATAL error. Also make a check for disconnected connections.
3. Handle output parameters properly in build_libpq_bind_params.Also handle return values properly.
4. Make check of connection lost.
5. Revise recent lost connection check.
Check the lost connection

1. at the beginning of ODBC APIs.
2. at the beginning of FE-BE communications using extended protocol.

6. Stop specifying parameter datatype oids in parse message. Unfortunately it is inflexible and rather harmful. Though I don't know if it has much meaning, use cast instead just in order to keep regression test results. It's not necessary to cast any more the 2nd parameter of {call a_b_c_d_e(?, ?, ?, ?, ?)} in odbc-escapes-test.

## psqlODBC 09.06.0100 Release

Changes:

1. Optimization of a build system.
some adjustment and support Visual Studio 2015 for Windows.
2. Use SIZEOF_LONG_INT to check whether SQLROWSETSIZE exists.
SIZEOF_LONG_INT is defined in UnixODBC headers, while SIZEOF_LONG is defined by psqlodbc's ./configure. In odbcapi.c, we use it to determine what format modifier, %ld or %lld, to use for pointers. (Why don't we use %p?). We should rely on our autoconf check for that. In odbcapi.c, however, the check should match that in the ODBC headers, to determine whether SQLROWSIZE exists, so we should use SIZEOF_LONG_INT.
3. Fix the bug messages handle.
handle_error_message() and handle_notice_message() were unified into handle_pgres_error() in the wrong way. Unfortunately handle_error_message() never handled notice messages and set positive errornumbers which mean error_not_a_notice in psqlodbc. I renamed the constant CONNECTION_SERVER_REPORTED_ERROR to CONNECTION_SERVER_REPORTED_SEVERITY_FATAL and the constant CONNECTION_SERVER_REPORTED_WARNING to CONNECTION_SERVER_REPORTED_SEVERITY_ERROR so as to avoid confusion.
Reported by Shinji Mecha.
4. Allow setting isolation level before the establishment of connection.
5. Fixed return proper sqlstate error 08S01 in case of communication link failures.
Patch by Tsunakawa,Takayuki.
6. Check the existence of directory for logging.
7. Handle PG_DIAG_SEVERITY_NONLOCALIZED for servers whose version >= 9.6 so as to detect FATAL message properly.
8. Now default isolation level is server's default instead of fixed SQL_TXN_READ_COMMITTED.
Patch by Tsunakawa,Takayuki.
9. Make sure the isolation level is SQLUINTEGER and add the declaration of CC_get_isolation().
10. Change the default for ExtraSysTablePrefixes to an empty string.
11. Use lo_lseek64(lo_tell64) instead of lo_lseek(lo_tell) if the server's version >= 9.3. We are now able to handle > 2GB BLOBs.
12. Implement SQL_FECTH_BY_BOOKMARK operation of SQLBulkOperations properly.
13. Enable SQLBulkOperations in declare/fetch mode using long (>=12bytes) bookmarks.
Formerly the driver offered very simple bookmark support -- it is just the current row number. Now the driver offers more verbose bookmarks which contain KeySet informations (CTID (+ OID)). Though they consume 12bytes (row number + CTID) or 16bytes (row number + CTID + OID), they are useful in declare/fetch mode.
14. a hack to handle boolean items in VBA with MS Access.
VBA seems to transform the where condition a_boolean_item=True into ("a_boolean_item" = 1) which causes an ERROR:Operator does not exist boolean = integer . Here transforms it into ("a_boolean_item"='1') which seems safe in anyway.
15. Add a new option 'pqopt' which specifies libpq connection parameters as a conninfo style string.
The string must be enclosed with braces {} e.g. pqopt={sslcert=... sslkey=... sslrootcert=...} in the case of connection strings. Though host, port, dbname, user, password, sslmode, keepalives_idle or keepalive_interval parameters can be set using this option, they are ordinarily set by other options. When some settings for those parameters conflict with other ordinary options, connections are rejected.
16. Fix a corner case when parsing connection strings enclosed with braces.
17. As tuple_updated item in AddUpdated(), the parameter should be used. Deriving from other items caused bad results.
18. Change the default of ByteaAsLongVarBinary from 0 to 1.

## psqlODBC 09.05.0400 Release

Changes:

1. Enable COMMLOG and MYLOG button.
2. Default of *level of rollback on errors* is default(statement) not transaction.
3. Fix the bug SQLGetDescFieldW or SQLColAttributeW mistakenly returns SQL_ERROR.
4. Move src/*.exe to exe/*.exe on Windows.
Also use fc command instead of diff command on Windows. Fix a compilation error in large-object-data-at-exec-test.c regarding a type declaration in the middle of a code block.
Patch by Michael Paquier.
5. Ignore the difference between CR LF, LF and CR line break when comparing expected and result output.
6. Prior to Visual Studio 2015 Update 3, the hook functions of type PfnDliHook __pfnDliNotifyHook2 and __pfnDliFailureHook2 were non-const.
They were made const to improve security (global, writable function pointers are bad). If for backwards compatibility you require the hooks to be writable, define the macro DELAYIMP_INSECURE_WRITABLE_HOOKS prior to including this header and provide your own non-const definition of the hooks.
The following infomation is from Dave Cramer(davecramer@gmail.com).
7. Fix a regression test some failures.

## psqlODBC 09.05.0300 Release

Changes:

1. Largely reduce overhead of localtime() in SQLFetch
localtime() is a very costly system call causing serious grief on performance of the driver for OLTP-type applications using a lot SQLFetch and this one is being called for all data types when performing an in-line conversion, while it is being used only in the case where some of the date and/or timestamp fields are not initialized. While testing performance of an internal application, this patch has proved to improve the overall performance of an application by 20%.
2. Fix the use and the implementation of getNthValid().
3. Fix the handling of boundary_should_be_adjusted case when a rowset is cut in the middle of cached rows. Also fix the row info of SQL_ADDed tuples.
4. Estimate the rowsetSize including deleted tuples correctly so that rowset can be effectively handled.
5. Set once_reached_eof status when useDeclareFetch=0 so that QR_num_total_read() macro works well.
Don't forget to call CC_on_abort_partial() when rollback back to a savepoint. Now the driver passes cursor-block-delete test.
6. Refine SQLFetchScroll() for the orientations other than SQL_FETCH_NEXT/PRIOR.
Discard move_from_the_last stuff and call move_cursor_to_last() instead.
7. Refine cursors with KEYSET using oid or oid alternative as far as possible.
8. Preparation for handling inheritance.
9. Convert tableoid to relation name in case of inheritance.
10. fix buffer overrun in logging, and code cleanup.
Patch by Tsunakawa, Takayuki.
11. Implement SQL_QUERY_TIMEOUT.
Patch by Tsunakawa, Takayuki.
12. 'for' loop initial declarations are only allowed in C99 mode.

## psqlODBC 09.05.0210 Release

Changes:

1. Makefile.am in order to add new test case and expected output to distribution.
2. Use LoadLibraryEx for gxalib.dll load search path.

## psqlODBC 09.05.0200 Release

Changes:

1. Clear the parsed result before executing simple query so that SQLRowCount() returns.
This fix the bug reported by Walter Willmertinger.
2. Fix NULL dereferences which causes application crash.
Patch by Tsunakawa, Takayuki.
3. Don't initialize next_in_cache or rowstart_in_cache info when scrolling (block) cursors in declare/fetch mode.
This fixes the bug reported by John Kew.
4. Correct the detection of eof in useDeclare/fetch mode.
This change fixes the bug about fetching prior after scrolling next until eof reported by BenS.
5. Fix the bug about MONEY type.
6. Consider decimal_digits of SQL_TIME (and time field of PostgreSQL).
7. Don't forget to update num_total_read field of QResultClass record in case 'fetch 0 rows' after 'move'.
This fixes the bug 'When fetching a row "behind" the rowset by "fetch absolute" only the first ones of the result set can be fetched.' reported by Bernhard Goebel.
8. Make sure that EOF occurs when 'fetched < fetch requested'.
9. Correctly handle SQLGetData() when the target type is SQL_C_WCHAR and the buffer is small to get the whole data for some data types such as bool, date, time ... etc.
10. Refine SQLGetData().

1. Unify midtemp and moneytemp.
2. Variable wconverted is no longer needed.
3. Pre_convert for PG_TYPE_BOOL is not needed.
4. It's better to take the same road even in case of pre_convet.

11. Fixed possible once to build test suite in a different place other than the source code is, it's not now.
12. CHAR causes a compilation error in some environment. Use char instead of CHAR.
13. Correctly judge the SQLSTATE 01S06(Attempt to fetch before the result set returned the first rowset) for SQL_FETCH_PRIOR operations of SQFetchScroll.
14. Checking a flag bit mistakenly resets other flag bits.
Patch by Tsunakawa, Takayuki.
15. setup.c:test_connection() calls EN_Constructor() twice, leaking small memory.
Patch by tsunakawa, Takayuki.
16. The existing memory is not freed upon realloc() failure.
PGAPI_BindCol() doesn't check the failure of extend_getdata_info().
Patch by Tsunakawa, Takayuki.
17. The statement linked list is not properly chained, which throws away some statements.
Patch by Tsunakawa, Takayuki.
18. LINKMT is not used in the build process.
ADDL_INC should be ADD_INC. Just a typo. The CLEAN target doesn't delete .pdb files.
Patch by Tsunakawa, Takayuki.
19. Fix a parameter unmatch of snprintf.
20. In Windows the use of external variables timezone, tzname and daylight are deprecated. Use _timezone, _tzname and _daylight instead.
21. SQLS(G)etDescRecW instead of SQLS(G)etDescRec for Unicode driver.
22. The third stricmp() in writeDriverCommoninfo() is useless, because the second one causes the function to return.

1. SC_get_errormsg() definition is repeated twice in succession.
2. In info.c:SQLGetInfo(), "len = 0" is unnecessary because len is assigned at the end of the function.
3. In execute.c:PGAPI_ExecDirect(), flag doesn't need to be set as its value doesn't change.
4. PODBC_PER_STATEMENT_ROLLBACK is not used.

Patch by Tsunakawa, Takayuki.

## psqlODBC 09.05.0100 Release

Changes:

1. Use libpq for all communication with the server
Previously, libpq was only used for authentication. Using it for all communication lets us remove a lot of duplicated code. libpq is now required for building or using libpq.
2. Remove support for protocol versions older than 3.
Protocol version 3 was introduced in PostgreSQL 7.4, so this means that we no longer support server versions 7.3 or older. This simplified the code, making maintenance easier.
3. Remove support for ODBC versions older than 3.51.
The official binaries have been compiled in 3.51 mode for a very long time, so this has no effect on the official binaries.
4. Avoid one round-trip to the server when establishing connection.
When connecting to a server, the driver used to issue a query to determine the client_encoding setting being used, but that was unnecessary because all supported server versions send that information as part of the connection handshake when a connection is established. Remove the extra query, which should make connecting over a high-latency link faster.
5. Report max length of 'name' fields correctly.
PostgreSQL columns of type 'name', used e.g. in catalog tables to hold names of relations and other objects, were reported as having type VARCHAR(64). However, the real max length of a name field is only 63 bytes.
6. Remove 'Optimizer' configuration option
You can use the generic ConnSettings option with value "set geqo=off", to disable GEQO.
7. Fix title in 32-bit Unicode drivers setup dialog
The title on the 32-bit Unicode drivers's setup dialog on Windows incorrectly said "ANSI".
8. Don't export private symbols that are not part of the ODBC interface
This was causing problems when the driver was loaded together with another dynamically loaded library with a function of the same name. This was reported to happen when loading the odbc_fdw foreign data wrapper into a PostgreSQL server, because both the PostgreSQL server and the ODBC driver contain a function called check_client_encoding().
9. Report a sensible SQL_DESC_OCTET_LENGTH value for result set columns of type 'unknown'
If a query returns a column of type 'unknown', as happens e.g. in a query like "select 'foobar' from table" where the datatype of the constant 'foobar' is not specified, the SQL_DESC_OCTET_LENGTH property of the column was returned as invalid. Report it the same as 'varchar' field with no explicit length, instead.
10. Fix quoting bugs in sending integer query parameters to server
The drivers used to assume that if a parameter's SQL type is SQL_INTEGER or SQL_SMALLINT, the value does not require quoting when its send to the server. For example, "SELECT ?", with parameter 123 was translated to "SELECT 123", when UseServerSidePrepare was not enabled. However, there was no check that the query parameter in fact contained a valid integer, when replacing the parameter markers with their values. Also, in a query like "SELECT 0-?", a negative value needs to have parens around it, as in "SELECT 0-(-123)".
11. Don't reset autocommit when a connection is established
If autocommit is disabled on a connection, by calling SQLSetConnectAttr(SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0), before connecting with SQLDriverConnect(), autocommit was incorrectly reset back to on when the connection was established.
12. Send datatype information for query parameters, when known
If a query parameter is bound with a specific SQL type, pass on that information to the server. This makes the behaviour of queries like "SELECT '555' > ?" more sensible, where the result depends on whether the query parameter is interpreted as an integer or a string.
13. Use libpq defaults for Server, Username and Database settings
Server, Username and Database settings can now be left empty, in which case the corresponding libpq defaults will be used. The libpq default is to connect to a local server over Unix domain sockets (on Unix systems) or to localhost over TCP/IP (on Windows), if Server is left empty. The default username is the current operating system user, and the database to connect to is a database with the same name as the user. These built-in defaults can be changed by environment variables, however. This is particularly useful for connecting to a local installation via Unix domain sockets, as that is the default when Server is left empty, and was difficult to configure otherwise.
14. Fix bug in parsing E'' literals
The driver needs to parse a query string to determine whether a '?' character is a parameter marker, or if it's inside a quoted string or a SQL comment. This parsing did not correctly handle E''-style strings.
15. Remove 256 byte limit on the length of NOTICE messages
There was a built-in limit of 256 bytes on the length of NOTICE messages received from the server. Strings larger than 256 bytes were not returned to the application. That limit has been removed.
16. Fix parsing of strings containing escaped quotes with Parse=1
This fixes issues in extracting metadata like result set column names, with the Parse=1 option.
17. Fix connecting with a user or database name that contains spaces or quotes
User and database names were not quoted correctly when building a connection string. A different method is now used for sending those parameters, which doesn't require quoting and escaping.
18. Remove support for so-called "premature execution"
Premature execution was a method for getting information about a result set of a query, before SQLExecute() was called. That was always dangerous, as any side-effects of the query would happen, even if the application did not call SQLExecute() after all. With protocol version 3, there is a safer way to do this. This also removes the DisallowPremature configuration option, as the driver never does premature execution anymore.
19. Fix buffer overrun when the server reports an error message longer than 4096 bytes
If the server returned an error longer than 4096 bytes, we would overrun the buffer by two bytes. If you're unlucky, that could lead to a crash. That consistently happened on Windows.
20. Improve parsing of INSERT INTO statements, for @@identity support
The code that parses INSERT INTO statements, to extract the name of the target table, got confused by values containing dots, and other things. Improve the parsing support to handle a wider range of INSERT statements.
21. Fix crash in SQLTables() function, if search_path was set to a non-existent schema
The server-side current_schema() function returns a NULL if search_path is set to a non-existent schema, and the driver code was not prepared for a NULL result.
22. Fix buffer overrun when connecting, and KeepaliveTime and KeepaliveInterval were both set
If the server returned an error longer than 4096 bytes, we would overrun the buffer by two bytes. If you're unlucky, that could lead to a crash, and it consistently did on Windows. Per report from Andrus Moor.
23. Set an error message when password is required to connect.
In previous versions, if a connection fails because the server requires a password and no password was supplied. Per report from "PSequel Support".
24. Improve parsing of INSERT INTO statements to support @@identity
Patch by Christian Ullrich.
25. Fix SQL_DATA_AT_EXEC processing for large objects.
Reported by Vadym Krevs.
26. The server decide if SQL_LONGVARBINARY means a bytea or large object.
This reverts the behaviour of SQL_LONGVARBINARY parameters.
27. Fix handling of return value in {? = CALL ... } syntax.
When sending the query to the server, need to use the number of parameters calculated by build_libpq_bind_params(), which excludes the OUT parameter, rather than the original number of parameters. Reported by Haribabu Kommi.

## 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