Skip to content

Commit ba38f64

Browse files
teunbrandclaude
andcommitted
Add cross-references between the two preamble execution paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 413ee09 commit ba38f64

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/execute/cte.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,10 @@ pub fn transform_global_sql(
243243
// VISUALISE FROM. Split them: side-effect statements run directly,
244244
// VISUALISE FROM becomes the queryable part.
245245
//
246-
// Only actual statements (CREATE, INSERT, …) are side effects — a bare
247-
// WITH clause without a trailing statement is not executable on its own
248-
// (its CTEs are already materialized separately).
246+
// Only structured DML is handled here — other_sql_statement nodes
247+
// (INSTALL, LOAD, SET, …) are pre-executed in prepare_data_with_reader.
248+
// A bare WITH clause without a trailing statement is not executable on
249+
// its own (its CTEs are already materialized separately).
249250
let root = source_tree.root();
250251

251252
let side_effect_stmts = r#"

src/execute/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,9 @@ pub fn prepare_data_with_reader(query: &str, reader: &dyn Reader) -> Result<Prep
10431043
));
10441044
}
10451045

1046-
// Execute setup statements (INSTALL, LOAD, SET, etc.) before the main query
1046+
// Execute setup statements (INSTALL, LOAD, SET, etc.) before the main query.
1047+
// Structured DML (CREATE, INSERT, UPDATE, DELETE) is handled separately as
1048+
// side-effects in cte::transform_global_sql.
10471049
for stmt in source_tree.find_texts(&root, "(sql_statement (other_sql_statement) @stmt)") {
10481050
execute_query(&stmt)?;
10491051
}

0 commit comments

Comments
 (0)