Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created August 17, 2012 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahoward/3382094 to your computer and use it in GitHub Desktop.
Save ahoward/3382094 to your computer and use it in GitHub Desktop.
ar / pg / bytea is fucked on heroku due to db config
>> 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
[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"
@tenderlove
Copy link

Are you using the same version of the pg gem?

@ahoward
Copy link
Author

ahoward commented Aug 17, 2012

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment