fix error with postgresql
* postgresql stores foreign key names in lower case by default, so the precondition was erroneously passing
* check for the presence of a primary key instead
Merge pull request #401 from MageFroh/pg-fix

fix error with postgresql