diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-01-30 12:30:38 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-01-30 12:30:59 -0500 |
| commit | 3d660d33aab2f1eb98367a84eb2addf3e0969c05 (patch) | |
| tree | 0ddca80ebcf52c22e9abf25cf3f1363580339210 /src/include | |
| parent | 68fa75f3188c050ec62804f2bfacd3ea85404743 (diff) | |
Fix assorted oversights in range selectivity estimation.
calc_rangesel() failed outright when comparing range variables to empty
constant ranges with < or >=, as a result of missing cases in a switch.
It also produced a bogus estimate for > comparison to an empty range.
On top of that, the >= and > cases were mislabeled throughout. For
nonempty constant ranges, they managed to produce the right answers
anyway as a result of counterbalancing typos.
Also, default_range_selectivity() omitted cases for elem <@ range,
range &< range, and range &> range, so that rather dubious defaults
were applied for these operators.
In passing, rearrange the code in rangesel() so that the elem <@ range
case is handled in a less opaque fashion.
Report and patch by Emre Hasegeli, some additional work by me
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/pg_operator.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index d8a25f841d2..af991d34f72 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -1723,10 +1723,10 @@ DESCR("less than or equal"); #define OID_RANGE_LESS_EQUAL_OP 3885 DATA(insert OID = 3886 ( ">=" PGNSP PGUID b f f 3831 3831 16 3885 3884 range_ge rangesel scalargtjoinsel )); DESCR("greater than or equal"); -#define OID_RANGE_GREATER_OP 3886 +#define OID_RANGE_GREATER_EQUAL_OP 3886 DATA(insert OID = 3887 ( ">" PGNSP PGUID b f f 3831 3831 16 3884 3885 range_gt rangesel scalargtjoinsel )); DESCR("greater than"); -#define OID_RANGE_GREATER_EQUAL_OP 3887 +#define OID_RANGE_GREATER_OP 3887 DATA(insert OID = 3888 ( "&&" PGNSP PGUID b f f 3831 3831 16 3888 0 range_overlaps rangesel areajoinsel )); DESCR("overlaps"); #define OID_RANGE_OVERLAP_OP 3888 |
