I didn't go deep trying to solve this by myself, but looks like with any image I throw at it, the upload gives me this error.
The stacktrace got lost already, but the exception was raised in "lib/active_record/connection_adapters/postgresql/oid/bytea.rb".
I was using ruby 2.0, Postgres & Rails 4.2.
I already started to switch to using S3, but thought I still want to report this. Storing images in the local database would been a perfect fit for this small application (tiny amoung of images, no long term data retention, security important).