Skip to content

Instantly share code, notes, and snippets.

@yoku0825
Created July 19, 2023 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoku0825/6fe9bee23465c916cd148b6164541c04 to your computer and use it in GitHub Desktop.
Save yoku0825/6fe9bee23465c916cd148b6164541c04 to your computer and use it in GitHub Desktop.
My First SHOW PARSE_TREE
mysql81 9> SHOW PARSE_TREE SELECT user, host, db, user.select_priv AS global_select, db.select_priv AS schema_select FROM mysql.user LEFT JOIN mysql.db USING(user, host)\G
*************************** 1. row ***************************
Show_parse_tree: {
"text": "SELECT user, host, db, user.select_priv AS global_select, db.select_priv AS schema_select FROM mysql.user LEFT JOIN mysql.db USING(user, host)",
"type": "PT_select_stmt",
"components": [
{
"text": "SELECT user, host, db, user.select_priv AS global_select, db.select_priv AS schema_select FROM mysql.user LEFT JOIN mysql.db USING(user, host)",
"type": "PT_query_expression",
"components": [
{
"text": "SELECT user, host, db, user.select_priv AS global_select, db.select_priv AS schema_select FROM mysql.user LEFT JOIN mysql.db USING(user, host)",
"type": "PT_query_specification",
"components": [
{
"text": "user, host, db, user.select_priv AS global_select, db.select_priv AS schema_select",
"type": "PT_select_item_list",
"components": [
{
"text": "user",
"type": "PTI_expr_with_alias",
"components": [
{
"text": "user",
"type": "PTI_simple_ident_ident"
}
]
},
{
"text": "host",
"type": "PTI_expr_with_alias",
"components": [
{
"text": "host",
"type": "PTI_simple_ident_ident"
}
]
},
{
"text": "db",
"type": "PTI_expr_with_alias",
"components": [
{
"text": "db",
"type": "PTI_simple_ident_ident"
}
]
},
{
"text": "user.select_priv AS global_select",
"type": "PTI_expr_with_alias",
"alias": "global_select",
"components": [
{
"text": "user.select_priv",
"type": "PTI_simple_ident_q_2d"
}
]
},
{
"text": "db.select_priv AS schema_select",
"type": "PTI_expr_with_alias",
"alias": "schema_select",
"components": [
{
"text": "db.select_priv",
"type": "PTI_simple_ident_q_2d"
}
]
}
]
},
{
"type": "PT_joined_table_using",
"join_type": "LEFT OUTER JOIN",
"components": [
{
"text": "mysql.user",
"type": "PT_table_factor_table_ident",
"table_ident": "`mysql`.`user`"
},
{
"text": "mysql.db",
"type": "PT_table_factor_table_ident",
"table_ident": "`mysql`.`db`"
}
],
"using_fields": "`user`,`host`"
}
]
}
]
}
]
}
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment