Bug when setting timestamp params from date strings

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
nickbarnes
Posts: 18
Joined: Mon 18 Nov 2013 01:37

Bug when setting timestamp params from date strings

Post by nickbarnes » Wed 02 Mar 2016 03:16

The following query returns a random timestamp:

Code: Select all

Query.SQL.Text := 'SELECT CAST(:Date AS timestamp)';
Query.ParamByName('Date').Value := '2015-01-01';
Query.Open;
// Query.Fields[0].Value is e.g. "13/12/2014 12:58:48"
The cause is a bug in TCustomPgTimeStamp.FromString(). One of the return values, TimeZoneOffset, is never initialised in this case. This is easily fixed by adding "TimeZoneOffset := MaxInt;" at the top of this function.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Bug when setting timestamp params from date strings

Post by AlexP » Wed 02 Mar 2016 07:17

Hello,

Thank you for the information. We will add the required changes.

Post Reply