The attached patch should prevent definition of
foreign keys to referenced columns that are
not constrained with a unique constraint on
the referenced table, and also should fix the
recent report of being able to make a foreign
key constraint on columns that don't really
exist.