Skip to content

Commit

Permalink
12/15/22 periodic update
Browse files Browse the repository at this point in the history
  • Loading branch information
keithhc2 committed Dec 15, 2022
1 parent efda0ae commit a74fb41
Show file tree
Hide file tree
Showing 216 changed files with 6,539 additions and 2,036 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added dg.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion doc_source/CONVERT_TIMEZONE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ select pg_timezone_names();
select pg_timezone_abbrevs();
```

See a list of each at [Appendix: Time zone names and abbreviations](appendix-timezone-names.md)\.
For more information, see [Appendix: Time zone names and abbreviations](appendix-timezone-names.md)\.

### Using a time zone name<a name="CONVERT_TIMEZONE-using-name"></a>

Expand Down
69 changes: 68 additions & 1 deletion doc_source/JSON_EXTRACT_PATH_TEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ VARCHAR string representing the JSON value referenced by the path elements\.

## Example<a name="JSON_EXTRACT_PATH_TEXT-examples"></a>

The following example returns the value for the path `'f4', 'f6'`:
The following example returns the value for the path `'f4', 'f6'`\.

```
select json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"star"}}','f4', 'f6');
Expand All @@ -55,4 +55,71 @@ select json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"star"}','f4',
json_extract_path_text
-------------------------------
NULL
```

The following example returns the value for the path `'farm', 'barn', 'color'`, where the value retrieved is at the third level\. This sample is formatted with a JSON lint tool, to make it easier to read\.

```
select json_extract_path_text('{
"farm": {
"barn": {
"color": "red",
"feed stocked": true
}
}
}', 'farm', 'barn', 'color');
json_extract_path_text
----------------------
red
```

The following example returns NULL because the `'color'` element is missing\. This sample is formatted with a JSON lint tool\.

```
select json_extract_path_text('{
"farm": {
"barn": {}
}
}', 'farm', 'barn', 'color');
json_extract_path_text
----------------------
NULL
```

If the JSON is valid, trying to extract an element that's missing returns NULL\.

The following example returns the value for the path `'house', 'appliances', 'washing machine', 'brand'`\.

```
select json_extract_path_text('{
"house": {
"address": {
"street": "123 Any St.",
"city": "Any Town",
"state": "FL",
"zip": "32830"
},
"bathroom": {
"color": "green",
"shower": true
},
"appliances": {
"washing machine": {
"brand": "Any Brand",
"color": "beige"
},
"dryer": {
"brand": "Any Brand",
"color": "white"
}
}
}
}', 'house', 'appliances', 'washing machine', 'brand');
json_extract_path_text
----------------------
Any Brand
```
2 changes: 1 addition & 1 deletion doc_source/PG_TERMINATE_BACKEND.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ The following statement terminates the session holding the locks:

```
select pg_terminate_backend(8585);
```
```
79 changes: 79 additions & 0 deletions doc_source/ST_GeomFromGeoHash-function.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# ST\_GeomFromGeoHash<a name="ST_GeomFromGeoHash-function"></a>

