Various partition related chnages

Detect table already partitoned
Correct INSTEAD OF study_id views (start)
Fix GLOBAL in startup trigger