I am trying to create an updatable view in MySql, but the result is not updatable. Attrepgen is a table where the first field (aidx = numauto) is the PK.
Any idea why attrepusr is not updatable ?
CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `attrepusr` AS
select
`attrepgen`.`Aidx` AS `Aidx`,
`attrepgen`.`IsOffset` AS `IsOffset`,
`attrepgen`.`Dt` AS `Dt`,
`attrepgen`.`Owner` AS `Owner`,
`attrepgen`.`P1` AS `P1`,
`attrepgen`.`P2` AS `P2`,
`attrepgen`.`P3` AS `P3`,
`attrepgen`.`P4` AS `P4`,
`attrepgen`.`P5` AS `P5`,
`attrepgen`.`P6` AS `P6`,
`attrepgen`.`Target` AS `Target`,
`attrepgen`.`Attend` AS `Attend`,
`attrepgen`.`Delta` AS `Delta`,
`attrepgen`.`Remark` AS `Remark`,
`attrepgen`.`Cat` AS `Cat`
from
`attrepgen`
where
(`attrepgen`.`Owner` = current_user())
for info, the table attrepgen :
CREATE TABLE `attrepgen` (
`Aidx` int(11) NOT NULL AUTO_INCREMENT,
`IsOffset` tinyint(1) NOT NULL,
`Dt` date NOT NULL,
`Owner` varchar(16) NOT NULL,
`P1` time DEFAULT NULL,
`P2` time DEFAULT NULL,
`P3` time DEFAULT NULL,
`P4` time DEFAULT NULL,
`P5` time DEFAULT NULL,
`P6` time DEFAULT NULL,
`Target` decimal(7,3) NOT NULL,
`Attend` decimal(7,3) NOT NULL,
`Delta` decimal(7,3) NOT NULL,
`Remark` varchar(32) DEFAULT NULL,
`Cat` varchar(1) DEFAULT NULL,
PRIMARY KEY (`Aidx`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
I am a bit puzzled.