refactor(postgres): replace sqlx with tokio-postgres + deadpool-postgres

- Use client.transaction() for safer transaction handling
- Add prepare_cached for all system queries to enable statement caching
- Use query_raw streaming to avoid buffering large result sets
- Add batch_execute support for bulk DDL scripts
- Add COPY protocol support (copy_in / copy_out) for fast data transfer
- Add pg_quote_ident to prevent SQL injection in SET search_path
- Increase connection pool max_size from 5 to 10
- Fix list_indexes bounds check for expression indexes
This commit is contained in:
t8y2 committed 2026-05-24 18:53:20 +08:00
1 parent fd4d3d2338
commit e83c335a70
8 files changed
+774 -757

No files matched your search

+2 -2
View File
@@ -238,7 +238,7 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
},
DatabaseType::Postgres | DatabaseType::Redshift => match db::postgres::connect(&url).await {
Ok(pool) => {
pool.close().await;
pool.close();
Ok("Connection successful".to_string())
}
Err(e) => Err(e),
@@ -435,7 +435,7 @@ pub async fn disconnect_db(state: State<'_, Arc<AppState>>, connection_id: Strin
PoolKind::Mysql(p, _) => {
let _ = p.disconnect().await;
}
PoolKind::Postgres(p) => p.close().await,
PoolKind::Postgres(p) => p.close(),
PoolKind::Sqlite(_) => {}
PoolKind::Redis(_) => {}
PoolKind::DuckDb(_) => {}