tursodatabase / tursodatabase/libsql-client-ts
'length' keyword is not supported as an alias name on the client
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 576
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two queries using length as the alias in the TypeScript client, then compare their returned rows with the Turso shell behavior described in the issue. Add regression coverage for both count(*) and url cases; done means the client populates length-keyed result objects as it does for the test alias.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite, typescript
- Domain
- api, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100