Add support for setting primary key on restricted view

Refactored TableView to better group the differences between a "real"
view (now called RegularTableView) and a view in a restricted schema
(now called RestrictedTableView).