Re: Passing varchar parameter to INTERVAL

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Passing varchar parameter to INTERVAL
Date: 2016-09-07 13:35:02
Message-ID: 20160907133502.fnaymlwquc2jw4gx@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Sep 07, 2016 at 03:05:38PM +0200, Alexander Farber wrote:
> ERROR: syntax error at or near "in_until"
> LINE 69: ... banned_until = CURRENT_TIMESTAMP + INTERVAL in_until,
> ^
> Is there please a better way here?

Why don't you simply make in_util parameter interval? What is the point
of accepting varchar, if you're unconditionally casting it to interval
anyway?

Having said that, the error looks rather strange for this.

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2016-09-07 13:40:15 Re: Passing varchar parameter to INTERVAL
Previous Message rob stone 2016-09-07 13:24:52 Re: Passing varchar parameter to INTERVAL