From 6a419be89bff787c64dead06b88718934df194f1 Mon Sep 17 00:00:00 2001 From: Ryan Kuo <8740013+taroface@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:00:00 -0400 Subject: [PATCH] disallow mutation and locking statements with AOST (#18622) * disallow mutation and locking statements with AOST --- src/current/v23.1/as-of-system-time.md | 12 +++++++++--- src/current/v23.2/as-of-system-time.md | 12 +++++++++--- src/current/v24.1/as-of-system-time.md | 12 +++++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/current/v23.1/as-of-system-time.md b/src/current/v23.1/as-of-system-time.md index f11beb5a8f3..23ade046064 100644 --- a/src/current/v23.1/as-of-system-time.md +++ b/src/current/v23.1/as-of-system-time.md @@ -15,15 +15,21 @@ Historical data is available only within the garbage collection window, which is ## Synopsis -The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, -including but not limited to: +The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, including but not limited to: -- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause. +- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause. The [`FOR`]({% link {{ page.version.version }}/select-for-update.md %}) locking clause is **not** allowed with `AS OF SYSTEM TIME`. - In [`BACKUP`]({% link {{ page.version.version }}/backup.md %}), after the parameters of the `TO` sub-clause. - In [`RESTORE`]({% link {{ page.version.version }}/restore.md %}), after the parameters of the `FROM` sub-clause. - In [`BEGIN`]({% link {{ page.version.version }}/begin-transaction.md %}), after the `BEGIN` keyword. - In [`SET`]({% link {{ page.version.version }}/set-transaction.md %}), after the `SET TRANSACTION` keyword. +`AS OF SYSTEM TIME` cannot be used with: + +- [Locking reads]({% link {{ page.version.version }}/select-for-update.md %}) (`SELECT ... FOR UPDATE`). +- [Mutation statements]({% link {{ page.version.version }}/sql-statements.md %}#data-manipulation-statements) (such as [`UPDATE`]({% link {{ page.version.version }}/update.md %}) or [`DELETE`]({% link {{ page.version.version }}/delete.md %})). + +The preceding statements return an error: `cannot execute {SQL STATEMENT} in a read-only transaction`. + ## Parameters The `timestamp` argument supports the following formats: diff --git a/src/current/v23.2/as-of-system-time.md b/src/current/v23.2/as-of-system-time.md index f11beb5a8f3..34df11a7039 100644 --- a/src/current/v23.2/as-of-system-time.md +++ b/src/current/v23.2/as-of-system-time.md @@ -15,15 +15,21 @@ Historical data is available only within the garbage collection window, which is ## Synopsis -The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, -including but not limited to: +The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, including but not limited to: -- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause. +- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause. The [`FOR`]({% link {{ page.version.version }}/select-for-update.md %}) locking clause is **not** allowed with `AS OF SYSTEM TIME`. - In [`BACKUP`]({% link {{ page.version.version }}/backup.md %}), after the parameters of the `TO` sub-clause. - In [`RESTORE`]({% link {{ page.version.version }}/restore.md %}), after the parameters of the `FROM` sub-clause. - In [`BEGIN`]({% link {{ page.version.version }}/begin-transaction.md %}), after the `BEGIN` keyword. - In [`SET`]({% link {{ page.version.version }}/set-transaction.md %}), after the `SET TRANSACTION` keyword. +`AS OF SYSTEM TIME` cannot be used with: + +- [Locking reads]({% link {{ page.version.version }}/select-for-update.md %}) (`SELECT ... FOR UPDATE` and `SELECT ... FOR SHARE`). +- [Mutation statements]({% link {{ page.version.version }}/sql-statements.md %}#data-manipulation-statements) (such as [`UPDATE`]({% link {{ page.version.version }}/update.md %}) or [`DELETE`]({% link {{ page.version.version }}/delete.md %})). + +The preceding statements return an error: `cannot execute {SQL STATEMENT} in a read-only transaction`. + ## Parameters The `timestamp` argument supports the following formats: diff --git a/src/current/v24.1/as-of-system-time.md b/src/current/v24.1/as-of-system-time.md index f11beb5a8f3..34df11a7039 100644 --- a/src/current/v24.1/as-of-system-time.md +++ b/src/current/v24.1/as-of-system-time.md @@ -15,15 +15,21 @@ Historical data is available only within the garbage collection window, which is ## Synopsis -The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, -including but not limited to: +The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, including but not limited to: -- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause. +- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause. The [`FOR`]({% link {{ page.version.version }}/select-for-update.md %}) locking clause is **not** allowed with `AS OF SYSTEM TIME`. - In [`BACKUP`]({% link {{ page.version.version }}/backup.md %}), after the parameters of the `TO` sub-clause. - In [`RESTORE`]({% link {{ page.version.version }}/restore.md %}), after the parameters of the `FROM` sub-clause. - In [`BEGIN`]({% link {{ page.version.version }}/begin-transaction.md %}), after the `BEGIN` keyword. - In [`SET`]({% link {{ page.version.version }}/set-transaction.md %}), after the `SET TRANSACTION` keyword. +`AS OF SYSTEM TIME` cannot be used with: + +- [Locking reads]({% link {{ page.version.version }}/select-for-update.md %}) (`SELECT ... FOR UPDATE` and `SELECT ... FOR SHARE`). +- [Mutation statements]({% link {{ page.version.version }}/sql-statements.md %}#data-manipulation-statements) (such as [`UPDATE`]({% link {{ page.version.version }}/update.md %}) or [`DELETE`]({% link {{ page.version.version }}/delete.md %})). + +The preceding statements return an error: `cannot execute {SQL STATEMENT} in a read-only transaction`. + ## Parameters The `timestamp` argument supports the following formats: