PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 17th, 2012, 10:31 PM
jehsom jehsom is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 9 jehsom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 38 m 53 sec
Reputation Power: 0
Encoding snafu, please help!

We just moved our database from one server running Postgres 8.4 to a new server running 9.1. The 8.4 database had an encoding of LATIN1, and the 9.1 has UTF-8.
To move the database over, I simply piped the output from pg_dumpall on the 8.4 machine into psql on the new machine. However, I think I created big problems because I didn't run it through iconv.
Now I have a UTF-8 database with lots of badly-encoded strings.
How can I fix this? I'd like to make the database LATIN1 again, since this is the encoding used by our whole system.

Thanks!

Reply With Quote
  #2  
Old June 18th, 2012, 01:17 AM
shammat shammat is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Oct 2003
Location: Germany
Posts: 2,701 shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 4 Days 2 h 27 m 57 sec
Reputation Power: 284
Quote:
Originally Posted by jehsom
I'd like to make the database LATIN1 again, since this is the encoding used by our whole system
You'll have to drop and re-create the database. There is no option to change the characterset for a database.

Reply With Quote
  #3  
Old June 18th, 2012, 07:10 AM
jehsom jehsom is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 9 jehsom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 38 m 53 sec
Reputation Power: 0
Quote:
Originally Posted by shammat
You'll have to drop and re-create the database. There is no option to change the characterset for a database.


I understand that, that's fine, but I want to make sure that when I do that, my data comes out correctly. The problem is that when I restored the dump from the LATIN1 database, I had no client_encoding set in psql (rather it was SQL_ASCII), connected to a UTF8 database, restoring LATIN1 data, so I'm not sure how to get the data out in a way that will make sense.

Reply With Quote
  #4  
Old June 18th, 2012, 07:30 AM
shammat shammat is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Oct 2003
Location: Germany
Posts: 2,701 shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 4 Days 2 h 27 m 57 sec
Reputation Power: 284
You need to either make sure the client_encoding is set correctly for both tools (pg_dumpall and psql).

I think when piping the data it's quite hard to get the client encoding correct for each step. You are probably better off using pg_dumpall and psql separately (or pg_dump/pg_restore using the custom format, maybe that's more stable regarding different client encodings)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > Encoding snafu, please help!

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap