adapter: expose Materialize version in mz_version parameter #17024
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.
This commit exposes the Materialize-specific information in a new
mz_version
parameter, as in:The
mz_version
parameter is additionally added to the parameter set that is automatically sent to the client during part of startup. This approach comes from CockroachDB, and allows clients to easily detect whether they're talking to Materialize or PostgreSQL without incurring an additional roundtrip.I already have a PR out to sqlx 0 that uses this feature to automatically disable PostgreSQL-specific features that Materialize does not support.
The version string matches the output of the
mz_version()
function.The implementation is somewhat irritating, as it requires plumbing the
BuildInfo
from the adapter into each session. Doesn't turn out too complicated, though, now that it's all written out.Motivation
Checklist
This PR has adequate test coverage / QA involvement has been duly considered.
This PR evolves an existing
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way) and therefore is tagged with aT-proto
label.If this PR will require changes to cloud orchestration, there is a
companion cloud PR to account for those changes that is tagged with
the release-blocker label (example).
This PR includes the following user-facing behavior changes:
mz_version
system configuration parameter, which reports the Materialize version information. The value of this parameter is the same as the value returned by the existingmz_version()
function. The parameter form can be more convenient for downstream applications.