SQLite Forum

Possible bug in group_concat() ?
Login
While testing my own table-valued function, I got some rather weird results when running a window-function test. Try as I might, I couldn't account for it in my own code. The debugger showed the correct output being assigned on each call to the `xColumn()` function. So, I ran the same test with the `generate_series()` function as a sanity check, using the following query:

    CREATE TABLE persons(id INTEGER PRIMARY KEY, name TEXT);
	INSERT INTO persons (name) VALUES('John'), ('Paul'), ('George'), ('Ringo');

	SELECT group_concat(value,name)
	OVER (
	  ORDER BY name ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
	)
	AS result
	FROM persons, generate_series(4450,4455);

Granted, the query is nonsense, but the issue is not that the results don't make any sense; it's that information is missing:

	result
	-------------------------
	4450George4451
	4450George4451George4452
	4451George4452George4453
	4452George4453George4454
	4453George4454George4455
	4454George4455John4450
	4455John4450John4451
	50John4451John4452   <-- initial values begin to be truncated
	51John4452John4453
	52John4453John4454
	53John4454John4455
	54John4455Paul4450
	55Paul4450Paul4451
	50Paul4451Paul4452
	51Paul4452Paul4453
	52Paul4453Paul4454
	53Paul4454Paul4455
	54Paul4455Ringo4450
	55Ringo4450Ringo4451
	450Ringo4451Ringo4452
	451Ringo4452Ringo4453
	452Ringo4453Ringo4454
	453Ringo4454Ringo4455
	454Ringo4455

shell `.version` command:

    SQLite 3.36.0 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5
	zlib version 1.2.11
	gcc-5.2.0

I compiled `series.c` as a 32-bit dll using Visual Studio 2015 (_MSC_VER 1900)

Regrettably, I'm not set up for testing sqlite itself, and besides, the amalgamation is apparently too large for the VS debugger (it can never seem to break on the correct source line).