Re: Problem with retrieving records using double precision fields

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Raymond C(dot) Rodgers" <sinful622(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with retrieving records using double precision fields
Date: 2009-01-21 17:30:41
Message-ID: 49775BC1.3000200@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Raymond C. Rodgers wrote:
> In two separate databases that are configured to have latitude and
> longitude as double precision fields, I'm having trouble retrieving
> records using "between" on the longitude field. I know that I have data
> within range, but any query involving the longitude field fails to find
> records.

> test=# select * from coordtest where longitude between -83.0 and -84.0;

Order of between arguments is important.

richardh=> SELECT 2 between 1 and 3;
?column?
----------
t
(1 row)

richardh=> SELECT 2 between 3 and 1;
?column?
----------
f
(1 row)

richardh=> SELECT -2 between -1 and -3;
?column?
----------
f
(1 row)

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-01-21 17:33:12 Re: Problem with retrieving records using double precision fields
Previous Message Raymond C. Rodgers 2009-01-21 17:22:14 Problem with retrieving records using double precision fields