Skip to content

Commit

Permalink
Merge pull request #24051 from cockroachdb/new-sql-diagram
Browse files Browse the repository at this point in the history
docs: Add SHOW SCHEMAS diagram
  • Loading branch information
Jesse Seldess authored Mar 20, 2018
2 parents 3347e63 + dc139c8 commit 526bab2
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 24 deletions.
3 changes: 3 additions & 0 deletions docs/generated/sql/bnf/show_schemas.bnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
show_schemas_stmt ::=
'SHOW' 'SCHEMAS' 'FROM' name
| 'SHOW' 'SCHEMAS'
97 changes: 73 additions & 24 deletions pkg/cmd/docgen/diagrams.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,28 +760,40 @@ var specs = []stmtSpec{
name: "show_cluster_setting",
stmt: "show_csettings_stmt",
},
{name: "show_columns", stmt: "show_stmt", match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'COLUMNS'")}, replace: map[string]string{"var_name": "table_name"}, unlink: []string{"table_name"}},
{name: "show_constraints", stmt: "show_stmt", match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'CONSTRAINTS'")}, replace: map[string]string{"var_name": "table_name"}, unlink: []string{"table_name"}},
{
name: "show_create_sequence_stmt",
match: []*regexp.Regexp{
regexp.MustCompile("'SHOW' 'CREATE' 'SEQUENCE'"),
},
name: "show_columns",
stmt: "show_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'COLUMNS'")},
replace: map[string]string{"var_name": "table_name"},
unlink: []string{"table_name"},
},
{
name: "show_constraints",
stmt: "show_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'CONSTRAINTS'")},
replace: map[string]string{"var_name": "table_name"},
unlink: []string{"table_name"},
},
{
name: "show_create_sequence_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'CREATE' 'SEQUENCE'")},
replace: map[string]string{"var_name": "sequence_name"},
unlink: []string{"sequence_name"},
},
{
name: "show_create_table_stmt",
},
{
name: "show_create_view_stmt",
match: []*regexp.Regexp{
regexp.MustCompile("'SHOW' 'CREATE' 'VIEW'"),
},
name: "show_create_view_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'CREATE' 'VIEW'")},
replace: map[string]string{"var_name": "view_name"},
unlink: []string{"view_name"},
},
{name: "show_databases", stmt: "show_stmt", match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'DATABASES'")}},
{
name: "show_databases",
stmt: "show_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'DATABASES'")},
},
{
name: "show_backup",
stmt: "show_backup_stmt",
Expand All @@ -801,29 +813,66 @@ var specs = []stmtSpec{
},
unlink: []string{"table_name", "database_name", "user_name"},
},
{name: "show_index", stmt: "show_stmt", match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'INDEX'")}, replace: map[string]string{"var_name": "table_name"}, unlink: []string{"table_name"}},
{name: "show_jobs", stmt: "show_jobs_stmt"},
{name: "show_keys", stmt: "show_stmt", match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'KEYS'")}},
{name: "show_queries", stmt: "show_queries_stmt"},
{name: "show_sessions", stmt: "show_sessions_stmt"},
{name: "show_tables", stmt: "show_stmt", match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'TABLES'")}},
{
name: "show_index",
stmt: "show_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'INDEX'")},
replace: map[string]string{"var_name": "table_name"},
unlink: []string{"table_name"},
},
{
name: "show_jobs",
stmt: "show_jobs_stmt",
},
{
name: "show_keys",
stmt: "show_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'KEYS'")},
},
{
name: "show_queries",
stmt: "show_queries_stmt",
},
{
name: "show_schemas",
stmt: "show_schemas_stmt",
},
{
name: "show_sessions",
stmt: "show_sessions_stmt",
},
{
name: "show_tables",
stmt: "show_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'TABLES'")},
},
{
name: "show_trace",
stmt: "show_trace_stmt",
inline: []string{"opt_compact"},
exclude: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'EXPERIMENTAL_REPLICA'")},
},
{name: "show_transaction", stmt: "show_stmt", match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'TRANSACTION'")}},
{name: "show_users", stmt: "show_stmt", match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'USERS'")}},
{name: "split_index_at",
stmt: "alter_split_index_stmt",
inline: []string{"table_name_with_index"},
replace: map[string]string{"qualified_name": "table_name", "'@' name": "'@' index_name"},
unlink: []string{"table_name", "index_name"}},
{
name: "show_transaction",
stmt: "show_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'TRANSACTION'")},
},
{
name: "show_users",
stmt: "show_stmt",
match: []*regexp.Regexp{regexp.MustCompile("'SHOW' 'USERS'")},
},
{
name: "sort_clause",
inline: []string{"sortby_list", "sortby", "opt_asc_desc"},
},
{
name: "split_index_at",
stmt: "alter_split_index_stmt",
inline: []string{"table_name_with_index"},
replace: map[string]string{"qualified_name": "table_name", "'@' name": "'@' index_name"},
unlink: []string{"table_name", "index_name"},
},
{
name: "split_table_at",
stmt: "alter_split_stmt",
Expand Down

0 comments on commit 526bab2

Please sign in to comment.