On 07/02/2018 10:54 PM, Charles Leifer wrote:
I'm getting a segfault with the following query, which uses window
functions:

Thanks for reporting this. Should now be fixed here:

  https://www.sqlite.org/src/info/693b4350d7413912

Thanks also for the sum() bug report in the follow-up. That one is fixed here:

  https://www.sqlite.org/src/info/693b4350d7413912

Dan.





SELECT "t1"."counter", "t1"."value", RANK() OVER w AS "rank"
FROM "sample" AS "t1"
WINDOW w AS (PARTITION BY "t1"."counter" ORDER BY "t1"."value" DESC)
ORDER BY "t1"."counter", RANK() OVER w

The sql used to create the "sample" table:

CREATE TABLE IF NOT EXISTS "sample" (
   "id" INTEGER NOT NULL PRIMARY KEY,
   "counter" INTEGER NOT NULL,
   "value" REAL NOT NULL);

Test data:

INSERT INTO "sample" (counter, value) VALUES (1, 10.), (1, 20.), (2, 1.),
(2, 3.), (3, 100.);

The expected output for the window query is:

1, 20., 1
1, 10., 2
2, 3., 1
2, 1., 2
3, 100., 1
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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

Reply via email to