Skip to content

Commit d80e912

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 76ae286 commit d80e912

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sqlx-core/src/postgres/connection/describe.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,10 @@ SELECT oid FROM pg_catalog.pg_type WHERE typname ILIKE $1
403403
.fetch_all(&mut *self)
404404
.await?;
405405

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

0 commit comments

Comments
 (0)