fix: Validate Timescale Version#540
Conversation
| // ValidateTimescaleVersion checks that Timescale plugin version available through pool is not lower than wanted version. | ||
| // In this case it returns nil. Otherwise returns error describing current and desired version or any other error encountered | ||
| // during the check. | ||
| func ValidateTimescaleVersion(ctx context.Context, pool *pgxpool.Pool, want *version.Version) error { |
There was a problem hiding this comment.
I would use the const MinTimescaleVersion here and not require want. (in fact the same logic applies to ValidatePostgresVersion)
There was a problem hiding this comment.
You can't make it a const:
version.Must(version.NewVersion("2.0")) (value of type *version.Version) is not constant
There was a problem hiding this comment.
no use the const in the top line with the string.
There was a problem hiding this comment.
ok saw the edit, var is also ok. but my point was, to make it like:
func ValidateTimescaleVersion(ctx context.Context, pool *pgxpool.Pool) error
ValidateTimescaleVersion uses the const inside of the fn, caller doesn't need to specify or know about what version or what const is required.
There was a problem hiding this comment.
This change would require changes to the tests
There was a problem hiding this comment.
Tests would use doValidateTimescaleVersion?
* upstream/main: (21 commits) feat: Ignore ignored diags unless -v is specified (cloudquery#545) chore: Sync form .github (cloudquery#527) chore: Clean up db version checks (cloudquery#542) fix: Validate Timescale Version (cloudquery#540) feat: Support timeouts in fetch (cloudquery#537) fix: Warn on providers with no resources requested (cloudquery#528) fix: Fixed local policy run (cloudquery#535) fix: Make Date a static value (cloudquery#534) fix: Downgrade provider (cloudquery#531) feat: Store cq_fetch_id in meta (cloudquery#523) fix: Foreign Keys in Snapshots (cloudquery#525) feat: Add file() func to config parser (cloudquery#522) feat: Drift: Add @getbool modifier (cloudquery#515) fix: Diag: Don't report errors we don't care about (cloudquery#521) fix: Handle if Path doesn't exist (cloudquery#518) fix: Keep binary reference consistent (cloudquery#516) fix: Validate DB connection with an explicit timeout, rather than the… (cloudquery#510) fix: Missing views in history mode (cloudquery#508) fix: Init command cleanup (cloudquery#502) fix: Upgrade/downgrade providers cleanup (cloudquery#498) ...
Output when running against pg12 with tsdb 2.6.0:
Output when running against pg 12 with tsdb 1.7.5: