Re: interval integer comparison

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
Subject: Re: interval integer comparison
Date: 2005-05-31 15:46:14
Message-ID: 12754.1117554374@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Harald Fuchs 2005-05-31 16:28:12 Re: Missing numbers
Previous Message Havasvölgyi Ottó 2005-05-31 15:37:05 Re: Accessing PostgreSQL from C++