Skip to content

Commit 28138c5

Browse files
committed
add alias to colnames explicitly as column-N
1 parent 72bf195 commit 28138c5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-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: 6 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
# ============================================
@@ -1469,3 +1474,4 @@ do_execsql_test_on_specific_db {:memory:} affinity-conversion-22 {
14691474
# CREATE INDEX idx20 ON t20(lower(name));
14701475
# SELECT * FROM t20 WHERE lower(name) = 'abc';
14711476
# } {ABC abc}
1477+

0 commit comments

Comments
 (0)