Skip to content

Commit

Permalink
Merge #140680
Browse files Browse the repository at this point in the history
140680: docgen: add DO statement diagram r=DrewKimball a=taroface

Added a SQL statement diagram for `DO`. The diagram looks like this:

<img width="519" alt="image" src="https://github.com/user-attachments/assets/30feb56a-2085-4fa6-800c-d7920ec4fe49" />

This is necessary for the accompanying docs PR: cockroachdb/docs#19356

Epic: none
Release note: none
Release justification: non-production code change

Co-authored-by: Ryan Kuo <[email protected]>
  • Loading branch information
craig[bot] and taroface committed Feb 10, 2025
2 parents 21a181a + 38f1665 commit 562d26b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/generated/sql/bnf/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ FILES = [
"default_value_column_level",
"delete_stmt",
"discard_stmt",
"do_stmt",
"do",
"drop_column",
"drop_constraint",
"drop_database",
Expand Down
3 changes: 3 additions & 0 deletions docs/generated/sql/bnf/do.bnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
do_stmt ::=
'DO' ( ( ( | 'LANGUAGE' ( 'PLPGSQL' ) routine_body_str ) ) )*
| 'DO' 'LANGUAGE' ( 'PLPGSQL' ) routine_body_str ( ( ( | 'LANGUAGE' ( 'PLPGSQL' ) routine_body_str ) ) )*
2 changes: 0 additions & 2 deletions docs/generated/sql/bnf/do_stmt.bnf

This file was deleted.

10 changes: 10 additions & 0 deletions pkg/cmd/docgen/diagrams.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,16 @@ var specs = []stmtSpec{
stmt: "column_table_def",
inline: []string{"col_qual_list"},
},
{
name: "do",
stmt: "do_stmt",
inline: []string{"do_stmt_opt_list", "do_stmt_opt_item"},
replace: map[string]string{
"'SCONST'": "",
"non_reserved_word_or_sconst": "( 'PLPGSQL' ) routine_body_str",
},
unlink: []string{"routine_body_str"},
},
{
name: "for_locking",
stmt: "for_locking_item",
Expand Down
2 changes: 1 addition & 1 deletion pkg/gen/bnf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ BNF_SRCS = [
"//docs/generated/sql/bnf:default_value_column_level.bnf",
"//docs/generated/sql/bnf:delete_stmt.bnf",
"//docs/generated/sql/bnf:discard_stmt.bnf",
"//docs/generated/sql/bnf:do_stmt.bnf",
"//docs/generated/sql/bnf:do.bnf",
"//docs/generated/sql/bnf:drop_column.bnf",
"//docs/generated/sql/bnf:drop_constraint.bnf",
"//docs/generated/sql/bnf:drop_database.bnf",
Expand Down
2 changes: 1 addition & 1 deletion pkg/gen/docs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ DOCS_SRCS = [
"//docs/generated/sql/bnf:default_value_column_level.bnf",
"//docs/generated/sql/bnf:delete_stmt.bnf",
"//docs/generated/sql/bnf:discard_stmt.bnf",
"//docs/generated/sql/bnf:do_stmt.bnf",
"//docs/generated/sql/bnf:do.bnf",
"//docs/generated/sql/bnf:drop_column.bnf",
"//docs/generated/sql/bnf:drop_constraint.bnf",
"//docs/generated/sql/bnf:drop_database.bnf",
Expand Down

0 comments on commit 562d26b

Please sign in to comment.