From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | "Karl O(dot) Pinc" <kop(at)meme(dot)com> |
Cc: | Bruno BAGUETTE <pgsql-ml(at)baguette(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Interval constant syntax, was Re: Interval & check clause |
Date: | 2004-03-29 20:44:10 |
Message-ID: | 20040329204410.GA7968@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Mar 29, 2004 at 13:58:51 -0600,
"Karl O. Pinc" <kop(at)meme(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-03-29 20:54:04 | Re: PG vs MySQL |
Previous Message | Tom Lane | 2004-03-29 20:11:32 | Re: bugs list working??? |