From 4a380db2aadfd7997188da29125c17f06700ae34 Mon Sep 17 00:00:00 2001 From: Keyur Panchal Date: Tue, 24 Dec 2024 08:59:59 -0700 Subject: [PATCH] Add hint when hypertable creation fails 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. --- .unreleased/pr_7565 | 2 ++ src/indexing.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .unreleased/pr_7565 diff --git a/.unreleased/pr_7565 b/.unreleased/pr_7565 new file mode 100644 index 00000000000..1dde2c8222b --- /dev/null +++ b/.unreleased/pr_7565 @@ -0,0 +1,2 @@ +Implements: #7565 Add hint when hypertable creation fails +Thanks: @k-rus for suggesting the improvement diff --git a/src/indexing.c b/src/indexing.c index 43c87395547..a9e2f4a6fa3 100644 --- a/src/indexing.c +++ b/src/indexing.c @@ -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."))); } }