Skip to content

Commit c75b1ec

Browse files
committed
Don't run EXPLAIN nullability analysis on Materialize
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
1 parent 82ff8d9 commit c75b1ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sqlx-postgres/src/connection/describe.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,10 @@ WHERE rngtypid = $1
399399
.fetch_all(&mut *self)
400400
.await?;
401401

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

0 commit comments

Comments
 (0)