Re: replacing expresion in plpgsql

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: replacing expresion in plpgsql
Date: 2013-12-16 14:47:20
Message-ID: CAHyXU0z02V0U1h2-_b3Z+NKxk0mj0n8+TyQ0chehTrmmL5yAXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Dec 16, 2013 at 2:08 AM, John R Pierce <pierce(at)hogranch(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Misa Simic 2013-12-16 15:26:36 Re: Grouping, Aggregate, Min, Max
Previous Message Steve McCoy 2013-12-16 14:41:56 Bus error in libxml2 in postgresql 9.2.x on FreeBSD