pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Neumann <mne@mne.de>
To: pgsql-sql@postgreSQL.org
Subject: How to put into 'now' into a datetime field
Date: Tue, 7 Sep 1999 08:22:22 +0200 (CEST)
Message-ID: <m11OEe6-000DJ3C@darwin.oche.de> (raw)

table foobar {
  [...]
  created datetime NOT NULL DEFAULT x
}

I want to put the current transaction time into
"created" when inserting into the table. After reading the manual
I've tried the following combinations for x:

'now'
''now''
(''now'')
('now')
datetime('now')
datetime(''now'')
datetime('now'::abstime)
'now'::datetime
('now'::datetime)

And perhaps some more I forgot. The only one not resulting in an
syntax error when creating the table is 'now'. But using simply 'now'
gives a strange result:

When I insert the first tuple the datetime-value is okay.
But when I insert further tuples they get the same datetime-value
as the first inserted tuple.

-- 
Martin Neumann
mne@mne.de



Message-ID: <m11OEe6-000DJ3C@darwin.oche.de>
Permalink:  ../m11OEe6-000DJ3C@darwin.oche.de/
Also on:    postgresql.org/message-id/m11OEe6-000DJ3C@darwin.oche.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: mne@mne.de
  Subject: Re: How to put into 'now' into a datetime field
  In-Reply-To: <m11OEe6-000DJ3C@darwin.oche.de>
  References: <m11OEe6-000DJ3C@darwin.oche.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox