• unknown's avatar
    A fix and a test case for Bug#21002 "Derived table not selecting from a · 0fa250a9
    unknown authored
    "real" table fails in JOINs".
    
    This is a regression caused by the fix for Bug 18444. 
    This fix removed the assignment of empty_c_string to table->db performed 
    in add_table_to_list, as neither me nor anyone else knew what it was 
    there for. Now we know it and it's covered with tests: the only case 
    when a table database name can be empty is when the table is a derived 
    table. The fix puts the assignment back but makes it a bit more explicit.
    
    Additionally, finally drop sp.result.orig which was checked in by mistake. 
    
    
    BitKeeper/deleted/.del-sp.result.orig:
      Delete: mysql-test/r/sp.result.orig
    mysql-test/r/derived.result:
      Updated result file.
    mysql-test/r/sp.result:
      Test results fixed (Bug#21002)
    mysql-test/t/derived.test:
      New error return for the case when MULTI-DELETE tries to delete from
      a derived table: now derived tables belong to their own db (""), and
      MUTLI-DELETE can't find the correspondent table for it in the 
      DELETE list, as it can't resolve tables in different dbs by alias
      (See Bug#21148 for details)
    mysql-test/t/sp.test:
      Add a test case for Bug#21002 "Derived table not selecting from a "real"
       table fails in JOINs"
    sql/sp.cc:
      Make empty_c_string globally accessible.
    sql/sql_class.cc:
      Add empty_c_string definition.
    sql/sql_class.h:
      Add a comment for the constructor of Table_ident which is
      used for derived tables. Make sure this constructor also initializes
      the database name, not only the table name.
    sql/sql_parse.cc:
      Don't call check_db_name for empty database. 
      Currently the only case when a table database name can be empty
      is when the table is a derived table.
      Report the right error if the database name is wrong (ER_WRONG_DB_NAME,
      not ER_WRONG_TABLE_NAME).
    0fa250a9
sql_class.h 66.4 KB