Skip to content

Commit

Permalink
Add hint when hypertable creation fails
Browse files Browse the repository at this point in the history
When creating a hypertable, we create default indexes on the partition
column, which requires that the column be a part of the table's primary
or composite key. The error message shown to the user in this scenario
did not indicate this correctly. This adds a hint to make this clearer.

Closes #2907.
  • Loading branch information
kpan2034 committed Dec 24, 2024
1 parent 27c4c02 commit 4a380db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .unreleased/pr_7565
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Implements: #7565 Add hint when hypertable creation fails
Thanks: @k-rus for suggesting the improvement
4 changes: 2 additions & 2 deletions src/indexing.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ ts_indexing_verify_columns(const Hyperspace *hs, const List *indexelems)
ereport(ERROR,
(errcode(ERRCODE_TS_BAD_HYPERTABLE_INDEX_DEFINITION),
errmsg("cannot create a unique index without the column \"%s\" (used in "
"partitioning)",
NameStr(dim->fd.column_name))));
"partitioning)", NameStr(dim->fd.column_name)),
errhint("If you're creating a hypertable on a table with a primary key, ensure the partitioning column is part of the primary or composite key.")));
}
}

Expand Down

0 comments on commit 4a380db

Please sign in to comment.