Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVXgS-0002OE-92 for pgsql-admin@arkaria.postgresql.org; Fri, 24 Feb 2023 13:00:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pVXgQ-0002O8-2j for pgsql-admin@arkaria.postgresql.org; Fri, 24 Feb 2023 13:00:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVXgP-0002Nz-ON for pgsql-admin@lists.postgresql.org; Fri, 24 Feb 2023 13:00:17 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pVXgN-0002Dj-2W for pgsql-admin@lists.postgresql.org; Fri, 24 Feb 2023 13:00:16 +0000 Received: by mail-ed1-x536.google.com with SMTP id cy6so48994878edb.5 for ; Fri, 24 Feb 2023 05:00:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=aHHqeCKK1gucoQ4guOBBDTUf7bTfvqwq925pdDb2QWw=; b=7I52AUGfXPovakjigF0OV9TXwcxJ/OoHlYzNcqsGldPpB9RgTJgDHIW7/GcIJSnRIe o9iQLEDAdzF6MeJdi6G+0EEgjn0XGX/1cvinnJMl/fh1mvjNnUeC7jEwVF6UMSj3utAz PZJBuMneywxS11h3IZWji8wb5bgOojlqCv09S3Rrh3iYC1STasOXVKYvULuApXXdw3mQ E7v2B+nptLCKV1FUn+ZOb02RrpqOybd/mTPVRwhUdmJWKy+VlaJ5Dpk9TQiESBCLXUJG AmAT4fvT8dXlKeIqyHa5yeDc1L95+iUYxoIQyYxW3urllKZn2H6lFD6EdxYcB1ioeze/ bAOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aHHqeCKK1gucoQ4guOBBDTUf7bTfvqwq925pdDb2QWw=; b=r9ZV9TQ3sIiXnlAvIKpGqAS8BeXtiFcRTvs8lmltJ0RQc+ZphCawiAHzIu/VVTHc1K 5Px40ZPSxbG/Y8rFsik2c5wh8koq2SFiLGvTDLd/G9bkE4IzcdUvUakzDBIfGcKCweLv ore0s+gWJEqpNHRxcI0jKw+0W2OUj4DJPRlw70VRgJpvmJEhtG7w5hamHpC87vLLGEnK yzh26IP4Q+FXXLdV9CqEZQN/FsZoDjCiTY2ZUjpiF0bjb/PMurFZuIQeO5XZztrhWn6Y idgh8ZVOR9XoG48ECmeudPEKAYZF+o2yo4dpT6DXp/RQPTNkbG0lgbsprbbCHCwhYVOD iyNQ== X-Gm-Message-State: AO0yUKWV/HhB3wFq5ifECa+i+P3snBvR9ETqCG4b5mJRwtltyIZ/iDFV ru1ZwYHQXhOYtE+kvJzwUlTeTw== X-Google-Smtp-Source: AK7set+8gCblGyGCOQRTbDyrkcHS9hRVRo3NLbLtoNpkJpTxsicq9Z5hpsQFQLkRq+zR7gL1njRHvg== X-Received: by 2002:aa7:cac7:0:b0:4af:601c:ef0c with SMTP id l7-20020aa7cac7000000b004af601cef0cmr9249297edt.13.1677243613645; Fri, 24 Feb 2023 05:00:13 -0800 (PST) Received: from dynamic-pd01.res.v6.highway.a1.net ([2001:871:5e:539:1b2c:c52a:475d:310c]) by smtp.gmail.com with ESMTPSA id ed4-20020a056402294400b004af70dcce7esm1608792edb.40.2023.02.24.05.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 05:00:13 -0800 (PST) Message-ID: Subject: Re: PostgreSQL, change encoding preserving data From: Laurenz Albe To: info@denisgottardello.it, pgsql-admin@lists.postgresql.org Date: Fri, 24 Feb 2023 14:00:12 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2023-02-23 at 14:00 +0100, info@denisgottardello.it wrote: > Hi, my database is setup with encoding=3D win1252. In order to go to utf8= I run the followed query: >=20 > update pg_database set encoding=3D pg_char_to_encoding('utf8') where datn= ame=3D 'Handyman' >=20 > The problem is that, the database has already got data with special chara= cters such > as "=C3=A0=C3=B2=C3=A8=C3=A9". 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