ST\_GeomFromGeoHash constructs a geometry object from the geohash representation of an input geometry\. ST\_GeomFromGeoHash returns a two\-dimensional \(2D\) geometry with the spatial reference identifier \(SRID\) of zero \(0\)\. For more information about the geohash format, see [Geohash](https://en.wikipedia.org/wiki/Geohash) in Wikipedia\.

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

```
ST_GeomFromGeoHash(geohash_string)
```

```
ST_GeomFromGeoHash(geohash_string, precision)
```

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

*geohash\_string*
A value of data type `VARCHAR` or an expression that evaluates to a `VARCHAR` type, that is a geohash representation of a geometry\.

*precision*
A value of data type `INTEGER` that represents the precision of the geohash\. The value is the number of characters of the geohash to be used as precision\. If the value is not specified, less than zero, or greater than the *geohash\_string* length\. then the *geohash\_string* length is used\.

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

`GEOMETRY`

If *geohash\_string* is null, then null is returned\.

If *geohash\_string* is not valid, then an error is returned\.

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

The following SQL returns a polygon with high precision\.

```
SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz0'));
```

```
st_asewkt
-----------------------
POLYGON((-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646))
```

The following SQL returns a point with high precision\.

```
SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz00'));
```

```
st_asewkt
-----------------------
POINT(-115.172816 36.114646)
```

The following SQL returns a polygon with low precision\.

```
SELECT ST_AsText(ST_GeomFromGeoHash('9qq'));
```

```
st_asewkt
-----------------------
POLYGON((-115.3125 35.15625,-115.3125 36.5625,-113.90625 36.5625,-113.90625 35.15625,-115.3125 35.15625))
```

The following SQL returns a polygon with precision 3\.

```
SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz0', 3));
```

```
st_asewkt
-----------------------
POLYGON((-115.3125 35.15625,-115.3125 36.5625,-113.90625 36.5625,-113.90625 35.15625,-115.3125 35.15625))
```
62 changes: 62 additions & 0 deletions doc_source/ST_GeomFromGeoJSON-function.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ST\_GeomFromGeoJSON<a name="ST_GeomFromGeoJSON-function"></a>

ST\_GeomFromGeoJSON constructs a geometry object from the GeoJSON representation of an input geometry\. For more information about the GeoJSON format, see [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) in Wikipedia\.

If there is at least one point with three or more coordinates, the resulting geometry is 3DZ, where the Z component is zero for the points that have only two coordinates\. If all points in the input GeoJSON contain two coordinates or are empty, ST\_GeomFromGeoJSON returns a 2D geometry\. The returned geometry always has the spatial reference identifier \(SRID\) of 4326\.

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

```
ST_GeomFromGeoJSON(geojson_string)
```

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

*geojson\_string*
A value of data type `VARCHAR` or an expression that evaluates to a `VARCHAR` type, that is a GeoJSON representation of a geometry\.

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

`GEOMETRY`

If *geojson\_string* is null, then null is returned\.

If *geojson\_string* is not valid, then an error is returned\.

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

The following SQL returns a 2D geometry represented in the input GeoJSON\.

```
SELECT ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[1,2]}'));
```

```
st_asewkt
-----------------------
SRID=4326;POINT(1 2)
```

The following SQL returns a 3DZ geometry represented in the input GeoJSON\.

```
SELECT ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[1,2,3],[4,5,6],[7,8,9]]}'));
```

```
st_asewkt
------------------------------------------
SRID=4326;LINESTRING Z (1 2 3,4 5 6,7 8 9)
```

The following SQL returns 3DZ geometry when only one point has three coordinates while all other points have two coordinates in the input GeoJSON\.

```
SELECT ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"Polygon","coordinates":[[[0, 0],[0, 1, 8],[1, 0],[0, 0]]]}'));
```

```
st_asewkt
------------------------------------------------
SRID=4326;POLYGON Z ((0 0 0,0 1 8,1 0 0,0 0 0))
```
69 changes: 69 additions & 0 deletions doc_source/SYS_CONNECTION_LOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# SYS\_CONNECTION\_LOG<a name="SYS_CONNECTION_LOG"></a>

Logs authentication attempts and connections and disconnections\.

This view is visible only to superusers\. For more information, see [Visibility of data in system tables and views](c_visibility-of-data.md)\.

## Table columns<a name="SYS_CONNECTION_LOG-table-columns2"></a>

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/redshift/latest/dg/SYS_CONNECTION_LOG.html)

## Sample queries<a name="SYS_CONNECTION_LOG-sample-queries2"></a>

To view the details for open connections, run the following query\.

```
select record_time, user_name, database_name, remote_host, remote_port
from sys_connection_log
where event = 'initiating session'
and session_id not in
(select session_id from sys_connection_log
where event = 'disconnecting session')
order by 1 desc;
record_time | user_name | database_name | remote_host | remote_port
--------------------+-------------+-----------------+---------------+---------------------------------
2014-11-06 20:30:06 | rdsdb | dev | [local] |
2014-11-06 20:29:37 | test001 | test | 10.49.42.138 | 11111
2014-11-05 20:30:29 | rdsdb | dev | 10.49.42.138 | 33333
2014-11-05 20:28:35 | rdsdb | dev | [local] |
(4 rows)
```

The following example reflects a failed authentication attempt and a successful connection and disconnection\.

