Skip to content

Nested insert doesn't work #11089

Closed

Description

@kaathewisegit

Describe the bug

An insert with a nested cell-path only creates the first element without an error.

How to reproduce

~> {} | insert z.z 0
╭───┬───╮
│ z │ 0 │
╰───┴───╯
~> {} | insert $.z.z 0
╭───┬───╮
│ z │ 0 │
╰───┴───╯

Expected behavior

I'd expect it to create {z: {z: 0}}.

Screenshots

No response

Configuration

key value
version 0.86.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-alpine-linux-musl
rust_version rustc 1.72.1 (d5c2e9c34 2023-09-13) (Alpine Linux 1.72.1-r0)
cargo_version cargo 1.72.1
build_time 2023-10-22 21:58:37 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which, zip
installed_plugins custom-value generate, custom-value generate2, custom-value update, gstat, nu-example-1, nu-example-2, nu-example-3

Additional context

No response

Activity

  1. added
    status:needs-triage
    on Nov 17, 2023
  2. kaathewisegit commented on Nov 17, 2023

    @kaathewisegit
    ContributorAuthor

    Oh, and this doesn't work either:

    ~> {z: 0} | insert z.z 0
    Error: nu::shell::unsupported_input
    
      × Unsupported input
       ╭─[entry #91:1:1]
     1 │ {z: 0} | insert z.z 0
       ·          ───┬──   ┬
       ·             │     ╰── input type: input type: Int
       ·             ╰── table or record
  3. IanManske commented on Nov 18, 2023

    @IanManske
    Member

    Coincidentally enough, I recently opened a PR (#11066) which will fix this.

  4. added
    category:bug
    and removed
    status:needs-triage
    on Nov 19, 2023
  5. fdncred commented on Nov 19, 2023

    @fdncred
    Contributor

    Not sure this is supposed to work after #11066 but it doesn't.

    {z: 0} | insert z.z 0
  6. added this to the v0.88.0 milestone on Nov 19, 2023
  7. IanManske commented on Nov 19, 2023

    @IanManske
    Member

    It's not supposed to, since insert fails if it has to overwrite any values. The error message here could maybe use some work. Weirdly enough, {z: 0} | upsert z.z 0 doesn't work either. (Actually, this makes sense.)

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

    category:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions