-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into DOC-10406
- Loading branch information
Showing
38 changed files
with
273 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/current/_includes/cockroachcloud/cdc/tutorial-privilege-check.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The `CHANGEFEED` privilege in order to create and manage changefeed jobs. Refer to [Required privileges]({% link {{site.current_cloud_version}}/create-changefeed.md %}#required-privileges) for more details. |
37 changes: 14 additions & 23 deletions
37
..._includes/v19.1/known-limitations/schema-changes-between-prepared-statements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,33 @@ | ||
When the schema of a table targeted by a prepared statement changes before the prepared statement is executed, CockroachDB allows the prepared statement to return results based on the changed table schema, for example: | ||
When the schema of a table targeted by a prepared statement changes after the prepared statement is created, future executions of the prepared statement could result in an error. For example, adding a column to a table referenced in a prepared statement with a `SELECT *` clause will result in an error: | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> CREATE TABLE users (id INT PRIMARY KEY); | ||
CREATE TABLE users (id INT PRIMARY KEY); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> PREPARE prep1 AS SELECT * FROM users; | ||
PREPARE prep1 AS SELECT * FROM users; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER TABLE users ADD COLUMN name STRING; | ||
ALTER TABLE users ADD COLUMN name STRING; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> INSERT INTO users VALUES (1, 'Max Roach'); | ||
INSERT INTO users VALUES (1, 'Max Roach'); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> EXECUTE prep1; | ||
EXECUTE prep1; | ||
~~~ | ||
|
||
~~~ | ||
+----+-----------+ | ||
| id | name | | ||
+----+-----------+ | ||
| 1 | Max Roach | | ||
+----+-----------+ | ||
(1 row) | ||
ERROR: cached plan must not change result type | ||
SQLSTATE: 0A000 | ||
~~~ | ||
|
||
It's therefore recommended to **not** use `SELECT *` in queries that will be repeated, via prepared statements or otherwise. | ||
|
||
Also, a prepared [`INSERT`](insert.html), [`UPSERT`](upsert.html), or [`DELETE`](delete.html) statement acts inconsistently when the schema of the table being written to is changed before the prepared statement is executed: | ||
|
||
- If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. | ||
- If the number of columns remains the same but the types have changed, the prepared statement writes the data and does not return an error. | ||
It's therefore recommended to explicitly list result columns instead of using `SELECT *` in prepared statements, when possible. |
37 changes: 14 additions & 23 deletions
37
..._includes/v19.2/known-limitations/schema-changes-between-prepared-statements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,33 @@ | ||
When the schema of a table targeted by a prepared statement changes before the prepared statement is executed, CockroachDB allows the prepared statement to return results based on the changed table schema, for example: | ||
When the schema of a table targeted by a prepared statement changes after the prepared statement is created, future executions of the prepared statement could result in an error. For example, adding a column to a table referenced in a prepared statement with a `SELECT *` clause will result in an error: | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> CREATE TABLE users (id INT PRIMARY KEY); | ||
CREATE TABLE users (id INT PRIMARY KEY); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> PREPARE prep1 AS SELECT * FROM users; | ||
PREPARE prep1 AS SELECT * FROM users; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER TABLE users ADD COLUMN name STRING; | ||
ALTER TABLE users ADD COLUMN name STRING; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> INSERT INTO users VALUES (1, 'Max Roach'); | ||
INSERT INTO users VALUES (1, 'Max Roach'); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> EXECUTE prep1; | ||
EXECUTE prep1; | ||
~~~ | ||
|
||
~~~ | ||
+----+-----------+ | ||
| id | name | | ||
+----+-----------+ | ||
| 1 | Max Roach | | ||
+----+-----------+ | ||
(1 row) | ||
ERROR: cached plan must not change result type | ||
SQLSTATE: 0A000 | ||
~~~ | ||
|
||
It's therefore recommended to **not** use `SELECT *` in queries that will be repeated, via prepared statements or otherwise. | ||
|
||
Also, a prepared [`INSERT`](insert.html), [`UPSERT`](upsert.html), or [`DELETE`](delete.html) statement acts inconsistently when the schema of the table being written to is changed before the prepared statement is executed: | ||
|
||
- If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. | ||
- If the number of columns remains the same but the types have changed, the prepared statement writes the data and does not return an error. | ||
It's therefore recommended to explicitly list result columns instead of using `SELECT *` in prepared statements, when possible. |
37 changes: 14 additions & 23 deletions
37
src/current/_includes/v2.1/misc/schema-changes-between-prepared-statements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,33 @@ | ||
When the schema of a table targeted by a prepared statement changes before the prepared statement is executed, CockroachDB allows the prepared statement to return results based on the changed table schema, for example: | ||
When the schema of a table targeted by a prepared statement changes after the prepared statement is created, future executions of the prepared statement could result in an error. For example, adding a column to a table referenced in a prepared statement with a `SELECT *` clause will result in an error: | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> CREATE TABLE users (id INT PRIMARY KEY); | ||
CREATE TABLE users (id INT PRIMARY KEY); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> PREPARE prep1 AS SELECT * FROM users; | ||
PREPARE prep1 AS SELECT * FROM users; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER TABLE users ADD COLUMN name STRING; | ||
ALTER TABLE users ADD COLUMN name STRING; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> INSERT INTO users VALUES (1, 'Max Roach'); | ||
INSERT INTO users VALUES (1, 'Max Roach'); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> EXECUTE prep1; | ||
EXECUTE prep1; | ||
~~~ | ||
|
||
~~~ | ||
+----+-----------+ | ||
| id | name | | ||
+----+-----------+ | ||
| 1 | Max Roach | | ||
+----+-----------+ | ||
(1 row) | ||
ERROR: cached plan must not change result type | ||
SQLSTATE: 0A000 | ||
~~~ | ||
|
||
It's therefore recommended to **not** use `SELECT *` in queries that will be repeated, via prepared statements or otherwise. | ||
|
||
Also, a prepared [`INSERT`](insert.html), [`UPSERT`](upsert.html), or [`DELETE`](delete.html) statement acts inconsistently when the schema of the table being written to is changed before the prepared statement is executed: | ||
|
||
- If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. | ||
- If the number of columns remains the same but the types have changed, the prepared statement writes the data and does not return an error. | ||
It's therefore recommended to explicitly list result columns instead of using `SELECT *` in prepared statements, when possible. |
37 changes: 14 additions & 23 deletions
37
..._includes/v20.1/known-limitations/schema-changes-between-prepared-statements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,33 @@ | ||
When the schema of a table targeted by a prepared statement changes before the prepared statement is executed, CockroachDB allows the prepared statement to return results based on the changed table schema, for example: | ||
When the schema of a table targeted by a prepared statement changes after the prepared statement is created, future executions of the prepared statement could result in an error. For example, adding a column to a table referenced in a prepared statement with a `SELECT *` clause will result in an error: | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> CREATE TABLE users (id INT PRIMARY KEY); | ||
CREATE TABLE users (id INT PRIMARY KEY); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> PREPARE prep1 AS SELECT * FROM users; | ||
PREPARE prep1 AS SELECT * FROM users; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER TABLE users ADD COLUMN name STRING; | ||
ALTER TABLE users ADD COLUMN name STRING; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> INSERT INTO users VALUES (1, 'Max Roach'); | ||
INSERT INTO users VALUES (1, 'Max Roach'); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> EXECUTE prep1; | ||
EXECUTE prep1; | ||
~~~ | ||
|
||
~~~ | ||
+----+-----------+ | ||
| id | name | | ||
+----+-----------+ | ||
| 1 | Max Roach | | ||
+----+-----------+ | ||
(1 row) | ||
ERROR: cached plan must not change result type | ||
SQLSTATE: 0A000 | ||
~~~ | ||
|
||
It's therefore recommended to **not** use `SELECT *` in queries that will be repeated, via prepared statements or otherwise. | ||
|
||
Also, a prepared [`INSERT`](insert.html), [`UPSERT`](upsert.html), or [`DELETE`](delete.html) statement acts inconsistently when the schema of the table being written to is changed before the prepared statement is executed: | ||
|
||
- If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. | ||
- If the number of columns remains the same but the types have changed, the prepared statement writes the data and does not return an error. | ||
It's therefore recommended to explicitly list result columns instead of using `SELECT *` in prepared statements, when possible. |
35 changes: 14 additions & 21 deletions
35
..._includes/v20.2/known-limitations/schema-changes-between-prepared-statements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,33 @@ | ||
When the schema of a table targeted by a prepared statement changes before the prepared statement is executed, CockroachDB allows the prepared statement to return results based on the changed table schema, for example: | ||
When the schema of a table targeted by a prepared statement changes after the prepared statement is created, future executions of the prepared statement could result in an error. For example, adding a column to a table referenced in a prepared statement with a `SELECT *` clause will result in an error: | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> CREATE TABLE users (id INT PRIMARY KEY); | ||
CREATE TABLE users (id INT PRIMARY KEY); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> PREPARE prep1 AS SELECT * FROM users; | ||
PREPARE prep1 AS SELECT * FROM users; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER TABLE users ADD COLUMN name STRING; | ||
ALTER TABLE users ADD COLUMN name STRING; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> INSERT INTO users VALUES (1, 'Max Roach'); | ||
INSERT INTO users VALUES (1, 'Max Roach'); | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> EXECUTE prep1; | ||
EXECUTE prep1; | ||
~~~ | ||
|
||
~~~ | ||
id | name | ||
-----+------------ | ||
1 | Max Roach | ||
(1 row) | ||
ERROR: cached plan must not change result type | ||
SQLSTATE: 0A000 | ||
~~~ | ||
|
||
It's therefore recommended to **not** use `SELECT *` in queries that will be repeated, via prepared statements or otherwise. | ||
|
||
Also, a prepared [`INSERT`](insert.html), [`UPSERT`](upsert.html), or [`DELETE`](delete.html) statement acts inconsistently when the schema of the table being written to is changed before the prepared statement is executed: | ||
|
||
- If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. | ||
- If the number of columns remains the same but the types have changed, the prepared statement writes the data and does not return an error. | ||
It's therefore recommended to explicitly list result columns instead of using `SELECT *` in prepared statements, when possible. |
25 changes: 9 additions & 16 deletions
25
..._includes/v21.1/known-limitations/schema-changes-between-prepared-statements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,33 @@ | ||
When the schema of a table targeted by a prepared statement changes before the prepared statement is executed, CockroachDB allows the prepared statement to return results based on the changed table schema, for example: | ||
When the schema of a table targeted by a prepared statement changes after the prepared statement is created, future executions of the prepared statement could result in an error. For example, adding a column to a table referenced in a prepared statement with a `SELECT *` clause will result in an error: | ||
|
||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> CREATE TABLE users (id INT PRIMARY KEY); | ||
CREATE TABLE users (id INT PRIMARY KEY); | ||
~~~ | ||
|
||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> PREPARE prep1 AS SELECT * FROM users; | ||
PREPARE prep1 AS SELECT * FROM users; | ||
~~~ | ||
|
||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER TABLE users ADD COLUMN name STRING; | ||
ALTER TABLE users ADD COLUMN name STRING; | ||
~~~ | ||
|
||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> INSERT INTO users VALUES (1, 'Max Roach'); | ||
INSERT INTO users VALUES (1, 'Max Roach'); | ||
~~~ | ||
|
||
{% include_cached copy-clipboard.html %} | ||
~~~ sql | ||
> EXECUTE prep1; | ||
EXECUTE prep1; | ||
~~~ | ||
|
||
~~~ | ||
id | name | ||
-----+------------ | ||
1 | Max Roach | ||
(1 row) | ||
ERROR: cached plan must not change result type | ||
SQLSTATE: 0A000 | ||
~~~ | ||
|
||
It's therefore recommended to **not** use `SELECT *` in queries that will be repeated, via prepared statements or otherwise. | ||
|
||
Also, a prepared [`INSERT`](insert.html), [`UPSERT`](upsert.html), or [`DELETE`](delete.html) statement acts inconsistently when the schema of the table being written to is changed before the prepared statement is executed: | ||
|
||
- If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. | ||
- If the number of columns remains the same but the types have changed, the prepared statement writes the data and does not return an error. | ||
It's therefore recommended to explicitly list result columns instead of using `SELECT *` in prepared statements, when possible. |
Oops, something went wrong.