Search code examples
mysqlsqlpermissionssql-grant

how to grant privileges to all columns except one?


I want to grant user an update privilege to update all columns except one - Id in my case (changing Id could make a mess in data, existing URLs etc. - foreign keys are not a solution). Is it possible in mysql without listing all the other columns? E.g. somehow by saying:

grant update on db.table to user;
NOT grant update id on db.table to user;

or something like that?

Reasons why I don't want to list all the columns:

  1. it is more robust - I often add some columns to tables later and I would probably forget that I must also update this rule,

  2. I don't have the grant permission so I must ask my hosting provider to run every grant command, so I want to minimize these requests as it is an above-standard service (it's their grace to me).

Particularly for mysql, but I'm also interested in gereric sql solution.


Solution

  • It is not possible - for more details see this question.