Fixes #3268 - Update prod2dev to handle fkeys in psql

A few other small fixes as well, handling missing dates and a slight change in the set_table_name syntax.

The controversial one is the `primary_key=nil` line, but I don't think it hurts. Without it, the rake task crashes on my db (at `architectures_operatingsystems`table) because it's picking up the pkey "id" from some other table. Easy enough to reproduce if anyone wants to spend time tracking down the race condition in Rails itself.