From 660522e7c9eaff11c7fbfdd9f84f2246556caa8f Mon Sep 17 00:00:00 2001 From: Ryan Kuo Date: Mon, 9 Dec 2024 17:36:28 -0500 Subject: [PATCH] docgen: update BEGIN and SET TRANSACTION diagrams --- docs/generated/sql/bnf/BUILD.bazel | 3 +- docs/generated/sql/bnf/begin_stmt.bnf | 1 + docs/generated/sql/bnf/legacy_begin_stmt.bnf | 29 ++++++++++++++++++- .../sql/bnf/nonpreparable_set_stmt.bnf | 2 ++ docs/generated/sql/bnf/set_transaction.bnf | 23 +++++++++------ docs/generated/sql/bnf/stmt_block.bnf | 13 ++++++++- pkg/cmd/docgen/diagrams.go | 18 ++++++------ pkg/gen/bnf.bzl | 3 +- pkg/gen/diagrams.bzl | 2 +- pkg/gen/docs.bzl | 3 +- pkg/sql/parser/sql.y | 1 - 11 files changed, 70 insertions(+), 28 deletions(-) create mode 100644 docs/generated/sql/bnf/nonpreparable_set_stmt.bnf diff --git a/docs/generated/sql/bnf/BUILD.bazel b/docs/generated/sql/bnf/BUILD.bazel index f00671164367..7adae8b804cd 100644 --- a/docs/generated/sql/bnf/BUILD.bazel +++ b/docs/generated/sql/bnf/BUILD.bazel @@ -72,7 +72,6 @@ FILES = [ "analyze_stmt", "backup", "backup_options", - "begin_stmt", "begin_transaction", "call", "cancel_all_jobs", @@ -168,6 +167,7 @@ FILES = [ "like_table_option_list", "limit_clause", "move_cursor_stmt", + "nonpreparable_set_stmt", "not_null_column_level", "offset_clause", "on_conflict", @@ -223,7 +223,6 @@ FILES = [ "set_rest_more", "set_session_stmt", "set_transaction", - "set_transaction_stmt", "show_backup", "show_cluster_setting", "show_columns_stmt", diff --git a/docs/generated/sql/bnf/begin_stmt.bnf b/docs/generated/sql/bnf/begin_stmt.bnf index 1059df25a0ad..b76ee9186f8f 100644 --- a/docs/generated/sql/bnf/begin_stmt.bnf +++ b/docs/generated/sql/bnf/begin_stmt.bnf @@ -1 +1,2 @@ begin_stmt ::= + 'START' 'TRANSACTION' begin_transaction diff --git a/docs/generated/sql/bnf/legacy_begin_stmt.bnf b/docs/generated/sql/bnf/legacy_begin_stmt.bnf index 3974be960389..f0c5585ba047 100644 --- a/docs/generated/sql/bnf/legacy_begin_stmt.bnf +++ b/docs/generated/sql/bnf/legacy_begin_stmt.bnf @@ -1,2 +1,29 @@ legacy_begin_stmt ::= - 'BEGIN' opt_transaction begin_transaction + 'BEGIN' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'READ' 'UNCOMMITTED' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'READ' 'COMMITTED' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'SNAPSHOT' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'REPEATABLE' 'READ' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'SERIALIZABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'PRIORITY' 'LOW' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'PRIORITY' 'NORMAL' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'PRIORITY' 'HIGH' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'READ' 'ONLY' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'READ' 'WRITE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'DEFERRABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' 'NOT' 'DEFERRABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'TRANSACTION' + | 'BEGIN' 'ISOLATION' 'LEVEL' 'READ' 'UNCOMMITTED' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'ISOLATION' 'LEVEL' 'READ' 'COMMITTED' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'ISOLATION' 'LEVEL' 'SNAPSHOT' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'ISOLATION' 'LEVEL' 'REPEATABLE' 'READ' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'ISOLATION' 'LEVEL' 'SERIALIZABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'PRIORITY' 'LOW' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'PRIORITY' 'NORMAL' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'PRIORITY' 'HIGH' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'READ' 'ONLY' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'READ' 'WRITE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'DEFERRABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' 'NOT' 'DEFERRABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'BEGIN' diff --git a/docs/generated/sql/bnf/nonpreparable_set_stmt.bnf b/docs/generated/sql/bnf/nonpreparable_set_stmt.bnf new file mode 100644 index 000000000000..c0cd7be13d8b --- /dev/null +++ b/docs/generated/sql/bnf/nonpreparable_set_stmt.bnf @@ -0,0 +1,2 @@ +nonpreparable_set_stmt ::= + set_transaction_stmt diff --git a/docs/generated/sql/bnf/set_transaction.bnf b/docs/generated/sql/bnf/set_transaction.bnf index 24f8f21d7433..d8a1db215d37 100644 --- a/docs/generated/sql/bnf/set_transaction.bnf +++ b/docs/generated/sql/bnf/set_transaction.bnf @@ -1,9 +1,14 @@ -nonpreparable_set_stmt ::= - 'SET' 'TRANSACTION' 'PRIORITY' 'LOW' ( ( ( ',' | ) ( ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* - | 'SET' 'TRANSACTION' 'PRIORITY' 'NORMAL' ( ( ( ',' | ) ( ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* - | 'SET' 'TRANSACTION' 'PRIORITY' 'HIGH' ( ( ( ',' | ) ( ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* - | 'SET' 'TRANSACTION' 'READ' 'ONLY' ( ( ( ',' | ) ( ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* - | 'SET' 'TRANSACTION' 'READ' 'WRITE' ( ( ( ',' | ) ( ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* - | 'SET' 'TRANSACTION' 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ( ( ( ',' | ) ( ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* - | 'SET' 'TRANSACTION' 'DEFERRABLE' ( ( ( ',' | ) ( ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* - | 'SET' 'TRANSACTION' 'NOT' 'DEFERRABLE' ( ( ( ',' | ) ( ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* +set_transaction_stmt ::= + 'SET' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'READ' 'UNCOMMITTED' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'READ' 'COMMITTED' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'SNAPSHOT' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'REPEATABLE' 'READ' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'ISOLATION' 'LEVEL' 'SERIALIZABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'PRIORITY' 'LOW' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'PRIORITY' 'NORMAL' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'PRIORITY' 'HIGH' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'READ' 'ONLY' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'READ' 'WRITE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'DEFERRABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* + | 'SET' 'TRANSACTION' 'NOT' 'DEFERRABLE' ( ( ( ',' | ) ( ( 'ISOLATION' 'LEVEL' ( 'READ' 'UNCOMMITTED' | 'READ' 'COMMITTED' | 'SNAPSHOT' | 'REPEATABLE' 'READ' | 'SERIALIZABLE' ) ) | ( 'PRIORITY' ( 'LOW' | 'NORMAL' | 'HIGH' ) ) | ( 'READ' 'ONLY' | 'READ' 'WRITE' ) | ( 'AS' 'OF' 'SYSTEM' 'TIME' a_expr ) | ( 'DEFERRABLE' | 'NOT' 'DEFERRABLE' ) ) ) )* diff --git a/docs/generated/sql/bnf/stmt_block.bnf b/docs/generated/sql/bnf/stmt_block.bnf index 4ee6e58af28c..b36af937b7a2 100644 --- a/docs/generated/sql/bnf/stmt_block.bnf +++ b/docs/generated/sql/bnf/stmt_block.bnf @@ -2155,7 +2155,8 @@ typename ::= | simple_typename 'ARRAY' transaction_mode ::= - transaction_user_priority + transaction_iso_level + | transaction_user_priority | transaction_read_mode | as_of_clause | transaction_deferrable_mode @@ -2959,6 +2960,9 @@ opt_array_bounds ::= '[' ']' | +transaction_iso_level ::= + 'ISOLATION' 'LEVEL' iso_level + transaction_user_priority ::= 'PRIORITY' user_priority @@ -3483,6 +3487,13 @@ interval_type ::= | 'INTERVAL' interval_qualifier | 'INTERVAL' '(' iconst32 ')' +iso_level ::= + 'READ' 'UNCOMMITTED' + | 'READ' 'COMMITTED' + | 'SNAPSHOT' + | 'REPEATABLE' 'READ' + | 'SERIALIZABLE' + user_priority ::= 'LOW' | 'NORMAL' diff --git a/pkg/cmd/docgen/diagrams.go b/pkg/cmd/docgen/diagrams.go index 153a9ee694fe..9f21fa121de8 100644 --- a/pkg/cmd/docgen/diagrams.go +++ b/pkg/cmd/docgen/diagrams.go @@ -625,22 +625,20 @@ var specs = []stmtSpec{ exclude: []*regexp.Regexp{regexp.MustCompile("'IN'")}, }, { - name: "begin_stmt", + name: "legacy_begin_stmt", inline: []string{ "opt_transaction", "begin_transaction", - "transaction_mode", - "transaction_user_priority", - "user_priority", - "iso_level", "transaction_mode_list", "opt_comma", + "transaction_mode", + "transaction_user_priority", "transaction_read_mode", "as_of_clause", "transaction_deferrable_mode", - }, - exclude: []*regexp.Regexp{ - regexp.MustCompile("'START'"), + "user_priority", + "transaction_iso_level", + "iso_level", }, }, { @@ -1420,7 +1418,7 @@ var specs = []stmtSpec{ }, { name: "set_transaction", - stmt: "nonpreparable_set_stmt", + stmt: "set_transaction_stmt", inline: []string{ "set_transaction_stmt", "transaction_mode", @@ -1431,6 +1429,8 @@ var specs = []stmtSpec{ "as_of_clause", "opt_comma", "transaction_deferrable_mode", + "transaction_iso_level", + "iso_level", }, match: []*regexp.Regexp{regexp.MustCompile("'SET' 'TRANSACTION'")}, }, diff --git a/pkg/gen/bnf.bzl b/pkg/gen/bnf.bzl index b80977b7fccc..a6c4e32a5ffe 100644 --- a/pkg/gen/bnf.bzl +++ b/pkg/gen/bnf.bzl @@ -72,7 +72,6 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:analyze_stmt.bnf", "//docs/generated/sql/bnf:backup.bnf", "//docs/generated/sql/bnf:backup_options.bnf", - "//docs/generated/sql/bnf:begin_stmt.bnf", "//docs/generated/sql/bnf:begin_transaction.bnf", "//docs/generated/sql/bnf:call.bnf", "//docs/generated/sql/bnf:cancel_all_jobs.bnf", @@ -168,6 +167,7 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:like_table_option_list.bnf", "//docs/generated/sql/bnf:limit_clause.bnf", "//docs/generated/sql/bnf:move_cursor_stmt.bnf", + "//docs/generated/sql/bnf:nonpreparable_set_stmt.bnf", "//docs/generated/sql/bnf:not_null_column_level.bnf", "//docs/generated/sql/bnf:offset_clause.bnf", "//docs/generated/sql/bnf:on_conflict.bnf", @@ -223,7 +223,6 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:set_rest_more.bnf", "//docs/generated/sql/bnf:set_session_stmt.bnf", "//docs/generated/sql/bnf:set_transaction.bnf", - "//docs/generated/sql/bnf:set_transaction_stmt.bnf", "//docs/generated/sql/bnf:show_backup.bnf", "//docs/generated/sql/bnf:show_cluster_setting.bnf", "//docs/generated/sql/bnf:show_columns_stmt.bnf", diff --git a/pkg/gen/diagrams.bzl b/pkg/gen/diagrams.bzl index 72cb63109a60..bc2ab870b340 100644 --- a/pkg/gen/diagrams.bzl +++ b/pkg/gen/diagrams.bzl @@ -72,7 +72,6 @@ DIAGRAMS_SRCS = [ "//docs/generated/sql/bnf:analyze.html", "//docs/generated/sql/bnf:backup.html", "//docs/generated/sql/bnf:backup_options.html", - "//docs/generated/sql/bnf:begin.html", "//docs/generated/sql/bnf:begin_transaction.html", "//docs/generated/sql/bnf:call.html", "//docs/generated/sql/bnf:cancel.html", @@ -168,6 +167,7 @@ DIAGRAMS_SRCS = [ "//docs/generated/sql/bnf:like_table_option_list.html", "//docs/generated/sql/bnf:limit_clause.html", "//docs/generated/sql/bnf:move_cursor.html", + "//docs/generated/sql/bnf:nonpreparable_set.html", "//docs/generated/sql/bnf:not_null_column_level.html", "//docs/generated/sql/bnf:offset_clause.html", "//docs/generated/sql/bnf:on_conflict.html", diff --git a/pkg/gen/docs.bzl b/pkg/gen/docs.bzl index aaf3e15f31db..a44bf6fcf520 100644 --- a/pkg/gen/docs.bzl +++ b/pkg/gen/docs.bzl @@ -85,7 +85,6 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:analyze_stmt.bnf", "//docs/generated/sql/bnf:backup.bnf", "//docs/generated/sql/bnf:backup_options.bnf", - "//docs/generated/sql/bnf:begin_stmt.bnf", "//docs/generated/sql/bnf:begin_transaction.bnf", "//docs/generated/sql/bnf:call.bnf", "//docs/generated/sql/bnf:cancel_all_jobs.bnf", @@ -181,6 +180,7 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:like_table_option_list.bnf", "//docs/generated/sql/bnf:limit_clause.bnf", "//docs/generated/sql/bnf:move_cursor_stmt.bnf", + "//docs/generated/sql/bnf:nonpreparable_set_stmt.bnf", "//docs/generated/sql/bnf:not_null_column_level.bnf", "//docs/generated/sql/bnf:offset_clause.bnf", "//docs/generated/sql/bnf:on_conflict.bnf", @@ -236,7 +236,6 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:set_rest_more.bnf", "//docs/generated/sql/bnf:set_session_stmt.bnf", "//docs/generated/sql/bnf:set_transaction.bnf", - "//docs/generated/sql/bnf:set_transaction_stmt.bnf", "//docs/generated/sql/bnf:show_backup.bnf", "//docs/generated/sql/bnf:show_cluster_setting.bnf", "//docs/generated/sql/bnf:show_columns_stmt.bnf", diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index 0ff0009f229d..508aa82678d8 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -12641,7 +12641,6 @@ opt_comma: transaction_mode: transaction_iso_level { - /* SKIP DOC */ $$.val = tree.TransactionModes{Isolation: $1.isoLevel()} } | transaction_user_priority