By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
SELECT 18
| field1 | spotted_table | origin_query |
|---|---|---|
| a | table2_insert_target | INSERT INTO table2_insert_target{ name, age, city, id} SELECT name, age, city, id FROM table1_select_source |
| a | table1_select_source | INSERT INTO table2_insert_target{ name, age, city, id} SELECT name, age, city, id FROM table1_select_source |
| b | table3_select_source | select from table3_select_source |
| c | table4_select_source | select * from table4_select_source |
| d | table5_delete_target | delete from table5_delete_target using table6_delete_source |
| d | table6_delete_source | delete from table5_delete_target using table6_delete_source |
| e | table7_update_target | update table7_update_target from table8_update_source |
| e | table8_update_source | update table7_update_target from table8_update_source |
| f | table9_table_expression | table table9_table_expression |
| g | table10_not_unpacked | select table10_not_unpacked from table10_not_unpacked |
| h | table11_select_into_target | SELECT $$abc$$ InTo table11_select_into_target; |
| i | table12_from_only | select * from only table12_from_only; |
| j | table13_join1 | select * from table13_join1 join table14_join2 on true |
| j | table14_join2 | select * from table13_join1 join table14_join2 on true |
| k | table14_table_expression_in_subquery | select * from (table table14_table_expression_in_subquery); |
| l | "table15_double_quoted" | select * from "table15_double_quoted" |
| m | "select * from table16_problems,, !@$@%#%#^@&%;;'" | select * from only "select * from table16_problems,, !@$@%#%#^@&%;;'" |
| n | "select * from table17_multiple_problems,, !@$@%#%#^@&%;;'" | select * from only "select * from table17_multiple_problems,, !@$@%#%#^@&%;;'", "table18_more_problems_if_greedy: THIS SHOULD NOT BE A PART OF table17" |
| o | only | select * from only """" |
| p | "table19_comma_separated1" | select * from only "table19_comma_separated1", "table20_comma_separated2", "table21_comma_separated3" |
| q | "table22_comma_separated1" | select * from only "table22_comma_separated1", (select from table23_in_comma_separated_subquery) as x, "table24_double_quoted_after_subquery" |
| q | table23_in_comma_separated_subquery | select * from only "table22_comma_separated1", (select from table23_in_comma_separated_subquery) as x, "table24_double_quoted_after_subquery" |
| r | "table25_comma_separated1" | select * from only "table25_comma_separated1" as "table28_alias", (select from table26_in_comma_separated_subquery) as x, table27_unquoted_after_subquery |
| r | table26_in_comma_separated_subquery | select * from only "table25_comma_separated1" as "table28_alias", (select from table26_in_comma_separated_subquery) as x, table27_unquoted_after_subquery |
SELECT 24