BUG #10785: error if using x>n AND x

From lunda@bitmessage.ch
Subject BUG #10785: error if using x>n AND x
Date
Msg-id 20140627135405.15694.38636@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #10785: error if using x>n AND x  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      10785
Logged by:          j.l.
Email address:      lunda@bitmessage.ch
PostgreSQL version: 9.3.4
Operating system:   Linux 64bit (ubuntu 12.04)
Description:

DOES WORK:
create index planet_osm_point_city_50k_index on planet_osm_point using
gist(way) where
(((capital IS NULL) OR (capital <> 'yes'::text)) AND
(place = ANY ('{city,town}'::text[])) AND
(population IS NOT NULL) AND (population <> ''::text) AND
(regexp_replace(population, '[., ]', '')::int > 50000));

DOES WORK:
create index planet_osm_point_city_50k_index on planet_osm_point using
gist(way) where
(((capital IS NULL) OR (capital <> 'yes'::text)) AND
(place = ANY ('{city,town}'::text[])) AND
(population IS NOT NULL) AND (population <> ''::text) AND
(regexp_replace(population, '[., ]', '')::int between 50000 and 99999));

DOES NOT WORK (ERROR:  invalid input syntax for integer: "tower"):
create index planet_osm_point_city_50k_index on planet_osm_point using
gist(way) where
(((capital IS NULL) OR (capital <> 'yes'::text)) AND
(place = ANY ('{city,town}'::text[])) AND
(population IS NOT NULL) AND (population <> ''::text) AND
(regexp_replace(population, '[., ]', '')::int >= 50000) AND
(regexp_replace(population, '[., ]', '')::int < 100000));

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Bogus pg_class.relminmxid value for pg_database
Next
From: Tom Lane
Date:
Subject: Re: BUG #10785: error if using x>n AND x