diff --git a/sqlx-macros-core/src/database/mod.rs b/sqlx-macros-core/src/database/mod.rs index c247af06..0885b3cc 100644 --- a/sqlx-macros-core/src/database/mod.rs +++ b/sqlx-macros-core/src/database/mod.rs @@ -88,8 +88,19 @@ impl CachingDescribeBlocking { } }; - conn.describe(AssertSqlSafe(query.to_string()).into_sql_str()) + match conn + .describe(AssertSqlSafe(query.to_string()).into_sql_str()) .await + { + Ok(describe) => Ok(describe), + Err(e) => { + if matches!(e, sqlx_core::Error::Io(_) | sqlx_core::Error::Protocol(_)) { + cache.remove(database_url); + } + + Err(e) + } + } }) } }