Received: from localhost.jpl.nasa.gov (IDENT:root@hectic-1.jpl.nasa.gov [128.149.68.203]) by hub.org (8.9.3/8.9.1) with ESMTP id KAA16107; Tue, 20 Apr 1999 10:40:01 -0400 (EDT) (envelope-from lockhart@alumni.caltech.edu) Received: from alumni.caltech.edu (lockhart@localhost [127.0.0.1]) by localhost.jpl.nasa.gov (8.8.7/8.8.7) with ESMTP id OAA06537; Tue, 20 Apr 1999 14:40:05 GMT Sender: lockhart@localhost.jpl.nasa.gov Message-ID: <371C91C5.2A7E4B4B@alumni.caltech.edu> Date: Tue, 20 Apr 1999 14:40:05 +0000 From: Thomas Lockhart X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: JT Kirkpatrick CC: "'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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > 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... - Tom -- Thomas Lockhart lockhart@alumni.caltech.edu South Pasadena, California