#453384: by spydmobile Fixed numerous errors in SQL that were preventing PostgreSQL from working. Also (by mbutcher) fixed a few views glitches.