From: | Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: interval integer comparison |
Date: | 2005-06-01 23:54:12 |
Message-ID: | 018d01c56705$35cc3540$6c00a8c0@OTTO |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you Tom.
It was a bit confusing because my WHERE clause looked something like this:
... WHERE date_field - current_date < '21 days'::interval;
And then I got records, whose with date_field's year was 2010. :-o
Now I am using this formula:
... WHERE date_field < current_date + '21 days'::interval;
Best Regards,
Otto
----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Havasvölgyi Ottó" <h(dot)otto(at)freemail(dot)hu>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Tuesday, May 31, 2005 5:46 PM
Subject: Re: [GENERAL] interval integer comparison
> =?iso-8859-2?Q?Havasv=F6lgyi_Ott=F3?= <h(dot)otto(at)freemail(dot)hu> writes:
> > Pg 8.0.3 allows me to compare interval with integer, but I cannot see
any
> > reasonable rule:
>
> > 1 < '1 days'::interval
>
> The reason that doesn't fail outright is that both integer and
> interval have implicit coercions to text. So the only interpretation
> the parser can find is to convert both sides to text and use the text <
> operator. As text comparisons your answers all make sense.
>
> I've been arguing for a long time that we need to cut down on the number
> of implicit coercions to text...
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Roman F | 2005-06-02 01:28:38 | Deleting orphaned records to establish Ref Integrity |
Previous Message | Ragnar Hafstað | 2005-06-01 22:52:50 | Re: hpw to Count without group by |