Postgres / TDateTime

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
bursch
Posts: 20
Joined: Tue 25 Sep 2018 07:45

Postgres / TDateTime

Post by bursch » Tue 27 Apr 2021 06:03

Hello,

under Postgres, very small date values (<01.01.0100) are always set to the value MinDateTime. TimeStamp values, on the other hand, work without problems.

Very small values can lead to inaccuracies, but there is no reason for this restriction. The Postgres database supports values from 4713BC.

Since there is no need for this restriction for timestamp values and this is also interpreted as TDateTime, it would only be logical to remove this restriction.

Code: Select all

unit PGClassesUni;

(...)

class procedure TPgBinaryConverter.ReadDate(Source: TPgSQLNet; Dest: IntPtr);
At least the date 01/01/0000 should still be possible.

Greetings,
Manuel

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Postgres / TDateTime

Post by MaximG » Thu 13 May 2021 14:15

Our components don't impose this restriction. The minimum and maximum values for ftDateTime are defined in Delphi on the base level, we're not able to change them.
You'll get the same results in standard Delphi data access components. You may create a table DATE_TYPES in pgAdmin

Code: Select all

CREATE TABLE DATE_TYPES (ID SERIAL,  F_DATE DATE, PRIMARY KEY (ID));
and insert a record

Code: Select all

INSERT INTO DATE_TYPES (id, f_DATE) VALUES (10, 'J0000187');
Querying the table in pgAdmin Select F_DATE From DATE_TYPES will return 4713-05-29 BC, whereas the same query executed with FireDAC components will return 01.01.0100

Post Reply