mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
core: Fix codegen for rowid alias
We should emit `Column` bytecode for a primary key, unless it is an alias for a rowid.
This commit is contained in:
parent
8d4d2f32ee
commit
828fb813a8
2 changed files with 8 additions and 1 deletions
|
@ -154,6 +154,13 @@ pub struct Column {
|
|||
pub primary_key: bool,
|
||||
}
|
||||
|
||||
impl Column {
|
||||
pub fn is_rowid_alias(&self) -> bool {
|
||||
self.primary_key && self.ty == Type::Integer
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Type {
|
||||
Null,
|
||||
Text,
|
||||
|
|
|
@ -174,7 +174,7 @@ fn translate_columns(
|
|||
sqlite3_parser::ast::ResultColumn::Star => {
|
||||
for (i, col) in table.unwrap().columns.iter().enumerate() {
|
||||
let dest = program.alloc_register();
|
||||
if col.primary_key {
|
||||
if col.is_rowid_alias() {
|
||||
program.emit_insn(Insn::RowId {
|
||||
cursor_id: cursor_id.unwrap(),
|
||||
dest,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue