Skip to content

Commit 6a419be

Browse files
authored
disallow mutation and locking statements with AOST (#18622)
* disallow mutation and locking statements with AOST
1 parent bdbe3ad commit 6a419be

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

src/current/v23.1/as-of-system-time.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ Historical data is available only within the garbage collection window, which is
1515

1616
## Synopsis
1717

18-
The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts,
19-
including but not limited to:
18+
The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, including but not limited to:
2019

21-
- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause.
20+
- 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`.
2221
- In [`BACKUP`]({% link {{ page.version.version }}/backup.md %}), after the parameters of the `TO` sub-clause.
2322
- In [`RESTORE`]({% link {{ page.version.version }}/restore.md %}), after the parameters of the `FROM` sub-clause.
2423
- In [`BEGIN`]({% link {{ page.version.version }}/begin-transaction.md %}), after the `BEGIN` keyword.
2524
- In [`SET`]({% link {{ page.version.version }}/set-transaction.md %}), after the `SET TRANSACTION` keyword.
2625

26+
`AS OF SYSTEM TIME` cannot be used with:
27+
28+
- [Locking reads]({% link {{ page.version.version }}/select-for-update.md %}) (`SELECT ... FOR UPDATE`).
29+
- [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 %})).
30+
31+
The preceding statements return an error: `cannot execute {SQL STATEMENT} in a read-only transaction`.
32+
2733
## Parameters
2834

2935
The `timestamp` argument supports the following formats:

src/current/v23.2/as-of-system-time.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ Historical data is available only within the garbage collection window, which is
1515

1616
## Synopsis
1717

18-
The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts,
19-
including but not limited to:
18+
The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, including but not limited to:
2019

21-
- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause.
20+
- 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`.
2221
- In [`BACKUP`]({% link {{ page.version.version }}/backup.md %}), after the parameters of the `TO` sub-clause.
2322
- In [`RESTORE`]({% link {{ page.version.version }}/restore.md %}), after the parameters of the `FROM` sub-clause.
2423
- In [`BEGIN`]({% link {{ page.version.version }}/begin-transaction.md %}), after the `BEGIN` keyword.
2524
- In [`SET`]({% link {{ page.version.version }}/set-transaction.md %}), after the `SET TRANSACTION` keyword.
2625

26+
`AS OF SYSTEM TIME` cannot be used with:
27+
28+
- [Locking reads]({% link {{ page.version.version }}/select-for-update.md %}) (`SELECT ... FOR UPDATE` and `SELECT ... FOR SHARE`).
29+
- [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 %})).
30+
31+
The preceding statements return an error: `cannot execute {SQL STATEMENT} in a read-only transaction`.
32+
2733
## Parameters
2834

2935
The `timestamp` argument supports the following formats:

src/current/v24.1/as-of-system-time.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ Historical data is available only within the garbage collection window, which is
1515

1616
## Synopsis
1717

18-
The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts,
19-
including but not limited to:
18+
The `AS OF SYSTEM TIME` clause is supported in multiple SQL contexts, including but not limited to:
2019

21-
- In [`SELECT` clauses]({% link {{ page.version.version }}/select-clause.md %}), at the very end of the `FROM` sub-clause.
20+
- 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`.
2221
- In [`BACKUP`]({% link {{ page.version.version }}/backup.md %}), after the parameters of the `TO` sub-clause.
2322
- In [`RESTORE`]({% link {{ page.version.version }}/restore.md %}), after the parameters of the `FROM` sub-clause.
2423
- In [`BEGIN`]({% link {{ page.version.version }}/begin-transaction.md %}), after the `BEGIN` keyword.
2524
- In [`SET`]({% link {{ page.version.version }}/set-transaction.md %}), after the `SET TRANSACTION` keyword.
2625

26+
`AS OF SYSTEM TIME` cannot be used with:
27+
28+
- [Locking reads]({% link {{ page.version.version }}/select-for-update.md %}) (`SELECT ... FOR UPDATE` and `SELECT ... FOR SHARE`).
29+
- [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 %})).
30+
31+
The preceding statements return an error: `cannot execute {SQL STATEMENT} in a read-only transaction`.
32+
2733
## Parameters
2834

2935
The `timestamp` argument supports the following formats:

0 commit comments

Comments
 (0)