Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent ActiveRecord::StatementInvalid: PG::CharacterNotInRepertoire Error #36

Open
D1plo1d opened this issue Feb 10, 2014 · 7 comments

Comments

@D1plo1d
Copy link

D1plo1d commented Feb 10, 2014

I'm getting the following error when I try to create a model with a UUID primary key in rails 4.0.2:

ActiveRecord::StatementInvalid: PG::CharacterNotInRepertoire: ERROR:  invalid byte sequence for encoding "UTF8": 0xd6 0x40

running reload! from the console seems to fix the problem so I'm wondering if this is a race condition in startup. I know rails added uuid's in 4 at some point and so I'm wondering if it's a conflict with the new uuid column type. Any ideas?

Full error: https://gist.github.com/D1plo1d/1f5a57b90e2a0d331a94

@D1plo1d
Copy link
Author

D1plo1d commented Feb 10, 2014

Removing ActiveUUID fixes the problem. So the uuid column type patch should not be applied for rails 4.0.2+ (and possibly earlier versions as well).

@claude
Copy link

claude commented Feb 23, 2015

@D1plo1d can you please elaborate on this? I'm also noticing an issue with intermittent behavior, but it's reproducible in tests. Initial run of tests fail when using spring, but saving any file and re-running the tests they pass. I'm guessing this is similar to the reload you were doing. Do you know how to use this gem on rails 4.0.2+ and get consistent results?

@D1plo1d
Copy link
Author

D1plo1d commented Feb 24, 2015

@claude Sorry, that was all from a year ago on my end. I can't recall the details of the issue any more then what I wrote above.

Edit: Not sure how to get the gem working consistently. Our solution was to removed it entirely.

@claude
Copy link

claude commented Feb 24, 2015

thanks for the response, so did you get uuid's working another way?

@D1plo1d
Copy link
Author

D1plo1d commented Feb 24, 2015

Yeah. It's actually baked into Rails 4 so we just use the built in helpers now (instead of activeuuid). Here's an example:

http://johnkolovos.blogspot.ca/2014/10/rails-4-uuid.html

@claude
Copy link

claude commented Feb 25, 2015

Ahh, yeah that works great for postgres. Unfortunately mysql doesn't have a native uuid type and so you need this gem to do the string to binary conversion for you. That way you don't have to store the uuid as a string in mysqll. Thanks for the help though!

@D1plo1d
Copy link
Author

D1plo1d commented Feb 25, 2015

np, good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants