Skip to content

Fix select pushdown column aliasing#17737

Merged
NotTheDr01ds merged 9 commits intonushell:mainfrom
fdncred:fix_select_pushdown_column_aliasing
Mar 7, 2026
Merged

Fix select pushdown column aliasing#17737
NotTheDr01ds merged 9 commits intonushell:mainfrom
fdncred:fix_select_pushdown_column_aliasing

Conversation

@fdncred
Copy link
Copy Markdown
Contributor

@fdncred fdncred commented Mar 6, 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.

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.

 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

/cc @NotTheDr01ds

@NotTheDr01ds
Copy link
Copy Markdown
Contributor

Simple case is working for me. I'm going to install it as my main shell and restart my long-running db script just to make sure there's nothing unexpected.

@NotTheDr01ds
Copy link
Copy Markdown
Contributor

Looking good overall with several tests. I'm going to go ahead and land it so we get more eyes on it.

@NotTheDr01ds NotTheDr01ds merged commit 0d4095e into nushell:main Mar 7, 2026
16 checks passed
@github-actions github-actions bot added this to the v0.112.0 milestone Mar 7, 2026
@fdncred fdncred deleted the fix_select_pushdown_column_aliasing branch March 7, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants