#648071 sqlite3: .mode tcl output format varies according to previous selected .mode

Package:
sqlite3
Source:
sqlite3
Description:
Command line interface for SQLite 3
Submitter:
Alexis Huxley
Date:
2011-11-08 19:36:05 UTC
Severity:
normal
#648071#5
Date:
2011-11-08 19:33:12 UTC
From:
To:
The documentation states:

	The sqlite3 program is able to show the results of a query in
	eight different formats: "csv", "column", "html", "insert",
	"line", "list", "tabs", and "tcl". You can use the ".mode"
	dot command to switch between these output formats.

But it seems that the switched-into mode "leaks" somewhat. An example
will explain this most clearly:

fiori$ sqlite3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>  CREATE TABLE people (name VARCHAR, sex VARCHAR);
sqlite> INSERT INTO people (name, sex) VALUES ("fred", "male");
sqlite> .mode tcl
sqlite> SELECT * FROM people;
"fred"|"male"|                            <------ last selected mode is 'tcl'; note '|' as separator
sqlite> .mode tabs
sqlite> .mode tcl
sqlite> SELECT * FROM people;
"fred"	"male"				  <------ last selected mode is 'tcl'; note tab as separator
sqlite>

Note the way the mode selected immediately before the two SELECT statements
is the same i.e. 'tcl' mode, but the earlier selected 'tabs' mode in the
second case has left a residual effect on the field separation.

I suspect that setting '.mode tabs' is setting the separator but that
'.mode tcl' is setting only the field formatting. But this is certainly
neither the expected nor the documented behaviour.

I'd be happy if this was passed upstream and not fixed in Debian, but as
the sqlite3 package from Debian, not compiled from upstream source, it
seems to me that the correct place to report this bug is with Debian.

If you need more info, or if I can test a fixed version for you, please
let me know. Thanks.

Alexis