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.