MySQL Views in Navicat - How to define 'primary key'?

11,803

its implied that the view uses the indices and primary keys of its base table. You can change the semantics of how insert and updates occur when using them via views by playing with the CASCADING CHECK options

See Updatable and Insertable Views

Share:
11,803

Related videos on Youtube

Ropstah
Author by

Ropstah

Updated on June 04, 2022

Comments

  • Ropstah
    Ropstah almost 2 years

    Often when I define a View in Navicat I receive the following message:

    xxx does not have a primary key. Updates to this table will be done using the following pseudo statement: UPDATE xxx SET ModifiedFieldsAndValues WHERE AllFieldsAndOldValues LIMIT 1

    Obviously I only use my Views for viewing data, not updating. But this did make me curious:

    Is there a way to define a "primary key" or "unique index" on a View?

  • Ropstah
    Ropstah almost 15 years
    Ok, but most views consist of multiple tables which are joined together... Does it automatically check if there is a unique combination of indices?
  • Pacerier
    Pacerier about 9 years
    @Ropstah, For that to happen, it needs an index anyway. Does show keys in View give you an empty set?