feat(postgres): support concurrent index creation

This commit is contained in:
jearhe authored and GitHub committed 2026-08-17 16:31:44 +08:00
1 parent ebf412b144
commit aa6d60533c
38 files changed
+1917 -34

No files matched your search

+8 -1
View File
@@ -25,9 +25,16 @@ use comments::build_table_comment_sql;
use foreign_keys::build_foreign_key_sql;
use indexes::build_index_sql;
use triggers::build_trigger_sql;
use validation::validate_draft;
use validation::{validate_concurrent_index_scope, validate_draft};
pub fn build_table_structure_change_sql(options: TableStructureSqlOptions) -> TableStructureSqlResult {
// Fail closed: an unsupported concurrent-index request (existing index, or
// partitioned parent table) must never degrade into blocking index DDL
// behind the caller's back, so the whole plan is refused up front.
let concurrent_errors = validate_concurrent_index_scope(&options);
if !concurrent_errors.is_empty() {
return TableStructureSqlResult { statements: Vec::new(), warnings: concurrent_errors };
}
let mut warnings = validate_draft(&options);
let mut statements = build_column_sql(&options, &mut warnings);
statements.extend(build_index_sql(&options, &mut warnings));