The behavior of group_concat for empty strings isn't what I expected.  This 
looks to me like a bug.  Would the sqlite developers consider it to be one? 

sqlite> .nullvalue VISIBLENULL
sqlite> CREATE table example (id INTEGER PRIMARY KEY AUTOINCREMENT, a TEXT);
sqlite> INSERT INTO example(a) VALUES ("");
sqlite> INSERT INTO example(a) VALUES ("");
sqlite> INSERT INTO example(a) VALUES ("");
sqlite> select * from example;
1|
2|
3|
sqlite> select group_concat(a, "|") from example;
VISIBLENULL
sqlite> INSERT INTO example(a) VALUES ("a");
sqlite> INSERT INTO example(a) VALUES ("b");
sqlite> INSERT INTO example(a) VALUES ("c");
sqlite> select group_concat(a, "|") from example;
a|b|c
sqlite> select * from example;
1|
2|
3|
4|a
5|b
6|c

I expected "||" in the first case and "|||a|b|c" in the second.

In python the equivalent group concatenation of lists results in what I expect:

In [2]: "|".join(["","",""])
Out[2]: '||'

In [3]: "|".join(["","","","a","b","c"])
Out[3]: '|||a|b|c'




_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to