Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> This is different in that you are using - instead of >= . Date - Date
> will get picked because that is the only - operator with a left operand
> of type date.
Even if it weren't the only one, there is a preferential case involved:
given "known_type operator unknown_literal", the parser will
preferentially assume that the unknown_literal is the same type as the
other operand, if there is an available operator that takes that type
on both sides. For details see
(rule 2a is my point here).
Note that in *no* case will the contents of the string literal have any
a-priori effect on the parser's decision about what the literal's type
is. I believe this is a good policy in general --- doing otherwise
would render the behavior way too unpredictable, since often the
contents of the literal are not under the control of the SQL query
author. But this does mean that just writing '2 days' is not going
to be enough to make the system think it is an interval constant.
There must be some cue to the type outside the quotes, whether an
explicit cast or an implicit match to another operand.
regards, tom lane
In response to
pgsql-general by date
|Next:||From: Bruno Baguette||Date: 2004-03-30 07:40:02|
|Subject: Best open source db poll currently|
|Previous:||From: Bruno Wolff III||Date: 2004-03-30 05:22:36|
|Subject: Re: Interval constant syntax, was Re: Interval & check clause|