```
select event, record_time, remote_host, user_name
from sys_connection_log order by record_time;
event | record_time | remote_host | user_name
-----------------------+----------------------------+---------------+---------
authentication failure | 2012-10-25 14:41:56.96391 | 10.49.42.138 | john
authenticated | 2012-10-25 14:42:10.87613 | 10.49.42.138 | john
initiating session | 2012-10-25 14:42:10.87638 | 10.49.42.138 | john
disconnecting session | 2012-10-25 14:42:19.95992 | 10.49.42.138 | john
(4 rows)
```

The following example shows the version of the ODBC driver, the operating system on the client machine, and the plugin used to connect to the Amazon Redshift cluster\. In this example, the plugin used is for standard ODBC driver authentication using a login name and password\.

```
select driver_version, os_version, plugin_name from sys_connection_log;
driver_version | os_version | plugin_name
----------------------------------------+-----------------------------------+--------------------
Amazon Redshift ODBC Driver 1.4.15.0001 | Darwin 18.7.0 x86_64 | none
Amazon Redshift ODBC Driver 1.4.15.0001 | Linux 4.15.0-101-generic x86_64 | none
```

The following example shows the version of the operating system on the client machine, the driver version, and the protocol version\.

```
select os_version, driver_version, protocol_version from sys_connection_log;
os_version | driver_version | protocol_version
--------------------------------+------------------------------+--------------------
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2
```
16 changes: 16 additions & 0 deletions doc_source/SYS_COPY_JOB.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SYS\_COPY\_JOB \(preview\)<a name="SYS_COPY_JOB"></a>


| |
| --- |
| This is prerelease documentation for auto\-copy \(SQL COPY JOB\), which is in preview release\. The documentation and the feature are both subject to change\. We recommend that you use this feature only in test environments, and not in production environments\. Public preview will end on February 28, 2023\. Preview clusters and preview serverless workgroups and namespaces will be removed automatically two weeks after the end of the preview\. For preview terms and conditions, see Betas and Previews in [AWS Service Terms](https://aws.amazon.com/service-terms/)\. |

Use SYS\_COPY\_JOB to view details of COPY JOB commands\.

This view contains the COPY JOB commands that have been created\.

SYS\_COPY\_JOB is visible to all users\. Superusers can see all rows; regular users can see only metadata to which they have access\.

## Table columns<a name="SYS_COPY_JOB-table-columns"></a>

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/redshift/latest/dg/SYS_COPY_JOB.html)
23 changes: 23 additions & 0 deletions doc_source/SYS_DATASHARE_CHANGE_LOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SYS\_DATASHARE\_CHANGE\_LOG<a name="SYS_DATASHARE_CHANGE_LOG"></a>

Records the consolidated view for tracking changes to datashares on both producer and consumer clusters\.

Superusers can see all rows; regular users can see only their own data\.

## Table columns<a name="SYS_DATASHARE_CHANGE_LOG-table-rows"></a>

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/redshift/latest/dg/SYS_DATASHARE_CHANGE_LOG.html)

## Sample queries<a name="SYS_DATASHARE_CHANGE_LOG-sample-queries"></a>

The following example shows a SYS\_DATASHARE\_CHANGE\_LOG view\.

```
SELECT DISTINCT action
FROM sys_datashare_change_log
WHERE share_object_name LIKE 'tickit%';
action
-----------------------
"ALTER DATASHARE ADD"
```
22 changes: 22 additions & 0 deletions doc_source/SYS_DATASHARE_USAGE_CONSUMER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SYS\_DATASHARE\_USAGE\_CONSUMER<a name="SYS_DATASHARE_USAGE_CONSUMER"></a>

Records the activity and usage of datashares\. This view is only relevant on the consumer cluster\.

SYS\_DATASHARE\_USAGE\_CONSUMER is visible to all users\.

## Table columns<a name="SYS_DATASHARE_USAGE_CONSUMER-table-rows"></a>

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/redshift/latest/dg/SYS_DATASHARE_USAGE_CONSUMER.html)

## Sample queries<a name="SYS_DATASHARE_USAGE_CONSUMER-sample-queries"></a>

The following example shows a SYS\_DATASHARE\_USAGE\_CONSUMER view\.

```
SELECT request_type, status, trim(error) AS error
FROM sys_datashare_usage_consumer
request_type | status | error
----------------+--------+--------
"GET RELATION" | 0 |
```
Loading

0 comments on commit a74fb41

Please sign in to comment.