X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6380BD1DA7D for ; Tue, 27 Jan 2004 02:38:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 39290-09 for ; Mon, 26 Jan 2004 22:38:02 -0400 (AST) Received: from millenium.mst.co.jp (unknown [210.230.185.241]) by svr1.postgresql.org (Postfix) with ESMTP id B67D8D1DAA6 for ; Mon, 26 Jan 2004 22:37:57 -0400 (AST) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id i0R2bfY01549; Tue, 27 Jan 2004 11:37:41 +0900 Message-ID: <000c01c3e47e$8928f1c0$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Tom Lane" Cc: References: <000901c3e3e6$6cd00060$7201a8c0@mst1x5r347kymb> <8421.1075136755@sss.pgh.pa.us> Subject: Re: Can I change the character encoding for a DB? Date: Tue, 27 Jan 2004 11:37:41 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/249 X-Sequence-Number: 12112 Hi Tom, Thanks for the info and warning. Fortunately this is just a development database so any problems won't be too big a deal. Does dumping and re-creating the DB avoid such a potential problem? I read the info written by Tasuo, but I have to admit that the whole encoding thing is still full of mystery for me. For example, if the database has a SQL_ASCII encoding and you enter japanese text, what encoding is used? Does it depend on the client used to enter it? I wonder if it is possible that there is some SJIS data in my DB... My understanding is that the DB doesn't ensure that data makes sense in the set encoding, it just allows the db to make conversions when dealing with clients such as the ODBC and JDBC drivers. Anyway, in this case the base data came from a EUC_JP encoded DB, but a VB app (and some psql scripts) has been used to enter and modify data. It uses the ODBC driver provided for postgres, everything had been working smoothly and I only noticed a problem when I tried getting data using java and the jdbc driver. I created a new mini test DB with the EUC_JP encoding and the data was returned correctly. regards, Iain ----- Original Message ----- From: "Tom Lane" To: "Iain" Cc: Sent: Tuesday, January 27, 2004 2:05 AM Subject: Re: [ADMIN] Can I change the character encoding for a DB? > "Iain" writes: > > I created a DB with SQL_ASCII encoding but I want to change it to EUC_JP. > > Can I do this without creating a new database? > > If you're certain that the data already in the database is in EUC_JP > encoding, it would probably work to do a quick UPDATE on the > pg_database.encoding entry for the database (and then start fresh > backend sessions, since they won't notice otherwise). If there's data in > there that is not correct per EUC_JP then this will create big problems, > so don't say I didn't warn you ... > > regards, tom lane