Fully qualified table names in generated queries

perry501's profile image perry501 posted 1 month ago in General Permalink

Hi,

would it be possible to add an option to use fully qualified table names when HeidiSQL generates a query via “Query top xxx rows”?

Currently HeidiSQL generates:

SELECT * FROM tablename LIMIT 1000;

I would prefer:

SELECT * FROM database.tablename LIMIT 1000;

This becomes especially useful when the generated query is modified afterwards, for example:

SELECT * FROM database.tablename WHERE ......;

I frequently work with many databases on the same server. If another database becomes the active/default database, an unqualified query can fail with errors such as:

Table 'fuhrpark.fahrzeugart' doesn't exist

Using database.table in generated queries would make them independent of the currently selected database and would also make copying queries between query tabs much safer.

Ideally this could be an optional setting, for example:

“Use fully qualified table names in generated queries”

The same option could possibly also apply to queries generated by the Query Helper.

Thanks!

Code modification/commit aa0f350 from Ansgar Becker <anse@heidisql.com>, 1 month ago, revision 12.21.0.7347
feat: Use fully qualified table name in "Select Top x rows" action when a click on it is combined with Shift

https://www.heidisql.com/forum.php?t=45359
ansgar's profile image ansgar posted 1 month ago Permalink

Nice idea. I just pushed a change which now uses the fully qualified db.table syntax when you have Shift pressed while clicking the "Select top x rows" item. A click without Shift still uses the table only.

Please login to leave a reply, or register at first.