Skip to content

'length' keyword is not supported as an alias name on the client #234

Description

@giovannibenussi

As mentioned in this discord thread, using length as an alias name doesn't return any results:

// query: select count(*) as 'length' from my_table
ResultSetImpl {
  columns: [ "length" ],
  columnTypes: [ "" ],
  rows: [ {} ],
  rowsAffected: 0,
  lastInsertRowid: undefined
}

// query: select url as 'length' from my_table
ResultSetImpl {
  columns: [ "length" ],
  columnTypes: [ "TEXT" ],
  rows: [ {}, {} ],
  rowsAffected: 0,
  lastInsertRowid: undefined
}

However, the code works when using an alias name other than length:

// query: select count(*) as 'test' from my_table
ResultSetImpl {
  columns: [ "test" ],
  columnTypes: [ "" ],
  rows: [ { test: 2 } ],
  rowsAffected: 0,
  lastInsertRowid: undefined
}

// query: select url as 'test' from my_table
ResultSetImpl {
  columns: [ "test" ],
  columnTypes: [ "TEXT" ],
  rows: [ { test: "https://example.com" }, { test: "https://example.org" } ],
  rowsAffected: 0,
  lastInsertRowid: undefined
}

Using the length name as an alias works on the Turso shell.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions