Skip to content

storageparam: return proper pgcode for float parsing errors#161472

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
rafiss:fix-storage-param-pgcode
Jan 21, 2026
Merged

storageparam: return proper pgcode for float parsing errors#161472
craig[bot] merged 1 commit intocockroachdb:masterfrom
rafiss:fix-storage-param-pgcode

Conversation

@rafiss
Copy link
Copy Markdown
Collaborator

@rafiss rafiss commented Jan 21, 2026

Previously, when storage parameters like fillfactor, geometry_min_x, or sql_stats_automatic_collection_fraction_stale_rows received an invalid string value, the error returned had an internal error code (XXUUU) because the raw strconv.ParseFloat error was propagated without wrapping.

This change wraps these errors with pgerror.Wrapf using pgcode.InvalidParameterValue (22023) to provide a proper user-facing error code.

Fixes #161364
Fixes #154926

Release note: None

@rafiss rafiss requested review from a team and shghasemi January 21, 2026 02:19
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Previously, when storage parameters like `fillfactor`, `geometry_min_x`,
or `sql_stats_automatic_collection_fraction_stale_rows` received an
invalid string value, the error returned had an internal error code
(XXUUU) because the raw `strconv.ParseFloat` error was propagated
without wrapping.

This change wraps these errors with `pgerror.Wrapf` using
`pgcode.InvalidParameterValue` (22023) to provide a proper user-facing
error code.

Fixes cockroachdb#160814

Release note: None
@rafiss rafiss force-pushed the fix-storage-param-pgcode branch from 209ea8b to a3ff990 Compare January 21, 2026 19:30
Copy link
Copy Markdown
Contributor

@shghasemi shghasemi left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks Rafi

@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Jan 21, 2026

tftr!

bors r+

@craig craig bot merged commit 9c89481 into cockroachdb:master Jan 21, 2026
26 of 27 checks passed
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 21, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants