-
Notifications
You must be signed in to change notification settings - Fork 507
Fix panic when attempting to set default_timestamp_interval to 0 #36853
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -205,6 +205,21 @@ ALTER SYSTEM SET max_timestamp_interval = '10s'; | |||||
| ---- | ||||||
| COMPLETE 0 | ||||||
|
|
||||||
| simple conn=mz_system,user=mz_system | ||||||
| ALTER SYSTEM SET default_timestamp_interval = '1'; | ||||||
| ---- | ||||||
| COMPLETE 0 | ||||||
|
|
||||||
| simple conn=mz_system,user=mz_system | ||||||
| ALTER SYSTEM SET default_timestamp_interval = '0'; | ||||||
| ---- | ||||||
| db error: ERROR: parameter "default_timestamp_interval" cannot have value "0ns": only supports durations greater than zero | ||||||
|
|
||||||
| simple conn=mz_system,user=mz_system | ||||||
| ALTER SYSTEM SET default_timestamp_interval = '-1'; | ||||||
| ---- | ||||||
| db error: ERROR: parameter "default_timestamp_interval" requires a "duration" value | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize this isn't a regression, but this error message is interesting, especially given that the above tests use values like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Poked around here a bit, and it looks like default unit for a materialize/src/sql/src/session/vars/value.rs Lines 309 to 310 in 8f3bf9d
This seems to be consistent across durations, but is documented on a per-field level. I.e. see docs for "idle_in_transaction_session_timeout" under https://materialize.com/docs/sql/alter-system-set/. Discussed offline that this may also align with postgres. |
||||||
|
|
||||||
| statement ok | ||||||
| ALTER SOURCE s SET (TIMESTAMP INTERVAL '2s') | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks a little weird to
is_zero()and then saygreater than zero. I had to double-check that Duration can't be negative 😅There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah whoops, I'll change this to "only supports non-zero durations" - I had originally named this struct
PositiveDurationwhich I later realized was a little weird/redundant given Durations are never negative. But then I forgot to update this reason field.