Skip to content

Commit 83391fe

Browse files
svenklemmtimescale-automation
authored andcommitted
Truncate constraint name before trying to rename
The check whether to rename a constraint would operate on the untruncated names which resulting in an error when the constraint name would be the same after truncation. (cherry picked from commit 18b6932)
1 parent 216780e commit 83391fe

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

.unreleased/pr_10265

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes: #10265 Truncate constraint name before trying to rename

sql/updates/2.27.2--2.28.0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ BEGIN
4444
SELECT pg_catalog.format('%I.%I', c.schema_name, c.table_name) AS chunk_table,
4545
cc.constraint_name AS old_name,
4646
CASE WHEN parent.contype = 'f' THEN cc.hypertable_constraint_name
47-
ELSE format('%s_%s', c.id, cc.hypertable_constraint_name)
47+
ELSE format('%s_%s', c.id, cc.hypertable_constraint_name)::name
4848
END AS new_name
4949
FROM _timescaledb_catalog.chunk_constraint cc
5050
JOIN _timescaledb_catalog.chunk c ON c.id = cc.chunk_id

0 commit comments

Comments
 (0)