Re: Passing varchar parameter to INTERVAL

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Re: Passing varchar parameter to INTERVAL
Дата
Msg-id CAADeyWi0q9p4-GXX3nopRXnAsn+BknOnXk+vH+U4UZTbt8eTGQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Passing varchar parameter to INTERVAL  (rob stone <floriparob@gmail.com>)
Ответы Re: Passing varchar parameter to INTERVAL  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Passing varchar parameter to INTERVAL
Следующее
От: Attila Soki
Дата:
Сообщение: Re: pgadmin4 rc1 query tool performance