MINOR: cli: Report location of errors or any extra data for "show table"
authorAdis Nezirovic <anezirovic@haproxy.com>
Wed, 22 Jan 2020 15:50:27 +0000 (16:50 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 23 Jan 2020 09:43:52 +0000 (10:43 +0100)
commitd0142e7224e874380b3f2c5f651557ffe74155c0
tree7fcd53571a5a41c6f4033113e4a2e2452892c223
parent8aad9465f9279342a3116f082dc12efd9ecac779
MINOR: cli: Report location of errors or any extra data for "show table"

When using multiple filters with "show table", it can be useful to
report which filter entry failed

  > show table MY_TABLE data.gpc0 gt 0 data.gpc0a lt 1000
  Filter entry #2: Unknown data type

  > show table MY_TABLE data.gpc0 gt 0 data.gpc0 lt 1000a
  Filter entry #2: Require a valid integer value to compare against

We now also catch garbage data after the filter

  > show table MY_TABLE data.gpc0 gt 0 data.gpc0 lt 1000 data.gpc0 gt 1\
    data.gpc0 gt 10 a
  Detected extra data in filter, 16th word of input, after '10'

Even before multi-filter feature we've also silently accepted garbage
after the input, hiding potential bugs

  > show table MY_TABLE data.gpc0 gt 0 data.gpc0
or
  > show table MY_TABLE data.gpc0 gt 0 a

In both cases, only first filter entry would be used, silently ignoring
extra filter entry or garbage data.

Last, but not the least, it is now possible to detect multi-filter
feature from cli with something like the following:

  > show table MY_TABLE data.blah
  Filter entry #1: Unknown data type
src/stick_table.c