lnav icon indicating copy to clipboard operation
lnav copied to clipboard

Simple SQL script fails 0.11, works on 0.10

Open paulelong opened this issue 2 years ago • 4 comments

lnav version v0.11.1

Describe the bug When creating a table and then running a select against it fails with this error:

✘ error: failed to compile SQL statement │ reason: vtable constructor failed: mytable │ --> command:1 │ | select log_time, val from mytable

To Reproduce Steps to reproduce the behavior:

Using this log file:

Apr 12 14:35:48 host local0.info proc1[3066]: x=5 Apr 12 14:35:48 host local0.info proc1[3066]: x=2 Apr 12 14:35:48 host local0.info proc1[3066]: x=3 Apr 12 14:35:48 host local0.info proc1[3066]: x=1

Run these commands:

:create-search-table mytable ^.*x=(?\d+) ;select log_time, val from mytable

paulelong avatar Apr 26 '23 18:04 paulelong

Is the following the exact command you're using?

:create-search-table mytable ^.*x=(?\d+)

That doesn't work for me, I get this error:

✘ error: “^.*x=(?\d+)” is not a valid regular expression
 reason: unrecognized character after (? or (?-
 --> pattern
 | ^.*x=(?\d+)                                    
 |        ^ unrecognized character after (? or (?-
 --> command-option:1
 | :create-search-table mytable ^.*x=(?\d+)
 = help: :create-search-table table-name [pattern]
         ══════════════════════════════════════════════════════════════════════
           Create an SQL table based on a regex search

Using this command works for me:

:create-search-table mytable ^.*x=(?<val>\d+)

tstack avatar Jun 18 '23 03:06 tstack

Your create-search-table command works for me, but even using that the next command doesn't work for me:

;select log_time, val from mytable

I'm using 0.12.1 now, and it still fails.

It also fails when I try something like ";select * from syslog_axon", which is my log file def. Yet I can see syslog_axon in the schema definition.

paulelong avatar Apr 01 '24 19:04 paulelong

Can you run lnav with -d /tmp/lnav-debug.log and send the resulting debug log. I'm not sure what is happening. Thanks and sorry for the trouble.

tstack avatar Apr 05 '24 05:04 tstack

Attached is the debug log. I ran ";select host from syslog_axon"

I think in the log it starts here: 2024-05-29T12:01:39.529 I t0 command_executor.cc:312 Executing SQL: select host from syslog_axon 2024-05-29T12:01:39.529 E t0 sql_util.cc:552 (1) no such table: syslog_axon in "select host from syslog_axon" 2024-05-29T12:01:42.130 D t0 hotkeys.cc:169 executing key sequence x71: |lnav-pop-view ${keyseq} Uploading lnav-debug.log…

paulelong avatar May 29 '24 16:05 paulelong