From 325ad66b52cc1751f8d185809f4221d6eba9db8e Mon Sep 17 00:00:00 2001 From: Oliver Tan <otan@cockroachlabs.com> Date: Mon, 31 Aug 2020 20:39:15 -0700 Subject: [PATCH] geo: rebrand geospatial to spatial with minor refactors * Rename geospatial to spatial (for outwards facing docs). * Replace all (args[d].(*tree.DType)) to tree.MustBeDType(args[d]) * Add tests to ensure all geo builtin info has a capital letter and full stop. Release justification: low risk update to new functionality Release note (cli change): The `--geo-libs` flag introduced in v20.2-alphas is renamed to `--spatial-libs`. --- docs/generated/sql/functions.md | 1526 ++++++++--------- pkg/cli/cliflags/flags.go | 4 +- pkg/cli/demo.go | 2 +- pkg/cli/start.go | 2 +- pkg/cmd/geoviz/main.go | 4 +- .../opt/invertedidx/inverted_index_expr.go | 2 +- pkg/sql/sem/builtins/builtins.go | 2 +- pkg/sql/sem/builtins/geo_builtins.go | 354 ++-- pkg/sql/sem/builtins/geo_builtins_test.go | 37 + pkg/sql/sem/tree/datum.go | 10 + pkg/util/encoding/encoding.go | 4 +- 11 files changed, 997 insertions(+), 950 deletions(-) create mode 100644 pkg/sql/sem/builtins/geo_builtins_test.go diff --git a/docs/generated/sql/functions.md b/docs/generated/sql/functions.md index f23aa1e20503..349539d4d92f 100644 --- a/docs/generated/sql/functions.md +++ b/docs/generated/sql/functions.md @@ -694,240 +694,630 @@ has no relationship with the commit order of concurrent transactions.</p> </span></td></tr></tbody> </table> -### Geospatial functions +### ID generation functions <table> <thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> <tbody> -<tr><td><a name="_st_contains"></a><code>_st_contains(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no points of geometry_b lie in the exterior of geometry_a, and there is at least one point in the interior of geometry_b that lies in the interior of geometry_a.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_containsproperly"></a><code>_st_containsproperly(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_b intersects the interior of geometry_a but not the boundary or exterior of geometry_a.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_coveredby"></a><code>_st_coveredby(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geography_a is outside geography_b.</p> -<p>The calculations performed are have a precision of 1cm.</p> -<p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_coveredby"></a><code>_st_coveredby(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_a is outside geometry_b</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_covers"></a><code>_st_covers(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geography_b is outside geography_a.</p> -<p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_covers"></a><code>_st_covers(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_b is outside geometry_a.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_crosses"></a><code>_st_crosses(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a has some - but not all - interior points in common with geometry_b.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_dfullywithin"></a><code>_st_dfullywithin(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if every pair of points comprising geometry_a and geometry_b are within distance units, inclusive. In other words, the ST_MaxDistance between geometry_a and geometry_b is less than or equal to distance units.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_dfullywithinexclusive"></a><code>_st_dfullywithinexclusive(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if every pair of points comprising geometry_a and geometry_b are within distance units, exclusive. In other words, the ST_MaxDistance between geometry_a and geometry_b is less than distance units.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_dwithin"></a><code>_st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, inclusive. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> -<p>The calculations performed are have a precision of 1cm.</p> -<p>This function utilizes the GeographicLib library for spheroid calculations.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_dwithin"></a><code>_st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>, use_spheroid: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, inclusive."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> -<p>The calculations performed are have a precision of 1cm.</p> -<p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function utilizes the GeographicLib library for spheroid calculations.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_dwithin"></a><code>_st_dwithin(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geometry_a is within distance units of geometry_b, inclusive.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_dwithinexclusive"></a><code>_st_dwithinexclusive(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, exclusive. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> -<p>The calculations performed are have a precision of 1cm.</p> -<p>This function utilizes the GeographicLib library for spheroid calculations.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_dwithinexclusive"></a><code>_st_dwithinexclusive(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>, use_spheroid: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, exclusive."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> -<p>The calculations performed are have a precision of 1cm.</p> -<p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function utilizes the GeographicLib library for spheroid calculations.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_dwithinexclusive"></a><code>_st_dwithinexclusive(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geometry_a is within distance units of geometry_b, exclusive.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_equals"></a><code>_st_equals(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a is spatially equal to geometry_b, i.e. ST_Within(geometry_a, geometry_b) = ST_Within(geometry_b, geometry_a) = true.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_intersects"></a><code>_st_intersects(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geography_a shares any portion of space with geography_b.</p> -<p>The calculations performed are have a precision of 1cm.</p> -<p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function variant does not utilize any geospatial index.</p> -</span></td></tr> -<tr><td><a name="_st_intersects"></a><code>_st_intersects(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a shares any portion of space with geometry_b.</p> -<p>The calculations performed are have a precision of 1cm.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> +<tr><td><a name="experimental_uuid_v4"></a><code>experimental_uuid_v4() → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns a UUID.</p> </span></td></tr> -<tr><td><a name="_st_overlaps"></a><code>_st_overlaps(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a intersects but does not completely contain geometry_b, or vice versa. “Does not completely” implies ST_Within(geometry_a, geometry_b) = ST_Within(geometry_b, geometry_a) = false.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> +<tr><td><a name="gen_random_uuid"></a><code>gen_random_uuid() → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Generates a random UUID and returns it as a value of UUID type.</p> </span></td></tr> -<tr><td><a name="_st_touches"></a><code>_st_touches(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if the only points in common between geometry_a and geometry_b are on the boundary. Note points do not touch other points.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> +<tr><td><a name="unique_rowid"></a><code>unique_rowid() → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns a unique ID used by CockroachDB to generate unique row IDs if a Primary Key isn’t defined for the table. The value is a combination of the insert timestamp and the ID of the node executing the statement, which guarantees this combination is globally unique. However, there can be gaps and the order is not completely guaranteed.</p> </span></td></tr> -<tr><td><a name="_st_within"></a><code>_st_within(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a is completely inside geometry_b.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant does not utilize any geospatial index.</p> +<tr><td><a name="uuid_v4"></a><code>uuid_v4() → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns a UUID.</p> +</span></td></tr></tbody> +</table> + +### INET functions + +<table> +<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> +<tbody> +<tr><td><a name="abbrev"></a><code>abbrev(val: <a href="inet.html">inet</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Converts the combined IP address and prefix length to an abbreviated display format as text.For INET types, this will omit the prefix length if it’s not the default (32 or IPv4, 128 for IPv6)</p> +<p>For example, <code>abbrev('192.168.1.2/24')</code> returns <code>'192.168.1.2/24'</code></p> </span></td></tr> -<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(catalog_name: <a href="string.html">string</a>, schema_name: <a href="string.html">string</a>, table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +<tr><td><a name="broadcast"></a><code>broadcast(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Gets the broadcast address for the network address represented by the value.</p> +<p>For example, <code>broadcast('192.168.1.2/24')</code> returns <code>'192.168.1.255/24'</code></p> </span></td></tr> -<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(catalog_name: <a href="string.html">string</a>, schema_name: <a href="string.html">string</a>, table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>, use_typmod: <a href="bool.html">bool</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +<tr><td><a name="family"></a><code>family(val: <a href="inet.html">inet</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Extracts the IP family of the value; 4 for IPv4, 6 for IPv6.</p> +<p>For example, <code>family('::1')</code> returns <code>6</code></p> </span></td></tr> -<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(schema_name: <a href="string.html">string</a>, table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +<tr><td><a name="host"></a><code>host(val: <a href="inet.html">inet</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Extracts the address part of the combined address/prefixlen value as text.</p> +<p>For example, <code>host('192.168.1.2/16')</code> returns <code>'192.168.1.2'</code></p> </span></td></tr> -<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(schema_name: <a href="string.html">string</a>, table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>, use_typmod: <a href="bool.html">bool</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +<tr><td><a name="hostmask"></a><code>hostmask(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Creates an IP host mask corresponding to the prefix length in the value.</p> +<p>For example, <code>hostmask('192.168.1.2/16')</code> returns <code>'0.0.255.255'</code></p> </span></td></tr> -<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +<tr><td><a name="masklen"></a><code>masklen(val: <a href="inet.html">inet</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Retrieves the prefix length stored in the value.</p> +<p>For example, <code>masklen('192.168.1.2/16')</code> returns <code>16</code></p> </span></td></tr> -<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>, use_typmod: <a href="bool.html">bool</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +<tr><td><a name="netmask"></a><code>netmask(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Creates an IP network mask corresponding to the prefix length in the value.</p> +<p>For example, <code>netmask('192.168.1.2/16')</code> returns <code>'255.255.0.0'</code></p> </span></td></tr> -<tr><td><a name="geometrytype"></a><code>geometrytype(geometry: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the type of geometry as a string.</p> -<p>This function utilizes the GEOS module.</p> +<tr><td><a name="set_masklen"></a><code>set_masklen(val: <a href="inet.html">inet</a>, prefixlen: <a href="int.html">int</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Sets the prefix length of <code>val</code> to <code>prefixlen</code>.</p> +<p>For example, <code>set_masklen('192.168.1.2', 16)</code> returns <code>'192.168.1.2/16'</code>.</p> </span></td></tr> -<tr><td><a name="geomfromewkb"></a><code>geomfromewkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from an EWKB representation.</p> +<tr><td><a name="text"></a><code>text(val: <a href="inet.html">inet</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Converts the IP address and prefix length to text.</p> +</span></td></tr></tbody> +</table> + +### INT functions + +<table> +<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> +<tbody> +<tr><td><a name="crc32c"></a><code>crc32c(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the CRC-32 hash using the Castagnoli polynomial.</p> </span></td></tr> -<tr><td><a name="geomfromewkt"></a><code>geomfromewkt(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from an EWKT representation.</p> +<tr><td><a name="crc32c"></a><code>crc32c(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the CRC-32 hash using the Castagnoli polynomial.</p> </span></td></tr> -<tr><td><a name="postgis_addbbox"></a><code>postgis_addbbox(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. This does not perform any operation on the Geometry.</p> +<tr><td><a name="crc32ieee"></a><code>crc32ieee(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the CRC-32 hash using the IEEE polynomial.</p> </span></td></tr> -<tr><td><a name="postgis_dropbbox"></a><code>postgis_dropbbox(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. This does not perform any operation on the Geometry.</p> +<tr><td><a name="crc32ieee"></a><code>crc32ieee(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the CRC-32 hash using the IEEE polynomial.</p> </span></td></tr> -<tr><td><a name="postgis_extensions_upgrade"></a><code>postgis_extensions_upgrade() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="fnv32"></a><code>fnv32(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 32-bit FNV-1 hash value of a set of values.</p> </span></td></tr> -<tr><td><a name="postgis_full_version"></a><code>postgis_full_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="fnv32"></a><code>fnv32(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 32-bit FNV-1 hash value of a set of values.</p> </span></td></tr> -<tr><td><a name="postgis_geos_version"></a><code>postgis_geos_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="fnv32a"></a><code>fnv32a(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 32-bit FNV-1a hash value of a set of values.</p> </span></td></tr> -<tr><td><a name="postgis_getbbox"></a><code>postgis_getbbox(geometry: geometry) → box2d</code></td><td><span class="funcdesc"><p>Returns a box2d encapsulating the given Geometry</p> +<tr><td><a name="fnv32a"></a><code>fnv32a(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 32-bit FNV-1a hash value of a set of values.</p> </span></td></tr> -<tr><td><a name="postgis_hasbbox"></a><code>postgis_hasbbox(geometry: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns whether a given Geometry has a bounding box. False for points and empty geometries; always true otherwise.</p> +<tr><td><a name="fnv64"></a><code>fnv64(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 64-bit FNV-1 hash value of a set of values.</p> </span></td></tr> -<tr><td><a name="postgis_lib_build_date"></a><code>postgis_lib_build_date() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="fnv64"></a><code>fnv64(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 64-bit FNV-1 hash value of a set of values.</p> </span></td></tr> -<tr><td><a name="postgis_lib_version"></a><code>postgis_lib_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="fnv64a"></a><code>fnv64a(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 64-bit FNV-1a hash value of a set of values.</p> </span></td></tr> -<tr><td><a name="postgis_liblwgeom_version"></a><code>postgis_liblwgeom_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="fnv64a"></a><code>fnv64a(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 64-bit FNV-1a hash value of a set of values.</p> </span></td></tr> -<tr><td><a name="postgis_libxml_version"></a><code>postgis_libxml_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="width_bucket"></a><code>width_bucket(operand: <a href="decimal.html">decimal</a>, b1: <a href="decimal.html">decimal</a>, b2: <a href="decimal.html">decimal</a>, count: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>return the bucket number to which operand would be assigned in a histogram having count equal-width buckets spanning the range b1 to b2.</p> </span></td></tr> -<tr><td><a name="postgis_proj_version"></a><code>postgis_proj_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="width_bucket"></a><code>width_bucket(operand: <a href="int.html">int</a>, b1: <a href="int.html">int</a>, b2: <a href="int.html">int</a>, count: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>return the bucket number to which operand would be assigned in a histogram having count equal-width buckets spanning the range b1 to b2.</p> </span></td></tr> -<tr><td><a name="postgis_scripts_build_date"></a><code>postgis_scripts_build_date() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="width_bucket"></a><code>width_bucket(operand: anyelement, thresholds: anyelement[]) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>return the bucket number to which operand would be assigned given an array listing the lower bounds of the buckets; returns 0 for an input less than the first lower bound; the thresholds array must be sorted, smallest first, or unexpected results will be obtained</p> +</span></td></tr></tbody> +</table> + +### JSONB functions + +<table> +<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> +<tbody> +<tr><td><a name="array_to_json"></a><code>array_to_json(array: anyelement[]) → jsonb</code></td><td><span class="funcdesc"><p>Returns the array as JSON or JSONB.</p> </span></td></tr> -<tr><td><a name="postgis_scripts_installed"></a><code>postgis_scripts_installed() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="array_to_json"></a><code>array_to_json(array: anyelement[], pretty_bool: <a href="bool.html">bool</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns the array as JSON or JSONB.</p> </span></td></tr> -<tr><td><a name="postgis_scripts_released"></a><code>postgis_scripts_released() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="crdb_internal.json_to_pb"></a><code>crdb_internal.json_to_pb(pbname: <a href="string.html">string</a>, json: jsonb) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Convert JSONB data to protocol message bytes</p> </span></td></tr> -<tr><td><a name="postgis_version"></a><code>postgis_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="crdb_internal.pb_to_json"></a><code>crdb_internal.pb_to_json(pbname: <a href="string.html">string</a>, data: <a href="bytes.html">bytes</a>) → jsonb</code></td><td><span class="funcdesc"><p>Converts protocol message to its JSONB representation.</p> </span></td></tr> -<tr><td><a name="postgis_wagyu_version"></a><code>postgis_wagyu_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +<tr><td><a name="json_array_length"></a><code>json_array_length(json: jsonb) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of elements in the outermost JSON or JSONB array.</p> </span></td></tr> -<tr><td><a name="st_area"></a><code>st_area(geography: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geography in meters^2. Uses a spheroid to perform the operation.</p> -<p>This function utilizes the GeographicLib library for spheroid calculations.</p> +<tr><td><a name="json_build_array"></a><code>json_build_array(anyelement...) → jsonb</code></td><td><span class="funcdesc"><p>Builds a possibly-heterogeneously-typed JSON or JSONB array out of a variadic argument list.</p> </span></td></tr> -<tr><td><a name="st_area"></a><code>st_area(geography: geography, use_spheroid: <a href="bool.html">bool</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geography in meters^2.</p> -<p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function utilizes the GeographicLib library for spheroid calculations.</p> +<tr><td><a name="json_build_object"></a><code>json_build_object(anyelement...) → jsonb</code></td><td><span class="funcdesc"><p>Builds a JSON object out of a variadic argument list.</p> </span></td></tr> -<tr><td><a name="st_area"></a><code>st_area(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geometry.</p> -<p>This function utilizes the GEOS module.</p> +<tr><td><a name="json_extract_path"></a><code>json_extract_path(jsonb, <a href="string.html">string</a>...) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments.</p> </span></td></tr> -<tr><td><a name="st_area"></a><code>st_area(geometry_str: <a href="string.html">string</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geometry.</p> -<p>This function utilizes the GEOS module.</p> -<p>This variant will cast all geometry_str arguments into Geometry types.</p> +<tr><td><a name="json_object"></a><code>json_object(keys: <a href="string.html">string</a>[], values: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>This form of json_object takes keys and values pairwise from two separate arrays. In all other respects it is identical to the one-argument form.</p> </span></td></tr> -<tr><td><a name="st_area2d"></a><code>st_area2d(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geometry.</p> -<p>This function utilizes the GEOS module.</p> +<tr><td><a name="json_object"></a><code>json_object(texts: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>Builds a JSON or JSONB object out of a text array. The array must have exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs.</p> </span></td></tr> -<tr><td><a name="st_asbinary"></a><code>st_asbinary(geography: geography) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the WKB representation of a given Geography.</p> +<tr><td><a name="json_remove_path"></a><code>json_remove_path(val: jsonb, path: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>Remove the specified path from the JSON object.</p> </span></td></tr> -<tr><td><a name="st_asbinary"></a><code>st_asbinary(geography: geography, xdr_or_ndr: <a href="string.html">string</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the WKB representation of a given Geography. This variant has a second argument denoting the encoding - <code>xdr</code> for big endian and <code>ndr</code> for little endian.</p> +<tr><td><a name="json_set"></a><code>json_set(val: jsonb, path: <a href="string.html">string</a>[], to: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments.</p> </span></td></tr> -<tr><td><a name="st_asbinary"></a><code>st_asbinary(geometry: geometry) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the WKB representation of a given Geometry.</p> +<tr><td><a name="json_set"></a><code>json_set(val: jsonb, path: <a href="string.html">string</a>[], to: jsonb, create_missing: <a href="bool.html">bool</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments. If <code>create_missing</code> is false, new keys will not be inserted to objects and values will not be prepended or appended to arrays.</p> </span></td></tr> -<tr><td><a name="st_asbinary"></a><code>st_asbinary(geometry: geometry, xdr_or_ndr: <a href="string.html">string</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the WKB representation of a given Geometry. This variant has a second argument denoting the encoding - <code>xdr</code> for big endian and <code>ndr</code> for little endian.</p> +<tr><td><a name="json_strip_nulls"></a><code>json_strip_nulls(from_json: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns from_json with all object fields that have null values omitted. Other null values are untouched.</p> </span></td></tr> -<tr><td><a name="st_asewkb"></a><code>st_asewkb(geography: geography) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the EWKB representation of a given Geography.</p> +<tr><td><a name="json_typeof"></a><code>json_typeof(val: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the type of the outermost JSON value as a text string.</p> </span></td></tr> -<tr><td><a name="st_asewkb"></a><code>st_asewkb(geometry: geometry) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the EWKB representation of a given Geometry.</p> +<tr><td><a name="jsonb_array_length"></a><code>jsonb_array_length(json: jsonb) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of elements in the outermost JSON or JSONB array.</p> </span></td></tr> -<tr><td><a name="st_asewkt"></a><code>st_asewkt(geography: geography) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the EWKT representation of a given Geography. A default of 15 decimal digits is used.</p> +<tr><td><a name="jsonb_build_array"></a><code>jsonb_build_array(anyelement...) → jsonb</code></td><td><span class="funcdesc"><p>Builds a possibly-heterogeneously-typed JSON or JSONB array out of a variadic argument list.</p> </span></td></tr> -<tr><td><a name="st_asewkt"></a><code>st_asewkt(geography: geography, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the EWKT representation of a given Geography. The max_decimal_digits parameter controls the maximum decimal digits to print after the <code>.</code>. Use -1 to print as many digits as required to rebuild the same number.</p> +<tr><td><a name="jsonb_build_object"></a><code>jsonb_build_object(anyelement...) → jsonb</code></td><td><span class="funcdesc"><p>Builds a JSON object out of a variadic argument list.</p> </span></td></tr> -<tr><td><a name="st_asewkt"></a><code>st_asewkt(geometry: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the EWKT representation of a given Geometry. A maximum of 15 decimal digits is used.</p> +<tr><td><a name="jsonb_extract_path"></a><code>jsonb_extract_path(jsonb, <a href="string.html">string</a>...) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments.</p> </span></td></tr> -<tr><td><a name="st_asewkt"></a><code>st_asewkt(geometry: geometry, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the WKT representation of a given Geometry. The max_decimal_digits parameter controls the maximum decimal digits to print after the <code>.</code>. Use -1 to print as many digits as required to rebuild the same number.</p> +<tr><td><a name="jsonb_insert"></a><code>jsonb_insert(target: jsonb, path: <a href="string.html">string</a>[], new_val: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments. <code>new_val</code> will be inserted before path target.</p> </span></td></tr> -<tr><td><a name="st_asewkt"></a><code>st_asewkt(geometry_str: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the EWKT representation of a given Geometry. A maximum of 15 decimal digits is used.</p> -<p>This variant will cast all geometry_str arguments into Geometry types.</p> +<tr><td><a name="jsonb_insert"></a><code>jsonb_insert(target: jsonb, path: <a href="string.html">string</a>[], new_val: jsonb, insert_after: <a href="bool.html">bool</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments. If <code>insert_after</code> is true (default is false), <code>new_val</code> will be inserted after path target.</p> </span></td></tr> -<tr><td><a name="st_asewkt"></a><code>st_asewkt(geometry_str: <a href="string.html">string</a>, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the WKT representation of a given Geometry. The max_decimal_digits parameter controls the maximum decimal digits to print after the <code>.</code>. Use -1 to print as many digits as required to rebuild the same number.</p> -<p>This variant will cast all geometry_str arguments into Geometry types.</p> +<tr><td><a name="jsonb_object"></a><code>jsonb_object(keys: <a href="string.html">string</a>[], values: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>This form of json_object takes keys and values pairwise from two separate arrays. In all other respects it is identical to the one-argument form.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geography: geography) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geography. Coordinates have a maximum of 9 decimal digits.</p> +<tr><td><a name="jsonb_object"></a><code>jsonb_object(texts: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>Builds a JSON or JSONB object out of a text array. The array must have exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geography: geography, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geography with max_decimal_digits output for each coordinate value.</p> +<tr><td><a name="jsonb_pretty"></a><code>jsonb_pretty(val: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the given JSON value as a STRING indented and with newlines.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geography: geography, max_decimal_digits: <a href="int.html">int</a>, options: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geography with max_decimal_digits output for each coordinate value.</p> -<p>Options is a flag that can be bitmasked. The options are:</p> -<ul> -<li>0: no option (default for Geography)</li> -<li>1: GeoJSON BBOX</li> -<li>2: GeoJSON Short CRS (e.g EPSG:4326)</li> -<li>4: GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326)</li> -<li>8: GeoJSON Short CRS if not EPSG:4326</li> -</ul> +<tr><td><a name="jsonb_set"></a><code>jsonb_set(val: jsonb, path: <a href="string.html">string</a>[], to: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry. Coordinates have a maximum of 9 decimal digits.</p> +<tr><td><a name="jsonb_set"></a><code>jsonb_set(val: jsonb, path: <a href="string.html">string</a>[], to: jsonb, create_missing: <a href="bool.html">bool</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments. If <code>create_missing</code> is false, new keys will not be inserted to objects and values will not be prepended or appended to arrays.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry: geometry, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry with max_decimal_digits output for each coordinate value.</p> +<tr><td><a name="jsonb_strip_nulls"></a><code>jsonb_strip_nulls(from_json: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns from_json with all object fields that have null values omitted. Other null values are untouched.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry: geometry, max_decimal_digits: <a href="int.html">int</a>, options: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry with max_decimal_digits output for each coordinate value.</p> -<p>Options is a flag that can be bitmasked. The options are:</p> -<ul> -<li>0: no option</li> -<li>1: GeoJSON BBOX</li> -<li>2: GeoJSON Short CRS (e.g EPSG:4326)</li> -<li>4: GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326)</li> -<li>8: GeoJSON Short CRS if not EPSG:4326 (default for Geometry)</li> -</ul> +<tr><td><a name="jsonb_typeof"></a><code>jsonb_typeof(val: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the type of the outermost JSON value as a text string.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry_str: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry. Coordinates have a maximum of 9 decimal digits.</p> -<p>This variant will cast all geometry_str arguments into Geometry types.</p> +<tr><td><a name="to_json"></a><code>to_json(val: anyelement) → jsonb</code></td><td><span class="funcdesc"><p>Returns the value as JSON or JSONB.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry_str: <a href="string.html">string</a>, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry with max_decimal_digits output for each coordinate value.</p> -<p>This variant will cast all geometry_str arguments into Geometry types.</p> +<tr><td><a name="to_jsonb"></a><code>to_jsonb(val: anyelement) → jsonb</code></td><td><span class="funcdesc"><p>Returns the value as JSON or JSONB.</p> +</span></td></tr></tbody> +</table> + +### Multi-tenancy functions + +<table> +<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> +<tbody> +<tr><td><a name="crdb_internal.sql_liveness_is_alive"></a><code>crdb_internal.sql_liveness_is_alive(session_id: <a href="bytes.html">bytes</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Checks is given sqlliveness session id is not expired</p> +</span></td></tr></tbody> +</table> + +### STRING[] functions + +<table> +<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> +<tbody> +<tr><td><a name="regexp_split_to_array"></a><code>regexp_split_to_array(string: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>) → <a href="string.html">string</a>[]</code></td><td><span class="funcdesc"><p>Split string using a POSIX regular expression as the delimiter.</p> </span></td></tr> -<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry_str: <a href="string.html">string</a>, max_decimal_digits: <a href="int.html">int</a>, options: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry with max_decimal_digits output for each coordinate value.</p> -<p>Options is a flag that can be bitmasked. The options are:</p> -<ul> -<li>0: no option</li> -<li>1: GeoJSON BBOX</li> -<li>2: GeoJSON Short CRS (e.g EPSG:4326)</li> -<li>4: GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326)</li> -<li>8: GeoJSON Short CRS if not EPSG:4326 (default for Geometry)</li> -</ul> -<p>This variant will cast all geometry_str arguments into Geometry types.</p> +<tr><td><a name="regexp_split_to_array"></a><code>regexp_split_to_array(string: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>, flags: <a href="string.html">string</a>) → <a href="string.html">string</a>[]</code></td><td><span class="funcdesc"><p>Split string using a POSIX regular expression as the delimiter with flags.</p> +<p>CockroachDB supports the following flags:</p> +<table> +<thead> +<tr> +<th>Flag</th> +<th>Description</th> +</tr> +</thead> +<tbody> +<tr> +<td><strong>c</strong></td> +<td>Case-sensitive matching</td> +</tr> +<tr> +<td><strong>g</strong></td> +<td>Global matching (match each substring instead of only the first)</td> +</tr> +<tr> +<td><strong>i</strong></td> +<td>Case-insensitive matching</td> +</tr> +<tr> +<td><strong>m</strong> or <strong>n</strong></td> +<td>Newline-sensitive (see below)</td> +</tr> +<tr> +<td><strong>p</strong></td> +<td>Partial newline-sensitive matching (see below)</td> +</tr> +<tr> +<td><strong>s</strong></td> +<td>Newline-insensitive (default)</td> +</tr> +<tr> +<td><strong>w</strong></td> +<td>Inverse partial newline-sensitive matching (see below)</td> +</tr> +</tbody> +</table> +<table> +<thead> +<tr> +<th>Mode</th> +<th><code>.</code> and <code>[^...]</code> match newlines</th> +<th><code>^</code> and <code>$</code> match line boundaries</th> +</tr> +</thead> +<tbody> +<tr> +<td>s</td> +<td>yes</td> +<td>no</td> +</tr> +<tr> +<td>w</td> +<td>yes</td> +<td>yes</td> +</tr> +<tr> +<td>p</td> +<td>no</td> +<td>no</td> +</tr> +<tr> +<td>m/n</td> +<td>no</td> +<td>yes</td> +</tr> +</tbody> +</table> +</span></td></tr></tbody> +</table> + +### Sequence functions + +<table> +<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> +<tbody> +<tr><td><a name="currval"></a><code>currval(sequence_name: <a href="string.html">string</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the latest value obtained with nextval for this sequence in this session.</p> +</span></td></tr> +<tr><td><a name="lastval"></a><code>lastval() → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Return value most recently obtained with nextval in this session.</p> +</span></td></tr> +<tr><td><a name="nextval"></a><code>nextval(sequence_name: <a href="string.html">string</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Advances the given sequence and returns its new value.</p> +</span></td></tr> +<tr><td><a name="pg_get_serial_sequence"></a><code>pg_get_serial_sequence(table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the name of the sequence used by the given column_name in the table table_name.</p> +</span></td></tr> +<tr><td><a name="setval"></a><code>setval(sequence_name: <a href="string.html">string</a>, value: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Set the given sequence’s current value. The next call to nextval will return <code>value + Increment</code></p> +</span></td></tr> +<tr><td><a name="setval"></a><code>setval(sequence_name: <a href="string.html">string</a>, value: <a href="int.html">int</a>, is_called: <a href="bool.html">bool</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Set the given sequence’s current value. If is_called is false, the next call to nextval will return <code>value</code>; otherwise <code>value + Increment</code>.</p> +</span></td></tr></tbody> +</table> + +### Set-returning functions + +<table> +<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> +<tbody> +<tr><td><a name="aclexplode"></a><code>aclexplode(aclitems: <a href="string.html">string</a>[]) → tuple{oid AS grantor, oid AS grantee, string AS privilege_type, bool AS is_grantable}</code></td><td><span class="funcdesc"><p>Produces a virtual table containing aclitem stuff (returns no rows as this feature is unsupported in CockroachDB)</p> +</span></td></tr> +<tr><td><a name="crdb_internal.testing_callback"></a><code>crdb_internal.testing_callback(name: <a href="string.html">string</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>For internal CRDB testing only. The function calls a callback identified by <code>name</code> registered with the server by the test.</p> +</span></td></tr> +<tr><td><a name="crdb_internal.unary_table"></a><code>crdb_internal.unary_table() → tuple</code></td><td><span class="funcdesc"><p>Produces a virtual table containing a single row with no values.</p> +<p>This function is used only by CockroachDB’s developers for testing purposes.</p> +</span></td></tr> +<tr><td><a name="generate_series"></a><code>generate_series(start: <a href="int.html">int</a>, end: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Produces a virtual table containing the integer values from <code>start</code> to <code>end</code>, inclusive.</p> +</span></td></tr> +<tr><td><a name="generate_series"></a><code>generate_series(start: <a href="int.html">int</a>, end: <a href="int.html">int</a>, step: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Produces a virtual table containing the integer values from <code>start</code> to <code>end</code>, inclusive, by increment of <code>step</code>.</p> +</span></td></tr> +<tr><td><a name="generate_series"></a><code>generate_series(start: <a href="timestamp.html">timestamp</a>, end: <a href="timestamp.html">timestamp</a>, step: <a href="interval.html">interval</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Produces a virtual table containing the timestamp values from <code>start</code> to <code>end</code>, inclusive, by increment of <code>step</code>.</p> +</span></td></tr> +<tr><td><a name="generate_subscripts"></a><code>generate_subscripts(array: anyelement[]) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns a series comprising the given array’s subscripts.</p> +</span></td></tr> +<tr><td><a name="generate_subscripts"></a><code>generate_subscripts(array: anyelement[], dim: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns a series comprising the given array’s subscripts.</p> +</span></td></tr> +<tr><td><a name="generate_subscripts"></a><code>generate_subscripts(array: anyelement[], dim: <a href="int.html">int</a>, reverse: <a href="bool.html">bool</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns a series comprising the given array’s subscripts.</p> +<p>When reverse is true, the series is returned in reverse order.</p> +</span></td></tr> +<tr><td><a name="information_schema._pg_expandarray"></a><code>information_schema._pg_expandarray(input: anyelement[]) → anyelement</code></td><td><span class="funcdesc"><p>Returns the input array as a set of rows with an index</p> +</span></td></tr> +<tr><td><a name="json_array_elements"></a><code>json_array_elements(input: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Expands a JSON array to a set of JSON values.</p> +</span></td></tr> +<tr><td><a name="json_array_elements_text"></a><code>json_array_elements_text(input: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Expands a JSON array to a set of text values.</p> +</span></td></tr> +<tr><td><a name="json_each"></a><code>json_each(input: jsonb) → tuple{string AS key, jsonb AS value}</code></td><td><span class="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs.</p> +</span></td></tr> +<tr><td><a name="json_each_text"></a><code>json_each_text(input: jsonb) → tuple{string AS key, string AS value}</code></td><td><span class="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs. The returned values will be of type text.</p> +</span></td></tr> +<tr><td><a name="json_object_keys"></a><code>json_object_keys(input: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns sorted set of keys in the outermost JSON object.</p> +</span></td></tr> +<tr><td><a name="jsonb_array_elements"></a><code>jsonb_array_elements(input: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Expands a JSON array to a set of JSON values.</p> +</span></td></tr> +<tr><td><a name="jsonb_array_elements_text"></a><code>jsonb_array_elements_text(input: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Expands a JSON array to a set of text values.</p> +</span></td></tr> +<tr><td><a name="jsonb_each"></a><code>jsonb_each(input: jsonb) → tuple{string AS key, jsonb AS value}</code></td><td><span class="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs.</p> +</span></td></tr> +<tr><td><a name="jsonb_each_text"></a><code>jsonb_each_text(input: jsonb) → tuple{string AS key, string AS value}</code></td><td><span class="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs. The returned values will be of type text.</p> +</span></td></tr> +<tr><td><a name="jsonb_object_keys"></a><code>jsonb_object_keys(input: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns sorted set of keys in the outermost JSON object.</p> +</span></td></tr> +<tr><td><a name="pg_get_keywords"></a><code>pg_get_keywords() → tuple{string AS word, string AS catcode, string AS catdesc}</code></td><td><span class="funcdesc"><p>Produces a virtual table containing the keywords known to the SQL parser.</p> +</span></td></tr> +<tr><td><a name="regexp_split_to_table"></a><code>regexp_split_to_table(string: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Split string using a POSIX regular expression as the delimiter.</p> +</span></td></tr> +<tr><td><a name="regexp_split_to_table"></a><code>regexp_split_to_table(string: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>, flags: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Split string using a POSIX regular expression as the delimiter with flags.</p> +<p>CockroachDB supports the following flags:</p> +<table> +<thead> +<tr> +<th>Flag</th> +<th>Description</th> +</tr> +</thead> +<tbody> +<tr> +<td><strong>c</strong></td> +<td>Case-sensitive matching</td> +</tr> +<tr> +<td><strong>g</strong></td> +<td>Global matching (match each substring instead of only the first)</td> +</tr> +<tr> +<td><strong>i</strong></td> +<td>Case-insensitive matching</td> +</tr> +<tr> +<td><strong>m</strong> or <strong>n</strong></td> +<td>Newline-sensitive (see below)</td> +</tr> +<tr> +<td><strong>p</strong></td> +<td>Partial newline-sensitive matching (see below)</td> +</tr> +<tr> +<td><strong>s</strong></td> +<td>Newline-insensitive (default)</td> +</tr> +<tr> +<td><strong>w</strong></td> +<td>Inverse partial newline-sensitive matching (see below)</td> +</tr> +</tbody> +</table> +<table> +<thead> +<tr> +<th>Mode</th> +<th><code>.</code> and <code>[^...]</code> match newlines</th> +<th><code>^</code> and <code>$</code> match line boundaries</th> +</tr> +</thead> +<tbody> +<tr> +<td>s</td> +<td>yes</td> +<td>no</td> +</tr> +<tr> +<td>w</td> +<td>yes</td> +<td>yes</td> +</tr> +<tr> +<td>p</td> +<td>no</td> +<td>no</td> +</tr> +<tr> +<td>m/n</td> +<td>no</td> +<td>yes</td> +</tr> +</tbody> +</table> +</span></td></tr> +<tr><td><a name="unnest"></a><code>unnest(anyelement[], anyelement[], anyelement[]...) → tuple</code></td><td><span class="funcdesc"><p>Returns the input arrays as a set of rows</p> +</span></td></tr> +<tr><td><a name="unnest"></a><code>unnest(input: anyelement[]) → anyelement</code></td><td><span class="funcdesc"><p>Returns the input array as a set of rows</p> +</span></td></tr></tbody> +</table> + +### Spatial functions + +<table> +<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> +<tbody> +<tr><td><a name="_st_contains"></a><code>_st_contains(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no points of geometry_b lie in the exterior of geometry_a, and there is at least one point in the interior of geometry_b that lies in the interior of geometry_a.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_containsproperly"></a><code>_st_containsproperly(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_b intersects the interior of geometry_a but not the boundary or exterior of geometry_a.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_coveredby"></a><code>_st_coveredby(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geography_a is outside geography_b.</p> +<p>The calculations performed are have a precision of 1cm.</p> +<p>This function utilizes the S2 library for spherical calculations.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_coveredby"></a><code>_st_coveredby(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_a is outside geometry_b.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_covers"></a><code>_st_covers(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geography_b is outside geography_a.</p> +<p>This function utilizes the S2 library for spherical calculations.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_covers"></a><code>_st_covers(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_b is outside geometry_a.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_crosses"></a><code>_st_crosses(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a has some - but not all - interior points in common with geometry_b.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_dfullywithin"></a><code>_st_dfullywithin(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if every pair of points comprising geometry_a and geometry_b are within distance units, inclusive. In other words, the ST_MaxDistance between geometry_a and geometry_b is less than or equal to distance units.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_dfullywithinexclusive"></a><code>_st_dfullywithinexclusive(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if every pair of points comprising geometry_a and geometry_b are within distance units, exclusive. In other words, the ST_MaxDistance between geometry_a and geometry_b is less than distance units.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_dwithin"></a><code>_st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, inclusive. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<p>The calculations performed are have a precision of 1cm.</p> +<p>This function utilizes the GeographicLib library for spheroid calculations.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_dwithin"></a><code>_st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>, use_spheroid: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, inclusive."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<p>The calculations performed are have a precision of 1cm.</p> +<p>This function utilizes the S2 library for spherical calculations.</p> +<p>This function utilizes the GeographicLib library for spheroid calculations.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_dwithin"></a><code>_st_dwithin(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geometry_a is within distance units of geometry_b, inclusive.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_dwithinexclusive"></a><code>_st_dwithinexclusive(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, exclusive. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<p>The calculations performed are have a precision of 1cm.</p> +<p>This function utilizes the GeographicLib library for spheroid calculations.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_dwithinexclusive"></a><code>_st_dwithinexclusive(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>, use_spheroid: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, exclusive."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<p>The calculations performed are have a precision of 1cm.</p> +<p>This function utilizes the S2 library for spherical calculations.</p> +<p>This function utilizes the GeographicLib library for spheroid calculations.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_dwithinexclusive"></a><code>_st_dwithinexclusive(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geometry_a is within distance units of geometry_b, exclusive.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_equals"></a><code>_st_equals(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a is spatially equal to geometry_b, i.e. ST_Within(geometry_a, geometry_b) = ST_Within(geometry_b, geometry_a) = true.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_intersects"></a><code>_st_intersects(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geography_a shares any portion of space with geography_b.</p> +<p>The calculations performed are have a precision of 1cm.</p> +<p>This function utilizes the S2 library for spherical calculations.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_intersects"></a><code>_st_intersects(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a shares any portion of space with geometry_b.</p> +<p>The calculations performed are have a precision of 1cm.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_overlaps"></a><code>_st_overlaps(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a intersects but does not completely contain geometry_b, or vice versa. “Does not completely” implies ST_Within(geometry_a, geometry_b) = ST_Within(geometry_b, geometry_a) = false.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_touches"></a><code>_st_touches(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if the only points in common between geometry_a and geometry_b are on the boundary. Note points do not touch other points.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="_st_within"></a><code>_st_within(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a is completely inside geometry_b.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant does not utilize any spatial index.</p> +</span></td></tr> +<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(catalog_name: <a href="string.html">string</a>, schema_name: <a href="string.html">string</a>, table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +</span></td></tr> +<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(catalog_name: <a href="string.html">string</a>, schema_name: <a href="string.html">string</a>, table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>, use_typmod: <a href="bool.html">bool</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +</span></td></tr> +<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(schema_name: <a href="string.html">string</a>, table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +</span></td></tr> +<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(schema_name: <a href="string.html">string</a>, table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>, use_typmod: <a href="bool.html">bool</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +</span></td></tr> +<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +</span></td></tr> +<tr><td><a name="addgeometrycolumn"></a><code>addgeometrycolumn(table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>, srid: <a href="int.html">int</a>, type: <a href="string.html">string</a>, dimension: <a href="int.html">int</a>, use_typmod: <a href="bool.html">bool</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Adds a new geometry column to an existing table and returns metadata about the column created.</p> +</span></td></tr> +<tr><td><a name="geometrytype"></a><code>geometrytype(geometry: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the type of geometry as a string.</p> +<p>This function utilizes the GEOS module.</p> +</span></td></tr> +<tr><td><a name="geomfromewkb"></a><code>geomfromewkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from an EWKB representation.</p> +</span></td></tr> +<tr><td><a name="geomfromewkt"></a><code>geomfromewkt(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from an EWKT representation.</p> +</span></td></tr> +<tr><td><a name="postgis_addbbox"></a><code>postgis_addbbox(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. This does not perform any operation on the Geometry.</p> +</span></td></tr> +<tr><td><a name="postgis_dropbbox"></a><code>postgis_dropbbox(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. This does not perform any operation on the Geometry.</p> +</span></td></tr> +<tr><td><a name="postgis_extensions_upgrade"></a><code>postgis_extensions_upgrade() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_full_version"></a><code>postgis_full_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_geos_version"></a><code>postgis_geos_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_getbbox"></a><code>postgis_getbbox(geometry: geometry) → box2d</code></td><td><span class="funcdesc"><p>Returns a box2d encapsulating the given Geometry.</p> +</span></td></tr> +<tr><td><a name="postgis_hasbbox"></a><code>postgis_hasbbox(geometry: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns whether a given Geometry has a bounding box. False for points and empty geometries; always true otherwise.</p> +</span></td></tr> +<tr><td><a name="postgis_lib_build_date"></a><code>postgis_lib_build_date() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_lib_version"></a><code>postgis_lib_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_liblwgeom_version"></a><code>postgis_liblwgeom_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_libxml_version"></a><code>postgis_libxml_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_proj_version"></a><code>postgis_proj_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_scripts_build_date"></a><code>postgis_scripts_build_date() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_scripts_installed"></a><code>postgis_scripts_installed() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_scripts_released"></a><code>postgis_scripts_released() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_version"></a><code>postgis_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="postgis_wagyu_version"></a><code>postgis_wagyu_version() → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Compatibility placeholder function with PostGIS. Returns a fixed string based on PostGIS 3.0.1, with minor edits.</p> +</span></td></tr> +<tr><td><a name="st_area"></a><code>st_area(geography: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geography in meters^2. Uses a spheroid to perform the operation.</p> +<p>This function utilizes the GeographicLib library for spheroid calculations.</p> +</span></td></tr> +<tr><td><a name="st_area"></a><code>st_area(geography: geography, use_spheroid: <a href="bool.html">bool</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geography in meters^2.</p> +<p>This function utilizes the S2 library for spherical calculations.</p> +<p>This function utilizes the GeographicLib library for spheroid calculations.</p> +</span></td></tr> +<tr><td><a name="st_area"></a><code>st_area(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geometry.</p> +<p>This function utilizes the GEOS module.</p> +</span></td></tr> +<tr><td><a name="st_area"></a><code>st_area(geometry_str: <a href="string.html">string</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geometry.</p> +<p>This function utilizes the GEOS module.</p> +<p>This variant will cast all geometry_str arguments into Geometry types.</p> +</span></td></tr> +<tr><td><a name="st_area2d"></a><code>st_area2d(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geometry.</p> +<p>This function utilizes the GEOS module.</p> +</span></td></tr> +<tr><td><a name="st_asbinary"></a><code>st_asbinary(geography: geography) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the WKB representation of a given Geography.</p> +</span></td></tr> +<tr><td><a name="st_asbinary"></a><code>st_asbinary(geography: geography, xdr_or_ndr: <a href="string.html">string</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the WKB representation of a given Geography. This variant has a second argument denoting the encoding - <code>xdr</code> for big endian and <code>ndr</code> for little endian.</p> +</span></td></tr> +<tr><td><a name="st_asbinary"></a><code>st_asbinary(geometry: geometry) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the WKB representation of a given Geometry.</p> +</span></td></tr> +<tr><td><a name="st_asbinary"></a><code>st_asbinary(geometry: geometry, xdr_or_ndr: <a href="string.html">string</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the WKB representation of a given Geometry. This variant has a second argument denoting the encoding - <code>xdr</code> for big endian and <code>ndr</code> for little endian.</p> +</span></td></tr> +<tr><td><a name="st_asewkb"></a><code>st_asewkb(geography: geography) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the EWKB representation of a given Geography.</p> +</span></td></tr> +<tr><td><a name="st_asewkb"></a><code>st_asewkb(geometry: geometry) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns the EWKB representation of a given Geometry.</p> +</span></td></tr> +<tr><td><a name="st_asewkt"></a><code>st_asewkt(geography: geography) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the EWKT representation of a given Geography. A default of 15 decimal digits is used.</p> +</span></td></tr> +<tr><td><a name="st_asewkt"></a><code>st_asewkt(geography: geography, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the EWKT representation of a given Geography. The max_decimal_digits parameter controls the maximum decimal digits to print after the <code>.</code>. Use -1 to print as many digits as required to rebuild the same number.</p> +</span></td></tr> +<tr><td><a name="st_asewkt"></a><code>st_asewkt(geometry: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the EWKT representation of a given Geometry. A maximum of 15 decimal digits is used.</p> +</span></td></tr> +<tr><td><a name="st_asewkt"></a><code>st_asewkt(geometry: geometry, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the WKT representation of a given Geometry. The max_decimal_digits parameter controls the maximum decimal digits to print after the <code>.</code>. Use -1 to print as many digits as required to rebuild the same number.</p> +</span></td></tr> +<tr><td><a name="st_asewkt"></a><code>st_asewkt(geometry_str: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the EWKT representation of a given Geometry. A maximum of 15 decimal digits is used.</p> +<p>This variant will cast all geometry_str arguments into Geometry types.</p> +</span></td></tr> +<tr><td><a name="st_asewkt"></a><code>st_asewkt(geometry_str: <a href="string.html">string</a>, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the WKT representation of a given Geometry. The max_decimal_digits parameter controls the maximum decimal digits to print after the <code>.</code>. Use -1 to print as many digits as required to rebuild the same number.</p> +<p>This variant will cast all geometry_str arguments into Geometry types.</p> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geography: geography) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geography. Coordinates have a maximum of 9 decimal digits.</p> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geography: geography, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geography with max_decimal_digits output for each coordinate value.</p> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geography: geography, max_decimal_digits: <a href="int.html">int</a>, options: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geography with max_decimal_digits output for each coordinate value.</p> +<p>Options is a flag that can be bitmasked. The options are:</p> +<ul> +<li>0: no option (default for Geography)</li> +<li>1: GeoJSON BBOX</li> +<li>2: GeoJSON Short CRS (e.g EPSG:4326)</li> +<li>4: GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326)</li> +<li>8: GeoJSON Short CRS if not EPSG:4326</li> +</ul> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry. Coordinates have a maximum of 9 decimal digits.</p> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry: geometry, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry with max_decimal_digits output for each coordinate value.</p> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry: geometry, max_decimal_digits: <a href="int.html">int</a>, options: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry with max_decimal_digits output for each coordinate value.</p> +<p>Options is a flag that can be bitmasked. The options are:</p> +<ul> +<li>0: no option</li> +<li>1: GeoJSON BBOX</li> +<li>2: GeoJSON Short CRS (e.g EPSG:4326)</li> +<li>4: GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326)</li> +<li>8: GeoJSON Short CRS if not EPSG:4326 (default for Geometry)</li> +</ul> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry_str: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry. Coordinates have a maximum of 9 decimal digits.</p> +<p>This variant will cast all geometry_str arguments into Geometry types.</p> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry_str: <a href="string.html">string</a>, max_decimal_digits: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry with max_decimal_digits output for each coordinate value.</p> +<p>This variant will cast all geometry_str arguments into Geometry types.</p> +</span></td></tr> +<tr><td><a name="st_asgeojson"></a><code>st_asgeojson(geometry_str: <a href="string.html">string</a>, max_decimal_digits: <a href="int.html">int</a>, options: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry with max_decimal_digits output for each coordinate value.</p> +<p>Options is a flag that can be bitmasked. The options are:</p> +<ul> +<li>0: no option</li> +<li>1: GeoJSON BBOX</li> +<li>2: GeoJSON Short CRS (e.g EPSG:4326)</li> +<li>4: GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326)</li> +<li>8: GeoJSON Short CRS if not EPSG:4326 (default for Geometry)</li> +</ul> +<p>This variant will cast all geometry_str arguments into Geometry types.</p> </span></td></tr> <tr><td><a name="st_asgeojson"></a><code>st_asgeojson(row: tuple) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the GeoJSON representation of a given Geometry. Coordinates have a maximum of 9 decimal digits.</p> </span></td></tr> @@ -1101,11 +1491,11 @@ from the given Geometry.</p> </span></td></tr> <tr><td><a name="st_contains"></a><code>st_contains(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no points of geometry_b lie in the exterior of geometry_a, and there is at least one point in the interior of geometry_b that lies in the interior of geometry_a.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_containsproperly"></a><code>st_containsproperly(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_b intersects the interior of geometry_a but not the boundary or exterior of geometry_a.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_convexhull"></a><code>st_convexhull(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a geometry that represents the Convex Hull of the given geometry.</p> <p>This function utilizes the GEOS module.</p> @@ -1115,49 +1505,49 @@ from the given Geometry.</p> <tr><td><a name="st_coveredby"></a><code>st_coveredby(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geography_a is outside geography_b.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> -<tr><td><a name="st_coveredby"></a><code>st_coveredby(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_a is outside geometry_b</p> +<tr><td><a name="st_coveredby"></a><code>st_coveredby(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_a is outside geometry_b.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> -<tr><td><a name="st_coveredby"></a><code>st_coveredby(geometry_a_str: <a href="string.html">string</a>, geometry_b_str: <a href="string.html">string</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_a is outside geometry_b</p> +<tr><td><a name="st_coveredby"></a><code>st_coveredby(geometry_a_str: <a href="string.html">string</a>, geometry_b_str: <a href="string.html">string</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_a is outside geometry_b.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> <p>This variant will cast all geometry_str arguments into Geometry types.</p> </span></td></tr> <tr><td><a name="st_covers"></a><code>st_covers(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geography_b is outside geography_a.</p> <p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_covers"></a><code>st_covers(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_b is outside geometry_a.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_covers"></a><code>st_covers(geometry_a_str: <a href="string.html">string</a>, geometry_b_str: <a href="string.html">string</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if no point in geometry_b is outside geometry_a.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> <p>This variant will cast all geometry_str arguments into Geometry types.</p> </span></td></tr> <tr><td><a name="st_crosses"></a><code>st_crosses(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a has some - but not all - interior points in common with geometry_b.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_dfullywithin"></a><code>st_dfullywithin(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if every pair of points comprising geometry_a and geometry_b are within distance units, inclusive. In other words, the ST_MaxDistance between geometry_a and geometry_b is less than or equal to distance units.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_dfullywithinexclusive"></a><code>st_dfullywithinexclusive(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if every pair of points comprising geometry_a and geometry_b are within distance units, exclusive. In other words, the ST_MaxDistance between geometry_a and geometry_b is less than distance units.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_dimension"></a><code>st_dimension(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of topological dimensions of a given Geometry.</p> </span></td></tr> <tr><td><a name="st_disjoint"></a><code>st_disjoint(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a does not overlap, touch or is within geometry_b.</p> <p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="st_distance"></a><code>st_distance(geography_a: geography, geography_b: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the distance in meters between geography_a and geography_b. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<tr><td><a name="st_distance"></a><code>st_distance(geography_a: geography, geography_b: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the distance in meters between geography_a and geography_b. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> <p>This function utilizes the GeographicLib library for spheroid calculations.</p> </span></td></tr> -<tr><td><a name="st_distance"></a><code>st_distance(geography_a: geography, geography_b: geography, use_spheroid: <a href="bool.html">bool</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the distance in meters between geography_a and geography_b."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<tr><td><a name="st_distance"></a><code>st_distance(geography_a: geography, geography_b: geography, use_spheroid: <a href="bool.html">bool</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the distance in meters between geography_a and geography_b."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> <p>This function utilizes the S2 library for spherical calculations.</p> <p>This function utilizes the GeographicLib library for spheroid calculations.</p> </span></td></tr> @@ -1169,44 +1559,44 @@ from the given Geometry.</p> <tr><td><a name="st_distancesphere"></a><code>st_distancesphere(geometry_a: geometry, geometry_b: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the distance in meters between geometry_a and geometry_b assuming the coordinates represent lng/lat points on a sphere.</p> <p>This function utilizes the S2 library for spherical calculations.</p> </span></td></tr> -<tr><td><a name="st_distancespheroid"></a><code>st_distancespheroid(geometry_a: geometry, geometry_b: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the distance in meters between geometry_a and geometry_b assuming the coordinates represent lng/lat points on a spheroid."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<tr><td><a name="st_distancespheroid"></a><code>st_distancespheroid(geometry_a: geometry, geometry_b: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the distance in meters between geometry_a and geometry_b assuming the coordinates represent lng/lat points on a spheroid."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> <p>This function utilizes the S2 library for spherical calculations.</p> <p>This function utilizes the GeographicLib library for spheroid calculations.</p> </span></td></tr> -<tr><td><a name="st_dwithin"></a><code>st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, inclusive. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<tr><td><a name="st_dwithin"></a><code>st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, inclusive. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the GeographicLib library for spheroid calculations.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> -<tr><td><a name="st_dwithin"></a><code>st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>, use_spheroid: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, inclusive."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<tr><td><a name="st_dwithin"></a><code>st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>, use_spheroid: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, inclusive."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the S2 library for spherical calculations.</p> <p>This function utilizes the GeographicLib library for spheroid calculations.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_dwithin"></a><code>st_dwithin(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geometry_a is within distance units of geometry_b, inclusive.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_dwithin"></a><code>st_dwithin(geometry_a_str: <a href="string.html">string</a>, geometry_b_str: <a href="string.html">string</a>, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geometry_a is within distance units of geometry_b, inclusive.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> <p>This variant will cast all geometry_str arguments into Geometry types.</p> </span></td></tr> -<tr><td><a name="st_dwithinexclusive"></a><code>st_dwithinexclusive(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, exclusive. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<tr><td><a name="st_dwithinexclusive"></a><code>st_dwithinexclusive(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, exclusive. Uses a spheroid to perform the operation."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the GeographicLib library for spheroid calculations.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> -<tr><td><a name="st_dwithinexclusive"></a><code>st_dwithinexclusive(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>, use_spheroid: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, exclusive."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> +<tr><td><a name="st_dwithinexclusive"></a><code>st_dwithinexclusive(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>, use_spheroid: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b, exclusive."\n\nWhen operating on a spheroid, this function will use the sphere to calculate the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. This follows observed PostGIS behavior.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the S2 library for spherical calculations.</p> <p>This function utilizes the GeographicLib library for spheroid calculations.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_dwithinexclusive"></a><code>st_dwithinexclusive(geometry_a: geometry, geometry_b: geometry, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geometry_a is within distance units of geometry_b, exclusive.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_dwithinexclusive"></a><code>st_dwithinexclusive(geometry_a_str: <a href="string.html">string</a>, geometry_b_str: <a href="string.html">string</a>, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geometry_a is within distance units of geometry_b, exclusive.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> <p>This variant will cast all geometry_str arguments into Geometry types.</p> </span></td></tr> <tr><td><a name="st_endpoint"></a><code>st_endpoint(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the last point of a geometry which has shape LineString. Returns NULL if the geometry is not a LineString.</p> @@ -1219,7 +1609,7 @@ Bottom Left.</p> </span></td></tr> <tr><td><a name="st_equals"></a><code>st_equals(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a is spatially equal to geometry_b, i.e. ST_Within(geometry_a, geometry_b) = ST_Within(geometry_b, geometry_a) = true.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_expand"></a><code>st_expand(box2d: box2d, delta: <a href="float.html">float</a>) → box2d</code></td><td><span class="funcdesc"><p>Extends the box2d by delta units across all dimensions.</p> </span></td></tr> @@ -1325,17 +1715,17 @@ calculated, the result is transformed back into a Geography with SRID 4326.</p> <tr><td><a name="st_intersects"></a><code>st_intersects(geography_a: geography, geography_b: geography) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geography_a shares any portion of space with geography_b.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_intersects"></a><code>st_intersects(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a shares any portion of space with geometry_b.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> <tr><td><a name="st_intersects"></a><code>st_intersects(geometry_a_str: <a href="string.html">string</a>, geometry_b_str: <a href="string.html">string</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a shares any portion of space with geometry_b.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> <p>This variant will cast all geometry_str arguments into Geometry types.</p> </span></td></tr> <tr><td><a name="st_isclosed"></a><code>st_isclosed(geometry: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns whether the geometry is closed as defined by whether the start and end points are coincident. Points are considered closed, empty geometries are not. For collections and multi-types, all members must be closed, as must all polygon rings.</p> @@ -1402,669 +1792,279 @@ calculated, the result is transformed back into a Geography with SRID 4326.</p> <p>This function utilizes the GEOS module.</p> </span></td></tr> <tr><td><a name="st_lineinterpolatepoints"></a><code>st_lineinterpolatepoints(geometry: geometry, fraction: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns one or more points along the LineString which is at an integral multiples of given fraction of LineString’s total length.</p> -<p>Note If the result has zero or one points, it will be returned as a POINT. If it has two or more points, it will be returned as a MULTIPOINT.</p> -<p>This function utilizes the GEOS module.</p> -</span></td></tr> -<tr><td><a name="st_lineinterpolatepoints"></a><code>st_lineinterpolatepoints(geometry: geometry, fraction: <a href="float.html">float</a>, repeat: <a href="bool.html">bool</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns one or more points along the LineString which is at an integral multiples of given fraction of LineString’s total length. If repeat is false (default true) then it returns first point.</p> -<p>Note If the result has zero or one points, it will be returned as a POINT. If it has two or more points, it will be returned as a MULTIPOINT.</p> -<p>This function utilizes the GEOS module.</p> -</span></td></tr> -<tr><td><a name="st_linestringfromtext"></a><code>st_linestringfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not LineString, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_linestringfromtext"></a><code>st_linestringfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not LineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_linestringfromwkb"></a><code>st_linestringfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not LineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_linestringfromwkb"></a><code>st_linestringfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not LineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_longestline"></a><code>st_longestline(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the LineString corresponds to the max distance across every pair of points comprising the given geometries.</p> -<p>Note if geometries are the same, it will return the LineString with the maximum distance between the geometry’s vertexes. The function will return the longest line that was discovered first when comparing maximum distances if more than one is found.</p> -</span></td></tr> -<tr><td><a name="st_makebox2d"></a><code>st_makebox2d(geometry_a: geometry, geometry_b: geometry) → box2d</code></td><td><span class="funcdesc"><p>Creates a box2d from two points. Errors if arguments are not two non-empty points.</p> -</span></td></tr> -<tr><td><a name="st_makepoint"></a><code>st_makepoint(x: <a href="float.html">float</a>, y: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a new Point with the given X and Y coordinates.</p> -</span></td></tr> -<tr><td><a name="st_makepolygon"></a><code>st_makepolygon(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a new Polygon with the given outer LineString.</p> -</span></td></tr> -<tr><td><a name="st_makepolygon"></a><code>st_makepolygon(outer: geometry, interior: anyelement[]) → geometry</code></td><td><span class="funcdesc"><p>Returns a new Polygon with the given outer LineString and interior (hole) LineString(s).</p> -</span></td></tr> -<tr><td><a name="st_makevalid"></a><code>st_makevalid(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a valid form of the given geometry according to the OGC spec.</p> -<p>This function utilizes the GEOS module.</p> -</span></td></tr> -<tr><td><a name="st_maxdistance"></a><code>st_maxdistance(geometry_a: geometry, geometry_b: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the maximum distance across every pair of points comprising the given geometries. Note if the geometries are the same, it will return the maximum distance between the geometry’s vertexes.</p> -</span></td></tr> -<tr><td><a name="st_mlinefromtext"></a><code>st_mlinefromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_mlinefromtext"></a><code>st_mlinefromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_mlinefromwkb"></a><code>st_mlinefromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_mlinefromwkb"></a><code>st_mlinefromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_mpointfromtext"></a><code>st_mpointfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPoint, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_mpointfromtext"></a><code>st_mpointfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPoint, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_mpointfromwkb"></a><code>st_mpointfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPoint, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_mpointfromwkb"></a><code>st_mpointfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPoint, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_mpolyfromtext"></a><code>st_mpolyfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_mpolyfromtext"></a><code>st_mpolyfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_mpolyfromwkb"></a><code>st_mpolyfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_mpolyfromwkb"></a><code>st_mpolyfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multi"></a><code>st_multi(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the geometry as a new multi-geometry, e.g converts a POINT to a MULTIPOINT. If the input is already a multitype or collection, it is returned as is.</p> -</span></td></tr> -<tr><td><a name="st_multilinefromtext"></a><code>st_multilinefromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_multilinefromtext"></a><code>st_multilinefromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multilinefromwkb"></a><code>st_multilinefromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multilinefromwkb"></a><code>st_multilinefromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multilinestringfromtext"></a><code>st_multilinestringfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_multilinestringfromtext"></a><code>st_multilinestringfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multilinestringfromwkb"></a><code>st_multilinestringfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multilinestringfromwkb"></a><code>st_multilinestringfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipointfromtext"></a><code>st_multipointfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPoint, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_multipointfromtext"></a><code>st_multipointfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPoint, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipointfromwkb"></a><code>st_multipointfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPoint, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipointfromwkb"></a><code>st_multipointfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPoint, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipolyfromtext"></a><code>st_multipolyfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_multipolyfromtext"></a><code>st_multipolyfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipolyfromwkb"></a><code>st_multipolyfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipolyfromwkb"></a><code>st_multipolyfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipolygonfromtext"></a><code>st_multipolygonfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_multipolygonfromtext"></a><code>st_multipolygonfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipolygonfromwkb"></a><code>st_multipolygonfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_multipolygonfromwkb"></a><code>st_multipolygonfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_ndims"></a><code>st_ndims(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of coordinate dimensions of a given Geometry.</p> -</span></td></tr> -<tr><td><a name="st_npoints"></a><code>st_npoints(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of points in a given Geometry. Works for any shape type.</p> -</span></td></tr> -<tr><td><a name="st_nrings"></a><code>st_nrings(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of rings in a Polygon Geometry. Returns 0 if the shape is not a Polygon.</p> -</span></td></tr> -<tr><td><a name="st_numgeometries"></a><code>st_numgeometries(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of shapes inside a given Geometry.</p> -</span></td></tr> -<tr><td><a name="st_numinteriorring"></a><code>st_numinteriorring(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of interior rings in a Polygon Geometry. Returns NULL if the shape is not a Polygon.</p> -</span></td></tr> -<tr><td><a name="st_numinteriorrings"></a><code>st_numinteriorrings(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of interior rings in a Polygon Geometry. Returns NULL if the shape is not a Polygon.</p> -</span></td></tr> -<tr><td><a name="st_numpoints"></a><code>st_numpoints(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of points in a LineString. Returns NULL if the Geometry is not a LineString.</p> -</span></td></tr> -<tr><td><a name="st_overlaps"></a><code>st_overlaps(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a intersects but does not completely contain geometry_b, or vice versa. “Does not completely” implies ST_Within(geometry_a, geometry_b) = ST_Within(geometry_b, geometry_a) = false.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> -</span></td></tr> -<tr><td><a name="st_perimeter"></a><code>st_perimeter(geography: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geography in meters. Uses a spheroid to perform the operation.</p> -<p>This function utilizes the GeographicLib library for spheroid calculations.</p> -</span></td></tr> -<tr><td><a name="st_perimeter"></a><code>st_perimeter(geography: geography, use_spheroid: <a href="bool.html">bool</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geography in meters.</p> -<p>This function utilizes the S2 library for spherical calculations.</p> -<p>This function utilizes the GeographicLib library for spheroid calculations.</p> -</span></td></tr> -<tr><td><a name="st_perimeter"></a><code>st_perimeter(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geometry.</p> -<p>Note ST_Perimeter is only valid for Polygon - use ST_Length for LineString.</p> -<p>This function utilizes the GEOS module.</p> -</span></td></tr> -<tr><td><a name="st_perimeter2d"></a><code>st_perimeter2d(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geometry.</p> -<p>Note ST_Perimeter is only valid for Polygon - use ST_Length for LineString.</p> -<p>This function utilizes the GEOS module.</p> -</span></td></tr> -<tr><td><a name="st_point"></a><code>st_point(x: <a href="float.html">float</a>, y: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a new Point with the given X and Y coordinates.</p> -</span></td></tr> -<tr><td><a name="st_pointfromgeohash"></a><code>st_pointfromgeohash(geohash: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Return a POINT Geometry from a GeoHash string with max precision.</p> -</span></td></tr> -<tr><td><a name="st_pointfromgeohash"></a><code>st_pointfromgeohash(geohash: <a href="string.html">string</a>, precision: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Return a POINT Geometry from a GeoHash string with supplied precision.</p> -</span></td></tr> -<tr><td><a name="st_pointfromtext"></a><code>st_pointfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not Point, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_pointfromtext"></a><code>st_pointfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not Point, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_pointfromwkb"></a><code>st_pointfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not Point, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_pointfromwkb"></a><code>st_pointfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not Point, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_pointn"></a><code>st_pointn(geometry: geometry, n: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the n-th Point of a LineString (1-indexed). Returns NULL if out of bounds or not a LineString.</p> -</span></td></tr> -<tr><td><a name="st_pointonsurface"></a><code>st_pointonsurface(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a point that intersects with the given Geometry.</p> -<p>This function utilizes the GEOS module.</p> -</span></td></tr> -<tr><td><a name="st_points"></a><code>st_points(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns all coordinates in the given Geometry as a MultiPoint, including duplicates.</p> -</span></td></tr> -<tr><td><a name="st_polyfromtext"></a><code>st_polyfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not Polygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_polyfromtext"></a><code>st_polyfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not Polygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_polyfromwkb"></a><code>st_polyfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not Polygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_polyfromwkb"></a><code>st_polyfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not Polygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_polygonfromtext"></a><code>st_polygonfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not Polygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> -</span></td></tr> -<tr><td><a name="st_polygonfromtext"></a><code>st_polygonfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not Polygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_polygonfromwkb"></a><code>st_polygonfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not Polygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_polygonfromwkb"></a><code>st_polygonfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not Polygon, NULL is returned.</p> -</span></td></tr> -<tr><td><a name="st_project"></a><code>st_project(geography: geography, distance: <a href="float.html">float</a>, azimuth: <a href="float.html">float</a>) → geography</code></td><td><span class="funcdesc"><p>Returns a point projected from a start point along a geodesic using a given distance and azimuth (bearing). -This is known as the direct geodesic problem.</p> -<p>The distance is given in meters. Negative values are supported.</p> -<p>The azimuth (also known as heading or bearing) is given in radians. It is measured clockwise from true north (azimuth zero). -East is azimuth π/2 (90 degrees); south is azimuth π (180 degrees); west is azimuth 3π/2 (270 degrees). -Negative azimuth values and values greater than 2π (360 degrees) are supported.</p> -</span></td></tr> -<tr><td><a name="st_relate"></a><code>st_relate(geometry_a: geometry, geometry_b: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the DE-9IM spatial relation between geometry_a and geometry_b.</p> -<p>This function utilizes the GEOS module.</p> -</span></td></tr> -<tr><td><a name="st_relate"></a><code>st_relate(geometry_a: geometry, geometry_b: geometry, pattern: <a href="string.html">string</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns whether the DE-9IM spatial relation between geometry_a and geometry_b matches the DE-9IM pattern.</p> -<p>This function utilizes the GEOS module.</p> -</span></td></tr> -<tr><td><a name="st_relatematch"></a><code>st_relatematch(intersection_matrix: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns whether the given DE-9IM intersection matrix satisfies the given pattern.</p> -</span></td></tr> -<tr><td><a name="st_removepoint"></a><code>st_removepoint(line_string: geometry, index: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Removes the Point at the given 0-based index and returns the modified LineString geometry.</p> -</span></td></tr> -<tr><td><a name="st_reverse"></a><code>st_reverse(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified geometry by reversing the order of its vertices.</p> -</span></td></tr> -<tr><td><a name="st_scale"></a><code>st_scale(g: geometry, factor: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry scaled by taking in a Geometry as the factor</p> -</span></td></tr> -<tr><td><a name="st_scale"></a><code>st_scale(g: geometry, factor: geometry, origin: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry scaled by the Geometry factor relative to a false origin</p> -</span></td></tr> -<tr><td><a name="st_scale"></a><code>st_scale(geometry: geometry, x_factor: <a href="float.html">float</a>, y_factor: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry scaled by the given factors</p> -</span></td></tr> -<tr><td><a name="st_segmentize"></a><code>st_segmentize(geography: geography, max_segment_length_meters: <a href="float.html">float</a>) → geography</code></td><td><span class="funcdesc"><p>Returns a modified Geography having no segment longer than the given max_segment_length meters.</p> -<p>The calculations are done on a sphere.</p> -<p>This function utilizes the S2 library for spherical calculations.</p> -</span></td></tr> -<tr><td><a name="st_segmentize"></a><code>st_segmentize(geometry: geometry, max_segment_length: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry having no segment longer than the given max_segment_length. Length units are in units of spatial reference.</p> -</span></td></tr> -<tr><td><a name="st_setpoint"></a><code>st_setpoint(line_string: geometry, index: <a href="int.html">int</a>, point: geometry) → geometry</code></td><td><span class="funcdesc"><p>Sets the Point at the given 0-based index and returns the modified LineString geometry</p> +<p>Note If the result has zero or one points, it will be returned as a POINT. If it has two or more points, it will be returned as a MULTIPOINT.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="st_setsrid"></a><code>st_setsrid(geography: geography, srid: <a href="int.html">int</a>) → geography</code></td><td><span class="funcdesc"><p>Sets a Geography to a new SRID without transforming the coordinates.</p> +<tr><td><a name="st_lineinterpolatepoints"></a><code>st_lineinterpolatepoints(geometry: geometry, fraction: <a href="float.html">float</a>, repeat: <a href="bool.html">bool</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns one or more points along the LineString which is at an integral multiples of given fraction of LineString’s total length. If repeat is false (default true) then it returns first point.</p> +<p>Note If the result has zero or one points, it will be returned as a POINT. If it has two or more points, it will be returned as a MULTIPOINT.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="st_setsrid"></a><code>st_setsrid(geometry: geometry, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Sets a Geometry to a new SRID without transforming the coordinates.</p> +<tr><td><a name="st_linestringfromtext"></a><code>st_linestringfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not LineString, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="st_sharedpaths"></a><code>st_sharedpaths(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a collection containing paths shared by the two input geometries.</p> -<p>Those going in the same direction are in the first element of the collection, -those going in the opposite direction are in the second element. -The paths themselves are given in the direction of the first geometry.</p> +<tr><td><a name="st_linestringfromtext"></a><code>st_linestringfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not LineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_shortestline"></a><code>st_shortestline(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the LineString corresponds to the minimum distance across every pair of points comprising the given geometries.</p> -<p>Note if geometries are the same, it will return the LineString with the minimum distance between the geometry’s vertexes. The function will return the shortest line that was discovered first when comparing minimum distances if more than one is found.</p> +<tr><td><a name="st_linestringfromwkb"></a><code>st_linestringfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not LineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_srid"></a><code>st_srid(geography: geography) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the Spatial Reference Identifier (SRID) for the ST_Geography as defined in spatial_ref_sys table.</p> +<tr><td><a name="st_linestringfromwkb"></a><code>st_linestringfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not LineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_srid"></a><code>st_srid(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the Spatial Reference Identifier (SRID) for the ST_Geometry as defined in spatial_ref_sys table.</p> +<tr><td><a name="st_longestline"></a><code>st_longestline(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the LineString corresponds to the max distance across every pair of points comprising the given geometries.</p> +<p>Note if geometries are the same, it will return the LineString with the maximum distance between the geometry’s vertexes. The function will return the longest line that was discovered first when comparing maximum distances if more than one is found.</p> </span></td></tr> -<tr><td><a name="st_startpoint"></a><code>st_startpoint(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the first point of a geometry which has shape LineString. Returns NULL if the geometry is not a LineString.</p> +<tr><td><a name="st_makebox2d"></a><code>st_makebox2d(geometry_a: geometry, geometry_b: geometry) → box2d</code></td><td><span class="funcdesc"><p>Creates a box2d from two points. Errors if arguments are not two non-empty points.</p> </span></td></tr> -<tr><td><a name="st_summary"></a><code>st_summary(geography: geography) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns a text summary of the contents of the geography.</p> -<p>Flags shown square brackets after the geometry type have the following meaning:</p> -<ul> -<li>M: has M coordinate</li> -<li>Z: has Z coordinate</li> -<li>B: has a cached bounding box</li> -<li>G: is geography</li> -<li>S: has spatial reference system</li> -</ul> +<tr><td><a name="st_makepoint"></a><code>st_makepoint(x: <a href="float.html">float</a>, y: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a new Point with the given X and Y coordinates.</p> </span></td></tr> -<tr><td><a name="st_summary"></a><code>st_summary(geometry: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns a text summary of the contents of the geometry.</p> -<p>Flags shown square brackets after the geometry type have the following meaning:</p> -<ul> -<li>M: has M coordinate</li> -<li>Z: has Z coordinate</li> -<li>B: has a cached bounding box</li> -<li>G: is geography</li> -<li>S: has spatial reference system</li> -</ul> +<tr><td><a name="st_makepolygon"></a><code>st_makepolygon(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a new Polygon with the given outer LineString.</p> </span></td></tr> -<tr><td><a name="st_symdifference"></a><code>st_symdifference(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the symmetric difference of both geometries.</p> -<p>This function utilizes the GEOS module.</p> +<tr><td><a name="st_makepolygon"></a><code>st_makepolygon(outer: geometry, interior: anyelement[]) → geometry</code></td><td><span class="funcdesc"><p>Returns a new Polygon with the given outer LineString and interior (hole) LineString(s).</p> </span></td></tr> -<tr><td><a name="st_symmetricdifference"></a><code>st_symmetricdifference(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the symmetric difference of both geometries.</p> +<tr><td><a name="st_makevalid"></a><code>st_makevalid(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a valid form of the given geometry according to the OGC spec.</p> <p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="st_touches"></a><code>st_touches(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if the only points in common between geometry_a and geometry_b are on the boundary. Note points do not touch other points.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<tr><td><a name="st_maxdistance"></a><code>st_maxdistance(geometry_a: geometry, geometry_b: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the maximum distance across every pair of points comprising the given geometries. Note if the geometries are the same, it will return the maximum distance between the geometry’s vertexes.</p> </span></td></tr> -<tr><td><a name="st_transform"></a><code>st_transform(geometry: geometry, from_proj_text: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Transforms a geometry into the coordinate reference system assuming the from_proj_text to the new to_proj_text by projecting its coordinates. The supplied SRID is set on the new geometry.</p> -<p>This function utilizes the PROJ library for coordinate projections.</p> +<tr><td><a name="st_mlinefromtext"></a><code>st_mlinefromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="st_transform"></a><code>st_transform(geometry: geometry, from_proj_text: <a href="string.html">string</a>, to_proj_text: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Transforms a geometry into the coordinate reference system assuming the from_proj_text to the new to_proj_text by projecting its coordinates.</p> -<p>This function utilizes the PROJ library for coordinate projections.</p> +<tr><td><a name="st_mlinefromtext"></a><code>st_mlinefromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_transform"></a><code>st_transform(geometry: geometry, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Transforms a geometry into the given SRID coordinate reference system by projecting its coordinates.</p> -<p>This function utilizes the PROJ library for coordinate projections.</p> +<tr><td><a name="st_mlinefromwkb"></a><code>st_mlinefromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_transform"></a><code>st_transform(geometry: geometry, to_proj_text: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Transforms a geometry into the coordinate reference system referenced by the projection text by projecting its coordinates.</p> -<p>This function utilizes the PROJ library for coordinate projections.</p> +<tr><td><a name="st_mlinefromwkb"></a><code>st_mlinefromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_translate"></a><code>st_translate(g: geometry, deltaX: <a href="float.html">float</a>, deltaY: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry translated by the given deltas</p> +<tr><td><a name="st_mpointfromtext"></a><code>st_mpointfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPoint, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="st_within"></a><code>st_within(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a is completely inside geometry_b.</p> -<p>This function utilizes the GEOS module.</p> -<p>This function variant will attempt to utilize any available geospatial index.</p> +<tr><td><a name="st_mpointfromtext"></a><code>st_mpointfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPoint, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_wkbtosql"></a><code>st_wkbtosql(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation.</p> +<tr><td><a name="st_mpointfromwkb"></a><code>st_mpointfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPoint, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_wkttosql"></a><code>st_wkttosql(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation.</p> +<tr><td><a name="st_mpointfromwkb"></a><code>st_mpointfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPoint, NULL is returned.</p> </span></td></tr> -<tr><td><a name="st_x"></a><code>st_x(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the X coordinate of a geometry if it is a Point.</p> +<tr><td><a name="st_mpolyfromtext"></a><code>st_mpolyfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="st_y"></a><code>st_y(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the Y coordinate of a geometry if it is a Point.</p> -</span></td></tr></tbody> -</table> - -### ID generation functions - -<table> -<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> -<tbody> -<tr><td><a name="experimental_uuid_v4"></a><code>experimental_uuid_v4() → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns a UUID.</p> +<tr><td><a name="st_mpolyfromtext"></a><code>st_mpolyfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="gen_random_uuid"></a><code>gen_random_uuid() → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Generates a random UUID and returns it as a value of UUID type.</p> +<tr><td><a name="st_mpolyfromwkb"></a><code>st_mpolyfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="unique_rowid"></a><code>unique_rowid() → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns a unique ID used by CockroachDB to generate unique row IDs if a Primary Key isn’t defined for the table. The value is a combination of the insert timestamp and the ID of the node executing the statement, which guarantees this combination is globally unique. However, there can be gaps and the order is not completely guaranteed.</p> +<tr><td><a name="st_mpolyfromwkb"></a><code>st_mpolyfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="uuid_v4"></a><code>uuid_v4() → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns a UUID.</p> -</span></td></tr></tbody> -</table> - -### INET functions - -<table> -<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> -<tbody> -<tr><td><a name="abbrev"></a><code>abbrev(val: <a href="inet.html">inet</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Converts the combined IP address and prefix length to an abbreviated display format as text.For INET types, this will omit the prefix length if it’s not the default (32 or IPv4, 128 for IPv6)</p> -<p>For example, <code>abbrev('192.168.1.2/24')</code> returns <code>'192.168.1.2/24'</code></p> +<tr><td><a name="st_multi"></a><code>st_multi(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the geometry as a new multi-geometry, e.g converts a POINT to a MULTIPOINT. If the input is already a multitype or collection, it is returned as is.</p> </span></td></tr> -<tr><td><a name="broadcast"></a><code>broadcast(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Gets the broadcast address for the network address represented by the value.</p> -<p>For example, <code>broadcast('192.168.1.2/24')</code> returns <code>'192.168.1.255/24'</code></p> +<tr><td><a name="st_multilinefromtext"></a><code>st_multilinefromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="family"></a><code>family(val: <a href="inet.html">inet</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Extracts the IP family of the value; 4 for IPv4, 6 for IPv6.</p> -<p>For example, <code>family('::1')</code> returns <code>6</code></p> +<tr><td><a name="st_multilinefromtext"></a><code>st_multilinefromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="host"></a><code>host(val: <a href="inet.html">inet</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Extracts the address part of the combined address/prefixlen value as text.</p> -<p>For example, <code>host('192.168.1.2/16')</code> returns <code>'192.168.1.2'</code></p> +<tr><td><a name="st_multilinefromwkb"></a><code>st_multilinefromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="hostmask"></a><code>hostmask(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Creates an IP host mask corresponding to the prefix length in the value.</p> -<p>For example, <code>hostmask('192.168.1.2/16')</code> returns <code>'0.0.255.255'</code></p> +<tr><td><a name="st_multilinefromwkb"></a><code>st_multilinefromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="masklen"></a><code>masklen(val: <a href="inet.html">inet</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Retrieves the prefix length stored in the value.</p> -<p>For example, <code>masklen('192.168.1.2/16')</code> returns <code>16</code></p> +<tr><td><a name="st_multilinestringfromtext"></a><code>st_multilinestringfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="netmask"></a><code>netmask(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Creates an IP network mask corresponding to the prefix length in the value.</p> -<p>For example, <code>netmask('192.168.1.2/16')</code> returns <code>'255.255.0.0'</code></p> +<tr><td><a name="st_multilinestringfromtext"></a><code>st_multilinestringfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="set_masklen"></a><code>set_masklen(val: <a href="inet.html">inet</a>, prefixlen: <a href="int.html">int</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Sets the prefix length of <code>val</code> to <code>prefixlen</code>.</p> -<p>For example, <code>set_masklen('192.168.1.2', 16)</code> returns <code>'192.168.1.2/16'</code>.</p> +<tr><td><a name="st_multilinestringfromwkb"></a><code>st_multilinestringfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="text"></a><code>text(val: <a href="inet.html">inet</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Converts the IP address and prefix length to text.</p> -</span></td></tr></tbody> -</table> - -### INT functions - -<table> -<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> -<tbody> -<tr><td><a name="crc32c"></a><code>crc32c(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the CRC-32 hash using the Castagnoli polynomial.</p> +<tr><td><a name="st_multilinestringfromwkb"></a><code>st_multilinestringfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiLineString, NULL is returned.</p> </span></td></tr> -<tr><td><a name="crc32c"></a><code>crc32c(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the CRC-32 hash using the Castagnoli polynomial.</p> +<tr><td><a name="st_multipointfromtext"></a><code>st_multipointfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPoint, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="crc32ieee"></a><code>crc32ieee(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the CRC-32 hash using the IEEE polynomial.</p> +<tr><td><a name="st_multipointfromtext"></a><code>st_multipointfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPoint, NULL is returned.</p> </span></td></tr> -<tr><td><a name="crc32ieee"></a><code>crc32ieee(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the CRC-32 hash using the IEEE polynomial.</p> +<tr><td><a name="st_multipointfromwkb"></a><code>st_multipointfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPoint, NULL is returned.</p> </span></td></tr> -<tr><td><a name="fnv32"></a><code>fnv32(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 32-bit FNV-1 hash value of a set of values.</p> +<tr><td><a name="st_multipointfromwkb"></a><code>st_multipointfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPoint, NULL is returned.</p> </span></td></tr> -<tr><td><a name="fnv32"></a><code>fnv32(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 32-bit FNV-1 hash value of a set of values.</p> +<tr><td><a name="st_multipolyfromtext"></a><code>st_multipolyfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="fnv32a"></a><code>fnv32a(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 32-bit FNV-1a hash value of a set of values.</p> +<tr><td><a name="st_multipolyfromtext"></a><code>st_multipolyfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="fnv32a"></a><code>fnv32a(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 32-bit FNV-1a hash value of a set of values.</p> +<tr><td><a name="st_multipolyfromwkb"></a><code>st_multipolyfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="fnv64"></a><code>fnv64(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 64-bit FNV-1 hash value of a set of values.</p> +<tr><td><a name="st_multipolyfromwkb"></a><code>st_multipolyfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="fnv64"></a><code>fnv64(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 64-bit FNV-1 hash value of a set of values.</p> +<tr><td><a name="st_multipolygonfromtext"></a><code>st_multipolygonfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="fnv64a"></a><code>fnv64a(<a href="bytes.html">bytes</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 64-bit FNV-1a hash value of a set of values.</p> +<tr><td><a name="st_multipolygonfromtext"></a><code>st_multipolygonfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="fnv64a"></a><code>fnv64a(<a href="string.html">string</a>...) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the 64-bit FNV-1a hash value of a set of values.</p> +<tr><td><a name="st_multipolygonfromwkb"></a><code>st_multipolygonfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="width_bucket"></a><code>width_bucket(operand: <a href="decimal.html">decimal</a>, b1: <a href="decimal.html">decimal</a>, b2: <a href="decimal.html">decimal</a>, count: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>return the bucket number to which operand would be assigned in a histogram having count equal-width buckets spanning the range b1 to b2.</p> +<tr><td><a name="st_multipolygonfromwkb"></a><code>st_multipolygonfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not MultiPolygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="width_bucket"></a><code>width_bucket(operand: <a href="int.html">int</a>, b1: <a href="int.html">int</a>, b2: <a href="int.html">int</a>, count: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>return the bucket number to which operand would be assigned in a histogram having count equal-width buckets spanning the range b1 to b2.</p> +<tr><td><a name="st_ndims"></a><code>st_ndims(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of coordinate dimensions of a given Geometry.</p> </span></td></tr> -<tr><td><a name="width_bucket"></a><code>width_bucket(operand: anyelement, thresholds: anyelement[]) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>return the bucket number to which operand would be assigned given an array listing the lower bounds of the buckets; returns 0 for an input less than the first lower bound; the thresholds array must be sorted, smallest first, or unexpected results will be obtained</p> -</span></td></tr></tbody> -</table> - -### JSONB functions - -<table> -<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> -<tbody> -<tr><td><a name="array_to_json"></a><code>array_to_json(array: anyelement[]) → jsonb</code></td><td><span class="funcdesc"><p>Returns the array as JSON or JSONB.</p> +<tr><td><a name="st_npoints"></a><code>st_npoints(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of points in a given Geometry. Works for any shape type.</p> </span></td></tr> -<tr><td><a name="array_to_json"></a><code>array_to_json(array: anyelement[], pretty_bool: <a href="bool.html">bool</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns the array as JSON or JSONB.</p> +<tr><td><a name="st_nrings"></a><code>st_nrings(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of rings in a Polygon Geometry. Returns 0 if the shape is not a Polygon.</p> </span></td></tr> -<tr><td><a name="crdb_internal.json_to_pb"></a><code>crdb_internal.json_to_pb(pbname: <a href="string.html">string</a>, json: jsonb) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Convert JSONB data to protocol message bytes</p> +<tr><td><a name="st_numgeometries"></a><code>st_numgeometries(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of shapes inside a given Geometry.</p> </span></td></tr> -<tr><td><a name="crdb_internal.pb_to_json"></a><code>crdb_internal.pb_to_json(pbname: <a href="string.html">string</a>, data: <a href="bytes.html">bytes</a>) → jsonb</code></td><td><span class="funcdesc"><p>Converts protocol message to its JSONB representation.</p> +<tr><td><a name="st_numinteriorring"></a><code>st_numinteriorring(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of interior rings in a Polygon Geometry. Returns NULL if the shape is not a Polygon.</p> </span></td></tr> -<tr><td><a name="json_array_length"></a><code>json_array_length(json: jsonb) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of elements in the outermost JSON or JSONB array.</p> +<tr><td><a name="st_numinteriorrings"></a><code>st_numinteriorrings(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of interior rings in a Polygon Geometry. Returns NULL if the shape is not a Polygon.</p> </span></td></tr> -<tr><td><a name="json_build_array"></a><code>json_build_array(anyelement...) → jsonb</code></td><td><span class="funcdesc"><p>Builds a possibly-heterogeneously-typed JSON or JSONB array out of a variadic argument list.</p> +<tr><td><a name="st_numpoints"></a><code>st_numpoints(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of points in a LineString. Returns NULL if the Geometry is not a LineString.</p> </span></td></tr> -<tr><td><a name="json_build_object"></a><code>json_build_object(anyelement...) → jsonb</code></td><td><span class="funcdesc"><p>Builds a JSON object out of a variadic argument list.</p> +<tr><td><a name="st_overlaps"></a><code>st_overlaps(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a intersects but does not completely contain geometry_b, or vice versa. “Does not completely” implies ST_Within(geometry_a, geometry_b) = ST_Within(geometry_b, geometry_a) = false.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> -<tr><td><a name="json_extract_path"></a><code>json_extract_path(jsonb, <a href="string.html">string</a>...) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments.</p> +<tr><td><a name="st_perimeter"></a><code>st_perimeter(geography: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geography in meters. Uses a spheroid to perform the operation.</p> +<p>This function utilizes the GeographicLib library for spheroid calculations.</p> </span></td></tr> -<tr><td><a name="json_object"></a><code>json_object(keys: <a href="string.html">string</a>[], values: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>This form of json_object takes keys and values pairwise from two separate arrays. In all other respects it is identical to the one-argument form.</p> +<tr><td><a name="st_perimeter"></a><code>st_perimeter(geography: geography, use_spheroid: <a href="bool.html">bool</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geography in meters.</p> +<p>This function utilizes the S2 library for spherical calculations.</p> +<p>This function utilizes the GeographicLib library for spheroid calculations.</p> </span></td></tr> -<tr><td><a name="json_object"></a><code>json_object(texts: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>Builds a JSON or JSONB object out of a text array. The array must have exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs.</p> +<tr><td><a name="st_perimeter"></a><code>st_perimeter(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geometry.</p> +<p>Note ST_Perimeter is only valid for Polygon - use ST_Length for LineString.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="json_remove_path"></a><code>json_remove_path(val: jsonb, path: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>Remove the specified path from the JSON object.</p> +<tr><td><a name="st_perimeter2d"></a><code>st_perimeter2d(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geometry.</p> +<p>Note ST_Perimeter is only valid for Polygon - use ST_Length for LineString.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="json_set"></a><code>json_set(val: jsonb, path: <a href="string.html">string</a>[], to: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments.</p> +<tr><td><a name="st_point"></a><code>st_point(x: <a href="float.html">float</a>, y: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a new Point with the given X and Y coordinates.</p> </span></td></tr> -<tr><td><a name="json_set"></a><code>json_set(val: jsonb, path: <a href="string.html">string</a>[], to: jsonb, create_missing: <a href="bool.html">bool</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments. If <code>create_missing</code> is false, new keys will not be inserted to objects and values will not be prepended or appended to arrays.</p> +<tr><td><a name="st_pointfromgeohash"></a><code>st_pointfromgeohash(geohash: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Return a POINT Geometry from a GeoHash string with max precision.</p> </span></td></tr> -<tr><td><a name="json_strip_nulls"></a><code>json_strip_nulls(from_json: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns from_json with all object fields that have null values omitted. Other null values are untouched.</p> +<tr><td><a name="st_pointfromgeohash"></a><code>st_pointfromgeohash(geohash: <a href="string.html">string</a>, precision: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Return a POINT Geometry from a GeoHash string with supplied precision.</p> </span></td></tr> -<tr><td><a name="json_typeof"></a><code>json_typeof(val: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the type of the outermost JSON value as a text string.</p> +<tr><td><a name="st_pointfromtext"></a><code>st_pointfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not Point, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="jsonb_array_length"></a><code>jsonb_array_length(json: jsonb) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the number of elements in the outermost JSON or JSONB array.</p> +<tr><td><a name="st_pointfromtext"></a><code>st_pointfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not Point, NULL is returned.</p> </span></td></tr> -<tr><td><a name="jsonb_build_array"></a><code>jsonb_build_array(anyelement...) → jsonb</code></td><td><span class="funcdesc"><p>Builds a possibly-heterogeneously-typed JSON or JSONB array out of a variadic argument list.</p> +<tr><td><a name="st_pointfromwkb"></a><code>st_pointfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not Point, NULL is returned.</p> </span></td></tr> -<tr><td><a name="jsonb_build_object"></a><code>jsonb_build_object(anyelement...) → jsonb</code></td><td><span class="funcdesc"><p>Builds a JSON object out of a variadic argument list.</p> +<tr><td><a name="st_pointfromwkb"></a><code>st_pointfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not Point, NULL is returned.</p> </span></td></tr> -<tr><td><a name="jsonb_extract_path"></a><code>jsonb_extract_path(jsonb, <a href="string.html">string</a>...) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments.</p> +<tr><td><a name="st_pointn"></a><code>st_pointn(geometry: geometry, n: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the n-th Point of a LineString (1-indexed). Returns NULL if out of bounds or not a LineString.</p> </span></td></tr> -<tr><td><a name="jsonb_insert"></a><code>jsonb_insert(target: jsonb, path: <a href="string.html">string</a>[], new_val: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments. <code>new_val</code> will be inserted before path target.</p> +<tr><td><a name="st_pointonsurface"></a><code>st_pointonsurface(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a point that intersects with the given Geometry.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="jsonb_insert"></a><code>jsonb_insert(target: jsonb, path: <a href="string.html">string</a>[], new_val: jsonb, insert_after: <a href="bool.html">bool</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments. If <code>insert_after</code> is true (default is false), <code>new_val</code> will be inserted after path target.</p> +<tr><td><a name="st_points"></a><code>st_points(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns all coordinates in the given Geometry as a MultiPoint, including duplicates.</p> </span></td></tr> -<tr><td><a name="jsonb_object"></a><code>jsonb_object(keys: <a href="string.html">string</a>[], values: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>This form of json_object takes keys and values pairwise from two separate arrays. In all other respects it is identical to the one-argument form.</p> +<tr><td><a name="st_polyfromtext"></a><code>st_polyfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not Polygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="jsonb_object"></a><code>jsonb_object(texts: <a href="string.html">string</a>[]) → jsonb</code></td><td><span class="funcdesc"><p>Builds a JSON or JSONB object out of a text array. The array must have exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs.</p> +<tr><td><a name="st_polyfromtext"></a><code>st_polyfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not Polygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="jsonb_pretty"></a><code>jsonb_pretty(val: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the given JSON value as a STRING indented and with newlines.</p> +<tr><td><a name="st_polyfromwkb"></a><code>st_polyfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not Polygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="jsonb_set"></a><code>jsonb_set(val: jsonb, path: <a href="string.html">string</a>[], to: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments.</p> +<tr><td><a name="st_polyfromwkb"></a><code>st_polyfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not Polygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="jsonb_set"></a><code>jsonb_set(val: jsonb, path: <a href="string.html">string</a>[], to: jsonb, create_missing: <a href="bool.html">bool</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns the JSON value pointed to by the variadic arguments. If <code>create_missing</code> is false, new keys will not be inserted to objects and values will not be prepended or appended to arrays.</p> +<tr><td><a name="st_polygonfromtext"></a><code>st_polygonfromtext(str: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation with an SRID. If the shape underneath is not Polygon, NULL is returned. If the SRID is present in both the EWKT and the argument, the argument value is used.</p> </span></td></tr> -<tr><td><a name="jsonb_strip_nulls"></a><code>jsonb_strip_nulls(from_json: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns from_json with all object fields that have null values omitted. Other null values are untouched.</p> +<tr><td><a name="st_polygonfromtext"></a><code>st_polygonfromtext(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation. If the shape underneath is not Polygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="jsonb_typeof"></a><code>jsonb_typeof(val: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the type of the outermost JSON value as a text string.</p> +<tr><td><a name="st_polygonfromwkb"></a><code>st_polygonfromwkb(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation. If the shape underneath is not Polygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="to_json"></a><code>to_json(val: anyelement) → jsonb</code></td><td><span class="funcdesc"><p>Returns the value as JSON or JSONB.</p> +<tr><td><a name="st_polygonfromwkb"></a><code>st_polygonfromwkb(wkb: <a href="bytes.html">bytes</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation with an SRID. If the shape underneath is not Polygon, NULL is returned.</p> </span></td></tr> -<tr><td><a name="to_jsonb"></a><code>to_jsonb(val: anyelement) → jsonb</code></td><td><span class="funcdesc"><p>Returns the value as JSON or JSONB.</p> -</span></td></tr></tbody> -</table> - -### Multi-tenancy functions - -<table> -<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> -<tbody> -<tr><td><a name="crdb_internal.sql_liveness_is_alive"></a><code>crdb_internal.sql_liveness_is_alive(session_id: <a href="bytes.html">bytes</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Checks is given sqlliveness session id is not expired</p> -</span></td></tr></tbody> -</table> - -### STRING[] functions - -<table> -<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> -<tbody> -<tr><td><a name="regexp_split_to_array"></a><code>regexp_split_to_array(string: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>) → <a href="string.html">string</a>[]</code></td><td><span class="funcdesc"><p>Split string using a POSIX regular expression as the delimiter.</p> +<tr><td><a name="st_project"></a><code>st_project(geography: geography, distance: <a href="float.html">float</a>, azimuth: <a href="float.html">float</a>) → geography</code></td><td><span class="funcdesc"><p>Returns a point projected from a start point along a geodesic using a given distance and azimuth (bearing). +This is known as the direct geodesic problem.</p> +<p>The distance is given in meters. Negative values are supported.</p> +<p>The azimuth (also known as heading or bearing) is given in radians. It is measured clockwise from true north (azimuth zero). +East is azimuth π/2 (90 degrees); south is azimuth π (180 degrees); west is azimuth 3π/2 (270 degrees). +Negative azimuth values and values greater than 2π (360 degrees) are supported.</p> </span></td></tr> -<tr><td><a name="regexp_split_to_array"></a><code>regexp_split_to_array(string: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>, flags: <a href="string.html">string</a>) → <a href="string.html">string</a>[]</code></td><td><span class="funcdesc"><p>Split string using a POSIX regular expression as the delimiter with flags.</p> -<p>CockroachDB supports the following flags:</p> -<table> -<thead> -<tr> -<th>Flag</th> -<th>Description</th> -</tr> -</thead> -<tbody> -<tr> -<td><strong>c</strong></td> -<td>Case-sensitive matching</td> -</tr> -<tr> -<td><strong>g</strong></td> -<td>Global matching (match each substring instead of only the first)</td> -</tr> -<tr> -<td><strong>i</strong></td> -<td>Case-insensitive matching</td> -</tr> -<tr> -<td><strong>m</strong> or <strong>n</strong></td> -<td>Newline-sensitive (see below)</td> -</tr> -<tr> -<td><strong>p</strong></td> -<td>Partial newline-sensitive matching (see below)</td> -</tr> -<tr> -<td><strong>s</strong></td> -<td>Newline-insensitive (default)</td> -</tr> -<tr> -<td><strong>w</strong></td> -<td>Inverse partial newline-sensitive matching (see below)</td> -</tr> -</tbody> -</table> -<table> -<thead> -<tr> -<th>Mode</th> -<th><code>.</code> and <code>[^...]</code> match newlines</th> -<th><code>^</code> and <code>$</code> match line boundaries</th> -</tr> -</thead> -<tbody> -<tr> -<td>s</td> -<td>yes</td> -<td>no</td> -</tr> -<tr> -<td>w</td> -<td>yes</td> -<td>yes</td> -</tr> -<tr> -<td>p</td> -<td>no</td> -<td>no</td> -</tr> -<tr> -<td>m/n</td> -<td>no</td> -<td>yes</td> -</tr> -</tbody> -</table> -</span></td></tr></tbody> -</table> - -### Sequence functions - -<table> -<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> -<tbody> -<tr><td><a name="currval"></a><code>currval(sequence_name: <a href="string.html">string</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the latest value obtained with nextval for this sequence in this session.</p> +<tr><td><a name="st_relate"></a><code>st_relate(geometry_a: geometry, geometry_b: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the DE-9IM spatial relation between geometry_a and geometry_b.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="lastval"></a><code>lastval() → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Return value most recently obtained with nextval in this session.</p> +<tr><td><a name="st_relate"></a><code>st_relate(geometry_a: geometry, geometry_b: geometry, pattern: <a href="string.html">string</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns whether the DE-9IM spatial relation between geometry_a and geometry_b matches the DE-9IM pattern.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="nextval"></a><code>nextval(sequence_name: <a href="string.html">string</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Advances the given sequence and returns its new value.</p> +<tr><td><a name="st_relatematch"></a><code>st_relatematch(intersection_matrix: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns whether the given DE-9IM intersection matrix satisfies the given pattern.</p> </span></td></tr> -<tr><td><a name="pg_get_serial_sequence"></a><code>pg_get_serial_sequence(table_name: <a href="string.html">string</a>, column_name: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns the name of the sequence used by the given column_name in the table table_name.</p> +<tr><td><a name="st_removepoint"></a><code>st_removepoint(line_string: geometry, index: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Removes the Point at the given 0-based index and returns the modified LineString geometry.</p> </span></td></tr> -<tr><td><a name="setval"></a><code>setval(sequence_name: <a href="string.html">string</a>, value: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Set the given sequence’s current value. The next call to nextval will return <code>value + Increment</code></p> +<tr><td><a name="st_reverse"></a><code>st_reverse(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified geometry by reversing the order of its vertices.</p> </span></td></tr> -<tr><td><a name="setval"></a><code>setval(sequence_name: <a href="string.html">string</a>, value: <a href="int.html">int</a>, is_called: <a href="bool.html">bool</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Set the given sequence’s current value. If is_called is false, the next call to nextval will return <code>value</code>; otherwise <code>value + Increment</code>.</p> -</span></td></tr></tbody> -</table> - -### Set-returning functions - -<table> -<thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> -<tbody> -<tr><td><a name="aclexplode"></a><code>aclexplode(aclitems: <a href="string.html">string</a>[]) → tuple{oid AS grantor, oid AS grantee, string AS privilege_type, bool AS is_grantable}</code></td><td><span class="funcdesc"><p>Produces a virtual table containing aclitem stuff (returns no rows as this feature is unsupported in CockroachDB)</p> +<tr><td><a name="st_scale"></a><code>st_scale(g: geometry, factor: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry scaled by taking in a Geometry as the factor.</p> </span></td></tr> -<tr><td><a name="crdb_internal.testing_callback"></a><code>crdb_internal.testing_callback(name: <a href="string.html">string</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>For internal CRDB testing only. The function calls a callback identified by <code>name</code> registered with the server by the test.</p> +<tr><td><a name="st_scale"></a><code>st_scale(g: geometry, factor: geometry, origin: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry scaled by the Geometry factor relative to a false origin.</p> </span></td></tr> -<tr><td><a name="crdb_internal.unary_table"></a><code>crdb_internal.unary_table() → tuple</code></td><td><span class="funcdesc"><p>Produces a virtual table containing a single row with no values.</p> -<p>This function is used only by CockroachDB’s developers for testing purposes.</p> +<tr><td><a name="st_scale"></a><code>st_scale(geometry: geometry, x_factor: <a href="float.html">float</a>, y_factor: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry scaled by the given factors.</p> </span></td></tr> -<tr><td><a name="generate_series"></a><code>generate_series(start: <a href="int.html">int</a>, end: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Produces a virtual table containing the integer values from <code>start</code> to <code>end</code>, inclusive.</p> +<tr><td><a name="st_segmentize"></a><code>st_segmentize(geography: geography, max_segment_length_meters: <a href="float.html">float</a>) → geography</code></td><td><span class="funcdesc"><p>Returns a modified Geography having no segment longer than the given max_segment_length meters.</p> +<p>The calculations are done on a sphere.</p> +<p>This function utilizes the S2 library for spherical calculations.</p> </span></td></tr> -<tr><td><a name="generate_series"></a><code>generate_series(start: <a href="int.html">int</a>, end: <a href="int.html">int</a>, step: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Produces a virtual table containing the integer values from <code>start</code> to <code>end</code>, inclusive, by increment of <code>step</code>.</p> +<tr><td><a name="st_segmentize"></a><code>st_segmentize(geometry: geometry, max_segment_length: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry having no segment longer than the given max_segment_length. Length units are in units of spatial reference.</p> </span></td></tr> -<tr><td><a name="generate_series"></a><code>generate_series(start: <a href="timestamp.html">timestamp</a>, end: <a href="timestamp.html">timestamp</a>, step: <a href="interval.html">interval</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Produces a virtual table containing the timestamp values from <code>start</code> to <code>end</code>, inclusive, by increment of <code>step</code>.</p> +<tr><td><a name="st_setpoint"></a><code>st_setpoint(line_string: geometry, index: <a href="int.html">int</a>, point: geometry) → geometry</code></td><td><span class="funcdesc"><p>Sets the Point at the given 0-based index and returns the modified LineString geometry.</p> </span></td></tr> -<tr><td><a name="generate_subscripts"></a><code>generate_subscripts(array: anyelement[]) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns a series comprising the given array’s subscripts.</p> +<tr><td><a name="st_setsrid"></a><code>st_setsrid(geography: geography, srid: <a href="int.html">int</a>) → geography</code></td><td><span class="funcdesc"><p>Sets a Geography to a new SRID without transforming the coordinates.</p> </span></td></tr> -<tr><td><a name="generate_subscripts"></a><code>generate_subscripts(array: anyelement[], dim: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns a series comprising the given array’s subscripts.</p> +<tr><td><a name="st_setsrid"></a><code>st_setsrid(geometry: geometry, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Sets a Geometry to a new SRID without transforming the coordinates.</p> </span></td></tr> -<tr><td><a name="generate_subscripts"></a><code>generate_subscripts(array: anyelement[], dim: <a href="int.html">int</a>, reverse: <a href="bool.html">bool</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns a series comprising the given array’s subscripts.</p> -<p>When reverse is true, the series is returned in reverse order.</p> +<tr><td><a name="st_sharedpaths"></a><code>st_sharedpaths(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns a collection containing paths shared by the two input geometries.</p> +<p>Those going in the same direction are in the first element of the collection, +those going in the opposite direction are in the second element. +The paths themselves are given in the direction of the first geometry.</p> </span></td></tr> -<tr><td><a name="information_schema._pg_expandarray"></a><code>information_schema._pg_expandarray(input: anyelement[]) → anyelement</code></td><td><span class="funcdesc"><p>Returns the input array as a set of rows with an index</p> +<tr><td><a name="st_shortestline"></a><code>st_shortestline(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the LineString corresponds to the minimum distance across every pair of points comprising the given geometries.</p> +<p>Note if geometries are the same, it will return the LineString with the minimum distance between the geometry’s vertexes. The function will return the shortest line that was discovered first when comparing minimum distances if more than one is found.</p> </span></td></tr> -<tr><td><a name="json_array_elements"></a><code>json_array_elements(input: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Expands a JSON array to a set of JSON values.</p> +<tr><td><a name="st_srid"></a><code>st_srid(geography: geography) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the Spatial Reference Identifier (SRID) for the ST_Geography as defined in spatial_ref_sys table.</p> </span></td></tr> -<tr><td><a name="json_array_elements_text"></a><code>json_array_elements_text(input: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Expands a JSON array to a set of text values.</p> +<tr><td><a name="st_srid"></a><code>st_srid(geometry: geometry) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns the Spatial Reference Identifier (SRID) for the ST_Geometry as defined in spatial_ref_sys table.</p> </span></td></tr> -<tr><td><a name="json_each"></a><code>json_each(input: jsonb) → tuple{string AS key, jsonb AS value}</code></td><td><span class="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs.</p> +<tr><td><a name="st_startpoint"></a><code>st_startpoint(geometry: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the first point of a geometry which has shape LineString. Returns NULL if the geometry is not a LineString.</p> </span></td></tr> -<tr><td><a name="json_each_text"></a><code>json_each_text(input: jsonb) → tuple{string AS key, string AS value}</code></td><td><span class="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs. The returned values will be of type text.</p> +<tr><td><a name="st_summary"></a><code>st_summary(geography: geography) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns a text summary of the contents of the geography.</p> +<p>Flags shown square brackets after the geometry type have the following meaning:</p> +<ul> +<li>M: has M coordinate</li> +<li>Z: has Z coordinate</li> +<li>B: has a cached bounding box</li> +<li>G: is geography</li> +<li>S: has spatial reference system</li> +</ul> </span></td></tr> -<tr><td><a name="json_object_keys"></a><code>json_object_keys(input: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns sorted set of keys in the outermost JSON object.</p> +<tr><td><a name="st_summary"></a><code>st_summary(geometry: geometry) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns a text summary of the contents of the geometry.</p> +<p>Flags shown square brackets after the geometry type have the following meaning:</p> +<ul> +<li>M: has M coordinate</li> +<li>Z: has Z coordinate</li> +<li>B: has a cached bounding box</li> +<li>G: is geography</li> +<li>S: has spatial reference system</li> +</ul> </span></td></tr> -<tr><td><a name="jsonb_array_elements"></a><code>jsonb_array_elements(input: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Expands a JSON array to a set of JSON values.</p> +<tr><td><a name="st_symdifference"></a><code>st_symdifference(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the symmetric difference of both geometries.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="jsonb_array_elements_text"></a><code>jsonb_array_elements_text(input: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Expands a JSON array to a set of text values.</p> +<tr><td><a name="st_symmetricdifference"></a><code>st_symmetricdifference(geometry_a: geometry, geometry_b: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns the symmetric difference of both geometries.</p> +<p>This function utilizes the GEOS module.</p> </span></td></tr> -<tr><td><a name="jsonb_each"></a><code>jsonb_each(input: jsonb) → tuple{string AS key, jsonb AS value}</code></td><td><span class="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs.</p> +<tr><td><a name="st_touches"></a><code>st_touches(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if the only points in common between geometry_a and geometry_b are on the boundary. Note points do not touch other points.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> -<tr><td><a name="jsonb_each_text"></a><code>jsonb_each_text(input: jsonb) → tuple{string AS key, string AS value}</code></td><td><span class="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs. The returned values will be of type text.</p> +<tr><td><a name="st_transform"></a><code>st_transform(geometry: geometry, from_proj_text: <a href="string.html">string</a>, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Transforms a geometry into the coordinate reference system assuming the from_proj_text to the new to_proj_text by projecting its coordinates. The supplied SRID is set on the new geometry.</p> +<p>This function utilizes the PROJ library for coordinate projections.</p> </span></td></tr> -<tr><td><a name="jsonb_object_keys"></a><code>jsonb_object_keys(input: jsonb) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns sorted set of keys in the outermost JSON object.</p> +<tr><td><a name="st_transform"></a><code>st_transform(geometry: geometry, from_proj_text: <a href="string.html">string</a>, to_proj_text: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Transforms a geometry into the coordinate reference system assuming the from_proj_text to the new to_proj_text by projecting its coordinates.</p> +<p>This function utilizes the PROJ library for coordinate projections.</p> </span></td></tr> -<tr><td><a name="pg_get_keywords"></a><code>pg_get_keywords() → tuple{string AS word, string AS catcode, string AS catdesc}</code></td><td><span class="funcdesc"><p>Produces a virtual table containing the keywords known to the SQL parser.</p> +<tr><td><a name="st_transform"></a><code>st_transform(geometry: geometry, srid: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Transforms a geometry into the given SRID coordinate reference system by projecting its coordinates.</p> +<p>This function utilizes the PROJ library for coordinate projections.</p> </span></td></tr> -<tr><td><a name="regexp_split_to_table"></a><code>regexp_split_to_table(string: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Split string using a POSIX regular expression as the delimiter.</p> +<tr><td><a name="st_transform"></a><code>st_transform(geometry: geometry, to_proj_text: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Transforms a geometry into the coordinate reference system referenced by the projection text by projecting its coordinates.</p> +<p>This function utilizes the PROJ library for coordinate projections.</p> </span></td></tr> -<tr><td><a name="regexp_split_to_table"></a><code>regexp_split_to_table(string: <a href="string.html">string</a>, pattern: <a href="string.html">string</a>, flags: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Split string using a POSIX regular expression as the delimiter with flags.</p> -<p>CockroachDB supports the following flags:</p> -<table> -<thead> -<tr> -<th>Flag</th> -<th>Description</th> -</tr> -</thead> -<tbody> -<tr> -<td><strong>c</strong></td> -<td>Case-sensitive matching</td> -</tr> -<tr> -<td><strong>g</strong></td> -<td>Global matching (match each substring instead of only the first)</td> -</tr> -<tr> -<td><strong>i</strong></td> -<td>Case-insensitive matching</td> -</tr> -<tr> -<td><strong>m</strong> or <strong>n</strong></td> -<td>Newline-sensitive (see below)</td> -</tr> -<tr> -<td><strong>p</strong></td> -<td>Partial newline-sensitive matching (see below)</td> -</tr> -<tr> -<td><strong>s</strong></td> -<td>Newline-insensitive (default)</td> -</tr> -<tr> -<td><strong>w</strong></td> -<td>Inverse partial newline-sensitive matching (see below)</td> -</tr> -</tbody> -</table> -<table> -<thead> -<tr> -<th>Mode</th> -<th><code>.</code> and <code>[^...]</code> match newlines</th> -<th><code>^</code> and <code>$</code> match line boundaries</th> -</tr> -</thead> -<tbody> -<tr> -<td>s</td> -<td>yes</td> -<td>no</td> -</tr> -<tr> -<td>w</td> -<td>yes</td> -<td>yes</td> -</tr> -<tr> -<td>p</td> -<td>no</td> -<td>no</td> -</tr> -<tr> -<td>m/n</td> -<td>no</td> -<td>yes</td> -</tr> -</tbody> -</table> +<tr><td><a name="st_translate"></a><code>st_translate(g: geometry, delta_x: <a href="float.html">float</a>, delta_y: <a href="float.html">float</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns a modified Geometry translated by the given deltas.</p> </span></td></tr> -<tr><td><a name="unnest"></a><code>unnest(anyelement[], anyelement[], anyelement[]...) → tuple</code></td><td><span class="funcdesc"><p>Returns the input arrays as a set of rows</p> +<tr><td><a name="st_within"></a><code>st_within(geometry_a: geometry, geometry_b: geometry) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if geometry_a is completely inside geometry_b.</p> +<p>This function utilizes the GEOS module.</p> +<p>This function variant will attempt to utilize any available spatial index.</p> </span></td></tr> -<tr><td><a name="unnest"></a><code>unnest(input: anyelement[]) → anyelement</code></td><td><span class="funcdesc"><p>Returns the input array as a set of rows</p> +<tr><td><a name="st_wkbtosql"></a><code>st_wkbtosql(val: <a href="bytes.html">bytes</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKB (or EWKB) representation.</p> +</span></td></tr> +<tr><td><a name="st_wkttosql"></a><code>st_wkttosql(val: <a href="string.html">string</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns the Geometry from a WKT or EWKT representation.</p> +</span></td></tr> +<tr><td><a name="st_x"></a><code>st_x(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the X coordinate of a geometry if it is a Point.</p> +</span></td></tr> +<tr><td><a name="st_y"></a><code>st_y(geometry: geometry) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the Y coordinate of a geometry if it is a Point.</p> </span></td></tr></tbody> </table> diff --git a/pkg/cli/cliflags/flags.go b/pkg/cli/cliflags/flags.go index 0791b0fb463c..6841eda26504 100644 --- a/pkg/cli/cliflags/flags.go +++ b/pkg/cli/cliflags/flags.go @@ -1093,9 +1093,9 @@ the demo shell.`, } GeoLibsDir = FlagInfo{ - Name: "geo-libs", + Name: "spatial-libs", Description: ` -The location where all libraries for Geospatial operations is located.`, +The location where all libraries for spatial operations is located.`, } Global = FlagInfo{ diff --git a/pkg/cli/demo.go b/pkg/cli/demo.go index e933e7e0f364..108ff0d6c17a 100644 --- a/pkg/cli/demo.go +++ b/pkg/cli/demo.go @@ -272,7 +272,7 @@ func runDemo(cmd *cobra.Command, gen workload.Generator) (err error) { loc, err := geos.EnsureInit(geos.EnsureInitErrorDisplayPrivate, startCtx.geoLibsDir) if err != nil { - log.Infof(ctx, "could not initialize GEOS - geospatial functions may not be available: %v", err) + log.Infof(ctx, "could not initialize GEOS - spatial functions may not be available: %v", err) } else { log.Infof(ctx, "GEOS loaded from directory %s", loc) } diff --git a/pkg/cli/start.go b/pkg/cli/start.go index b0a513b9fd6d..5f43e64394a8 100644 --- a/pkg/cli/start.go +++ b/pkg/cli/start.go @@ -497,7 +497,7 @@ If problems persist, please see %s.` // We need to make sure this happens before any queries involving geospatial data is executed. loc, err := geos.EnsureInit(geos.EnsureInitErrorDisplayPrivate, startCtx.geoLibsDir) if err != nil { - log.Infof(ctx, "could not initialize GEOS - geospatial functions may not be available: %v", err) + log.Infof(ctx, "could not initialize GEOS - spatial functions may not be available: %v", err) } else { log.Infof(ctx, "GEOS loaded from directory %s", loc) } diff --git a/pkg/cmd/geoviz/main.go b/pkg/cmd/geoviz/main.go index 8c23f3f6d026..17a32892131c 100644 --- a/pkg/cmd/geoviz/main.go +++ b/pkg/cmd/geoviz/main.go @@ -89,14 +89,14 @@ func handleLoad(w http.ResponseWriter, r *http.Request) { var flagGeoLibsDir = flag.String( "geo_libs", "/usr/local/lib/cockroach", - "Location where geospatial related libraries can be found.", + "Location where spatial related libraries can be found.", ) func main() { flag.Parse() if _, err := geos.EnsureInit(geos.EnsureInitErrorDisplayPrivate, *flagGeoLibsDir); err != nil { - log.Fatalf("could not initialize GEOS - geospatial functions may not be available: %v", err) + log.Fatalf("could not initialize GEOS - spatial functions may not be available: %v", err) } http.HandleFunc("/", handleIndex) diff --git a/pkg/sql/opt/invertedidx/inverted_index_expr.go b/pkg/sql/opt/invertedidx/inverted_index_expr.go index 400424dc0275..7724f4cdda1c 100644 --- a/pkg/sql/opt/invertedidx/inverted_index_expr.go +++ b/pkg/sql/opt/invertedidx/inverted_index_expr.go @@ -26,7 +26,7 @@ func NewDatumsToInvertedExpr( evalCtx *tree.EvalContext, colTypes []*types.T, expr tree.TypedExpr, desc *descpb.IndexDescriptor, ) (invertedexpr.DatumsToInvertedExpr, error) { if geoindex.IsEmptyConfig(&desc.GeoConfig) { - return nil, fmt.Errorf("inverted joins are currently only supported for geospatial indexes") + return nil, fmt.Errorf("inverted joins are currently only supported for spatial indexes") } return NewGeoDatumsToInvertedExpr(evalCtx, colTypes, expr, &desc.GeoConfig) diff --git a/pkg/sql/sem/builtins/builtins.go b/pkg/sql/sem/builtins/builtins.go index f9636e3235ec..64f5c42b88c0 100644 --- a/pkg/sql/sem/builtins/builtins.go +++ b/pkg/sql/sem/builtins/builtins.go @@ -91,7 +91,7 @@ const ( categoryDateAndTime = "Date and time" categoryEnum = "Enum" categoryGenerator = "Set-returning" - categoryGeospatial = "Geospatial" + categorySpatial = "Spatial" categoryIDGeneration = "ID generation" categoryJSON = "JSONB" categoryMultiTenancy = "Multi-tenancy" diff --git a/pkg/sql/sem/builtins/geo_builtins.go b/pkg/sql/sem/builtins/geo_builtins.go index 2d565ac10612..0f464495ada4 100644 --- a/pkg/sql/sem/builtins/geo_builtins.go +++ b/pkg/sql/sem/builtins/geo_builtins.go @@ -48,7 +48,7 @@ const ( const usesSpheroidMessage = " Uses a spheroid to perform the operation." const spheroidDistanceMessage = `"\n\nWhen operating on a spheroid, this function will use the sphere to calculate ` + - `the closest two points using S2. The spheroid distance between these two points is calculated using GeographicLib. ` + + `the closest two points using a sphere. The spheroid distance between these two points is calculated using GeographicLib. ` + `This follows observed PostGIS behavior.` const ( @@ -415,7 +415,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, types.Box2D, infoBuilder{ - info: "Returns a box2d encapsulating the given Geometry", + info: "Returns a box2d encapsulating the given Geometry.", }, tree.VolatilityImmutable, ), @@ -574,7 +574,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - outer := args[0].(*tree.DGeometry) + outer := tree.MustBeDGeometry(args[0]) interiorArr := tree.MustBeDArray(args[1]) interior := make([]geo.Geometry, len(interiorArr.Array)) for i, v := range interiorArr.Array { @@ -766,8 +766,8 @@ var geoBuiltins = map[string]builtinDefinition{ Types: tree.ArgTypes{{"x", types.Float}, {"y", types.Float}}, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - x := float64(*args[0].(*tree.DFloat)) - y := float64(*args[1].(*tree.DFloat)) + x := float64(tree.MustBeDFloat(args[0])) + y := float64(tree.MustBeDFloat(args[1])) g, err := geo.MakeGeometryFromPointCoords(x, y) if err != nil { return nil, err @@ -787,9 +787,9 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DString) - p := args[1].(*tree.DInt) - ret, err := geo.ParseGeometryPointFromGeoHash(string(*g), int(*p)) + g := tree.MustBeDString(args[0]) + p := tree.MustBeDInt(args[1]) + ret, err := geo.ParseGeometryPointFromGeoHash(string(g), int(p)) if err != nil { return nil, err } @@ -806,9 +806,9 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DString) - p := len(string(*g)) - ret, err := geo.ParseGeometryPointFromGeoHash(string(*g), p) + g := tree.MustBeDString(args[0]) + p := len(string(g)) + ret, err := geo.ParseGeometryPointFromGeoHash(string(g), p) if err != nil { return nil, err } @@ -829,9 +829,9 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DString) - p := args[1].(*tree.DInt) - bbox, err := geo.ParseCartesianBoundingBoxFromGeoHash(string(*g), int(*p)) + g := tree.MustBeDString(args[0]) + p := tree.MustBeDInt(args[1]) + bbox, err := geo.ParseCartesianBoundingBoxFromGeoHash(string(g), int(p)) if err != nil { return nil, err } @@ -852,9 +852,9 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DString) - p := len(string(*g)) - bbox, err := geo.ParseCartesianBoundingBoxFromGeoHash(string(*g), p) + g := tree.MustBeDString(args[0]) + p := len(string(g)) + bbox, err := geo.ParseCartesianBoundingBoxFromGeoHash(string(g), p) if err != nil { return nil, err } @@ -879,9 +879,9 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Box2D), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DString) - p := args[1].(*tree.DInt) - bbox, err := geo.ParseCartesianBoundingBoxFromGeoHash(string(*g), int(*p)) + g := tree.MustBeDString(args[0]) + p := tree.MustBeDInt(args[1]) + bbox, err := geo.ParseCartesianBoundingBoxFromGeoHash(string(g), int(p)) if err != nil { return nil, err } @@ -898,9 +898,9 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Box2D), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DString) - p := len(string(*g)) - bbox, err := geo.ParseCartesianBoundingBoxFromGeoHash(string(*g), p) + g := tree.MustBeDString(args[0]) + p := len(string(g)) + bbox, err := geo.ParseCartesianBoundingBoxFromGeoHash(string(g), p) if err != nil { return nil, err } @@ -937,7 +937,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) + g := tree.MustBeDGeometry(args[0]) maxDecimalDigits := int(tree.MustBeDInt(args[1])) wkt, err := geo.SpatialObjectToWKT(g.Geometry.SpatialObject(), fitMaxDecimalDigitsToBounds(maxDecimalDigits)) return tree.NewDString(string(wkt)), err @@ -965,7 +965,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) + g := tree.MustBeDGeography(args[0]) maxDecimalDigits := int(tree.MustBeDInt(args[1])) wkt, err := geo.SpatialObjectToWKT(g.Geography.SpatialObject(), fitMaxDecimalDigitsToBounds(maxDecimalDigits)) return tree.NewDString(string(wkt)), err @@ -996,7 +996,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) + g := tree.MustBeDGeometry(args[0]) maxDecimalDigits := int(tree.MustBeDInt(args[1])) ewkt, err := geo.SpatialObjectToEWKT(g.Geometry.SpatialObject(), fitMaxDecimalDigitsToBounds(maxDecimalDigits)) return tree.NewDString(string(ewkt)), err @@ -1024,7 +1024,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) + g := tree.MustBeDGeography(args[0]) maxDecimalDigits := int(tree.MustBeDInt(args[1])) ewkt, err := geo.SpatialObjectToEWKT(g.Geography.SpatialObject(), fitMaxDecimalDigitsToBounds(maxDecimalDigits)) return tree.NewDString(string(ewkt)), err @@ -1062,7 +1062,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Bytes), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) + g := tree.MustBeDGeometry(args[0]) text := string(tree.MustBeDString(args[1])) wkb, err := geo.SpatialObjectToWKB(g.Geometry.SpatialObject(), geo.StringToByteOrder(text)) @@ -1081,7 +1081,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.Bytes), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) + g := tree.MustBeDGeography(args[0]) text := string(tree.MustBeDString(args[1])) wkb, err := geo.SpatialObjectToWKB(g.Geography.SpatialObject(), geo.StringToByteOrder(text)) @@ -1159,7 +1159,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) + g := tree.MustBeDGeometry(args[0]) text := string(tree.MustBeDString(args[1])) byteOrder := geo.StringToByteOrder(text) @@ -1192,7 +1192,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) + g := tree.MustBeDGeography(args[0]) text := string(tree.MustBeDString(args[1])) byteOrder := geo.StringToByteOrder(text) @@ -1263,9 +1263,9 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - p := args[1].(*tree.DInt) - ret, err := geo.SpatialObjectToGeoHash(g.Geometry.SpatialObject(), int(*p)) + g := tree.MustBeDGeometry(args[0]) + p := tree.MustBeDInt(args[1]) + ret, err := geo.SpatialObjectToGeoHash(g.Geometry.SpatialObject(), int(p)) if err != nil { return nil, err } @@ -1297,9 +1297,9 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) - p := args[1].(*tree.DInt) - ret, err := geo.SpatialObjectToGeoHash(g.Geography.SpatialObject(), int(*p)) + g := tree.MustBeDGeography(args[0]) + p := tree.MustBeDInt(args[1]) + ret, err := geo.SpatialObjectToGeoHash(g.Geography.SpatialObject(), int(p)) if err != nil { return nil, err } @@ -1317,7 +1317,7 @@ var geoBuiltins = map[string]builtinDefinition{ Types: tree.ArgTypes{{"row", types.AnyTuple}}, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - tuple := args[0].(*tree.DTuple) + tuple := tree.MustBeDTuple(args[0]) return stAsGeoJSONFromTuple( ctx, tuple, @@ -1338,7 +1338,7 @@ var geoBuiltins = map[string]builtinDefinition{ Types: tree.ArgTypes{{"row", types.AnyTuple}, {"geo_column", types.String}}, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - tuple := args[0].(*tree.DTuple) + tuple := tree.MustBeDTuple(args[0]) return stAsGeoJSONFromTuple( ctx, tuple, @@ -1363,7 +1363,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - tuple := args[0].(*tree.DTuple) + tuple := tree.MustBeDTuple(args[0]) return stAsGeoJSONFromTuple( ctx, tuple, @@ -1389,7 +1389,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - tuple := args[0].(*tree.DTuple) + tuple := tree.MustBeDTuple(args[0]) return stAsGeoJSONFromTuple( ctx, tuple, @@ -1427,7 +1427,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) + g := tree.MustBeDGeometry(args[0]) maxDecimalDigits := int(tree.MustBeDInt(args[1])) geojson, err := geo.SpatialObjectToGeoJSON(g.Geometry.SpatialObject(), fitMaxDecimalDigitsToBounds(maxDecimalDigits), geo.SpatialObjectToGeoJSONFlagShortCRSIfNot4326) return tree.NewDString(string(geojson)), err @@ -1445,7 +1445,7 @@ var geoBuiltins = map[string]builtinDefinition{ }, ReturnType: tree.FixedReturnType(types.String), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) + g := tree.MustBeDGeometry(args[0]) maxDecimalDigits := int(tree.MustBeDInt(args[1])) options := geo.SpatialObjectToGeoJSONFlag(tree.MustBeDInt(args[2])) geojson, err := geo.SpatialObjectToGeoJSON(g.Geometry.SpatialObject(), fitMaxDecimalDigitsToBounds(maxDecimalDigits), options) @@ -1484,7 +1484,7 @@ Options is a flag that can be bitmasked. The options are: }, ReturnType: tree.FixedReturnType(types.String), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) + g := tree.MustBeDGeography(args[0]) maxDecimalDigits := int(tree.MustBeDInt(args[1])) geojson, err := geo.SpatialObjectToGeoJSON(g.Geography.SpatialObject(), fitMaxDecimalDigitsToBounds(maxDecimalDigits), geo.SpatialObjectToGeoJSONFlagZero) return tree.NewDString(string(geojson)), err @@ -1502,7 +1502,7 @@ Options is a flag that can be bitmasked. The options are: }, ReturnType: tree.FixedReturnType(types.String), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) + g := tree.MustBeDGeography(args[0]) maxDecimalDigits := int(tree.MustBeDInt(args[1])) options := geo.SpatialObjectToGeoJSONFlag(tree.MustBeDInt(args[2])) geojson, err := geo.SpatialObjectToGeoJSON(g.Geography.SpatialObject(), fitMaxDecimalDigitsToBounds(maxDecimalDigits), options) @@ -1531,9 +1531,9 @@ Options is a flag that can be bitmasked. The options are: }, ReturnType: tree.FixedReturnType(types.Geography), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) - distance := float64(*args[1].(*tree.DFloat)) - azimuth := float64(*args[2].(*tree.DFloat)) + g := tree.MustBeDGeography(args[0]) + distance := float64(tree.MustBeDFloat(args[1])) + azimuth := float64(tree.MustBeDFloat(args[2])) geog, err := geogfn.Project(g.Geography, distance, s1.Angle(azimuth)) if err != nil { @@ -1830,8 +1830,8 @@ Flags shown square brackets after the geometry type have the following meaning: Types: tree.ArgTypes{{"geometry", types.Geometry}, {"n", types.Int}}, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := *args[0].(*tree.DGeometry) - n := int(*args[1].(*tree.DInt)) + g := tree.MustBeDGeometry(args[0]) + n := int(tree.MustBeDInt(args[1])) t, err := g.Geometry.AsGeomT() if err != nil { return nil, err @@ -1864,8 +1864,8 @@ Flags shown square brackets after the geometry type have the following meaning: Types: tree.ArgTypes{{"geometry", types.Geometry}, {"n", types.Int}}, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := *args[0].(*tree.DGeometry) - n := int(*args[1].(*tree.DInt)) - 1 + g := tree.MustBeDGeometry(args[0]) + n := int(tree.MustBeDInt(args[1])) - 1 if n < 0 { return tree.DNull, nil } @@ -1898,8 +1898,8 @@ Flags shown square brackets after the geometry type have the following meaning: Types: tree.ArgTypes{{"geometry", types.Geometry}, {"n", types.Int}}, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := *args[0].(*tree.DGeometry) - n := int(*args[1].(*tree.DInt)) - 1 + g := tree.MustBeDGeometry(args[0]) + n := int(tree.MustBeDInt(args[1])) - 1 if n < 0 { return tree.DNull, nil } @@ -2332,9 +2332,9 @@ Note If the result has zero or one points, it will be returned as a POINT. If it }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - fraction := float64(*args[1].(*tree.DFloat)) - repeat := bool(*args[2].(*tree.DBool)) + g := tree.MustBeDGeometry(args[0]) + fraction := float64(tree.MustBeDFloat(args[1])) + repeat := bool(tree.MustBeDBool(args[2])) interpolatedPoints, err := geomfn.LineInterpolatePoints(g.Geometry, fraction, repeat) if err != nil { return nil, err @@ -2378,9 +2378,9 @@ Note If the result has zero or one points, it will be returned as a POINT. If it }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - shapeType := args[1].(*tree.DInt) - res, err := geomfn.CollectionExtract(g.Geometry, geopb.ShapeType(*shapeType)) + g := tree.MustBeDGeometry(args[0]) + shapeType := tree.MustBeDInt(args[1]) + res, err := geomfn.CollectionExtract(g.Geometry, geopb.ShapeType(shapeType)) if err != nil { return nil, err } @@ -2580,9 +2580,9 @@ The azimuth is angle is referenced from north, and is positive clockwise: North }, ReturnType: tree.FixedReturnType(types.Float), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeography) - b := args[1].(*tree.DGeography) - useSpheroid := args[2].(*tree.DBool) + a := tree.MustBeDGeography(args[0]) + b := tree.MustBeDGeography(args[1]) + useSpheroid := tree.MustBeDBool(args[2]) ret, err := geogfn.Distance(a.Geography, b.Geography, toUseSphereOrSpheroid(useSpheroid)) if err != nil { @@ -2758,7 +2758,7 @@ Note if geometries are the same, it will return the LineString with the minimum geometryOverload2BinaryPredicate( geomfn.CoveredBy, infoBuilder{ - info: `Returns true if no point in geometry_a is outside geometry_b`, + info: `Returns true if no point in geometry_a is outside geometry_b.`, libraryUsage: usesGEOS, }, ), @@ -2822,10 +2822,10 @@ Note if geometries are the same, it will return the LineString with the minimum }, ReturnType: tree.FixedReturnType(types.Bool), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeometry) - b := args[1].(*tree.DGeometry) - dist := args[2].(*tree.DFloat) - ret, err := geomfn.DFullyWithin(a.Geometry, b.Geometry, float64(*dist), geo.FnInclusive) + a := tree.MustBeDGeometry(args[0]) + b := tree.MustBeDGeometry(args[1]) + dist := tree.MustBeDFloat(args[2]) + ret, err := geomfn.DFullyWithin(a.Geometry, b.Geometry, float64(dist), geo.FnInclusive) if err != nil { return nil, err } @@ -2931,10 +2931,10 @@ Note if geometries are the same, it will return the LineString with the minimum }, ReturnType: tree.FixedReturnType(types.Bool), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeometry) - b := args[1].(*tree.DGeometry) - pattern := args[2].(*tree.DString) - ret, err := geomfn.RelatePattern(a.Geometry, b.Geometry, string(*pattern)) + a := tree.MustBeDGeometry(args[0]) + b := tree.MustBeDGeometry(args[1]) + pattern := tree.MustBeDString(args[2]) + ret, err := geomfn.RelatePattern(a.Geometry, b.Geometry, string(pattern)) if err != nil { return nil, err } @@ -3000,8 +3000,8 @@ Note if geometries are the same, it will return the LineString with the minimum }, ReturnType: tree.FixedReturnType(types.Bool), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - flags := int(*args[1].(*tree.DInt)) + g := tree.MustBeDGeometry(args[0]) + flags := int(tree.MustBeDInt(args[1])) validDetail, err := geomfn.IsValidDetail(g.Geometry, flags) if err != nil { return nil, err @@ -3043,8 +3043,8 @@ For flags=1, validity considers self-intersecting rings forming holes as valid a }, ReturnType: tree.FixedReturnType(types.String), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - flags := int(*args[1].(*tree.DInt)) + g := tree.MustBeDGeometry(args[0]) + flags := int(tree.MustBeDInt(args[1])) validDetail, err := geomfn.IsValidDetail(g.Geometry, flags) if err != nil { return nil, err @@ -3273,8 +3273,8 @@ For flags=1, validity considers self-intersecting rings forming holes as valid a infoBuilder{ info: `Returns a collection containing paths shared by the two input geometries. -Those going in the same direction are in the first element of the collection, -those going in the opposite direction are in the second element. +Those going in the same direction are in the first element of the collection, +those going in the opposite direction are in the second element. The paths themselves are given in the direction of the first geometry.`, }, tree.VolatilityImmutable, @@ -3311,9 +3311,9 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - srid := args[1].(*tree.DInt) - newGeom, err := g.Geometry.CloneWithSRID(geopb.SRID(*srid)) + g := tree.MustBeDGeometry(args[0]) + srid := tree.MustBeDInt(args[1]) + newGeom, err := g.Geometry.CloneWithSRID(geopb.SRID(srid)) if err != nil { return nil, err } @@ -3331,9 +3331,9 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geography), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) - srid := args[1].(*tree.DInt) - newGeom, err := g.Geography.CloneWithSRID(geopb.SRID(*srid)) + g := tree.MustBeDGeography(args[0]) + srid := tree.MustBeDInt(args[1]) + newGeom, err := g.Geography.CloneWithSRID(geopb.SRID(srid)) if err != nil { return nil, err } @@ -3354,8 +3354,8 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - srid := geopb.SRID(*args[1].(*tree.DInt)) + g := tree.MustBeDGeometry(args[0]) + srid := geopb.SRID(tree.MustBeDInt(args[1])) fromProj, exists := geoprojbase.Projection(g.SRID()) if !exists { @@ -3384,8 +3384,8 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - toProj := string(*args[1].(*tree.DString)) + g := tree.MustBeDGeometry(args[0]) + toProj := string(tree.MustBeDString(args[1])) fromProj, exists := geoprojbase.Projection(g.SRID()) if !exists { @@ -3416,9 +3416,9 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - fromProj := string(*args[1].(*tree.DString)) - toProj := string(*args[2].(*tree.DString)) + g := tree.MustBeDGeometry(args[0]) + fromProj := string(tree.MustBeDString(args[1])) + toProj := string(tree.MustBeDString(args[2])) ret, err := geotransform.Transform( g.Geometry, @@ -3445,9 +3445,9 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - fromProj := string(*args[1].(*tree.DString)) - srid := geopb.SRID(*args[2].(*tree.DInt)) + g := tree.MustBeDGeometry(args[0]) + fromProj := string(tree.MustBeDString(args[1])) + srid := geopb.SRID(tree.MustBeDInt(args[2])) toProj, exists := geoprojbase.Projection(srid) if !exists { @@ -3476,14 +3476,14 @@ The paths themselves are given in the direction of the first geometry.`, tree.Overload{ Types: tree.ArgTypes{ {"g", types.Geometry}, - {"deltaX", types.Float}, - {"deltaY", types.Float}, + {"delta_x", types.Float}, + {"delta_y", types.Float}, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - deltaX := float64(*args[1].(*tree.DFloat)) - deltaY := float64(*args[2].(*tree.DFloat)) + g := tree.MustBeDGeometry(args[0]) + deltaX := float64(tree.MustBeDFloat(args[1])) + deltaY := float64(tree.MustBeDFloat(args[2])) ret, err := geomfn.Translate(g.Geometry, []float64{deltaX, deltaY}) if err != nil { @@ -3493,7 +3493,7 @@ The paths themselves are given in the direction of the first geometry.`, return tree.NewDGeometry(ret), nil }, Info: infoBuilder{ - info: `Returns a modified Geometry translated by the given deltas`, + info: `Returns a modified Geometry translated by the given deltas.`, }.String(), Volatility: tree.VolatilityImmutable, }, @@ -3508,9 +3508,9 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - xFactor := float64(*args[1].(*tree.DFloat)) - yFactor := float64(*args[2].(*tree.DFloat)) + g := tree.MustBeDGeometry(args[0]) + xFactor := float64(tree.MustBeDFloat(args[1])) + yFactor := float64(tree.MustBeDFloat(args[2])) ret, err := geomfn.Scale(g.Geometry, []float64{xFactor, yFactor}) if err != nil { @@ -3520,7 +3520,7 @@ The paths themselves are given in the direction of the first geometry.`, return tree.NewDGeometry(ret), nil }, Info: infoBuilder{ - info: `Returns a modified Geometry scaled by the given factors`, + info: `Returns a modified Geometry scaled by the given factors.`, }.String(), Volatility: tree.VolatilityImmutable, }, @@ -3531,8 +3531,8 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - factor, err := args[1].(*tree.DGeometry).AsGeomT() + g := tree.MustBeDGeometry(args[0]) + factor, err := tree.MustBeDGeometry(args[1]).AsGeomT() if err != nil { return nil, err } @@ -3550,7 +3550,7 @@ The paths themselves are given in the direction of the first geometry.`, return tree.NewDGeometry(ret), nil }, Info: infoBuilder{ - info: `Returns a modified Geometry scaled by taking in a Geometry as the factor`, + info: `Returns a modified Geometry scaled by taking in a Geometry as the factor.`, }.String(), Volatility: tree.VolatilityImmutable, }, @@ -3562,9 +3562,9 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - factor := args[1].(*tree.DGeometry) - origin := args[2].(*tree.DGeometry) + g := tree.MustBeDGeometry(args[0]) + factor := tree.MustBeDGeometry(args[1]) + origin := tree.MustBeDGeometry(args[2]) ret, err := geomfn.ScaleRelativeToOrigin(g.Geometry, factor.Geometry, origin.Geometry) if err != nil { @@ -3574,7 +3574,7 @@ The paths themselves are given in the direction of the first geometry.`, return tree.NewDGeometry(ret), nil }, Info: infoBuilder{ - info: `Returns a modified Geometry scaled by the Geometry factor relative to a false origin`, + info: `Returns a modified Geometry scaled by the Geometry factor relative to a false origin.`, }.String(), Volatility: tree.VolatilityImmutable, }, @@ -3589,9 +3589,9 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - lineString := args[0].(*tree.DGeometry) - index := int(*args[1].(*tree.DInt)) - point := args[2].(*tree.DGeometry) + lineString := tree.MustBeDGeometry(args[0]) + index := int(tree.MustBeDInt(args[1])) + point := tree.MustBeDGeometry(args[2]) ret, err := geomfn.SetPoint(lineString.Geometry, index, point.Geometry) if err != nil { @@ -3601,7 +3601,7 @@ The paths themselves are given in the direction of the first geometry.`, return tree.NewDGeometry(ret), nil }, Info: infoBuilder{ - info: `Sets the Point at the given 0-based index and returns the modified LineString geometry`, + info: `Sets the Point at the given 0-based index and returns the modified LineString geometry.`, }.String(), Volatility: tree.VolatilityImmutable, }, @@ -3615,8 +3615,8 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - lineString := args[0].(*tree.DGeometry) - index := int(*args[1].(*tree.DInt)) + lineString := tree.MustBeDGeometry(args[0]) + index := int(tree.MustBeDInt(args[1])) ret, err := geomfn.RemovePoint(lineString.Geometry, index) if err != nil { @@ -3639,7 +3639,7 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - geometry := args[0].(*tree.DGeometry) + geometry := tree.MustBeDGeometry(args[0]) ret, err := geomfn.Reverse(geometry.Geometry) if err != nil { @@ -3663,8 +3663,8 @@ The paths themselves are given in the direction of the first geometry.`, }, ReturnType: tree.FixedReturnType(types.Geography), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) - segmentMaxLength := float64(*args[1].(*tree.DFloat)) + g := tree.MustBeDGeography(args[0]) + segmentMaxLength := float64(tree.MustBeDFloat(args[1])) segGeography, err := geogfn.Segmentize(g.Geography, segmentMaxLength) if err != nil { return nil, err @@ -3686,8 +3686,8 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - segmentMaxLength := float64(*args[1].(*tree.DFloat)) + g := tree.MustBeDGeometry(args[0]) + segmentMaxLength := float64(tree.MustBeDFloat(args[1])) segGeometry, err := geomfn.Segmentize(g.Geometry, segmentMaxLength) if err != nil { return nil, err @@ -3710,8 +3710,8 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - distance := *args[1].(*tree.DInt) + g := tree.MustBeDGeometry(args[0]) + distance := tree.MustBeDInt(args[1]) ret, err := geomfn.Buffer(g.Geometry, geomfn.MakeDefaultBufferParams(), float64(distance)) if err != nil { @@ -3729,8 +3729,8 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - distance := *args[1].(*tree.DFloat) + g := tree.MustBeDGeometry(args[0]) + distance := tree.MustBeDFloat(args[1]) ret, err := geomfn.Buffer(g.Geometry, geomfn.MakeDefaultBufferParams(), float64(distance)) if err != nil { @@ -3748,8 +3748,8 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - distanceDec := *args[1].(*tree.DDecimal) + g := tree.MustBeDGeometry(args[0]) + distanceDec := tree.MustBeDDecimal(args[1]) distance, err := distanceDec.Float64() if err != nil { @@ -3773,9 +3773,9 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - distance := *args[1].(*tree.DFloat) - quadSegs := *args[2].(*tree.DInt) + g := tree.MustBeDGeometry(args[0]) + distance := tree.MustBeDFloat(args[1]) + quadSegs := tree.MustBeDInt(args[2]) ret, err := geomfn.Buffer( g.Geometry, @@ -3798,9 +3798,9 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - distance := *args[1].(*tree.DFloat) - paramsString := *args[2].(*tree.DString) + g := tree.MustBeDGeometry(args[0]) + distance := tree.MustBeDFloat(args[1]) + paramsString := tree.MustBeDString(args[2]) params, modifiedDistance, err := geomfn.ParseBufferParams(string(paramsString), float64(distance)) if err != nil { @@ -3827,8 +3827,8 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geography), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) - distance := *args[1].(*tree.DFloat) + g := tree.MustBeDGeography(args[0]) + distance := tree.MustBeDFloat(args[1]) ret, err := performGeographyOperationUsingBestGeomProjection( g.Geography, @@ -3853,9 +3853,9 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geography), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) - distance := *args[1].(*tree.DFloat) - quadSegs := *args[2].(*tree.DInt) + g := tree.MustBeDGeography(args[0]) + distance := tree.MustBeDFloat(args[1]) + quadSegs := tree.MustBeDInt(args[2]) ret, err := performGeographyOperationUsingBestGeomProjection( g.Geography, @@ -3883,9 +3883,9 @@ The calculations are done on a sphere.`, }, ReturnType: tree.FixedReturnType(types.Geography), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeography) - distance := *args[1].(*tree.DFloat) - paramsString := *args[2].(*tree.DString) + g := tree.MustBeDGeography(args[0]) + distance := tree.MustBeDFloat(args[1]) + paramsString := tree.MustBeDString(args[2]) params, modifiedDistance, err := geomfn.ParseBufferParams(string(paramsString), float64(distance)) if err != nil { @@ -3941,7 +3941,7 @@ Bottom Left.`, }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) + g := tree.MustBeDGeometry(args[0]) ret, err := geomfn.FlipCoordinates(g.Geometry) if err != nil { @@ -4127,7 +4127,7 @@ Bottom Left.`, "addgeometrycolumn": makeBuiltin( tree.FunctionProperties{ Class: tree.SQLClass, - Category: categoryGeospatial, + Category: categorySpatial, }, tree.Overload{ Types: tree.ArgTypes{ @@ -4390,10 +4390,10 @@ Bottom Left.`, }, ReturnType: tree.FixedReturnType(types.Bool), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeometry) - b := args[1].(*tree.DGeometry) - dist := args[2].(*tree.DFloat) - ret, err := geomfn.DFullyWithin(a.Geometry, b.Geometry, float64(*dist), geo.FnExclusive) + a := tree.MustBeDGeometry(args[0]) + b := tree.MustBeDGeometry(args[1]) + dist := tree.MustBeDFloat(args[2]) + ret, err := geomfn.DFullyWithin(a.Geometry, b.Geometry, float64(dist), geo.FnExclusive) if err != nil { return nil, err } @@ -4520,7 +4520,7 @@ func geometryOverload1( }, ReturnType: tree.FixedReturnType(returnType), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeometry) + a := tree.MustBeDGeometry(args[0]) return f(ctx, a) }, Info: ib.String(), @@ -4561,8 +4561,8 @@ func geometryOverload2( }, ReturnType: tree.FixedReturnType(returnType), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeometry) - b := args[1].(*tree.DGeometry) + a := tree.MustBeDGeometry(args[0]) + b := tree.MustBeDGeometry(args[1]) return f(ctx, a, b) }, Info: ib.String(), @@ -4602,7 +4602,7 @@ func geographyOverload1( }, ReturnType: tree.FixedReturnType(returnType), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeography) + a := tree.MustBeDGeography(args[0]) return f(ctx, a) }, Info: ib.String(), @@ -4631,7 +4631,7 @@ func geographyOverload1WithUseSpheroid( }, ReturnType: tree.FixedReturnType(returnType), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeography) + a := tree.MustBeDGeography(args[0]) return f(ctx, a, geogfn.UseSpheroid) }, Info: infoWithSpheroid.String(), @@ -4644,8 +4644,8 @@ func geographyOverload1WithUseSpheroid( }, ReturnType: tree.FixedReturnType(returnType), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeography) - b := args[1].(*tree.DBool) + a := tree.MustBeDGeography(args[0]) + b := tree.MustBeDBool(args[1]) return f(ctx, a, toUseSphereOrSpheroid(b)) }, Info: infoWithSphereAndSpheroid.String(), @@ -4668,8 +4668,8 @@ func geographyOverload2( }, ReturnType: tree.FixedReturnType(returnType), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeography) - b := args[1].(*tree.DGeography) + a := tree.MustBeDGeography(args[0]) + b := tree.MustBeDGeography(args[1]) return f(ctx, a, b) }, Info: ib.String(), @@ -4697,8 +4697,8 @@ func geographyOverload2BinaryPredicate( } // toUseSphereOrSpheroid returns whether to use a sphere or spheroid. -func toUseSphereOrSpheroid(useSpheroid *tree.DBool) geogfn.UseSphereOrSpheroid { - if *useSpheroid { +func toUseSphereOrSpheroid(useSpheroid tree.DBool) geogfn.UseSphereOrSpheroid { + if useSpheroid { return geogfn.UseSpheroid } return geogfn.UseSphere @@ -4736,9 +4736,9 @@ func initGeoBuiltins() { // Copy the builtin and add an underscore on the name. overloads := make([]tree.Overload, len(builtin.overloads)) for i, ovCopy := range builtin.overloads { - builtin.overloads[i].Info += "\n\nThis function variant will attempt to utilize any available geospatial index." + builtin.overloads[i].Info += "\n\nThis function variant will attempt to utilize any available spatial index." - ovCopy.Info += "\n\nThis function variant does not utilize any geospatial index." + ovCopy.Info += "\n\nThis function variant does not utilize any spatial index." overloads[i] = ovCopy } underscoreBuiltin := makeBuiltin( @@ -4790,7 +4790,7 @@ func initGeoBuiltins() { if _, exists := builtins[k]; exists { panic("duplicate builtin: " + k) } - v.props.Category = categoryGeospatial + v.props.Category = categorySpatial v.props.AvailableOnPublicSchema = true builtins[k] = v } @@ -4873,8 +4873,8 @@ func lineInterpolatePointForRepeatOverload(repeat bool, builtinInfo string) tree }, ReturnType: tree.FixedReturnType(types.Geometry), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - g := args[0].(*tree.DGeometry) - fraction := float64(*args[1].(*tree.DFloat)) + g := tree.MustBeDGeometry(args[0]) + fraction := float64(tree.MustBeDFloat(args[1])) interpolatedPoints, err := geomfn.LineInterpolatePoints(g.Geometry, fraction, repeat) if err != nil { return nil, err @@ -5071,10 +5071,10 @@ func makeSTDWithinBuiltin(exclusivity geo.FnExclusivity) builtinDefinition { }, ReturnType: tree.FixedReturnType(types.Bool), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeometry) - b := args[1].(*tree.DGeometry) - dist := args[2].(*tree.DFloat) - ret, err := geomfn.DWithin(a.Geometry, b.Geometry, float64(*dist), exclusivity) + a := tree.MustBeDGeometry(args[0]) + b := tree.MustBeDGeometry(args[1]) + dist := tree.MustBeDFloat(args[2]) + ret, err := geomfn.DWithin(a.Geometry, b.Geometry, float64(dist), exclusivity) if err != nil { return nil, err } @@ -5094,10 +5094,10 @@ func makeSTDWithinBuiltin(exclusivity geo.FnExclusivity) builtinDefinition { }, ReturnType: tree.FixedReturnType(types.Bool), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeography) - b := args[1].(*tree.DGeography) - dist := args[2].(*tree.DFloat) - ret, err := geogfn.DWithin(a.Geography, b.Geography, float64(*dist), geogfn.UseSpheroid, exclusivity) + a := tree.MustBeDGeography(args[0]) + b := tree.MustBeDGeography(args[1]) + dist := tree.MustBeDFloat(args[2]) + ret, err := geogfn.DWithin(a.Geography, b.Geography, float64(dist), geogfn.UseSpheroid, exclusivity) if err != nil { return nil, err } @@ -5120,12 +5120,12 @@ func makeSTDWithinBuiltin(exclusivity geo.FnExclusivity) builtinDefinition { }, ReturnType: tree.FixedReturnType(types.Bool), Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) { - a := args[0].(*tree.DGeography) - b := args[1].(*tree.DGeography) - dist := args[2].(*tree.DFloat) - useSpheroid := args[3].(*tree.DBool) + a := tree.MustBeDGeography(args[0]) + b := tree.MustBeDGeography(args[1]) + dist := tree.MustBeDFloat(args[2]) + useSpheroid := tree.MustBeDBool(args[3]) - ret, err := geogfn.DWithin(a.Geography, b.Geography, float64(*dist), toUseSphereOrSpheroid(useSpheroid), exclusivity) + ret, err := geogfn.DWithin(a.Geography, b.Geography, float64(dist), toUseSphereOrSpheroid(useSpheroid), exclusivity) if err != nil { return nil, err } diff --git a/pkg/sql/sem/builtins/geo_builtins_test.go b/pkg/sql/sem/builtins/geo_builtins_test.go new file mode 100644 index 000000000000..7043f7a39166 --- /dev/null +++ b/pkg/sql/sem/builtins/geo_builtins_test.go @@ -0,0 +1,37 @@ +// Copyright 2020 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package builtins + +import ( + "strconv" + "strings" + "testing" + "unicode" + + "github.com/cockroachdb/cockroach/pkg/util/leaktest" + "github.com/stretchr/testify/require" +) + +func TestGeoBuiltinsInfo(t *testing.T) { + defer leaktest.AfterTest(t)() + + for k, builtin := range geoBuiltins { + t.Run(k, func(t *testing.T) { + for i, overload := range builtin.overloads { + t.Run(strconv.Itoa(i+1), func(t *testing.T) { + infoFirstLine := strings.Trim(strings.Split(overload.Info, "\n\n")[0], "\t\n ") + require.True(t, infoFirstLine[len(infoFirstLine)-1] == '.', "first line of info must end with a `.` character") + require.True(t, unicode.IsUpper(rune(infoFirstLine[0])), "first character of info start with an uppercase letter.") + }) + } + }) + } +} diff --git a/pkg/sql/sem/tree/datum.go b/pkg/sql/sem/tree/datum.go index 355604adf5ac..7a9babd52ab7 100644 --- a/pkg/sql/sem/tree/datum.go +++ b/pkg/sql/sem/tree/datum.go @@ -3300,6 +3300,16 @@ func AsDTuple(e Expr) (*DTuple, bool) { return nil, false } +// MustBeDTuple attempts to retrieve a *DTuple from an Expr, panicking if the +// assertion fails. +func MustBeDTuple(e Expr) *DTuple { + i, ok := AsDTuple(e) + if !ok { + panic(errors.AssertionFailedf("expected *DTuple, found %T", e)) + } + return i +} + // maybePopulateType populates the tuple's type if it hasn't yet been // populated. func (d *DTuple) maybePopulateType() { diff --git a/pkg/util/encoding/encoding.go b/pkg/util/encoding/encoding.go index adf30d2eab4c..8b1ee97d0291 100644 --- a/pkg/util/encoding/encoding.go +++ b/pkg/util/encoding/encoding.go @@ -1675,7 +1675,7 @@ func PeekLength(b []byte) (int, error) { case geoMarker: // Expect to reserve at least 8 bytes for int64. if len(b) < 8 { - return 0, errors.Errorf("slice too short for geospatial (%d)", len(b)) + return 0, errors.Errorf("slice too short for spatial object (%d)", len(b)) } ret, err := getBytesLength(b[8:], ascendingGeoEscapes) if err != nil { @@ -1689,7 +1689,7 @@ func PeekLength(b []byte) (int, error) { case geoDescMarker: // Expect to reserve at least 8 bytes for int64. if len(b) < 8 { - return 0, errors.Errorf("slice too short for geospatial (%d)", len(b)) + return 0, errors.Errorf("slice too short for spatial object (%d)", len(b)) } ret, err := getBytesLength(b[8:], descendingGeoEscapes) if err != nil {