Skip to content

Case sensitivity in 'where' #849

Closed
Closed

Description

@thomasheartman

Hey,

The where command is case sensitive both for column names and values. Could there be a way to make it ignore case, especially in column names? I find that when working with generated data, column names often come out in all caps, so the filtering needs to use all caps too, which, while no big deal, is a little annoying.

Would it be an idea to have a flag to make the command case insensitive? I'm thinking primarily about the column names, though the values could also be matched case insensitively.

This might cause issues if you have two columns names that only differ in casing, though, so I don't know whether that's doable or desirable.

Activity

  1. sophiajt commented on Oct 19, 2019

    @sophiajt
    Contributor

    I have mixed feelings. Mostly because data sources, with the exception of something like Windows filenames, are all going to be case sensitive for fields.

    That said, it might make sense to have a relaxed mode, or to at least have a forgiving autocomplete, when we add that.

  2. added
    status:needs-design
    category:enhancement
    on Oct 23, 2019
  3. thomasheartman commented on Oct 24, 2019

    @thomasheartman
    Author

    Yeah, I can see your point about data sources often being case sensitive. That said, SQL tends to be insensitive, doesn't it? I don't think it should be the default, but a relaxed mode / ignore-case flag could be a good idea.

    The forgiving auto-complete might also be enough. Fish shell does this for paths on case sensitive file systems and that works great.

  4. cig0 commented on May 1, 2020

    @cig0

    Hi all,

    I believe that Nu really needs to allow the user to query for an insensitive case, similar as we can do with grep -i.

    A typical example would be to look for some file or process id, when you don't know exactly how that process is called or spelled (is it written in uppercase, lowercase, camelCase?), i.e.:

    image

    Thanks

  5. thegedge commented on May 2, 2020

    @thegedge
    Contributor

    We'll need to think about the syntax for a simplified version of this, but here's an example of what you can do for now:

    ps | str --downcase name | where name =~ ...
    

    Of course, if you care about the case for the end result, there's not really an option right now (or nothing I can think of).

  6. github-actions commented on Jun 24, 2021

    @github-actions

    This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

  7. github-actions commented on Jul 7, 2021

    @github-actions

    This issue has been marked stale for more than 10 days without activity. Closing this issue, but if you find that the issue is still valid, please reopen.

  8. added a commit that references this issue on Feb 7, 2022
  9. added a commit that references this issue on Feb 7, 2022
  10. youk commented on Jul 3, 2024

    @youk

    AFAIU, the issue is still valid. There are only workarounds such as using intermediate str. Could you please reopen it?

  11. onsamyj commented on Dec 21, 2024

    @onsamyj

    Can we have something like {some data} | ignore-case | where name like cat that would return cat, Cat, CAT, etc?

    Nushell is about data. Nushell is about pipes. That makes sense to me.

  12. tim-mccarthy commented on Dec 21, 2024

    @tim-mccarthy

    where name =~ "(?i)^cat$" would get the desired effect.

  13. onsamyj commented on Dec 21, 2024

    @onsamyj

    It, will, you’re not wrong, but, and you can argue it’s a silly argument, it doesn’t feel like the Nushell way. Some other programs would probably have a --flag, which also feels weird here.

    I was trying to come up with something that would feel natural here. Just a suggestion though.

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:enhancementstatus:needs-design

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions