Skip to content

Commit

Permalink
disallow mutation and locking statements with AOST (#18622)
Browse files Browse the repository at this point in the history
* disallow mutation and locking statements with AOST
  • Loading branch information
taroface authored Jun 5, 2024
1 parent bdbe3ad commit 6a419be
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/current/v23.1/as-of-system-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 9 additions & 3 deletions src/current/v23.2/as-of-system-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 9 additions & 3 deletions src/current/v24.1/as-of-system-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6a419be

Please sign in to comment.