Toad World® Forums

Code completion within queries

This feature already works great, but there are some things that I don’t understand or could be improved.

  1. Why is “col.owner = con.owner” not suggested in the following query?

SELECT *
FROM all_tables tab
JOIN all_constraints con ON ( con.owner = tab.owner AND con.table_name = tab.table_name )
JOIN all_cons_columns col ON ( col.

  1. Do you think it would make sense to suppress join suggestions that are already used? Is it possible?

Example: con.owner = tab.owner already exists

SELECT *
FROM all_tables tab
JOIN all_constraints con ON ( con.owner = tab.owner AND con.

  1. I always write the joined table alias first (JOIN a ON a.x = b.x not JOIN a ON b.x = a.x).
    That’s the way that makes most sense to me, but I’m sure that there are others who do it the other way round.

TOAD suggests both ways now, so both camps have to skip the “wrong” suggestions at some time. Do you think it would make sense to let me configure which option I prefer and only display that one?
Maybe offer three ways: always A first, always B first, both (current way). Could also be two check-boxes, default is both checked, and if someone un-checks both the feature is disabled?

This would really add some more value to this already impressive feature.

  1. Accepting the suggestion in the following case leads to wrong code:

SELECT *
FROM all_tables tab
JOIN all_constraints con ON ( con.table_name |

The problem is with the space after “con.table_name”. If the space is not there, the suggestion is inserted as expected, if the “=” is already there it is also ok.

Leads to

SELECT *
FROM all_tables tab
JOIN all_constraints con ON ( con.table_name con.table_name = tab.table_name

Thanks a lot!

Good stuff, I can reproduce 1,2, and 4 have logged them as defects. #3 I’ve logged as something to investigate as well.

Thanks,

Michael