Search Postgresql Archives

Re: Interval constant syntax, was Re: Interval & check clause

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

 



On Mon, Mar 29, 2004 at 13:58:51 -0600,
  "Karl O. Pinc" <kop@meme.com> wrote:
> 
> Is there any way to write a constant interval without a cast?
> It sure seems awkward to always have to cast.  (AT least I always
> seem to have to cast after my little bit of experiementing.)
> 
> (BTW, check (col_name >= CAST ('0 days' AS interval))
> is more portable.)

In postgres you shouldn't have to explicitly cast the constant to an
interval as long as there isn't one than one >= operator that could
be applied (depending on the eventaul type of the constant). I would
really be surprized if this were to happen for >= and an interval operand
on one side or the other.

It won't work with two unknown constants, if that was what you tested.
Try just casting on one side.

P.S.
I think :: is easier to read than a CAST function call, so that is what
I am in the habit of using.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

[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