Some hints and important stuff about PostgreSQL.
Reordering columns in existing tables with data: never do that, pointers to data seems to be lost. Redo the table if needed with create select and such.
Avoiding divisions by zero: the nullif function is an useful way to avoid them:
round(((sum(e001518)::float) / (nullif(sum(e166418), 0))::float)::numeric, 2)