Crystle Numan wrote:
Dear all: I am fairly knowledgeable about PostgreSQL but this behaviour is stumping me. Any help would be wonderful. If you think it is a bug, let me now and I'll file one. (select values in DB (date stamps) between Jan 1, 2000 and Jan 1, 2005, no results) db_name=# SELECT * from person_detail WHERE field='2' AND value>'946702800' AND value<'1104555600'; id | person | field | value ----+--------+-------+------- (0 rows)
You are comparing strings, which is not quite the same as a numerical comparison. The above range is empty, as '9...' > '1...' (even though the left string is shorter).
Either compare numbers, or left pad your left string with zeroes until it's the same length as the right string.
-- Alban Hertroys alban@xxxxxxxxxxxxxxxxx magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproductions.nl A: Postbus 416 7500 AK Enschede //Showing your Vision to the World// ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match