Re: Passing varchar parameter to INTERVAL - Mailing list pgsql-general

From Alexander Farber
Subject Re: Passing varchar parameter to INTERVAL
Date
Msg-id CAADeyWi0q9p4-GXX3nopRXnAsn+BknOnXk+vH+U4UZTbt8eTGQ@mail.gmail.com
Whole thread Raw
In response to Re: Passing varchar parameter to INTERVAL  (rob stone <floriparob@gmail.com>)
Responses Re: Passing varchar parameter to INTERVAL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello Rob,

On Wed, Sep 7, 2016 at 3:24 PM, rob stone <floriparob@gmail.com> wrote:

I think the interval values need to be quoted.
In any event I always use the P or T syntax. 'P1D' means add one day,

unfortunately, I can not call INTERVAL 'in_until', that wouldn't work.

Also 'P1D' vs. '1 day' seems to be just a matter of taste.

Finally, to provide more context to my question -

I would prefer to call my custom function as

    select words_ban_user(1, '1 day', 'attacking other users');

and not as

    select words_ban_user(1, CURRENT_TIMESTAMP + '1 day', 'attacking other users');

because additionally to the temporary ban I would like to prolong VIP-periods for paying users (to avoid discussions) - and that would be more difficult in the latter case (would require more date acrobatics)...

Regards
Alex

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: Passing varchar parameter to INTERVAL
Next
From: Attila Soki
Date:
Subject: Re: pgadmin4 rc1 query tool performance