Why does rake db:migrate sometimes add trailing whitespace to structure.sql?

postgresql, ruby-on-rails

Solution

It is the best day of my life, and maybe yours:

In PG 11, this error is not here anymore since `Tablespace` is not written to the dump. So you can upgrade your PG version and get rid of the hook you had for space deletion.

Problem

On some of our developer machines `rake db:migrate` adds trailing whitespace to `structure.sql` which is really annoying because every time a change is made to the database we have to first remove all trailing whitespace from the file. Anyone know what could be up with that? Where would the whitespace come from? Has it to do with PostgreSQL or is it something else?

Original source

Related problems