Data tab: list column names explicitly when the user only has column-level SELECT privileges

jev1984's profile image jev1984 posted 3 weeks ago in Feature discussion Permalink

Problem On MariaDB/MySQL, a user may have only column-level privileges on a table, e.g. GRANT SELECT (id, created_at, active) ON db.users TO 'analyst'@'%'; information_schema.COLUMNS then returns only the permitted columns, so HeidiSQL sees them as “all columns” of the table. In TMainForm.DataGridBeforePaint (source/main.pas, around if (FullColumnCount = SelectedTableColumns.Count) and (not NeedFullColumns) then Select := '';) the column list is collapsed to SELECT . The server rejects that with SQL Error (1142): SELECT command denied to user 'analyst'@'…' for table 'users', and the Data tab shows “0 rows total”. The same statement with an explicit column list (SELECT id, created_at, active FROM db.users) works. Today the only workaround is to hide one column via the Columns button so that HeidiSQL builds an explicit list (only on tables with a primary key).

Request One of:

Never collapse to and always send the explicit column list (the list is already built), or a preference such as ”Data tab: always list column names instead of SELECT “, or on error 1142 for SELECT *, retry automatically with the explicit column list.

Environment HeidiSQL Version 12.21.0.7360 (64 Bit), MariaDB, users with column-level grants for data-protection reasons

ansgar's profile image ansgar posted 3 weeks ago Permalink

Yeah that's indeed something which breaks with disallowed columns. Never saw anyone setting or using column privileges but it's of course possible. Perhaps the error "SELECT command denied" may be helpful for a workaround. Will check that.

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