Repository navigation
[*] fix error hint in timetable.cron_split_to_arrays - #863
Open
pashagolub wants to merge 1 commit into
Open
pashagolub wants to merge 1 commit into
pashagolub wants to merge 1 commit into
Conversation
The hint was built with `+` instead of `||`, so an unrecognized cron
value raised 42725 (operator is not unique) instead of the intended
'Value ("...") not recognized' error.
Migration 00850 replaces the function on existing installs, and dbapi
is bumped to 00850. TestMigrations checks the migrated function and
TestCronSplitToArraysUnknownValue checks a fresh install.
Coverage Report for CI Build 37968493685Coverage decreased (-0.07%) to 87.49%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions8 previously-covered lines in 3 files lost coverage.
Coverage Stats
💛 - Coveralls |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
timetable.cron_split_to_arraysjoined itsRAISE EXCEPTIONhint with+instead of||. PostgreSQL has no uniquetext + textoperator, so an unrecognised cron field raised the wrong error.RAISE EXCEPTION 'Value ("%") not recognized', a_element[i_index] - USING HINT = 'fields separated by space or tab.'+ - 'Values allowed: numbers (value list with ","), '+ + USING HINT = 'fields separated by space or tab. ' || + 'Values allowed: numbers (value list with ","), ' || 'any value with "*", range of value with "-" and step values with "/"!';internal/pgengine/ ├── sql/cron.sql # fresh installs +├── sql/migrations/00850.sql # existing installs, CREATE OR REPLACE FUNCTION ├── sql/init.sql # records 00850 in timetable.migration └── migration.go # registers 00850 cmd/pg_timetable/main.go # dbapi 00820 → 00850Found by the pgcov SQL tests in #850, which is stacked on this PR.
Evidence
assertCronSplitRejectsValuerunsSELECT timetable.cron_split_to_arrays('foo * * * *'). Two tests call it:TestCronSplitToArraysUnknownValueon a fresh install, andTestMigrationsafter migrating from00000.sql.--- FAIL: TestCronSplitToArraysUnknownValueMerge Danger
Door: one-way
Migration
00850runs on existing installs and is recorded intimetable.migration. It only replaces one function body, so a later migration can change it again.Blast Radius: small
Only the error path for an unrecognised cron field changes, and that path already failed with the wrong error. Valid cron strings take the same code path as before.