Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 5967FB5DC6D for ; Thu, 3 Nov 2011 14:56:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 28891-02-7 for ; Thu, 3 Nov 2011 17:56:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from smtp.comsquared.com (smtp.comsquared.com [209.155.237.140]) by mail.postgresql.org (Postfix) with ESMTP id 84E8EB5DC4F for ; Thu, 3 Nov 2011 14:56:14 -0300 (ADT) Received: from mdpserv.comsquared.com (mdpserv [10.82.40.1]) by smtp.comsquared.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id pA3Hu9rW007548 for ; Thu, 3 Nov 2011 13:56:13 -0400 (EDT) Received: from erouse052008 ([10.82.60.61]) by mdpserv.comsquared.com (8.13.6+Sun/8.13.6) with ESMTP id pA3Hu9Pe028229 for ; Thu, 3 Nov 2011 13:56:09 -0400 (EDT) From: "Edward W. Rouse" To: References: <00ee01cc9a4e$2b41f050$81c5d0f0$@com> In-Reply-To: Subject: Re: intervals Date: Thu, 3 Nov 2011 13:56:09 -0400 Message-ID: <00f501cc9a51$de2c1080$9a843180$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcyaUL8ISa+1Q25ORU2SPsF3X9ogAAAARAgg Content-Language: en-us X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.101 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.201 X-Spam-Level: X-Archive-Number: 201111/8 X-Sequence-Number: 35981 That was part of the problem. Thanks for the info. > -----Original Message----- > From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql- > owner@postgresql.org] On Behalf Of Jonathan S. Katz > Sent: Thursday, November 03, 2011 1:41 PM > To: Edward W. Rouse > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] intervals > > Hi Edward, > > "LIMIT" is a keyword, which is where you are getting your errors. Did > you try a different variable name? > > Best, > > Jonathan > > On Nov 3, 2011, at 1:29 PM, Edward W. Rouse wrote: > > > I am writing a procedure and am having a little difficulty with an > interval. > > In the DECLARE section I have: > > > > expire interval := '30 days'::interval; > > > > which seems to work fine. In the BEGIN block I need to pull out the > number > > of days from a table and update the expire interval to that. But I > can't > > quite seem to get the replacement correct. > > > > First I use "SELECT value into limit from" to get the new limit > value. The > > value is text, but I have also tried with SELECT (value::integer) > into limit > > from" with the same result. The error occurs here: > > > > expire := '% days'::interval, limit; > > > > Now I have tried several different ways to get a new interval, such > as '' || > > limit || days''::interval; and other various differently quoted > variations, > > but haven't found the one that works yet. I am still trying various > > combinations, but thought that someone on the list has probably done > this > > already. I may, in fact, be doing it entirely wrong. So if someone > knows the > > correct/better/easier way to create a dynamic interval I'd appreciate > a > > clue. > > > > Thanks. > > > > > > Edward W. Rouse > > > > > > > > > > -- > > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgsql-sql > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql