Menu

#2650 (ok 2.11.6) Import of VIEWs fails if tempTable exists

2.11.5
fixed
1
2013-06-11
2008-03-04
Falk Nisius
No

If You export a view with 2.11.5 and you wish to import it in the same Database at a other machine, the creation of the placeholder table fails, because they exists in an older version, also if you have choosen drop table at the export.

Thanks

Discussion

  • Marc Delisle

    Marc Delisle - 2008-03-08
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2008-03-08

    Logged In: YES
    user_id=210714
    Originator: NO

    I think you did not click the option "Add IF NOT EXISTS" when exporting.

     
  • Marc Delisle

    Marc Delisle - 2008-03-08
    • status: open --> pending
     
  • Falk Nisius

    Falk Nisius - 2008-03-10
    • status: pending --> open
     
  • Falk Nisius

    Falk Nisius - 2008-03-10

    Logged In: YES
    user_id=596866
    Originator: YES

    The IF NOT EXISTS Option is not the solution, because it leaves the old tables in their state.
    I try to explain a little szenario:

    We have a developer and a production machine. The tables and views are the following:
    CREATE TABLE test ( value INT );
    CREATE VIEW testview AS SELECT * FROM test;

    If You export with the default IF NOT EXISTS in an empty Database with the same name,
    all works fine. By the way, if the target DB has a other name the fully qualified names in the dump are a problem.

    After that you make some changes at your developer machine at the table structure:

    ALTER TABLE test ADD secondvalue INT;

    The next export is without IF NOT EXISTS, because You wish to propagate the structural changes.
    We select DROP TABLE / DROP VIEW to kill the old structure. A Reimport to the not empty database
    produce the error Table testview already exists, because the view is DROPPED to late directly before
    the creating of the new VIEW.

    I hope that makes it much clearer.

    Falk

    PS: Should I start a new Bug for the fully qualified Views, they prevent an import to a other database at the same machine.
    Perhaps you have to add a switch for full qualified export

     
  • Marc Delisle

    Marc Delisle - 2008-03-17
    • assigned_to: lem9 --> nobody
     
  • Marc Delisle

    Marc Delisle - 2008-03-17

    Logged In: YES
    user_id=210714
    Originator: NO

    Yes, please start a new bug entry for the other bug.

     
  • Falk Nisius

    Falk Nisius - 2008-03-18

    Logged In: YES
    user_id=596866
    Originator: YES

    A solution proposal for the problem is to include in sql.php in the
    function PMA_getTableDefStandIn( $db, $view, $crlf)

    to change the first lines in the following way:

    $create_query = '';
    if ( !empty($GLOBALS['sql_drop_table'])) {
    $create_query .= 'DROP VIEW IF EXISTS ' .PMA_backquote($view) . ';' . $crlf;
    }

    $create_query .= 'CREATE TABLE ';

    that works fine for me, but it isn't tested for other scenarios. Sorry for this way to transmit code, but I didn't involved in the development proccess and I'm afraid to have not enough time to be a serious, reliable and useful developer in the community.

    PS: I start also the new BUG for the full qualified names

     
  • Marc Delisle

    Marc Delisle - 2008-03-18
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2008-03-18
    • summary: Import of VIEWs fails if tempTable exists --> (ok 2.11.6) Import of VIEWs fails if tempTable exists
    • priority: 5 --> 1
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2008-04-29
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

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