-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edits for Postgres compatibility #2887
Changes from 4 commits
8858a95
6e39ea0
6d909d0
c619dcf
e2e77f2
441e4c7
b5cde5d
fd8b8ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,12 @@ The variable name is case insensitive. The value can be a list of one or more it | |
| `default_transaction_isolation` | The default transaction isolation level for the current session. See [Transaction parameters](transactions.html#transaction-parameters) and [`SET TRANSACTION`](set-transaction.html) for more details. | Settings in connection string, or "`SERIALIZABLE`" if not specified | Yes | | ||
| `sql_safe_updates` | If `true`, disallow potentially unsafe SQL statements, including `DELETE` without a `WHERE` clause, `UPDATE` without a `WHERE` clause, and `ALTER TABLE ... DROP COLUMN`. See [Allow Potentially Unsafe SQL Statements](use-the-built-in-sql-client.html#allow-potentially-unsafe-sql-statements) for more details. | `true` for interactive sessions from the [built-in SQL client](use-the-built-in-sql-client.html) unless `--safe-updates=false` is specified,<br>`false` for sessions from other clients | Yes | | ||
| `search_path` | <span class="version-tag">Changed in v2.0:</span> A list of schemas that will be searched to resolve unqualified table or function names. For more details, see [Name Resolution](sql-name-resolution.html). | "`{public}`" | Yes | | ||
| `time zone` | The default time zone for the current session.<br><br>This value can be a string representation of a local system-defined time zone (e.g., `'EST'`, `'America/New_York'`) or a positive or negative numeric offset from UTC (e.g., `-7`, `+7`). Also, `DEFAULT`, `LOCAL`, or `0` sets the session time zone to `UTC`.</br><br>See [`SET TIME ZONE`](#set-time-zone) for more details. | `UTC` | Yes | | ||
| `server_version_num` | <span class="version-tag">New in v2.0:</span> The version of PostgreSQL that CockroachDB emulates. | Version-dependent | Yes | | ||
| `time zone` | The default time zone for the current session.<br><br>This value can be a string representation of a local system-defined time zone (e.g., `'EST'`, `'America/New_York'`) or a positive or negative numeric offset from UTC (e.g., `-7`, `+7`). Also, `DEFAULT`, `LOCAL`, or `0` sets the session time zone to `UTC`.</br><br>See [`SET TIME ZONE`](#set-time-zone) for more details. <br><br><span class="version-tag">New in v2.0:</span> Alias: `"timezone"` | `UTC` | Yes | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable has been renamed. This entire line must be replaced with:
|
||
| `tracing` | The trace recording state.<br><br>See [`SET TRACING`](#set-tracing) for more details. | `off` | Yes | | ||
| `transaction isolation level` | The isolation level of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details.<br><br><span class="version-tag">New in v2.0:</span> Alias: `transaction_isolation` | `SERIALIZABLE` | Yes | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variables have been renamed. These three lines must be entirely replaced by:
|
||
| `transaction priority` | The priority of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details.<br><br><span class="version-tag">New in v2.0:</span> Alias: `transaction_priority` | `NORMAL` | Yes | | ||
| `transaction status` | The state of the current transaction. See [Transactions](transactions.html) for more details.<br><br><span class="version-tag">New in v2.0:</span> Alias: `transaction_status` | `NoTxn` | Yes | | ||
| `client_encoding` | Ignored; recognized for compatibility with PostgreSQL clients. Only possible value is "`UTF8`". | N/A | No | | ||
| `client_min_messages` | Ignored; recognized for compatibility with PostgreSQL clients. Only possible value is "`on`". | N/A | No | | ||
| `extra_float_digits` | Ignored; recognized for compatibility with PostgreSQL clients. | N/A | No | | ||
|
@@ -54,7 +58,7 @@ Special syntax cases: | |
| `USE ...` | `SET database = ...` | This is provided as convenience for users with a MySQL/MSSQL background. | ||
| `SET NAMES ...` | `SET client_encoding = ...` | This is provided for compatibility with PostgreSQL clients. | ||
| `SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL ...` | `SET default_transaction_isolation = ...` | This is provided for compatibility with standard SQL. | ||
| `SET TIME ZONE ...` | `SET "time zone" = ...` | This is provided for compatibility with PostgreSQL clients. | ||
| `SET TIME ZONE ...` | `SET "timezone" = ...` | This is provided for compatibility with PostgreSQL clients. | ||
|
||
## Examples | ||
|
||
|
@@ -159,7 +163,7 @@ You can control your client's default time zone for the current session with <co | |
|
||
{{site.data.alerts.callout_info}}With setting <code>SET TIME ZONE</code>, CockroachDB uses UTC as the default time zone.{{site.data.alerts.end}} | ||
|
||
`SET TIME ZONE` uses a special syntax form used to configure the `"time zone"` session parameter because `SET` cannot assign to parameter names containing spaces. | ||
`SET TIME ZONE` uses a special syntax form used to configure the `"timezone"` session parameter because `SET` cannot assign to parameter names containing spaces. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This entire line must be deleted as it is no longer accurate. |
||
|
||
### Parameters | ||
|
||
|
@@ -173,7 +177,7 @@ negative numeric offset from UTC (e.g., `-7`, `+7`). Also, `DEFAULT`, | |
### Example: Set the Default Time Zone via `SET TIME ZONE` | ||
|
||
~~~ sql | ||
> SET TIME ZONE 'EST'; -- same as SET "time zone" = 'EST' | ||
> SET TIME ZONE 'EST'; -- same as SET "timezone" = 'EST' | ||
> SHOW TIME ZONE; | ||
~~~ | ||
~~~ shell | ||
|
@@ -185,7 +189,7 @@ negative numeric offset from UTC (e.g., `-7`, `+7`). Also, `DEFAULT`, | |
(1 row) | ||
~~~ | ||
~~~ sql | ||
> SET TIME ZONE DEFAULT; -- same as SET "time zone" = DEFAULT | ||
> SET TIME ZONE DEFAULT; -- same as SET "timezone" = DEFAULT | ||
> SHOW TIME ZONE; | ||
~~~ | ||
~~~ shell | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,13 +40,15 @@ The variable name is case insensitive. It may be enclosed in double quotes; this | |
| `node_id` | <span class="version-tag">New in v1.1:</span> The ID of the node currently connected to.<br><br>This variable is particularly useful for verifying load balanced connections. | Node-dependent | No | | ||
| `search_path` | <span class="version-tag">Changed in v2.0:</span> A list of schemas that will be searched to resolve unqualified table or function names. For more details, see [Name Resolution](sql-name-resolution.html). | `{public}` | Yes | | ||
| `server_version` | The version of PostgreSQL that CockroachDB emulates. | Version-dependent | No | | ||
| `server_version_num` | <span class="version-tag">New in v2.0:</span> The version of PostgreSQL that CockroachDB emulates. | Version-dependent | Yes | | ||
| `session_user` | The user connected for the current session. | User in connection string | No | | ||
| `sql_safe_updates` | If `false`, potentially unsafe SQL statements are allowed, including `DROP` of a non-empty database and all dependent objects, `DELETE` without a `WHERE` clause, `UPDATE` without a `WHERE` clause, and `ALTER TABLE .. DROP COLUMN`. See [Allow Potentially Unsafe SQL Statements](use-the-built-in-sql-client.html#allow-potentially-unsafe-sql-statements) for more details. | `true` for interactive sessions from the [built-in SQL client](use-the-built-in-sql-client.html),<br>`false` for sessions from other clients | Yes | | ||
| `time zone` | The default time zone for the current session | `UTC` | Yes | | ||
| `time zone` | The default time zone for the current session. <br><br><span class="version-tag">New in v2.0:</span> Alias: `"timezone"` | `UTC` | Yes | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace:
|
||
| `tracing` | | `off` | | | ||
| `transaction isolation level` | The isolation level of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details. | `SERIALIZABLE` | Yes | | ||
| `transaction priority` | The priority of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details. | `NORMAL` | Yes | | ||
| `transaction status` | The state of the current transaction. See [Transactions](transactions.html) for more details. | `NoTxn` | No | | ||
| `transaction isolation level` | The isolation level of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details.<br><br><span class="version-tag">New in v2.0:</span> Alias: `transaction_isolation` | `SERIALIZABLE` | Yes | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take the 3 lines over from my comment on set-vars.md, adjusting the last column as needed. |
||
| `transaction priority` | The priority of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details.<br><br><span class="version-tag">New in v2.0:</span> Alias: `transaction_priority` | `NORMAL` | Yes | | ||
| `transaction_read_only` | <span class="version-tag">New in v2.0:</span> (Reserved; exposed only for ORM compatibility.) | `off` | No | | ||
| `transaction status` | The state of the current transaction. See [Transactions](transactions.html) for more details.<br><br><span class="version-tag">New in v2.0:</span> Alias: `transaction_status` | `NoTxn` | No | | ||
| `client_encoding` | (Reserved; exposed only for ORM compatibility.) | `UTF8` | No | | ||
| `client_min_messages` | (Reserved; exposed only for ORM compatibility.) | (Reserved) | No | | ||
| `datestyle` | (Reserved; exposed only for ORM compatibility.) | `ISO` | No | | ||
|
@@ -60,7 +62,7 @@ Special syntax cases supported for compatibility: | |
|--------|---------------| | ||
| `SHOW TRANSACTION PRIORITY` | `SHOW "transaction priority"` | | ||
| `SHOW TRANSACTION ISOLATION LEVEL` | `SHOW "transaction isolation level"` | | ||
| `SHOW TIME ZONE` | `SHOW "time zone"` | | ||
| `SHOW TIME ZONE` | `SHOW "timezone"` | | ||
| `SHOW TRANSACTION STATUS` | `SHOW "transaction status"` | | ||
|
||
## Examples | ||
|
@@ -103,7 +105,7 @@ Special syntax cases supported for compatibility: | |
| server_version | 9.5.0 | | ||
| session_user | root | | ||
| standard_conforming_strings | on | | ||
| time zone | UTC | | ||
| timezone | UTC | | ||
| transaction isolation level | SERIALIZABLE | | ||
| transaction priority | NORMAL | | ||
| transaction status | NoTxn | | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ In CockroachDB, the following are aliases for `STRING`: | |
|
||
- `CHARACTER` | ||
- `CHAR` | ||
- `"char"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line is not accurate and should be removed. Just curious: why did you add it? |
||
- `VARCHAR` | ||
- `TEXT` | ||
|
||
|
@@ -25,7 +26,8 @@ And the following are aliases for `STRING(n)`: | |
- `CHARACTER VARYING(n)` | ||
- `CHAR(n)` | ||
- `CHAR VARYING(n)` | ||
- `VARCHAR(n)` | ||
- `VARCHAR(n)` | ||
|
||
|
||
## Length | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below:
(it's not an alias.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also btw this is now new in v2.0.