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

Restore data on PostgreSQL returns : PG::Error: incomplete multibyte character #21

Open
endersonmaia opened this issue Jan 19, 2016 · 1 comment

Comments

@endersonmaia
Copy link

I'm using this to migrate a Rails database from SQL Server 2008 to PostgreSQL 9.4.

The error PG::Error: incomplete multibyte character is about UNICODE.

All tables/fields works fines without errors during restore or breaking charset, except for Postgres' text bytea field that has gziped content.

@endersonmaia
Copy link
Author

Using this simple script

#!/usr/bin/env ruby
require 'sequel'

DB_src = Sequel.connect('tinytds://HOST/redmine')
DB_dst = Sequel.connect('postgres://HOST/redmine')

src_wcv = DB_src[:wiki_content_versions]
dst_wcv = DB_dst[:wiki_content_versions]

src_wcv.each { |r| dst_wcv << r }

I get this error

PG::CharacterNotInRepertoire: ERROR:  invalid byte sequence for encoding "UTF8": 0xda 0xcb (Sequel::DatabaseError)

I think since the filed is of type bytea, it shouldn't complain about UTF8 byte sequence.

Fetching the data via irb, the output is this

irb(main):016:0> wcv.first[:data]
=> "x\xDA\xCB0\xD4S\b\xCF\xCC\xCE\x04\x00\n)\x02|"

I know that Sequel and dump are differente projects, but I think the errors are related, right ?

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

1 participant