Received: from localhost (IDENT:root@hectic-2.jpl.nasa.gov [128.149.68.204]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA57139; Fri, 3 Dec 1999 10:46:24 -0500 (EST) (envelope-from lockhart@alumni.caltech.edu) Received: from alumni.caltech.edu (lockhart@localhost [127.0.0.1]) by localhost (8.8.7/8.8.7) with ESMTP id PAA13254; Fri, 3 Dec 1999 15:48:35 GMT Sender: lockhart@hub.org Message-ID: <3847E653.AAF97645@alumni.caltech.edu> Date: Fri, 03 Dec 1999 15:48:35 +0000 From: Thomas Lockhart X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: Karel Zak - Zakkr CC: Andy Lewis , pgsql-hackers , pgsql-sql Subject: Re: Datetime operators (was: Re: [SQL] Another Date question) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > > I'd like to create a table with a datetime field that defaults to +60 > > days. > > mydate datetime default 'now() +@60 days', > > ... > Where is a problem? You have enclosed your default values into a large string, rather than letting them be evaluated as an expression: mydate datetime default (now() + '60 days') where the outer parens are optional. > datetime + '10 day' or > datetime + '2 year' ..etc. > But I'm not sure what is better or exists it in other SQL. afaik this is the simplest and most direct way to do it. Note that you can include other timespan fields in the constant: mydate datetime default (now() + '60 days 10 hours') HTH - Thomas -- Thomas Lockhart lockhart@alumni.caltech.edu South Pasadena, California