Skip to content

Commit

Permalink
Periodic update - 12/22/2021
Browse files Browse the repository at this point in the history
  • Loading branch information
tommagnus committed Dec 23, 2021
1 parent 8b58643 commit d7ed651
Show file tree
Hide file tree
Showing 283 changed files with 4,057 additions and 1,214 deletions.
4 changes: 2 additions & 2 deletions doc_source/CONVERT_TIMEZONE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ Either *source\_timezone* or *target\_timezone* can be specified as a time zone
**Note**
The results of using a time zone name or a time zone abbreviation can be different due to local seasonal time, such as, Daylight Saving Time\.

To view a list of supported time zone names, execute the following command\.
To view a list of supported time zone names, run the following command\.

```
select pg_timezone_names();
```

To view a list of supported time zone abbreviations, execute the following command\.
To view a list of supported time zone abbreviations, run the following command\.

```
select pg_timezone_abbrevs();
Expand Down
4 changes: 2 additions & 2 deletions doc_source/Date_functions_header.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Leap seconds are not considered in elapsed\-time calculations\.

## Date and time functions in transactions<a name="date-functions-transactions"></a>

When you execute the following functions within a transaction block \(BEGIN … END\), the function returns the start date or time of the current transaction, not the start of the current statement\.
When you run the following functions within a transaction block \(BEGIN … END\), the function returns the start date or time of the current transaction, not the start of the current statement\.
+ SYSDATE
+ TIMESTAMP
+ CURRENT\_DATE
Expand All @@ -58,7 +58,7 @@ The following functions always return the start date or time of the current stat

## Deprecated leader node\-only functions<a name="date-functions-deprecated"></a>

The following date functions are deprecated because they execute only on the leader node\. For more information, see [Leader node–only functions](c_SQL_functions_leader_node_only.md)\.
The following date functions are deprecated because they run only on the leader node\. For more information, see [Leader node–only functions](c_SQL_functions_leader_node_only.md)\.
+ AGE\. Use [DATEDIFF function](r_DATEDIFF_function.md) instead\.
+ CURRENT\_TIME\. Use [GETDATE function](r_GETDATE.md) or [SYSDATE](r_SYSDATE.md) instead\.
+ CURRENT\_TIMESTAMP\. Use [GETDATE function](r_GETDATE.md) or [SYSDATE](r_SYSDATE.md) instead\.
Expand Down
1 change: 0 additions & 1 deletion doc_source/Math_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
+ [SIGN function](r_SIGN.md)
+ [SQRT function](r_SQRT.md)
+ [TAN function](r_TAN.md)
+ [TO\_HEX function](r_TO_HEX.md)
+ [TRUNC function](r_TRUNC.md)

This section describes the mathematical operators and functions supported in Amazon Redshift\.
2 changes: 1 addition & 1 deletion doc_source/PG_BACKEND_PID.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Returns an integer\.

## Example<a name="PG_BACKEND_PID-example"></a>

You can correlate PG\_BACKEND\_PID with log tables to retrieve information for the current session\. For example, the following query returns the query ID and a portion of the query text for queries executed in the current session\.
You can correlate PG\_BACKEND\_PID with log tables to retrieve information for the current session\. For example, the following query returns the query ID and a portion of the query text for queries completed in the current session\.

```
select query, substring(text,1,40)
Expand Down
2 changes: 1 addition & 1 deletion doc_source/PG_CANCEL_BACKEND.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If queries in multiple sessions hold locks on the same table, you can use the [P

## Examples<a name="PG_CANCEL_BACKEND-example"></a>

To cancel a currently running query, first retrieve the process ID for the query that you want to cancel\. To determine the process IDs for all currently running queries, execute the following command:
To cancel a currently running query, first retrieve the process ID for the query that you want to cancel\. To determine the process IDs for all currently running queries, run the following command:

```
select pid, trim(starttime) as start,
Expand Down
4 changes: 2 additions & 2 deletions doc_source/PG_LAST_COPY_COUNT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PG\_LAST\_COPY\_COUNT<a name="PG_LAST_COPY_COUNT"></a>

Returns the number of rows that were loaded by the last COPY command executed in the current session\. PG\_LAST\_COPY\_COUNT is updated with the last COPY ID, which is the query ID of the last COPY that began the load process, even if the load failed\. The query ID and COPY ID are updated when the COPY command begins the load process\.
Returns the number of rows that were loaded by the last COPY command run in the current session\. PG\_LAST\_COPY\_COUNT is updated with the last COPY ID, which is the query ID of the last COPY that began the load process, even if the load failed\. The query ID and COPY ID are updated when the COPY command begins the load process\.

If the COPY fails because of a syntax error or because of insufficient privileges, the COPY ID is not updated and PG\_LAST\_COPY\_COUNT returns the count for the previous COPY\. If no COPY commands were executed in the current session, or if the last COPY failed during loading, PG\_LAST\_COPY\_COUNT returns 0\. For more information, see [PG\_LAST\_COPY\_ID](PG_LAST_COPY_ID.md)\.
If the COPY fails because of a syntax error or because of insufficient privileges, the COPY ID is not updated and PG\_LAST\_COPY\_COUNT returns the count for the previous COPY\. If no COPY commands were run in the current session, or if the last COPY failed during loading, PG\_LAST\_COPY\_COUNT returns 0\. For more information, see [PG\_LAST\_COPY\_ID](PG_LAST_COPY_ID.md)\.

## Syntax<a name="PG_LAST_COPY_COUNT-synopsis"></a>

Expand Down
2 changes: 1 addition & 1 deletion doc_source/PG_LAST_COPY_ID.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PG\_LAST\_COPY\_ID<a name="PG_LAST_COPY_ID"></a>

Returns the query ID of the most recently executed COPY command in the current session\. If no COPY commands have been executed in the current session, PG\_LAST\_COPY\_ID returns \-1\.
Returns the query ID of the most recently completed COPY command in the current session\. If no COPY commands have been run in the current session, PG\_LAST\_COPY\_ID returns \-1\.

The value for PG\_LAST\_COPY\_ID is updated when the COPY command begins the load process\. If the COPY fails because of invalid load data, the COPY ID is updated, so you can use PG\_LAST\_COPY\_ID when you query STL\_LOAD\_ERRORS table\. If the COPY transaction is rolled back, the COPY ID is not updated\.

Expand Down
6 changes: 3 additions & 3 deletions doc_source/PG_LAST_QUERY_ID.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PG\_LAST\_QUERY\_ID<a name="PG_LAST_QUERY_ID"></a>

Returns the query ID of the most recently executed query in the current session\. If no queries have been executed in the current session, PG\_LAST\_QUERY\_ID returns \-1\. PG\_LAST\_QUERY\_ID does not return the query ID for queries that execute exclusively on the leader node\. For more information, see [Leader node–only functions](c_SQL_functions_leader_node_only.md)\.
Returns the query ID of the most recently completed query in the current session\. If no queries have been run in the current session, PG\_LAST\_QUERY\_ID returns \-1\. PG\_LAST\_QUERY\_ID does not return the query ID for queries that run exclusively on the leader node\. For more information, see [Leader node–only functions](c_SQL_functions_leader_node_only.md)\.

## Syntax<a name="PG_LAST_QUERY_ID-synopsis"></a>

Expand All @@ -14,7 +14,7 @@ Returns an integer\.

## Example<a name="PG_LAST_QUERY_ID-example"></a>

The following query returns the ID of the latest query executed in the current session\.
The following query returns the ID of the latest query completed in the current session\.

```
select pg_last_query_id();
Expand All @@ -25,7 +25,7 @@ pg_last_query_id
(1 row)
```

The following query returns the query ID and text of the most recently executed query in the current session\.
The following query returns the query ID and text of the most recently completed query in the current session\.

```
select query, trim(querytxt) as sqlquery
Expand Down
2 changes: 1 addition & 1 deletion doc_source/PG_LAST_UNLOAD_COUNT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PG\_LAST\_UNLOAD\_COUNT<a name="PG_LAST_UNLOAD_COUNT"></a>

Returns the number of rows that were unloaded by the last UNLOAD command executed in the current session\. PG\_LAST\_UNLOAD\_COUNT is updated with the query ID of the last UNLOAD, even if the operation failed\. The query ID is updated when the UNLOAD is executed\. If the UNLOAD fails because of a syntax error or because of insufficient privileges, PG\_LAST\_UNLOAD\_COUNT returns the count for the previous UNLOAD\. If no UNLOAD commands were executed in the current session, or if the last UNLOAD failed during the unload operation, PG\_LAST\_UNLOAD\_COUNT returns 0\.
Returns the number of rows that were unloaded by the last UNLOAD command completed in the current session\. PG\_LAST\_UNLOAD\_COUNT is updated with the query ID of the last UNLOAD, even if the operation failed\. The query ID is updated when the UNLOAD is completed\. If the UNLOAD fails because of a syntax error or because of insufficient privileges, PG\_LAST\_UNLOAD\_COUNT returns the count for the previous UNLOAD\. If no UNLOAD commands were completed in the current session, or if the last UNLOAD failed during the unload operation, PG\_LAST\_UNLOAD\_COUNT returns 0\.

## Syntax<a name="PG_LAST_UNLOAD_COUNT-synopsis"></a>

Expand Down
2 changes: 1 addition & 1 deletion doc_source/PG_LAST_UNLOAD_ID.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PG\_LAST\_UNLOAD\_ID<a name="PG_LAST_UNLOAD_ID"></a>

Returns the query ID of the most recently executed UNLOAD command in the current session\. If no UNLOAD commands have been executed in the current session, PG\_LAST\_UNLOAD\_ID returns \-1\.
Returns the query ID of the most recently completed UNLOAD command in the current session\. If no UNLOAD commands have been run in the current session, PG\_LAST\_UNLOAD\_ID returns \-1\.

The value for PG\_LAST\_UNLOAD\_ID is updated when the UNLOAD command begins the load process\. If the UNLOAD fails because of invalid load data, the UNLOAD ID is updated, so you can use the UNLOAD ID for further investigation\. If the UNLOAD transaction is rolled back, the UNLOAD ID is not updated\.

Expand Down
36 changes: 31 additions & 5 deletions doc_source/ST_Area-function.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# ST\_Area<a name="ST_Area-function"></a>

ST\_Area returns the Cartesian area of the 2D projection of an input geometry\. The area units are the same as the units in which the coordinates of the input geometry are expressed\. For points, linestrings, multipoints, and multilinestrings, the function returns 0\. For geometry collections, it returns the sum of the areas of the geometries in the collection\.
For an input geometry, ST\_Area returns the Cartesian area of the 2D projection\. The area units are the same as the units in which the coordinates of the input geometry are expressed\. For points, linestrings, multipoints, and multilinestrings, the function returns 0\. For geometry collections, it returns the sum of the areas of the geometries in the collection\.

For an input geography, ST\_Area returns the geodesic area of the 2D projection of an input areal geography computed on the spheroid determined by the SRID\. The unit of length is in square meters\. The function returns zero \(0\) for points, multipoints, and linear geographies\. When the input is a geometry collection, the function returns the sum of the areas of the areal geographies in the collection\.

## Syntax<a name="ST_Area-function-syntax"></a>

```
ST_Area(geom)
ST_Area(geo)
```

## Arguments<a name="ST_Area-function-arguments"></a>

*geom*
A value of data type `GEOMETRY` or an expression that evaluates to a `GEOMETRY` type\.
*geo*
A value of data type `GEOMETRY` or `GEOGRAPHY`, or an expression that evaluates to a `GEOMETRY` or `GEOGRAPHY` type\.

## Return type<a name="ST_Area-function-return"></a>

`DOUBLE PRECISION`

If *geom* is null, then null is returned\.
If *geo* is null, then null is returned\.

## Examples<a name="ST_Area-function-examples"></a>

Expand All @@ -31,4 +33,28 @@ SELECT ST_Area(ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,0 10,0 0)),((10 0,20 0,2
st_area
---------
100
```

The following SQL returns the area of a polygon in a geography\.

```
SELECT ST_Area(ST_GeogFromText('polygon((34 35, 28 30, 25 34, 34 35))'));
```

```
st_area
------------------
201824655743.383
```

The following SQL returns zero for a linear geography\.

```
SELECT ST_Area(ST_GeogFromText('multipoint(0 0, 1 1, -21.32 121.2)'));
```

```
st_area
---------
0
```
26 changes: 19 additions & 7 deletions doc_source/ST_AsEWKT-function.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# ST\_AsEWKT<a name="ST_AsEWKT-function"></a>

ST\_AsEWKT returns the extended well\-known text \(EWKT\) representation of an input geometry\. For 3DZ, 3DM, and 4D geometries, ST\_AsEWKT appends Z, M, or ZM to the WKT value for the geometry type\.
ST\_AsEWKT returns the extended well\-known text \(EWKT\) representation of an input geometry or geography\. For 3DZ, 3DM, and 4D geometries, ST\_AsEWKT appends Z, M, or ZM to the WKT value for the geometry type\.

## Syntax<a name="ST_AsEWKT-function-syntax"></a>

```
ST_AsEWKT(geom)
ST_AsEWKT(geo)
```

```
ST_AsEWKT(geom, precision)
ST_AsEWKT(geo, precision)
```

## Arguments<a name="ST_AsEWKT-function-arguments"></a>

*geom*
A value of data type `GEOMETRY` or an expression that evaluates to a `GEOMETRY` type\.
*geo*
A value of data type `GEOMETRY` or `GEOGRAPHY`, or an expression that evaluates to a `GEOMETRY` or `GEOGRAPHY` type\.

*precision*
A value of data type `INTEGER`\. The coordinates of *geom* are displayed using the specified precision 1–20\. If *precision* is not specified, the default is 15\.
A value of data type `INTEGER`\. For geometries, the coordinates of *geo* are displayed using the specified precision 1–20\. If *precision* is not specified, the default is 15\. For geographies, the coordinates of *geo* are displayed using the specified precision\. If *precision* is not specified, the default is 15\.

## Return type<a name="ST_AsEWKT-function-return"></a>

`VARCHAR`

If *geom* is null, then null is returned\.
If *geo* is null, then null is returned\.

If *precision* is null, then null is returned\.

Expand Down Expand Up @@ -54,4 +54,16 @@ SELECT ST_AsEWKT(ST_GeomFromText('LINESTRING(3.141592653589793 -6.28318530717958
st_asewkt
--------------------------------
SRID=4326;LINESTRING(3.14159 -6.28319,2.71828 -1.41421)
```

The following SQL returns the EWKT representation of a geography\.

```
SELECT ST_AsEWKT(ST_GeogFromText('LINESTRING(110 40, 2 3, -10 80, -7 9)'));
```

```
st_asewkt
----------------------------------------------
SRID=4326;LINESTRING(110 40,2 3,-10 80,-7 9)
```
28 changes: 21 additions & 7 deletions doc_source/ST_AsGeoJSON-function.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
# ST\_AsGeoJSON<a name="ST_AsGeoJSON-function"></a>

ST\_AsGeoJSON returns the GeoJSON representation of an input geometry\. For more information about GeoJSON, see [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) in Wikipedia\.
ST\_AsGeoJSON returns the GeoJSON representation of an input geometry or geography\. For more information about GeoJSON, see [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) in Wikipedia\.

For 3DZ and 4D geometries, the output geometry is a 3DZ projection of the input 3DZ or 4D geometry\. That is, the `x`, `y`, and `z` coordinates are present in the output\. For 3DM geometries, the output geometry is a 2D projection of the input 3DM geometry\. That is, only `x` and `y` coordinates are present in the output\.

For input geographies, ST\_AsGeoJSON returns the GeoJSON representation of an input geography\. The coordinates of the geography are displayed using the specified precision\.

## Syntax<a name="ST_AsGeoJSON-function-syntax"></a>

```
ST_AsGeoJSON(geom)
ST_AsGeoJSON(geo)
```

```
ST_AsGeoJSON(geom, precision)
ST_AsGeoJSON(geo, precision)
```

## Arguments<a name="ST_AsGeoJSON-function-arguments"></a>

*geom*
A value of data type `GEOMETRY` or an expression that evaluates to a `GEOMETRY` type\.
*geo*
A value of data type `GEOMETRY` or `GEOGRAPHY`, or an expression that evaluates to a `GEOMETRY` or `GEOGRAPHY` type\.

*precision*
A value of data type `INTEGER`\. The coordinates of *geom* are displayed using the specified precision 1–20\. If *precision* is not specified, the default is 15\.
A value of data type `INTEGER`\. For geometries, the coordinates of *geo* are displayed using the specified precision 1–20\. If *precision* is not specified, the default is 15\. For geographies, the coordinates of *geo* are displayed using the specified precision\. If *precision* is not specified, the default is 15\.

## Return type<a name="ST_AsGeoJSON-function-return"></a>

`VARCHAR`

If *geom* is null, then null is returned\.
If *geo* is null, then null is returned\.

If *precision* is null, then null is returned\.

Expand Down Expand Up @@ -56,4 +58,16 @@ SELECT ST_AsGeoJSON(ST_GeomFromText('LINESTRING(3.141592653589793 -6.28318530717
st_asgeojson
-----------------------------------------------------------------------------
{"type":"LineString","coordinates":[[3.14159,-6.28319],[2.71828,-1.41421]]}
```

The following SQL returns the GeoJSON representation of a geography\.

```
SELECT ST_AsGeoJSON(ST_GeogFromText('LINESTRING(110 40, 2 3, -10 80, -7 9)'));
```

```
st_asgeojson
----------------------------------------------------------------------
{"type":"LineString","coordinates":[[110,40],[2,3],[-10,80],[-7,9]]}
```
48 changes: 48 additions & 0 deletions doc_source/ST_AsHexEWKB-function.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# ST\_AsHexEWKB<a name="ST_AsHexEWKB-function"></a>

ST\_AsHexEWKB returns the extended well\-known binary \(EWKB\) representation of an input geometry or geography using ASCII hexadecimal characters \(0–9, A–F\)\. For 3DZ, 3DM, and 4D geometries or geographies, ST\_AsHexEWKB uses the PostGIS extended WKB value for the geometry or geography type\.

## Syntax<a name="ST_AsHexEWKB-function-syntax"></a>

```
ST_AsHexEWKB(geo)
```

## Arguments<a name="ST_AsHexEWKB-function-arguments"></a>

*geo*
A value of data type `GEOMETRY` or `GEOGRAPHY`, or an expression that evaluates to a `GEOMETRY` or `GEOGRAPHY` type\.

## Return type<a name="ST_AsHexEWKB-function-return"></a>

`VARCHAR`

If *geo* is null, then null is returned\.

If the result is larger than a 64\-KB `VARCHAR`, then an error is returned\.

## Examples<a name="ST_AsHexEWKB-function-examples"></a>

The following SQL returns the hexadecimal EWKB representation of a polygon in a geometry\.

```
SELECT ST_AsHexEWKB(ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))',4326));
```

```
st_ashexewkb
--------------------------------
0103000020E61000000100000005000000000000000000000000000000000000000000000000000000000000000000F03F000000000000F03F000000000000F03F000000000000F03F000000000000000000000000000000000000000000000000
```

The following SQL returns the hexadecimal EWKB representation of a polygon in a geography\.

```
SELECT ST_AsHexEWKB(ST_GeogFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))'));
```

```
st_ashexewkb
--------------------------------
0103000020E61000000100000005000000000000000000000000000000000000000000000000000000000000000000F03F000000000000F03F000000000000F03F000000000000F03F000000000000000000000000000000000000000000000000
```
Loading

0 comments on commit d7ed651

Please sign in to comment.