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?.
version |
---|
PostgreSQL 12.8 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1), 64-bit |
5 rows affected
ERROR: window functions are not allowed in UPDATE
LINE 2: SET sort_order = activity_id - FIRST_VALUE(activity_id)
^
ERROR: window functions are not allowed in column generation expressions
LINE 8: activity_id - FIRST_VALUE(activity_id)
^
5 rows affected
user_id | activity_id | sort_order |
---|---|---|
101 | 123 | 0 |
101 | 124 | 1 |
101 | 125 | 2 |
102 | 123 | 0 |
102 | 124 | 1 |
ERROR: syntax error at or near "RETURNS"
LINE 2: RETURNS TRIGGER
^
1 rows affected
user_id | activity_id | sort_order |
---|---|---|
101 | 123 | 0 |
101 | 124 | 0 |
101 | 125 | 0 |
102 | 123 | 0 |
102 | 124 | 0 |
102 | 125 | null |