From 3b6db1f445e14bd189ebc99ce1e5535a1c624613 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Tue, 5 May 2015 15:22:24 -0300 Subject: Add geometry/range functions to support BRIN inclusion This commit adds the following functions: box(point) -> box bound_box(box, box) -> box inet_same_family(inet, inet) -> bool inet_merge(inet, inet) -> cidr range_merge(anyrange, anyrange) -> anyrange The first of these is also used to implement a new assignment cast from point to box. These functions are the first part of a base to implement an "inclusion" operator class for BRIN, for multidimensional data types. Author: Emre Hasegeli Reviewed by: Andreas Karlsson --- doc/src/sgml/func.sgml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index e6f2129f386..fb397316048 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -8295,6 +8295,12 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple circle to box box(circle '((0,0),2.0)') + + box(point) + box + point to empty box + box(point '(0,0)') + box(point, point) box @@ -8307,6 +8313,12 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple polygon to box box(polygon '((0,0),(1,1),(2,0))') + + bound_box(box, box) + box + boxes to bounding box + bound_box(box '((0,0),(1,1))', box '((3,3),(4,4))') + @@ -8734,6 +8746,30 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple text(inet '192.168.1.5') 192.168.1.5/32 + + + + inet_same_family + + inet_same_family(inet, inet) + + boolean + are the addresses from the same family? + inet_same_family('192.168.1.5/24', '::1') + false + + + + + inet_merge + + inet_merge(inet, inet) + + cidr + the smallest network which includes both of the given networks + inet_merge('192.168.1.5/24', '192.168.2.5/24') + 192.168.0.0/22 + @@ -12090,6 +12126,17 @@ NULL baz(3 rows) upper_inf('(,)'::daterange) true + + + + range_merge(anyrange, anyrange) + + + anyrange + the smallest range which includes both of the given ranges + range_merge('[1,2)'::int4range, '[3,4)'::int4range) + [1,4) + -- cgit v1.2.3