Received: from rns.roundnoon.com (root@[204.0.130.147]) by hub.org (8.9.3/8.9.3) with ESMTP id PAA91586; Fri, 3 Dec 1999 15:41:49 -0500 (EST) (envelope-from alewis@roundnoon.com) Received: from localhost (alewis@localhost) by rns.roundnoon.com (8.9.1/8.9.3) with ESMTP id NAA16059; Fri, 3 Dec 1999 13:43:32 -0600 Date: Fri, 3 Dec 1999 13:43:32 -0600 (CST) From: Andy Lewis To: kaiq@realtyideas.com cc: Thomas Lockhart , Karel Zak - Zakkr , pgsql-hackers , pgsql-sql Subject: Re: Datetime operators (was: Re: [SQL] Another Date question) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Remove the ::timespan and it will. Andy On Fri, 3 Dec 1999 kaiq@realtyideas.com wrote: > why > > create table mymy (mydate datetime default (now() + '60 days'::timespan )); > > does not work? > > On Fri, 3 Dec 1999, Thomas Lockhart wrote: > > > > > 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 > > > > ************ > > >