|
208 | 208 | </tgroup> |
209 | 209 | </table> |
210 | 210 |
|
211 | | - <para> |
212 | | - Currently, ordering by the distance operator <literal><-></> |
213 | | - is supported only with <literal>point</> by the operator classes |
214 | | - of the geometric types. |
215 | | - </para> |
216 | | - |
217 | 211 | <para> |
218 | 212 | For historical reasons, the <literal>inet_ops</> operator class is |
219 | 213 | not the default class for types <type>inet</> and <type>cidr</>. |
@@ -805,28 +799,30 @@ my_distance(PG_FUNCTION_ARGS) |
805 | 799 | </para> |
806 | 800 |
|
807 | 801 | <para> |
808 | | - Some approximation is allowed when determining the distance, as long as |
809 | | - the result is never greater than the entry's actual distance. Thus, for |
810 | | - example, distance to a bounding box is usually sufficient in geometric |
811 | | - applications. For an internal tree node, the distance returned must not |
812 | | - be greater than the distance to any of the child nodes. If the returned |
813 | | - distance is not accurate, the function must set *recheck to false. (This |
814 | | - is not necessary for internal tree nodes; for them, the calculation is |
815 | | - always assumed to be inaccurate). The executor will calculate the |
816 | | - accurate distance after fetching the tuple from the heap, and reorder |
817 | | - the tuples if necessary. |
| 802 | + Some approximation is allowed when determining the distance, so long |
| 803 | + as the result is never greater than the entry's actual distance. Thus, |
| 804 | + for example, distance to a bounding box is usually sufficient in |
| 805 | + geometric applications. For an internal tree node, the distance |
| 806 | + returned must not be greater than the distance to any of the child |
| 807 | + nodes. If the returned distance is not exact, the function must set |
| 808 | + <literal>*recheck</> to true. (This is not necessary for internal tree |
| 809 | + nodes; for them, the calculation is always assumed to be inexact.) In |
| 810 | + this case the executor will calculate the accurate distance after |
| 811 | + fetching the tuple from the heap, and reorder the tuples if necessary. |
818 | 812 | </para> |
819 | 813 |
|
820 | 814 | <para> |
821 | | - If the distance function returns *recheck=true for a leaf node, the |
822 | | - original ordering operator's return type must be float8 or float4, and |
823 | | - the distance function's return value must be comparable with the actual |
824 | | - distance operator. Otherwise, the distance function's return type can |
825 | | - be any finit <type>float8</> value, as long as the relative order of |
826 | | - the returned values matches the order returned by the ordering operator. |
827 | | - (Infinity and minus infinity are used internally to handle cases such as |
828 | | - nulls, so it is not recommended that <function>distance</> functions |
829 | | - return these values.) |
| 815 | + If the distance function returns <literal>*recheck = true</> for any |
| 816 | + leaf node, the original ordering operator's return type must |
| 817 | + be <type>float8</> or <type>float4</>, and the distance function's |
| 818 | + result values must be comparable to those of the original ordering |
| 819 | + operator, since the executor will sort using both distance function |
| 820 | + results and recalculated ordering-operator results. Otherwise, the |
| 821 | + distance function's result values can be any finite <type>float8</> |
| 822 | + values, so long as the relative order of the result values matches the |
| 823 | + order returned by the ordering operator. (Infinity and minus infinity |
| 824 | + are used internally to handle cases such as nulls, so it is not |
| 825 | + recommended that <function>distance</> functions return these values.) |
830 | 826 | </para> |
831 | 827 |
|
832 | 828 | </listitem> |
@@ -857,7 +853,7 @@ LANGUAGE C STRICT; |
857 | 853 | struct, whose 'key' field contains the same datum in the original, |
858 | 854 | uncompressed form. If the opclass' compress function does nothing for |
859 | 855 | leaf entries, the fetch method can return the argument as is. |
860 | | - </para> |
| 856 | + </para> |
861 | 857 |
|
862 | 858 | <para> |
863 | 859 | The matching code in the C module could then follow this skeleton: |
|
0 commit comments