Postgresql Unique Constraint Create Sql Table From Another Table