Pgsql small fix  (update 2)

[1] Updated the code styling and braces.
[2] Added additional check for foreign tables that are not in the same schema.
[3] Fixed typo.
[4] Removed unused columns for the constraints SQL.