Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0.0-BETA3
-
Component/s: None
-
Labels:None
-
Environment:Doctrine - GIT trunk (night build from 2010-07-17), Windows 7, PHP 5.3.2, PostgreSQL 8.4.3, Apache 2.2.15
Description
A column in database may be defined as both TIMESTAMP WITH TIMEZONE and TIMESTAMP WITHOUT TIMEZONE. If I insert a new value directly to the database through NOW() function, the value is stored including microseconds.
But then, when I am trying to load the record to Doctrine entity, following exception is thrown:
—
Doctrine\DBAL\Types\ConversionException
Could not convert database value "2010-07-17 15:29:57.762+02" to Doctrine Type datetimetz
File: C:\dev\etrener\library\Doctrine\DBAL\Types\ConversionException.php Line: 46
—
The same with both datetime and datetimetz columns.
The problem is probably in PostgreSqlPlatform::getDateTimeTzFormatString(), where is the following row:
public function getDateTimeTzFormatString()
But PostgreSQL stores timestamps with microseconds, so format should be maybe something like:
{ return 'Y-m-d H:i:s.uO'; }The problem is already posted in http://www.doctrine-project.org/jira/browse/DBAL-22?focusedCommentId=13574&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_13574, but that issue is already closed so maybe it was overlooked already then.
Thank you for fix!
Both DateTime and DateTimeTz assume that TIMESTAMP(0) is the definition, not the TIMESTAMP that implicitly degrades to TIMESTAMP(6). I am not sure how to handle this, I find this Postgres DateTime stuff rather annoying
Is there a global client side option for Postgres users to configure this?