Re: replacing expresion in plpgsql - Mailing list pgsql-general

From Merlin Moncure
Subject Re: replacing expresion in plpgsql
Date
Msg-id CAHyXU0z02V0U1h2-_b3Z+NKxk0mj0n8+TyQ0chehTrmmL5yAXA@mail.gmail.com
Whole thread Raw
In response to Re: replacing expresion in plpgsql  (John R Pierce <pierce@hogranch.com>)
List pgsql-general
On Mon, Dec 16, 2013 at 2:08 AM, John R Pierce <pierce@hogranch.com> wrote:
> On 12/15/2013 10:54 PM, Thomas Kellerer wrote:
>>
>> Both are valid. interval '2' day is the ANSI SQL format though.
>
>
> oh, really!   ah, I stand corrected, didn't realize the units were valid
> keywords like that.

Me neither.   Stuff like this is black magic implemented in the
parser...I always avoid it when I can.  I would have done it like
this:

newexpdate := CURRENT_TIMESTAMP +  (expdays || ' days')::interval;

merlin


pgsql-general by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: pg_stat_tmp
Next
From: Misa Simic
Date:
Subject: Re: Grouping, Aggregate, Min, Max