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()
{ return 'Y-m-d H:i:sO'; }
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!
Is there a global client side option for Postgres users to configure this?