Various fixes to autoinrement, postgres, etc/