Re: db encoding - Mailing list pgsql-hackers

From Tom Lane
Subject Re: db encoding
Date
Msg-id 2040.1065472284@sss.pgh.pa.us
Whole thread Raw
In response to Re: db encoding  (Oliver Elphick <olly@lfix.co.uk>)
Responses Re: db encoding  (Oliver Elphick <olly@lfix.co.uk>)
List pgsql-hackers
Oliver Elphick <olly@lfix.co.uk> writes:
> I currently use pg_encoding in Debian's automatic upgrade script to
> extract the existing default encoding from pg_database, thus:
> $ psql  -q -t -d template1 -c "select encoding from pg_database where
> datname = 'template1'"
>         0
> and then I use it to translate that number into an encoding name that
> can be fed to initdb.

But you can do that with pg_encoding_to_char:

regression=# select pg_encoding_to_char(encoding) from pg_database where datname = 'template1';pg_encoding_to_char
---------------------SQL_ASCII
(1 row)

AFAICS the standalone pg_encoding program is only useful if you need to
do encoding-number conversions while the postmaster is not available.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: CREATE USER bug
Next
From: Oliver Elphick
Date:
Subject: Re: db encoding