Skip to content

Commit

Permalink
Update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
konskov committed Sep 15, 2023
1 parent 0419d25 commit 88ece27
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 21 additions & 2 deletions src/nodes/chunk_dispatch/chunk_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "guc.h"
#include "nodes/hypertable_modify.h"
#include "ts_catalog/chunk_data_node.h"
#include "hypercube.h"

static Node *chunk_dispatch_state_create(CustomScan *cscan);

Expand Down Expand Up @@ -106,13 +107,31 @@ ts_chunk_dispatch_get_chunk_insert_state(ChunkDispatch *dispatch, Point *point,
elog(ERROR, "cannot INSERT into frozen chunk \"%s\"", get_rel_name(chunk->table_id));
#endif
if (chunk && IS_OSM_CHUNK(chunk))
{
const Dimension *time_dim =

Check warning on line 111 in src/nodes/chunk_dispatch/chunk_dispatch.c

View check run for this annotation

Codecov / codecov/patch

src/nodes/chunk_dispatch/chunk_dispatch.c#L111

Added line #L111 was not covered by tests
hyperspace_get_open_dimension(dispatch->hypertable->space, 0);
Assert(time_dim != NULL);

Oid outfuncid = InvalidOid;
bool isvarlena;
getTypeOutputInfo(time_dim->fd.column_type, &outfuncid, &isvarlena);
Assert(!isvarlena);
Datum start_ts = ts_internal_to_time_value(chunk->cube->slices[0]->fd.range_start,
time_dim->fd.column_type);
Datum end_ts = ts_internal_to_time_value(chunk->cube->slices[0]->fd.range_end,
time_dim->fd.column_type);
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("Cannot insert into tiered chunk range of %s.%s",
errmsg("Cannot insert into tiered chunk range of %s.%s - attempt to create "
"new chunk "
"with range [%s %s] failed",
NameStr(dispatch->hypertable->fd.schema_name),
NameStr(dispatch->hypertable->fd.table_name)),
NameStr(dispatch->hypertable->fd.table_name),
DatumGetCString(OidFunctionCall1(outfuncid, start_ts)),
DatumGetCString(OidFunctionCall1(outfuncid, end_ts))),
errhint(
"Hypertable has tiered data with time range that overlaps the insert")));
}

Check warning on line 134 in src/nodes/chunk_dispatch/chunk_dispatch.c

View check run for this annotation

Codecov / codecov/patch

src/nodes/chunk_dispatch/chunk_dispatch.c#L134

Added line #L134 was not covered by tests

if (!chunk)
{
Expand Down
2 changes: 1 addition & 1 deletion tsl/test/expected/chunk_utils_internal.out
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ SELECT ts_setup_osm_hook();

\set ON_ERROR_STOP 0
INSERT INTO test_chunkapp VALUES ('2020-01-03 02:00'::timestamptz, 3);
ERROR: Cannot insert into tiered chunk range of public.test_chunkapp
ERROR: Cannot insert into tiered chunk range of public.test_chunkapp - attempt to create new chunk with range [Fri Jan 03 00:00:00 2020 PST Sat Jan 04 00:00:00 2020 PST] failed
\set ON_ERROR_STOP 1
SELECT ts_undo_osm_hook();
ts_undo_osm_hook
Expand Down

0 comments on commit 88ece27

Please sign in to comment.