I’ve got an interesting (to me at least) issue with MySQL views. I’ve got a view that has a nullable field, though in the underlying tables the field is set to NOT NULL. How can I force that field to not allow NULL values?
Also, I’d like to know how to set a primary key on a view. I’m using Navicat and it’s complaining about the lack of a primary key. Does a view need a primary key? How do I create one?
All the documentation I’ve seen on MySQL.com and elsewhere just shows a view being created on a select statement. I’ve seen where it talks about definitions and algorithims, but it doesn’t say anything about creating keys or making fields nullable (or not).
The issue this is creating is that when I do a join on the 2 views, it’s returning a row of all NULLS where I would expect it to return zero rows. I think that’s caused by the key field behaving as though it’s nullable (though it shouldn’t be).
This just seems really weird to me. Anyone have any greater wisdom on this topic?
CrimsonDryad Web Design Services
Web Design, Custom Software Development