Search Postgresql Archives

Re: Passing varchar parameter to INTERVAL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexander Farber <alexander.farber@xxxxxxxxx> writes:
> unfortunately, I can not call INTERVAL 'in_until', that wouldn't work.

No, because the syntax TYPENAME 'LITERAL' only works for simple string
literals.  What you want here is a run-time cast, either
CAST(in_until AS interval) or in_until::interval.

> I would prefer to call my custom function as
>     select words_ban_user(1, '1 day', 'attacking other users');

That is not a reason not to declare the argument as interval.

> and not as
>     select words_ban_user(1, CURRENT_TIMESTAMP + '1 day', 'attacking other
> users');

Hm?  That would be passing a timestamp not an interval.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux