Thread: Does initdb -e is working ? (Latest dev. snapshot)

Does initdb -e is working ? (Latest dev. snapshot)

From
Oleg Bartunov
Date:
Probably I miss something 
I tried latest snapshot and notice some changes in configure.
Everything went smoothly on my Linux 2.2.14, glic 2.1.2 system.

One problem: I tried initdb -e koi8 and it doesn't works - 
all databases I have are in SQL_ASCII encodingDatabase  |  Owner   | Encoding  
-----------+----------+-----------discovery | postgres | SQL_ASCIItemplate1 | postgres | SQL_ASCIItest      | postgres
|SQL_ASCII
 

createdb -E koi8 works as expected:
createdb -E koi8 aa
CREATE DATABASE
zen:~$ psql -l       List of databasesDatabase  |  Owner   | Encoding  
-----------+----------+-----------aa        | postgres | KOI8discovery | postgres | SQL_ASCIItemplate1 | postgres |
SQL_ASCIItest     | postgres | SQL_ASCII
 

I found -e for initdb , -E for createdb options for specifying encoding a 
little bit confused - why not just use one of them !

Is't possible to change encoding of database except dump/destroydb/createdb
cycle ? Is't worth to have pg_encoding to do this ?

Regards,
Oleg

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



Re: [HACKERS] Does initdb -e is working ? (Latest dev. snapshot)

From
Tatsuo Ishii
Date:
> Probably I miss something 
> I tried latest snapshot and notice some changes in configure.
> Everything went smoothly on my Linux 2.2.14, glic 2.1.2 system.
> 
> One problem: I tried initdb -e koi8 and it doesn't works - 

Because someone has changed -e to -E.

> I found -e for initdb , -E for createdb options for specifying encoding a 
> little bit confused - why not just use one of them !

So now both initdb and createdb use -E as you expect. I think this is
a good thing.

> Is't possible to change encoding of database except dump/destroydb/createdb
> cycle ? Is't worth to have pg_encoding to do this ?

update pg_database set encoding = pg_char_to_encoding('KOI8');

should work for you. However I'm a little bit worried about the
syscache staffs. It would be safer to shutdown postmaster then issue
the update command from standalone postgres.
--
Tatsuo Ishii



Re: [HACKERS] Does initdb -e is working ? (Latest dev. snapshot)

From
Oleg Bartunov
Date:
On Sat, 29 Jan 2000, Tatsuo Ishii wrote:

> Date: Sat, 29 Jan 2000 20:32:43 +0900
> From: Tatsuo Ishii <t-ishii@sra.co.jp>
> To: oleg@sai.msu.su
> Cc: pgsql-hackers@postgreSQL.org
> Subject: Re: [HACKERS] Does initdb -e is working ? (Latest dev. snapshot)
> 
> > Probably I miss something 
> > I tried latest snapshot and notice some changes in configure.
> > Everything went smoothly on my Linux 2.2.14, glic 2.1.2 system.
> > 
> > One problem: I tried initdb -e koi8 and it doesn't works - 
> 
> Because someone has changed -e to -E.

OK. this is good if we have now similar option,
I suggest Peter should reflect this change in initdb --help
Usage: initdb [options] datadir

Options: [-D, --pgdata] <datadir>    Location for this database -W, --pwprompt              Prompt for a password for
thenew superuser's -e, --encoding <encoding>         Set the default multibyte encoding for new databases ^^^
 

> 
> > I found -e for initdb , -E for createdb options for specifying encoding a 
> > little bit confused - why not just use one of them !
> 
> So now both initdb and createdb use -E as you expect. I think this is
> a good thing.
> 
> > Is't possible to change encoding of database except dump/destroydb/createdb
> > cycle ? Is't worth to have pg_encoding to do this ?
> 
> update pg_database set encoding = pg_char_to_encoding('KOI8');
> 
> should work for you. However I'm a little bit worried about the
> syscache staffs. It would be safer to shutdown postmaster then issue
> the update command from standalone postgres.

Thanks, it works fine.
Regards,    Oleg

> --
> Tatsuo Ishii
> 
> 
> ************
> 

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



Re: [HACKERS] Does initdb -e is working ? (Latest dev. snapshot)

From
Peter Eisentraut
Date:
On 2000-01-29, Oleg Bartunov mentioned:

> One problem: I tried initdb -e koi8 and it doesn't works - 

> createdb -E koi8 works as expected:

> I found -e for initdb , -E for createdb options for specifying encoding a 
> little bit confused - why not just use one of them !

That's exactly why initdb uses -E as well now. But I see now it doesn't
reject invalid args because it interprets them as data directory. Will
fix.

Next time: initdb -? or initdb --help.

> Is't possible to change encoding of database except dump/destroydb/createdb
> cycle ? Is't worth to have pg_encoding to do this ?

pg_encoding is just a tools that maps encoding names to codes and vice
versa.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



Re: [HACKERS] Does initdb -e is working ? (Latest dev. snapshot)

From
Peter Eisentraut
Date:
On 2000-01-29, Peter Eisentraut mentioned:

> On 2000-01-29, Oleg Bartunov mentioned:
> 
> > One problem: I tried initdb -e koi8 and it doesn't works - 
> 
> > createdb -E koi8 works as expected:
> 
> > I found -e for initdb , -E for createdb options for specifying encoding a 
> > little bit confused - why not just use one of them !
> 
> That's exactly why initdb uses -E as well now. But I see now it doesn't
> reject invalid args because it interprets them as data directory. Will
> fix.
> 
> Next time: initdb -? or initdb --help.

Sorry, I just noticed that the help is wrong.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden