Skip to content

Do not use ERRCODE_INTERNAL_ERROR for user errors #8188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025

Conversation

Poroma-Banerjee
Copy link
Member

@Poroma-Banerjee Poroma-Banerjee commented May 28, 2025

This code is reserved for internal program errors, i.e. bugs. This commit fixes only some of these existing incorrect codes, we have more.

Or else, the CI pipeline will complain about detecting internal errors from regression tests.

Disable-check: force-changelog-file

Copy link

@antekresic, @erimatnor: please review this pull request.

Powered by pull-review

Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 82.37%. Comparing base (3a2c482) to head (362f6aa).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
tsl/src/compression/create.c 0.00% 3 Missing and 1 partial ⚠️
src/chunk_adaptive.c 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8188      +/-   ##
==========================================
+ Coverage   82.32%   82.37%   +0.05%     
==========================================
  Files         256      256              
  Lines       47931    47903      -28     
  Branches    12077    12073       -4     
==========================================
+ Hits        39458    39462       +4     
- Misses       3637     3657      +20     
+ Partials     4836     4784      -52     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


elog(DEBUG1, "[adaptive] chunk_target_size_bytes=" UINT64_FORMAT, chunk_target_size_bytes);

hypertable_id = ts_dimension_get_hypertable_id(dimension_id);

if (hypertable_id <= 0)
elog(ERROR, "could not find a matching hypertable for dimension %u", dimension_id);
ereport(ERROR,
(errcode(ERRCODE_NO_DATA_FOUND),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a PL/pgSQL error, so you should not use this here. The closest match seems to be ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE, but ERRCODE_UNDEFINED_OBJECT is also used in similar situations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERRCODE_UNDEFINED_OBJECT seems more appropriated for this case

@fabriziomello
Copy link
Member

@Poroma-Banerjee there many other elog(ERROR... to inspect in both source files. IMHO is worth to inspect and fix all of them.

@Poroma-Banerjee Poroma-Banerjee force-pushed the tserror branch 2 times, most recently from e7d6e99 to b77baf6 Compare May 28, 2025 14:53
This code is reserved for internal program errors, i.e. bugs. This
commit fixes only some of these existing incorrect codes, we have more.
"cannot compress tables with reserved column prefix '%s'",
COMPRESSION_COLUMN_METADATA_PREFIX);
ereport(ERROR,
(errcode(ERRCODE_RESERVED_NAME),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be ERRCODE_INVALID_NAME ?

@Poroma-Banerjee Poroma-Banerjee merged commit 5b5ac55 into timescale:main May 28, 2025
40 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants