Skip to content
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

Don't run EXPLAIN nullability analysis on Materialize #2282

Merged
merged 1 commit into from
Mar 4, 2023

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Jan 8, 2023

Materialize 0 is a PostgreSQL-like database that, similar to CockroachDB, does not support PostgreSQL's EXPLAIN output. Extend the fix from PR #1248 to Materialize, too, so that sqlx can still be used with Materialize.

See #1248.

benesch added a commit to benesch/materialize that referenced this pull request Jan 8, 2023
This commit exposes the Materialize-specific information in a new
`mz_version` parameter, as in:

    materialize=> show mz_version;
           mz_version
    -------------------------
     v0.39.0-dev (73f6bed)
    (1 row)

The `mz_version` parameter is additionally added to set of parameters
that are 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.

[0]: launchbadge/sqlx#2282
benesch added a commit to benesch/materialize that referenced this pull request Jan 8, 2023
This commit exposes the Materialize-specific information in a new
`mz_version` parameter, as in:

    materialize=> show mz_version;
           mz_version
    -------------------------
     v0.39.0-dev (73f6bed)
    (1 row)

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.

[0]: launchbadge/sqlx#2282
benesch added a commit to MaterializeInc/materialize that referenced this pull request Jan 9, 2023
This commit exposes the Materialize-specific information in a new
`mz_version` parameter, as in:

    materialize=> show mz_version;
           mz_version
    -------------------------
     v0.39.0-dev (73f6bed)
    (1 row)

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.

[0]: launchbadge/sqlx#2282
@abonander
Copy link
Collaborator

@benesch the Postgres driver was moved into a subdirectory, can you rebase please?

Materialize [0] is a PostgreSQL-like database that, similar to
CockroachDB, does not support PostgreSQL's `EXPLAIN` output. Extend the
fix from PR launchbadge#1248 to Materialize, too, so that sqlx can still be used
with Materialize.

See launchbadge#1248.

[0]: https://materialize.com
@benesch
Copy link
Contributor Author

benesch commented Mar 3, 2023

Sure! Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants