Fix insert ordering.
Make work with postgres.