Menu

#4663 (ok 4.3.4) Export missing back ticks for order table name

4.3.3
fixed
None
1
2014-12-29
2014-12-22
Brandon S
No

When doing an export with a table named "order", the export is not putting the back ticks around the name which causes an error when trying to import.

Discussion

  • Brandon S

    Brandon S - 2014-12-22

    Version information: 4.3.3 (up to date)
    Git revision: 953e3e0 from STABLE branch,
    committed on Dec 21, 2014 at 02:41 AM by Marc Delisle
    Server type: MySQL
    Server version: 5.6.21 - Homebrew
    Protocol version: 10
    Apache
    Database client version: libmysql - mysqlnd 5.0.11-dev - 20120503 - $Id: f373ea5dd5538761406a8022a4b8a374418b240e $

     
  • Marc Delisle

    Marc Delisle - 2014-12-22

    Cannot reproduce in 4.3.3; please attach a small export showing the problem.

     
  • Brandon S

    Brandon S - 2014-12-22

    I just did a little more digging. Create a table with this

    CREATE TABLE IF NOT EXISTS `order` (
      id bigint(20) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    ALTER TABLE `order`
      ADD PRIMARY KEY (id);
    
    ALTER TABLE `order`
      MODIFY id bigint(20) NOT NULL AUTO_INCREMENT;
    

    Then do an export but under custom uncheck "Enclose table and column names with backquotes" Then the export looks like this

    CREATE TABLE IF NOT EXISTS `order` (
      id bigint(20) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    ALTER TABLE order
      ADD PRIMARY KEY (id);
    
    ALTER TABLE order
      MODIFY id bigint(20) NOT NULL AUTO_INCREMENT;
    
     

    Last edit: Brandon S 2014-12-22
  • Marc Delisle

    Marc Delisle - 2014-12-22

    So, you are wondering why there are no backquotes, when you have asked to not put backquotes in the export file?

     
  • Brandon S

    Brandon S - 2014-12-22

    No i expect that if the output backquote reserved words for create table statements that it will also do so for alter table statements. Even with "Enclose table and column names with backquotes" off.

     
  • Brandon S

    Brandon S - 2014-12-22

    I should say it this way. Currently with "Enclose table and column names with backquotes" off it will still backquote reserved words in the create table statement but not the alter table statement. So ether one or the other is a bug.

     
  • Marc Delisle

    Marc Delisle - 2014-12-22

    So the bug's title should be "Deactivating backquotes in export does not work in CREATE TABLE", right?

     
  • Brandon S

    Brandon S - 2014-12-22

    Depends on the aim of the exporter. I didn't want every thing to be backquoted but since I am using a reserved word for a table name it has to be. So my preference would be to still backquote all reserved words because otherwise you sql export will not work.

    Another thing to note is that even for CREATE TABLE statements it will only backquote reserved words. Which is what I wanted.

     
  • Madhura Jayaratne

    • assigned_to: Madhura Jayaratne
     
  • Rakesh Kumar

    Rakesh Kumar - 2014-12-23

    Hi,
    If i understand it correctly , for table name with reserved word ,the table name should be backquoted both in "create table .." as well as "alter table .." statements even if the user has custom uncheck "Enclose table and column names with backquotes" ? as if we don't backquote the reserved word table name , it will be an issue while importing it back.

     
  • Madhura Jayaratne

    Rakesh,
    Yes, what you are saying is correct.

     
  • Marc Delisle

    Marc Delisle - 2014-12-23
    • summary: Export missing back ticks for order table name --> (ok 4.3.4) Export missing back ticks for order table name
    • status: open --> resolved
    • Priority: 5 --> 1
     
  • Marc Delisle

    Marc Delisle - 2014-12-29
    • Status: resolved --> fixed