But I think this is a bug anyway. The app is just blown out of the water. It is impossible to debug this problem, otherwise I would have done so.
You can debug lcl (lazarus-libs) or fcl (fp-libs) when you compile lazarus and fpc in development mode.
Sqldb-components belongs to fcl so you need to recompile fcl also in debug mode.
You can also compile all lcl-libraries, that required from your application when you add
-gw2 to projects custom options.
look at screenshot.
If there is a circular reference between the query object and the datasource that should be caught, perhaps at design time, shouldn't it? I'm trying to imagine how that could be a feature, especially in this case when the original query takes no parameters.
It is for TSQLQuery impossible to detect if the datasource component is for results or for paramater values.
I think to many controls make a system slow, it is good how it is.
Sometimes it is good to read the documentation especially for the functions you are using.
When you use db-components with form designer, then never forget to set active property for connections and querries to false before saving. Maybe the user have their databases in other folders and in this case they get at application start exception.
good luck.