Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 336
Ropstah Avatar asked May 19 '09 17:05

Ropstah


1 Answers

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

like image 168
simon622 Avatar answered Nov 14 '22 22:11

simon622