Received: from trends.net (root@clio.trends.ca [209.47.148.2]) by hub.org (8.9.3/8.9.1) with ESMTP id WAA03447; Thu, 22 Apr 1999 22:58:42 -0400 (EDT) (envelope-from chairudin@prima.net.id) Received: from ns1.prima.net.id ([202.57.0.8]) by trends.net (8.8.8/8.8.8) with ESMTP id WAA24707; Thu, 22 Apr 1999 22:23:29 -0400 (EDT) Received: from prima.net.id (mail.prima.net.id [202.57.0.8]) by ns1.prima.net.id (8.8.4/8.7.2) with ESMTP id QAA10832; Fri, 23 Apr 1999 16:13:12 +0700 (GMT) Sender: root@ns1.prima.net.id Message-ID: <372039A8.51FDEA58@prima.net.id> Date: Fri, 23 Apr 1999 02:13:12 -0700 From: Chairudin Sentosa Reply-To: chairudin@prima.net.id Organization: PT. Khasanah Timur Indonesia X-Mailer: Mozilla 4.5 [en] (X11; I; SunOS 5.5.1 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Thomas Lockhart CC: JT Kirkpatrick , "'pgsql-admin@hub.org'" , "'pgsql-interfaces@hub.org'" Subject: Re: [INTERFACES] where did that date and time come from?? References: <01BE8A7D.00789480.jt-kirkpatrick@mpsllc.com> <371C91C5.2A7E4B4B@alumni.caltech.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Thomas Lockhart wrote: > > I have a database that has four fields - > > Create table dispnote ( > > Autoinv int4 > > noteby char(8) not null default 'current_user', > > added datetime not null default 'now', > > notes varchar(255), > > constraint dispnotepk primary key (autoinv, added), > > constraint dispnotessms foreign key (auoinv) references ssms > > ); > > ... But when I insert a record it came up with a date of april 14, 10am! My > > server and my client both have the correct date and time (april 19, 3pm) - > > where did it get the wrong date and time from?? > > This is (still) a problem with Postgres optimizing untyped constants > by evaluating them at table creation time rather than at run time. > Redefine your datetime field as > > ... > added datetime not null default text 'now', > ... > > to force the type of the default value to be a string, which is then > converted at run time as you would expect. Fixing this behavior would > seem to be a good project for someone (maybe me :) for v6.6... > How about this? added datetime default datetime(now()) not null, Is this one OK? Regards, Chai