PostgreSQL supports several different text encodings.
To support Unicode characters including Emoji in the current version of PostgreSQL, select the UTF8 encoding when you create the database:
initdb -E UTF8
In SQL you can run
CREATE DATABASE sample_name WITH ENCODING 'UTF8';
Older versions
On PostgreSQL 8.0 and earlier, you should use ‘UNICODE’ instead of ‘UTF8’.
Multibyte UNICODE encoding was made available for the first time in PostgreSQL 7.1 and 7.2, but you need to compile PostgreSQL with –enable-multibyte=UNICODE. Starting in 7.3, it was built-in.