Extract pgsql8 foreign keys properly