Re: How do I make a timestamp column default to current time

From: "John D(dot) Burger" <john(at)mitre(dot)org>
To: PostgreSQL-general general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How do I make a timestamp column default to current time
Date: 2006-03-16 18:14:57
Message-ID: e54617506699a152613f93922789c4f8@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane writes:

> Try
>
> mycol timestamp default now()
> or
> mycol timestamp default current_timestamp
>
> (the latter is actually a function call, even though the SQL standard
> says it has to be spelled without any parentheses)

And both of these return start time of the current transaction, yes?
Is it the case that there is no SQL-standard way to get the current
time? I know Postgresql has timeofday(), but it's not standard (plus
it's weird that it returns a text string).

- John D. Burger
MITRE

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2006-03-16 18:51:15 Re: PostgreSQL scalability concerns
Previous Message Philip Hallstrom 2006-03-16 17:40:34 Re: Replication & web apps