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?.
CREATE TABLE
INSERT 0 3
CREATE TABLE
INSERT 0 3
CREATE FUNCTION
year | gdp | dividends |
---|---|---|
2000 | 100 | 20 |
2001 | 110 | 30 |
2002 | 120 | 40 |
SELECT 3
ERROR: schema "u_1459125103" does not exist CONTEXT: SQL statement "SELECT ( SELECT format('DROP TABLE IF EXISTS %1$I; CREATE TABLE %1$I AS SELECT %3$s FROM %2$I t JOIN cpi c USING (year)' , _tbl || '_adj' -- %1 , _tbl -- %2 , string_agg( -- %3 CASE a.attname WHEN 'id' THEN 't.id' -- case sensitive! WHEN 'year' THEN 't.year' ELSE format('t.%1$I * c.cpi_adjustment AS %1$I', a.attname) END, ', ' ORDER BY a.attnum ) ) FROM pg_catalog.pg_attribute a JOIN pg_catalog.pg_class c ON c.oid = a.attrelid WHERE c.relname = _tbl AND c.relnamespace = current_user::regnamespace -- adapted for dbfiddle! AND NOT a.attisdropped AND a.attnum > 0 )" PL/pgSQL function f_results_inflation_adjusted(text) line 4 at EXECUTE
ERROR: relation "nominal_dollars_adj" does not exist LINE 1: TABLE nominal_dollars_adj; ^