Simple view not updatable / readonly strange and why !??
I just defined a MySQL database as backend for MsAcces, when I did detected that even a simple view can not be updated is readonly.
The situation is quite simple:
- table one is for example a list of shops
- table two holds in one row details about that shop
I defined a view (in access a query) combining the two tables, where the tables are joined by the shopname being the PK in both tables.
MySQL workbench indicates that the view is read only !! ?????
So trying to update fields or adding records is a NO GO !
However why!?
- a comparable query in MsAccess is no issue
- and I can not remember that kind of issue with MySQL in the past !!!
- and if I define a mysql query which is ^identical^ to the view ... I can update !!
- I even did add a foreign key in table two PK towards table one PK, what did not change the situation.
So I am lost! I hope someone does understand it and has the solution. Below the very simple tables I defined trying to understand / doing some testing.
Note that I am using windows11 64bit pro in combination with MySQL 8.4.2
Here some test code:
CREATE TABLE `shops` (
`ShopNo` int NOT NULL,
`ShopName` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ShopNo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `shop_details` (
`ShopRef` int NOT NULL,
`ShopDetails` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ShopRef`),
CONSTRAINT `ShopNo` FOREIGN KEY (`ShopRef`) REFERENCES `shops` (`ShopNo`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `processfiles`.`shopinfo` AS select `processfiles`.`shops`.`ShopNo` AS `shopno`,`processfiles`.`shops`.`ShopName` AS `shopname`,`processfiles`.`shop_details`.`ShopRef` AS `shopref`,`processfiles`.`shop_details`.`ShopDetails` AS `shopdetails` from (`processfiles`.`shops` join `processfiles`.`shop_details` on((`processfiles`.`shops`.`ShopNo` = `processfiles`.`shop_details`.`ShopRef`)));
Subject
Written By
Posted
Simple view not updatable / readonly strange and why !??
September 14, 2024 05:16AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.