By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
ERROR: column "version" does not exist LINE 1: select @@version; ^
CREATE TABLE
INSERT 0 4
CREATE TABLE
CREATE INDEX
INSERT 0 5
ERROR: syntax error at or near "WHERE" LINE 10: WHERE o.total_price > ISNULL(sub.paid, 0); ^