Fixes #1334: foreign key is incorrectly determined for pgsql.