pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Jonathan S. Katz <jonathan.katz@excoventures.com>
To: Edward W. Rouse <erouse@comsquared.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: intervals
Date: Thu, 3 Nov 2011 13:41:16 -0400
Message-ID: <B63820AA-AA3A-4B45-B7EB-0955F1975C77@excoventures.com> (raw)
In-Reply-To: <00ee01cc9a4e$2b41f050$81c5d0f0$@com>
References: <00ee01cc9a4e$2b41f050$81c5d0f0$@com>
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
view thread (6+ messages) latest in thread
Message-ID: <B63820AA-AA3A-4B45-B7EB-0955F1975C77@excoventures.com> Permalink: ../B63820AA-AA3A-4B45-B7EB-0955F1975C77@excoventures.com/ Also on: postgresql.org/message-id/B63820AA-AA3A-4B45-B7EB-0955F1975C77@excoventures.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients using the --to and --cc options: reply via email To: pgsql-sql@postgresql.org Cc: jonathan.katz@excoventures.com, erouse@comsquared.com Subject: Re: intervals In-Reply-To: <B63820AA-AA3A-4B45-B7EB-0955F1975C77@excoventures.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox