[unixODBC-support] Was there a change in the time zone meaning of SQL_TIMESTAMP?
rtaheri at vmware.com
Fri Nov 18 20:21:15 GMT 2016
We have developed a performance benchmark (http://www.tpc.org/tpcx-v) with PostgreSQL using ODBC in the application. Everything was working fine up to
Then, someone took our kit, and installed it on a system with
· A twist here may be that he may have loaded the database in one time zone, later running the test from another time zone
Now we are running into the following problem: the server rejects stored procedure calls with:
<>ERROR: function traderesultframe5(bigint, numeric, unknown, timestamp with time zone, bigint, numeric) does not exist at character 15
<>HINT: No function matches the given name and argument types. You might need to add explicit type casts.
I can see why this could happen since psql tpcv -c '\df' says our function is declared as:
public | traderesultframe5 | void | broker_id ident_t, comm_amount value_t, st_completed_id character, trade_dts timestamp without time zone, trade_id trade_t, trade_price s_price_t
So, the problem is with the timestamp parameter. We bind the timestamp argument with: SQLBindParameter(…, SQL_C_TIMESTAMP, SQL_TIMESTAMP, …). This used to work with the older revs. But not for this user. I was able to get PostgreSQL to accept the function call by changing the stored procedure to explicitly declare the parameter as timestamp with time zone. But timestamps (not stating with or without time zone) are used all over the place in our application, and according to PostgreSQL documentation:
The SQL standard requires that writing just timestamp be equivalent to timestamp without time zone, and PostgreSQL honors that behavior.
So, to be consistent, we’d have to change all our declarations to say with time zone. That’s a pain. Plus, it seems like PGSQL actually recommends storing timestamps without time zone (i.e., absolute time)
Did the definition of SQL_TIMESTAMP somehow change such that it now implies timestamp with time zone? Or did some marshaling that used to take place doesn’t work anymore?
Also, is there a way for SQLBindParameter() to explicitly bind the argument as SQL_TIMESTAMP and force it to be without time zone?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the unixODBC-support