Heikki Linnakangas <heikki.linnakangas@iki.fi> wrote:
> Fix "element <@ range" cost estimation.
>
> The statistics-based cost estimation patch for range types broke that, by
> incorrectly assuming that the left operand of all range oeprators is a
> range. That lead to a "type x is not a range type" error. Because it
> took so long for anyone to notice, add a regression test for that case.
>
> We still don't do proper statistics-based cost estimation for that, so you
> just get a default constant estimate. We should look into implementing that,
> but this patch at least fixes the regression.
Something is still wrong. When I run `make check-world` everything
passes, but `make installcheck-world` on a fresh initdb with
default configuration yields this:
*** /home/kgrittn/pg/master/src/test/regress/expected/rangetypes.out 2013-03-21 09:17:39.445690793 -0500
--- /home/kgrittn/pg/master/src/test/regress/results/rangetypes.out 2013-03-21 10:13:20.201683022 -0500
***************
*** 1048,1058 ****
create index test_range_elem_idx on test_range_elem (i);
insert into test_range_elem select i from generate_series(1,100) i;
select count(*) from test_range_elem where i <@ int4range(10,50);
! count
! -------
! 40
! (1 row)
!
drop table test_range_elem;
--
-- Btree_gist is not included by default, so to test exclusion
--- 1048,1054 ----
create index test_range_elem_idx on test_range_elem (i);
insert into test_range_elem select i from generate_series(1,100) i;
select count(*) from test_range_elem where i <@ int4range(10,50);
! ERROR: type 23 is not a range type
drop table test_range_elem;
--
-- Btree_gist is not included by default, so to test exclusion
======================================================================
--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company