pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: info@denisgottardello.it
To: pgsql-admin@lists.postgresql.org
Subject: Re: PostgreSQL, change encoding preserving data
Date: Fri, 24 Feb 2023 14:00:12 +0100
Message-ID: <eaed12d75cc4a053c0e266901787b5dda6f69dbc.camel@cybertec.at> (raw)
In-Reply-To: <RQJATA$1E1680D647802A67AD54279BC45B25E6@denisgottardello.it>
References: <RQJATA$1E1680D647802A67AD54279BC45B25E6@denisgottardello.it>

On Thu, 2023-02-23 at 14:00 +0100, info@denisgottardello.it wrote:
> Hi, my database is setup with encoding= win1252. In order to go to utf8 I run the followed query:
> 
> update pg_database set encoding= pg_char_to_encoding('utf8') where datname= 'Handyman'
> 
> The problem is that, the database has already got data with special characters such
> as "àòèé". After having executed the query to change the encoding to utf8, I can't read the special caracters.
> Is there a way to change the encoding and to migtrate the data?

Congratulations, you have broken your database.
Undo that change right away.  Don't update catalog tables.

The only way to do that is dump/restore.

Yours,
Laurenz Albe





view thread (4+ messages)

Message-ID: <eaed12d75cc4a053c0e266901787b5dda6f69dbc.camel@cybertec.at>
Permalink:  ../eaed12d75cc4a053c0e266901787b5dda6f69dbc.camel@cybertec.at/
Also on:    postgresql.org/message-id/eaed12d75cc4a053c0e266901787b5dda6f69dbc.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, info@denisgottardello.it, pgsql-admin@lists.postgresql.org
  Subject: Re: PostgreSQL, change encoding preserving data
  In-Reply-To: <eaed12d75cc4a053c0e266901787b5dda6f69dbc.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox