Crazy Bytes Being Added to Record Attribute

Issue #210 duplicate
Faraz created an issue

We had a fairly insane bug using PG v9.3.2 PG v0.17.1, and Ruby v2.2.0 that was alleviated by upgrading to v0.18.1, and I thought I should bring it up here.

Somewhere after ActiveRecord hands off SQL statement to the PG::Connection, seemingly random bits are being added to the end of an email string.

Here are some examples:

user@example.com\u007f
user@example.comr\u007f
user@example.comU\u007f
user@example.coma\u007f
user@example.com#m$\u007f

(Note the wonky delete character!)

Occasionally completely garbage bits get added causing a PG::CharacterNotInRepertoire error.

I thoroughly debugged the values of the email, and everything seems clean even before ActiveRecord's call to #async_exec, but retrieving the record back from the database (if the PG::CharacterNotInRepertoire had not occurred, of course) reveals those mystery bits.

Original SO post: http://stackoverflow.com/questions/28891447/weird-bytes-added-to-attribute-after-save-in-rails/28933076

Comments (6)

  1. Faraz reporter

    I realize this now of course. :)

    Can a warning of sorts be posted in the readme? Or perhaps release a teeny
    1.7 version that's incompatible with Ruby 2.2?

    This was one hell of a bug to track down...

  2. Log in to comment