Re: Interval constant syntax, was Re: Interval & check clause
| От | Bruno Wolff III |
|---|---|
| Тема | Re: Interval constant syntax, was Re: Interval & check clause |
| Дата | |
| Msg-id | 20040329204410.GA7968@wolff.to обсуждение исходный текст |
| Ответ на | Interval constant syntax, was Re: Interval & check clause ("Karl O. Pinc" <kop@meme.com>) |
| Ответы |
Re: Interval constant syntax, was Re: Interval & check clause
|
| Список | pgsql-general |
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.
В списке pgsql-general по дате отправления: