Create PostgreSQL Database with ENCODING 'WIN1252' on Cluster Initialized with locale "en_US.UTF-8"?

From: KARIN SUSANNE HILBERT <ioh1(at)psu(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: Create PostgreSQL Database with ENCODING 'WIN1252' on Cluster Initialized with locale "en_US.UTF-8"?
Date: 2017-02-23 01:00:26
Message-ID: 1426412704.8061179.1487811626868.JavaMail.zimbra@psu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a Windows DB2 database that I need to migrate to PostgreSQL 9.4 on RedHat Linux.
The database cluster was initialized with locale "en_US.UTF-8".

For my migrated database, I need to create a PostgreSQL database with ENCODING 'WIN1252'.
Is it possible to do this on my current cluster?
My research seems to indicatate that WIN1252 is a subset of UTF8.
But I can't find anything to tell me what to put for the LC_COLLATE or LC_CTYPE options.

I tried the following;
CREATE DATABASE :dbName WITH OWNER :dbOwner ENCODING 'WIN1252' CONNECTION LIMIT -1;
and got this error:
ERROR: encoding "WIN1252" does not match locale "en_US.UTF-8"
DETAIL: The chosen LC_CTYPE setting requires encoding "UTF8".

I then tried:
CREATE DATABASE :dbName WITH OWNER :dbOwner ENCODING 'WIN1252' LC_COLLATE='en_US.1252' CONNECTION LIMIT -1;
but got this error:
ERROR: invalid locale name: "en_US.1252"

And tried:
CREATE DATABASE :dbName WITH OWNER :dbOwner ENCODING 'WIN1252' LC_COLLATE='en_US.WIN1252' CONNECTION LIMIT -1;
and got this:
ERROR: invalid locale name: "en_US.WIN1252"

Any help would be greatly appreciated.
Thanks,
Karin Hilbert

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2017-02-23 01:52:09 Re: Create PostgreSQL Database with ENCODING 'WIN1252' on Cluster Initialized with locale "en_US.UTF-8"?
Previous Message Rounak Jain 2017-02-18 06:17:43 Re: alter existing table column with primary key to auto-increment