Comments (7)
Comment created by @beberlei:
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?
from dbal.
Comment created by @beberlei:
@jan: Did you use create the column manually yourself (TIMESTAMP WITHOUT TIMEZONE) or use the Doctrine Schema-Tool which defines TIMESTAMP(0) WITHOUT TIMEZONE.
from dbal.
Comment created by @beberlei:
Fixed in DBAL Trunk, see the following section of the DBAL manual to understand the workaround for PostgreSQL TIMESTAMP( n ) types where n > 0.
ORM always creates TIMESTAMP(0), so this is handled as a legacy database schema.
from dbal.
Comment created by @beberlei:
<ins></ins> PostgreSQL
<ins></ins>+ DateTime, DateTimeTz and Time Types
Postgres has a variable return format for the datatype TIMESTAMP(n) and TIME(n)
if microseconds are allowed (n > 0). Whenever you save a value with microseconds = 0.
PostgreSQL will return this value in the format:
2010-10-10 10:10:10 (Y-m-d H:i:s)
However if you save a value with microseconds it will return the full representation:
2010-10-10 10:10:10.123456 (Y-m-d H:i:s.u)
Using the DateTime, DateTimeTz or Time type with microseconds enabled columns
can lead to errors because internally types expect the exact format 'Y-m-d H:i:s'
in combination with `DateTime::createFromFormat()`. This method is twice a fast
as passing the date to the constructor of `DateTime`.
This is why Doctrine always wants to create the time related types without microseconds:
* DateTime to `TIMESTAMP(0) WITHOUT TIME ZONE`
* DateTimeTz to `TIMESTAMP(0) WITH TIME ZONE`
* Time to `TIME(0) WITHOUT TIME ZONE`
If you do not let Doctrine create the date column types and rather use types with microseconds
you have replace the "DateTime", "DateTimeTz" and "Time" types with a more liberal DateTime parser
that detects the format automatically:
[php]
use Doctrine\DBAL\Types\Type;
Type::overrideType('datetime', 'Doctrine\DBAL\Types\VarDateTime');
Type::overrideType('datetimetz', 'Doctrine\DBAL\Types\VarDateTime');
Type::overrideType('time', 'Doctrine\DBAL\Types\VarDateTime');
from dbal.
Comment created by jantichy:
@benjamin: Yes, I have created the column manualy directly in database using my own CREATE TABLE definition.
from dbal.
Issue was closed with resolution "Fixed"
from dbal.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from dbal.
Related Issues (20)
- Reserved word Condition is not escaped on insert
- Doctrine\DBAL\Driver\PDO\SQLSrv\Statement::bindParam is deprecated HOT 3
- Support "ON UPDATE CURRENT_TIMESTAMP" for MySQL
- SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'TABLE_NAME' i n where clause is ambiguous HOT 2
- Password authentication failed DBAL v4 and ORM v3 HOT 4
- Impossible to create a user HOT 2
- Preventing incorrect column renames no longer possible in 4.0 HOT 11
- Partial unique index for XML mapping is not supported? HOT 4
- Column precision is not specified
- Support DuckDB HOT 1
- [API] Add getWrappedDriver method to AbstractDriverMiddleware HOT 2
- Doctrine\ORM\QueryBuilder::setParameter and ArrayParameterType in 4.0.0 HOT 2
- `SqliteSchemaManager` still emulates schema namespacing
- Custom driver and ExceptionConverter HOT 1
- PostgreSQL option gssencmode=disable isn't configurable HOT 4
- index-by and order-by do not work for abstract entities with inheritance type "JOINED" in many-to-many relations HOT 3
- Got error on SQLite database creation stage HOT 7
- Incorrect definition of table mysql.column_stats MariaDB OOM-kill HOT 3
- Mysqli Driver - Undesired Collations Cannot be Altered for `collation_connection` Variable
- Platform override HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbal.