Re: copying a large database to change encoding

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Matthew Chambers *EXTERN*" <mchambers(at)wetafx(dot)co(dot)nz>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: copying a large database to change encoding
Date: 2014-10-15 08:35:18
Message-ID: A737B7A37273E048B164557ADEF4A58B17D7469C@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Matthew Chambers wrote:
> Would something like this work best, or is it better to use pgdump?
>
> CREATE DATABASE newDatabase TEMPLATE oldDatabase ENCODING 'UTF8'
>
> Does using a template do a file system copy or just SQL copy everything over?

Using the old database as template will not change the encoding,
so I think that will not work at all.

The documentation says:
The encoding and locale settings must match those of the template database,
except when template0 is used as template.

Did you try it?

I think you will have to dump/restore.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2014-10-15 09:03:38 Re: Will pg_repack improve this query performance?
Previous Message Roopeshakumar Narayansa Shalgar (rshalgar) 2014-10-15 08:17:01 Any postgres API available to get errorcode for PQerrorMessage