I tried to calculate difference between rows in a field using a query:
Illustrations: input:year,month,fixes output:increase year | month | fixes | incre
This is what window functions are for:
select year, month, fixes, fixes - lag(fixes) over (order by year, month) as increase, from the_table;
For more details please see the manual: http://www.postgresql.org/docs/current/static/tutorial-window.html