Skip to content

Commit bad9dce

Browse files
committed
add alias to colnames explicitly as column-N
1 parent aecafe8 commit bad9dce

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

core/translate/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ fn prepare_one_select_plan(
518518
result_columns.push(ResultSetColumn {
519519
// these result_columns work as placeholders for the values, so the expr doesn't matter
520520
expr: ast::Expr::Literal(ast::Literal::Numeric(i.to_string())),
521-
alias: None,
521+
alias: Some(format!("column{}", i + 1)),
522522
contains_aggregates: false,
523523
});
524524
}

testing/select.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,11 @@ do_execsql_test_on_specific_db {:memory:} affinity-conversion-2 {
12441244
SELECT * FROM t WHERE a == 2;
12451245
} {2}
12461246

1247+
# https://github.com/tursodatabase/turso/issues/3950
1248+
do_execsql_test select-values-column-name {
1249+
SELECT column1 FROM (VALUES(123));
1250+
} {123}
1251+
12471252
# Test suite for SQLite affinity conversion in WHERE clauses
12481253

12491254
# ============================================

0 commit comments

Comments
 (0)