mithrandie / csvq

SQL-like query language for csv
https://mithrandie.github.io/csvq
MIT License
1.5k stars 65 forks source link

special character behavior in LIKE pattern #25

Closed ken3 closed 4 years ago

ken3 commented 4 years ago

[OS] CentOS 7.7.1908 [go version] go1.13.3 linux/amd64

input file is sample.txt

case 1, case2 and case 3 should cause the same result, but case 2 does not.

case 1 (expected): $ cat sample.txt|csvq -n "select * where c1 like '%i686'" +--------------------------------+ | c1 | +--------------------------------+ | glibc-2.28-9.fc29.i686 | | glibc-devel-2.28-9.fc29.i686 | | glibc-headers-2.28-9.fc29.i686 | | gpm-devel-1.20.7-6.el7.i686 | | gpm-libs-1.20.7-6.el7.i686 | +--------------------------------+

case 2 (unexpected): $ cat sample.txt|csvq -n "select * where c1 like '%i_86'" +------------------------------+ | c1 | +------------------------------+ | gpm-devel-1.20.7-6.el7.i686 | +------------------------------+

case 3 (expected): $ cat sample.txt|csvq -n "select * where c1 like '%.i_86'" +--------------------------------+ | c1 | +--------------------------------+ | glibc-2.28-9.fc29.i686 | | glibc-devel-2.28-9.fc29.i686 | | glibc-headers-2.28-9.fc29.i686 | | gpm-devel-1.20.7-6.el7.i686 | | gpm-libs-1.20.7-6.el7.i686 | +--------------------------------+

mithrandie commented 4 years ago

I confirmed to replicate this bug. Please wait to fix.

mithrandie commented 4 years ago

This bug has been fixed and the fix is released as version 1.12.2. Thank you for reporting.

ken3 commented 4 years ago

Excellent work! Thank you.