- Notifications
You must be signed in to change notification settings - Fork5
Commit00dac60
committed
Refactor pattern_fixed_prefix() to avoid dealing in incomplete patterns.
Previously, pattern_fixed_prefix() was defined to return whatever fixedprefix it could extract from the pattern, plus the "rest" of the pattern.That definition was sensible for LIKE patterns, but not so much forregexes, where reconstituting a valid pattern minus the prefix could bequite tricky (certainly the existing code wasn't doing that correctly).Since the only thing that callers ever did with the "rest" of the patternwas to pass it to like_selectivity() or regex_selectivity(), let's cut outthe middle-man and just have pattern_fixed_prefix's subroutines do thisdirectly. Then pattern_fixed_prefix can return a simple selectivitynumber, and the question of how to cope with partial patterns is removedfrom its API specification.While at it, adjust the API spec so that callers who don't actually careabout the pattern's selectivity (which is a lot of them) can pass NULL forthe selectivity pointer to skip doing the work of computing a selectivityestimate.This patch is only an API refactoring that doesn't actually change anyprocessing, other than allowing a little bit of useless work to be skipped.However, it's necessary infrastructure for my upcoming fix to regex prefixextraction, because after that change there won't be any simple way toidentify the "rest" of the regex, not even to the low level of fidelityneeded by regex_selectivity. We can cope with that if regex_fixed_prefixand regex_selectivity communicate directly, but not if we have to workwithin the old API. Hence, back-patch to all active branches.1 parente7ef6d7 commit00dac60
File tree
3 files changed
+60
-128
lines changed- src
- backend
- optimizer/path
- utils/adt
- include/utils
3 files changed
+60
-128
lines changedLines changed: 9 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2785 | 2785 |
| |
2786 | 2786 |
| |
2787 | 2787 |
| |
2788 |
| - | |
2789 | 2788 |
| |
2790 | 2789 |
| |
2791 | 2790 |
| |
| |||
2814 | 2813 |
| |
2815 | 2814 |
| |
2816 | 2815 |
| |
2817 |
| - | |
| 2816 | + | |
2818 | 2817 |
| |
2819 | 2818 |
| |
2820 | 2819 |
| |
2821 | 2820 |
| |
2822 | 2821 |
| |
2823 |
| - | |
| 2822 | + | |
2824 | 2823 |
| |
2825 | 2824 |
| |
2826 | 2825 |
| |
| |||
2829 | 2828 |
| |
2830 | 2829 |
| |
2831 | 2830 |
| |
2832 |
| - | |
| 2831 | + | |
2833 | 2832 |
| |
2834 | 2833 |
| |
2835 | 2834 |
| |
| |||
2838 | 2837 |
| |
2839 | 2838 |
| |
2840 | 2839 |
| |
2841 |
| - | |
| 2840 | + | |
2842 | 2841 |
| |
2843 | 2842 |
| |
2844 | 2843 |
| |
| |||
2847 | 2846 |
| |
2848 | 2847 |
| |
2849 | 2848 |
| |
2850 |
| - | |
| 2849 | + | |
2851 | 2850 |
| |
2852 | 2851 |
| |
2853 | 2852 |
| |
| |||
3115 | 3114 |
| |
3116 | 3115 |
| |
3117 | 3116 |
| |
3118 |
| - | |
3119 | 3117 |
| |
3120 | 3118 |
| |
3121 | 3119 |
| |
| |||
3135 | 3133 |
| |
3136 | 3134 |
| |
3137 | 3135 |
| |
3138 |
| - | |
| 3136 | + | |
3139 | 3137 |
| |
3140 | 3138 |
| |
3141 | 3139 |
| |
| |||
3147 | 3145 |
| |
3148 | 3146 |
| |
3149 | 3147 |
| |
3150 |
| - | |
| 3148 | + | |
3151 | 3149 |
| |
3152 | 3150 |
| |
3153 | 3151 |
| |
| |||
3159 | 3157 |
| |
3160 | 3158 |
| |
3161 | 3159 |
| |
3162 |
| - | |
| 3160 | + | |
3163 | 3161 |
| |
3164 | 3162 |
| |
3165 | 3163 |
| |
| |||
3171 | 3169 |
| |
3172 | 3170 |
| |
3173 | 3171 |
| |
3174 |
| - | |
| 3172 | + | |
3175 | 3173 |
| |
3176 | 3174 |
| |
3177 | 3175 |
| |
|
0 commit comments
Comments
(0)