SQLite Forum

"headers on" yet no headers
Login

"headers on" yet no headers

(1) By anonymous on 2021-01-15 11:45:07 [link] [source]

Hi,

It looks unlikely that I'm the first to notice this but I can't find anything in the forum.

I use the command line utility sqlite3.exe to write the results of a query to a TAB-separated file, using the headers on setting. When the query doesn't return any rows, there will be no header line in the output file. I would VERY MUCH prefer to get a file with header line (and nothing else of course).

Cheers,

John

(2) By Larry Brasfield (LarryBrasfield) on 2021-01-15 14:09:56 in reply to 1 [source]

The behavior you would prefer is my preference also. But the CLI shell does not work that way. The changes necessary to make do so are not well localized in the code. A callback scheme is used to emit the data, and some of them emit a header also for the first row. But with an empty result set, nothing is emitted.

Several years ago, I suggested changes to "fix" this, without visible effect.