I want to disallow users from inserting into a table product
(which has auto-incremented ids) if they’re setting the id manually.
So this would be valid (id generated automatically since it’s set as AUTO_INCREMENT
):
INSERT INTO product (name) VALUES ("Product1")
But this wouldn’t (id being set manually):
INSERT INTO product (id, name) VALUES (10, "Product1")
Is this possible in any way?
2
Answers
Trigger logic may help.
fiddle
Give the user column-level permissions.
Then the user tries these: