CREATE TABLE t0 (c0 INTEGER UNIQUE, c1 INTEGER, c2 TEXT UNIQUE, c3 TEXT UNIQUE);
CREATE INDEX i8 ON t0(c1) WHERE (t0.c3 < 'default');
INSERT INTO t0 (c0, c1, c2, c3) VALUES (894, 89, 'unique_0_578', 'unique_0_359'), (110, (41 + 8), 'unique_1_214', 'unique_1_463'), (588, 74, 'unique_2_657', 'unique_2_44'), (155, (22 * 4), 'unique_3_705', 'unique_3_765'), (580, NULL, 'unique_4_635', 'unique_4_302'), (936, (13 + 0), 'unique_5_819', 'unique_5_766'), (888, 58, 'unique_6_681', 'unique_6_32'), (125, NULL, 'unique_7_781', 'unique_7_39'), (209, 87, 'unique_8_74', 'unique_8_945'), (30, 69, 'unique_9_330', 'unique_9_340');
SELECT t0.c1, t0.c0, COALESCE(AVG(t0.c0) OVER (PARTITION BY t0.c3 ORDER BY t0.c0 DESC), 9) FROM t0 WHERE (t0.c1) IN (SELECT t0.c1 FROM t0)