Created
September 22, 2018 01:28
-
-
Save hoehrmann/aa30920408a15db8b4d76fc74e36e6cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, | |
Using the sqlite-tools-linux-x86-3250100 Linux binaries I find that | |
Window functions in VIEWS behave differently from PostgreSQL 9.6 and | |
from what I expect. | |
DROP TABLE IF EXISTS example; | |
CREATE TABLE example(t INT, total INT); | |
INSERT INTO example VALUES(0,2); | |
INSERT INTO example VALUES(5,1); | |
INSERT INTO example VALUES(10,1); | |
DROP VIEW IF EXISTS view_example; | |
CREATE VIEW view_example AS | |
SELECT | |
NTILE(256) OVER (ORDER BY total) - 1 AS nt | |
FROM | |
example | |
; | |
SELECT * FROM view_example; | |
In SQLite 3.25.1 I get 0, 0, 0, while PostgreSQL 9.6 gives 0, 1, 2. | |
(Executing the SELECT directly gives the correct result in SQLite.) | |
Thanks, |
Author
hoehrmann
commented
Sep 22, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment