add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
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?.
1 rows affected
2 rows affected
ERROR:  column "September" of relation "psy_revenues" does not exist
LINE 2:               SET  "September" = (
                           ^
QUERY:  UPDATE psy_revenues 
              SET  "September" = (
                SELECT SUM(payed) FROM psy_consultations WHERE 
                    owner_id =  $1 AND to_char(date, 'MM-YYYY') = $2 
                    )
CONTEXT:  PL/pgSQL function update_revenues() line 4 at EXECUTE

id owner_id January February March April December
2 1 0 0 0 0 1