[Postgres] Default column value (CURRENT_TIMESTAMP) "date/time value current is no longer supported" #5491

Closed
opened 2026-01-22 15:09:05 +01:00 by admin · 2 comments
Owner

Originally created by @BabakMN on GitHub (Apr 4, 2017).

Originally assigned to: @Ocramius on GitHub.

This is a preliminary issue I will provide more information if needed.

It seems that the schema tool is wrapping the column default value in single quotes so I get a query like,

create table test (test timestamptz not null default 'CURRENT_TIMESTAMP');

Which causes,

[PDOException]                                                                                      
  SQLSTATE[0A000]: Feature not supported: 7 ERROR:  date/time value "current" is no longer supported

Column definition:

timeCreated:
            column: time_created
            type: datetimetz
            nullable: false
            options:
                default: CURRENT_TIMESTAMP

If CURRENT_TIMESTAMP is not wrapped in single quotes it will work.

Perhaps default is for constant string values and I should use columnDefinition instead?

Originally created by @BabakMN on GitHub (Apr 4, 2017). Originally assigned to: @Ocramius on GitHub. This is a preliminary issue I will provide more information if needed. It seems that the schema tool is wrapping the column default value in single quotes so I get a query like, ```sql create table test (test timestamptz not null default 'CURRENT_TIMESTAMP'); ``` Which causes, ``` [PDOException] SQLSTATE[0A000]: Feature not supported: 7 ERROR: date/time value "current" is no longer supported ``` Column definition: ```yaml timeCreated: column: time_created type: datetimetz nullable: false options: default: CURRENT_TIMESTAMP ``` If `CURRENT_TIMESTAMP` is not wrapped in single quotes it will work. Perhaps `default` is for constant string values and I should use `columnDefinition` instead?
admin added the InvalidDuplicate labels 2026-01-22 15:09:05 +01:00
admin closed this issue 2026-01-22 15:09:05 +01:00
Author
Owner

@Ocramius commented on GitHub (Apr 4, 2017):

Yep: "default" does evaluate to a constant, not to an expression.

On 4 Apr 2017 07:51, "BabakMN" notifications@github.com wrote:

This is a preliminary issue I will provide more information if needed.

It seems that the schema tool is wrapping the column default value in
single quotes so I get a query like,

create table test (test timestamptz not null default 'CURRENT_TIMESTAMP');

Which causes,

[PDOException]
SQLSTATE[0A000]: Feature not supported: 7 ERROR: date/time value "current" is no longer supported

Column definition:

timeCreated:
column: time_created
type: datetimetz
nullable: false
options:
default: CURRENT_TIMESTAMP

If CURRENT_TIMESTAMP is not wrapped in single quotes it will work.

Perhaps default is for constant literal values and I should use
columnDefinition instead?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/6383, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakJ7XRiJ3o7tmDFjQNknsXOTVHNEYks5rsdpRgaJpZM4MyaeK
.

@Ocramius commented on GitHub (Apr 4, 2017): Yep: "default" does evaluate to a constant, not to an expression. On 4 Apr 2017 07:51, "BabakMN" <notifications@github.com> wrote: > This is a preliminary issue I will provide more information if needed. > > It seems that the schema tool is wrapping the column default value in > single quotes so I get a query like, > > create table test (test timestamptz not null default 'CURRENT_TIMESTAMP'); > > Which causes, > > [PDOException] > SQLSTATE[0A000]: Feature not supported: 7 ERROR: date/time value "current" is no longer supported > > Column definition: > > timeCreated: > column: time_created > type: datetimetz > nullable: false > options: > default: CURRENT_TIMESTAMP > > If CURRENT_TIMESTAMP is not wrapped in single quotes it will work. > > Perhaps default is for constant literal values and I should use > columnDefinition instead? > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/6383>, or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakJ7XRiJ3o7tmDFjQNknsXOTVHNEYks5rsdpRgaJpZM4MyaeK> > . >
Author
Owner

@Ocramius commented on GitHub (Apr 4, 2017):

Closing as invalid and duplicate ( https://github.com/doctrine/dbal/issues/2582 )

@Ocramius commented on GitHub (Apr 4, 2017): Closing as `invalid` and `duplicate` ( https://github.com/doctrine/dbal/issues/2582 )
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5491