Skip to content

Commit 412bb5c

Browse files
Do not use ERRCODE_INTERNAL_ERROR for user errors
This code is reserved for internal program errors, i.e. bugs. This commit fixes only some of these existing incorrect codes, we have more.
1 parent 3a2c482 commit 412bb5c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/chunk_adaptive.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,9 @@ ts_calculate_chunk_interval(PG_FUNCTION_ARGS)
440440
hypertable_id = ts_dimension_get_hypertable_id(dimension_id);
441441

442442
if (hypertable_id <= 0)
443-
elog(ERROR, "could not find a matching hypertable for dimension %u", dimension_id);
443+
ereport(ERROR,
444+
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
445+
errmsg("could not find a matching hypertable for dimension %u", dimension_id)));
444446

445447
ht = ts_hypertable_get_by_id(hypertable_id);
446448

@@ -830,7 +832,7 @@ ChunkSizingInfo *
830832
ts_chunk_sizing_info_get_default_disabled(Oid table_relid)
831833
{
832834
ChunkSizingInfo *chunk_sizing_info = palloc(sizeof(*chunk_sizing_info));
833-
*chunk_sizing_info = (ChunkSizingInfo){
835+
*chunk_sizing_info = (ChunkSizingInfo) {
834836
.table_relid = table_relid,
835837
.target_size = NULL,
836838
.func = get_default_chunk_sizing_fn_oid(),

tsl/src/compression/create.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,9 +1006,10 @@ validate_hypertable_for_compression(Hypertable *ht)
10061006
if (strncmp(NameStr(attr->attname),
10071007
COMPRESSION_COLUMN_METADATA_PREFIX,
10081008
strlen(COMPRESSION_COLUMN_METADATA_PREFIX)) == 0)
1009-
elog(ERROR,
1010-
"cannot convert tables with reserved column prefix '%s' to columnstore",
1011-
COMPRESSION_COLUMN_METADATA_PREFIX);
1009+
ereport(ERROR,
1010+
(errcode(ERRCODE_RESERVED_NAME),
1011+
errmsg("cannot convert tables with reserved column prefix '%s' to columnstore",
1012+
COMPRESSION_COLUMN_METADATA_PREFIX)));
10121013
}
10131014

10141015
if (row_size > MaxHeapTupleSize)
@@ -1192,7 +1193,7 @@ compression_setting_orderby_get_default(Hypertable *ht, ArrayType *segmentby)
11921193
if (!OidIsValid(orderby_fn))
11931194
{
11941195
/* fallback to original logic */
1195-
OrderBySettings obs = (OrderBySettings){ 0 };
1196+
OrderBySettings obs = (OrderBySettings) { 0 };
11961197
obs = add_time_to_order_by_if_not_included(obs, segmentby, ht);
11971198
elog(LOG_SERVER_ONLY,
11981199
"order_by default: hypertable=\"%s\" function=\"\" confidence=-1",

0 commit comments

Comments
 (0)