Cover ADD COLUMN commands defining fkeys

pull/4453/head
Onur Tirtir 2020-12-25 10:25:16 +03:00
parent 1b53193eb9
commit 6af1ece547
1 changed files with 13 additions and 0 deletions

View File

@ -1033,6 +1033,19 @@ AlterTableCmdAddsFKey(AlterTableCmd *command, Oid relationId)
return true;
}
}
else if (alterTableType == AT_AddColumn)
{
ColumnDef *columnDef = (ColumnDef *) command->def;
List *constraints = columnDef->constraints;
Constraint *constraint = NULL;
foreach_ptr(constraint, constraints)
{
if (constraint->contype == CONSTR_FOREIGN)
{
return true;
}
}
}
return false;
}