Skip to content

Fix history | last 10 being in descending order#17645

Merged
fdncred merged 1 commit intonushell:mainfrom
NotTheDr01ds:fix-sql-last
Feb 25, 2026
Merged

Fix history | last 10 being in descending order#17645
fdncred merged 1 commit intonushell:mainfrom
NotTheDr01ds:fix-sql-last

Conversation

@NotTheDr01ds
Copy link
Copy Markdown
Contributor

@NotTheDr01ds NotTheDr01ds commented Feb 24, 2026

fixes #17646

Release notes summary - What our users need to know

history | last x will be in ascending order.

Copy link
Copy Markdown
Member

@cptpiepmatz cptpiepmatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last is explicitly implemented for sqlite tables 👀, crazy.

lgtm

@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Feb 25, 2026

last is explicitly implemented for sqlite tables 👀, crazy.

it had to be to get significant speed ups

@fdncred fdncred merged commit db16d3b into nushell:main Feb 25, 2026
16 checks passed
@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Feb 25, 2026

Thanks

@github-actions github-actions bot added this to the v0.111.0 milestone Feb 25, 2026
@cptpiepmatz cptpiepmatz added notes:fixes Include the release notes summary in the "Bug fixes" section notes:ready The "Release notes summary" section of this PR is ready to be included in our release notes. notes:other Include the release notes summary in the "Other changes" section and removed notes:fixes Include the release notes summary in the "Bug fixes" section labels Feb 27, 2026
NotTheDr01ds pushed a commit that referenced this pull request Mar 7, 2026
This PR is a follow-on of these PRs to hopefully finish the last fixing of the sqlite pushdown. The biggest part of this fix is creating mini-sqlite-column-projection code for when sqlite column names are aliased in rust code like `command_line as command`. It's not a fully sql parser but it looks for column aliasing so it knows how to select the data properly. I've tried to comment the code verbosely to help us all remember what it's doing.

- #17415
- #17645
- #17680
- #17668

I also took the opportunity to refactor the push down calls from filter commands so that they're easier to understand by calling a new pipeline function that does the same thing but in a little cleaner way.

There's also a bunch of new tests around `open some_sqlite_file.db`.

Before this PR you would get this with `history | select command`
because `command` is an alias to `command_line`.
```nushell
❯ history | select command
Error: nu::shell::error

  × Failed to execute query
   ╭─[repl_entry #1:1:11]
 1 │ history | select command
   ·           ───┬──
   ·              ╰── no such column: command in SELECT command FROM [history] at offset 7
   ╰────
```
After, it just works (tm)

## Release notes summary - What our users need to know

Refactor sqlite push down and apply to (nearly) all filter commands.

## Tasks after submitting

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

Labels

notes:other Include the release notes summary in the "Other changes" section notes:ready The "Release notes summary" section of this PR is ready to be included in our release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

history | last x is in wrong order

3 participants