PostgreSQL: create database with UTF8 encoding same as in MySQL (including character set, encoding, and lc_type)

Yes, you can be more specific.

For example:

CREATE DATABASE "scratch"
  WITH OWNER "postgres"
  ENCODING 'UTF8'
  LC_COLLATE = 'en_US.UTF-8'
  LC_CTYPE = 'en_US.UTF-8';

Also I recommend to read the following pages about locales and collations in PostgreSQL:

  • http://www.postgresql.org/docs/current/interactive/locale.html
  • http://www.postgresql.org/docs/current/interactive/collation.html

Leave a Comment

tech