Menu

#2978 (ok 3.3.1) export view as sql includes INSERT INTO

3.3.0
fixed
1
2014-08-18
2010-02-16
No

Exporting a complete database as sql worked fine in 3.2.2.1. I could use such an export to recreate the database, including views.

In 3.2.5. it doesn't work. The export now has sql code to insert data into views, not just to recreate a view's structure. Trying to use such an export to recreate the database fails, because you can't insert data into a view, and the data is already inserted into the base tables.

Below is a small part of an example export. `vStaff_publications` isn't a table, but a view:

--
-- Tabelstructuur voor tabel `vStaff_publications`
--

DROP TABLE IF EXISTS `vStaff_publications`;
CREATE ALGORITHM=UNDEFINED DEFINER=`alfa`@`localhost` SQL SECURITY DEFINER VIEW `clcg`.`vStaff_publications` AS select `s`.`pub_id` AS `pub_id`,`s`.`staff_id` AS `staff_id`,`s`.`staff_version` AS `staff_version`,concat(`s`.`staff_id`,_utf8'-',`s`.`staff_version`) AS `person`,count(0) AS `n` from (`clcg`.`staff_publications` `s` join `clcg`.`staff_publications` `t`) where (`s`.`pub_id` = `t`.`pub_id`) group by `s`.`pub_id`,`s`.`staff_id`,`s`.`staff_version`;

--
-- Gegevens worden uitgevoerd voor tabel `vStaff_publications`
--

INSERT INTO `vStaff_publications` (`pub_id`, `staff_id`, `staff_version`, `person`, `n`) VALUES
(1, 62, 1, '62-1', 2),
(1, 70, 1, '70-1', 2),
(2, 70, 1, '70-1', 1),

Discussion

  • Marc Delisle

    Marc Delisle - 2010-02-27
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2010-02-27

    Fixed in subversion, thanks for reporting.

     
  • Marc Delisle

    Marc Delisle - 2010-02-27
    • milestone: 1027128 --> 3.3.0
    • priority: 5 --> 1
    • summary: export view as sql includes INSERT INTO --> (ok 3.3.1) export view as sql includes INSERT INTO
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2010-03-16
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed
     
MongoDB Logo MongoDB