Skip to content

Commit

Permalink
Don't run EXPLAIN nullability analysis on Materialize
Browse files Browse the repository at this point in the history
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.

[0]: https://materialize.com
  • Loading branch information
benesch committed Jan 8, 2023
1 parent 76ae286 commit d80e912
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sqlx-core/src/postgres/connection/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,10 @@ SELECT oid FROM pg_catalog.pg_type WHERE typname ILIKE $1
.fetch_all(&mut *self)
.await?;

// if it's cockroachdb skip this step #1248
if !self.stream.parameter_statuses.contains_key("crdb_version") {
// If the server is CockroachDB or Materialize, skip this step (#1248).
if !self.stream.parameter_statuses.contains_key("crdb_version")
&& !self.stream.parameter_statuses.contains_key("mz_version")
{
// patch up our null inference with data from EXPLAIN
let nullable_patch = self
.nullables_from_explain(stmt_id, meta.parameters.len())
Expand Down

0 comments on commit d80e912

Please sign in to comment.