• unknown's avatar
    Bug #16110: insert permitted into view col w/o default value · 5d0a1a1e
    unknown authored
    When compiling INSERT statements the check whether columns are provided values
    depends on the flag whether a field is used in that query (Field::query_id).
    However the check for updatability of VIEW columns (check_view_insertability())
    was calling fix_fields() and thus setting the Field::query_id even for the 
    view fields that are not referenced in the current INSERT statement.
    So the correct check for columns without default values 
    ( check_that_all_fields_are_given_values() ) is assuming that all the VIEW
    columns were mentioned in the INSERT field list and was issuing no 
    warnings or errors.
    Fixed check_view_insertability() to turn off the flag whether or not to set
    Field::query_id (THREAD::set_query_id) before calling fix fields and restore
    it when it's done.
    
    
    mysql-test/r/view.result:
      Bug #16110: insert permitted into view col w/o default value
        * test case
    mysql-test/t/view.test:
      Bug #16110: insert permitted into view col w/o default value
        * test case
    sql/sql_insert.cc:
      Bug #16110: insert permitted into view col w/o default value
        * avoid setting the "field used" flag for fields when checking view columns 
          for updatability.
        * a missing DBUG_RETURN added.
    5d0a1a1e
view.test 67.5 KB