public
Last active

ar / pg / bytea is fucked on heroku due to db config

  • Download Gist
2.3.5.on-heroku.txt
1 2 3 4 5 6
>> escaped = ActiveRecord::Base.connection.raw_connection.query("select 'foobar'::bytea").first.values.first
=> "\\x666f6f626172"
>> PGconn.unescape_bytea(escaped)
=> "x666f6f626172"
>> ActiveRecord::VERSION::STRING
=> "2.3.5"a
4.0.0.beta.txt
1 2 3 4 5 6
[47] pry(#<PostgresqlByteaTest>)> escaped = ActiveRecord::Base.connection.raw_connection.query("select 'foobar'::bytea").values[0][0]
=> "\\x666f6f626172"
[48] pry(#<PostgresqlByteaTest>)> PGconn.unescape_bytea(escaped)
=> "foobar"
[49] pry(#<PostgresqlByteaTest>)> ActiveRecord::VERSION::STRING
=> "4.0.0.beta"

Are you using the same version of the pg gem?

no. but that's not the issue. the actually call to PGconn.unescape_bytea returns different values on heroku even with the same versions. odd!

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.