X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7361F52C1F; Sat, 20 Aug 2005 02:44:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08350-08; Sat, 20 Aug 2005 05:44:31 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 67D9A52C17; Sat, 20 Aug 2005 02:44:30 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id AF91C3556E; Fri, 19 Aug 2005 22:44:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id AD96635564; Fri, 19 Aug 2005 22:44:30 -0700 (PDT) Date: Fri, 19 Aug 2005 22:44:30 -0700 (PDT) From: Stephan Szabo To: CSN Cc: pgsql-docs@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] Suggestion for Date/Time Functions Section In-Reply-To: <20050820045921.40396.qmail@web52914.mail.yahoo.com> Message-ID: <20050819224233.C81094@megazone.bigpanda.com> References: <20050820045921.40396.qmail@web52914.mail.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200508/20 X-Sequence-Number: 3182 On Fri, 19 Aug 2005, CSN wrote: > Hi, > > I suggestion for the date/time functions in the docs: > http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html > > I was trying to figure out how to do: > update table set next=now() + interval 'table.period > seconds'; > > I tried subqueries, the concat operator, and anything > else I could think of until I rediscovered the page on > the various ways to cast. Perhaps mix up the examples > in the docs so other ways to do date arithmetic (and > that allow expressions, fields, etc.) are obvious: > > date '2001-09-28' + cast((7+7)||' seconds' as > interval); I'd suggest something like date '2001-09-28' + (7+7) * interval '1 second'; instead of using text concatenation.