mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-18 03:23:37 +08:00
Fix hint when dropping chunks with dependencies
When dropping chunks that have dependent objects, like a continuous aggregate view, a dependent object error is raised. The hint message is overridden to produce a more useful hint for the drop chunks use case. However, the hint is overriden without checking the error code, which means the hint is replaced for any error raised. This can produce confusing log output. The issue is fixed by first examining the error code before overriding the hint.
This commit is contained in:
parent
caf64357f4
commit
e6a61c065c
@ -3456,10 +3456,14 @@ ts_chunk_drop_chunks(PG_FUNCTION_ARGS)
|
||||
* CASCADE (we don't support it), so we replace the hint with a more
|
||||
* accurate hint for our situation. */
|
||||
ErrorData *edata;
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
edata = CopyErrorData();
|
||||
FlushErrorState();
|
||||
edata->hint = pstrdup("Use DROP ... to drop the dependent objects.");
|
||||
|
||||
if (edata->sqlerrcode == ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST)
|
||||
edata->hint = pstrdup("Use DROP ... to drop the dependent objects.");
|
||||
|
||||
ts_cache_release(hcache);
|
||||
ReThrowError(edata);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user