From 045c0c0bca1219b905adf5c1f7f147542ccc7c91 Mon Sep 17 00:00:00 2001 From: Ian Evans Date: Tue, 23 Aug 2022 15:41:47 -0700 Subject: [PATCH] Document cockroach-sql binary (#14671) * Add cockroach-sql docs. Co-authored-by: Nick Vigilante --- _includes/v22.1/sidebar-data/reference.json | 6 + _includes/v22.1/sql/connection-parameters.md | 4 +- _includes/v22.1/sql/shell-commands.md | 10 +- _includes/v22.1/sql/shell-shortcuts.md | 2 +- _includes/v22.1/sql/sql-errors.md | 22 + _includes/v22.1/sql/sql-examples.md | 570 +++++++++++++++++ _includes/v22.2/sidebar-data/reference.json | 6 + _includes/v22.2/sql/connection-parameters.md | 4 +- _includes/v22.2/sql/sql-errors.md | 22 + _includes/v22.2/sql/sql-examples.md | 570 +++++++++++++++++ v22.1/cockroach-sql-binary.md | 212 +++++++ v22.1/cockroach-sql.md | 628 +----------------- v22.2/cockroach-sql-binary.md | 210 +++++++ v22.2/cockroach-sql.md | 630 +------------------ 14 files changed, 1647 insertions(+), 1249 deletions(-) create mode 100644 _includes/v22.1/sql/sql-errors.md create mode 100644 _includes/v22.1/sql/sql-examples.md create mode 100644 _includes/v22.2/sql/sql-errors.md create mode 100644 _includes/v22.2/sql/sql-examples.md create mode 100644 v22.1/cockroach-sql-binary.md create mode 100644 v22.2/cockroach-sql-binary.md diff --git a/_includes/v22.1/sidebar-data/reference.json b/_includes/v22.1/sidebar-data/reference.json index 489e45de671..1cc54754676 100644 --- a/_includes/v22.1/sidebar-data/reference.json +++ b/_includes/v22.1/sidebar-data/reference.json @@ -1614,6 +1614,12 @@ ] } ] + }, + { + "title": "The cockroach-sql command", + "urls": [ + "/${VERSION}/cockroach-sql-binary.html" + ] } ] }, diff --git a/_includes/v22.1/sql/connection-parameters.md b/_includes/v22.1/sql/connection-parameters.md index 9e0699b0614..769f3c776d6 100644 --- a/_includes/v22.1/sql/connection-parameters.md +++ b/_includes/v22.1/sql/connection-parameters.md @@ -1,9 +1,9 @@ Flag | Description -----|------------ + `--url` | A [connection URL](connection-parameters.html#connect-using-a-url) to use instead of the other arguments. To convert a connection URL to the syntax that works with your client driver, run [`cockroach convert-url`](connection-parameters.html#convert-a-url-for-different-drivers).

**Env Variable:** `COCKROACH_URL`
**Default:** no URL `--host` | The server host and port number to connect to. This can be the address of any node in the cluster.

**Env Variable:** `COCKROACH_HOST`
**Default:** `localhost:26257` `--port`

`-p` | The server port to connect to. Note: The port number can also be specified via `--host`.

**Env Variable:** `COCKROACH_PORT`
**Default:** `26257` `--user`

`-u` | The [SQL user](create-user.html) that will own the client session.

**Env Variable:** `COCKROACH_USER`
**Default:** `root` `--insecure` | Use an insecure connection.

**Env Variable:** `COCKROACH_INSECURE`
**Default:** `false` `--cert-principal-map` | A comma-separated list of `:` mappings. This allows mapping the principal in a cert to a DB principal such as `node` or `root` or any SQL user. This is intended for use in situations where the certificate management system places restrictions on the `Subject.CommonName` or `SubjectAlternateName` fields in the certificate (e.g., disallowing a `CommonName` like `node` or `root`). If multiple mappings are provided for the same ``, the last one specified in the list takes precedence. A principal not specified in the map is passed through as-is via the identity function. A cert is allowed to authenticate a DB principal if the DB principal name is contained in the mapped `CommonName` or DNS-type `SubjectAlternateName` fields. -`--certs-dir` | The path to the [certificate directory](cockroach-cert.html) containing the CA and client certificates and client key.

**Env Variable:** `COCKROACH_CERTS_DIR`
**Default:** `${HOME}/.cockroach-certs/` - `--url` | A [connection URL](connection-parameters.html#connect-using-a-url) to use instead of the other arguments. To convert a connection URL to the syntax that works with your client driver, run [`cockroach convert-url`](connection-parameters.html#convert-a-url-for-different-drivers).

**Env Variable:** `COCKROACH_URL`
**Default:** no URL \ No newline at end of file +`--certs-dir` | The path to the [certificate directory](cockroach-cert.html) containing the CA and client certificates and client key.

**Env Variable:** `COCKROACH_CERTS_DIR`
**Default:** `${HOME}/.cockroach-certs/` \ No newline at end of file diff --git a/_includes/v22.1/sql/shell-commands.md b/_includes/v22.1/sql/shell-commands.md index 8065fe5b126..3916d738cea 100644 --- a/_includes/v22.1/sql/shell-commands.md +++ b/_includes/v22.1/sql/shell-commands.md @@ -2,14 +2,14 @@ The following commands can be used within the interactive SQL shell: Command | Usage --------|------------ -`\?`,`help` | View this help within the shell. -`\q`,`quit`,`exit`,`ctrl-d` | Exit the shell.
When no text follows the prompt, `ctrl-c` exits the shell as well; otherwise, `ctrl-c` clears the line. +`\?`
`help` | View this help within the shell. +`\q`
`quit`
`exit`
**Ctrl+D** | Exit the shell.
When no text follows the prompt, **Ctrl+C** exits the shell as well; otherwise, **Ctrl+C** clears the line. `\!` | Run an external command and print its results to `stdout`. [See an example](cockroach-sql.html#run-external-commands-from-the-sql-shell). \| | Run the output of an external command as SQL statements. [See an example](cockroach-sql.html#run-external-commands-from-the-sql-shell). -`\set