aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 265b1c397fb..2705cf11330 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -10712,14 +10712,16 @@ addFkConstraint(addFkConstraintSides fkside,
/*
* Caller supplies us with a constraint name; however, it may be used in
- * this partition, so come up with a different one in that case.
+ * this partition, so come up with a different one in that case. Unless
+ * truncation to NAMEDATALEN dictates otherwise, the new name will be the
+ * supplied name with an underscore and digit(s) appended.
*/
if (ConstraintNameIsUsed(CONSTRAINT_RELATION,
RelationGetRelid(rel),
constraintname))
- conname = ChooseConstraintName(RelationGetRelationName(rel),
- ChooseForeignKeyConstraintNameAddition(fkconstraint->fk_attrs),
- "fkey",
+ conname = ChooseConstraintName(constraintname,
+ NULL,
+ "",
RelationGetNamespace(rel), NIL);
else
conname = constraintname;