我正在尝试在 MySql 中创建一个可更新的视图,但结果不可更新。Attrepgen 是一个表,其中第一个字段 (aidx = numauto) 是 PK。
知道为什么 attrepusr 不可更新吗?
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())
有关信息,表 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;
我有点疑惑。