[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: new postgresql version for slink to potato



Oliver,

I tried version 6.5.3-20, and it solves several of the problems
previously mentioned, but there still seem to be some outstanding
issues, mostly relating to the encoding.

First of all, postgresql-dump appears to be using the wrong option to
initdb for encoding. It sets:
		INITOPTS=" --encoding $ENCODING"    #wrong syntax!

I think it should read:
		INITOPTS=" --pgencoding=$ENCODING"
or:		INITOPTS=" -e $ENCODING"

[Neither the man page for initdb nor the initdb documentation in
postgresql-doc (at least for 6.5.3-19 of postgresql-doc; I didn't
bother to reinstall the newer documentation package) mentions the
pgencoding variable, but initdb itself gives these two options as
proper syntax.  So it also appears that there's a bit of a
documentation bug.  The release notes to version 6.4 mention that the
--pgencoding option was added to initdb then.]

At the end of this email is a copy of the output to postgresql-dump
run as instructed in README.Debian.migration.gz (with the -v option
added).

If I change the INITOPTS line to use --pgencoding=$ENCODING, it runs
farther, but it still fails.  Apparently the problem is that
pg_dumpall is dumping a line that instructs psql to create a database
with a blank encoding, as in the following:

create database foo with encoding='';

I haven't tracked down the source of that problem.  I ran a modified
version of postgresql-dump (with the INITOPTS set as above); the
output is listed below.  The actual failure is shown in the following
segment, when psql fails to create a database because a nil encoding
isn't proper and then fails to connect because the database wasn't
created.

QUERY: create database foo with encoding='';
ERROR:  invalid encoding name 
\connect foo maw
connecting to new database: foo as user: maw
FATAL 1:  Database foo does not exist in pg_database

Could not connect to new database. exiting
Reload failed

A minor point: It appears that you tried to address the issue of
postgresql-dump finding all processes containing the string
"postmaster" in at least one place in postgresql-dump, but I'm not
sure you did this everywhere. If I run postgresql-dump (with the
corrected INITOPTS), and with a 'less postmaster.init' process
running, postgresql-dump appears to think that the postmaster is
running, but without the process containing the string postmaster,
postgresql-dump restarts the postmaster. Interestingly, this does not
affect the failure mode.  Some relevant snippets from the output:

With 'less postmaster.init' running:

...
Loading pg_description
Checking that the postmaster is running
Loading the database from db3.out
Reloading databases...
...

Without 'less postmaster.init' running:

...
Checking that the postmaster is running
Starting the postmaster
Starting PostgreSQL postmaster
/usr/lib/postgresql/bin/postmaster -i -b /usr/lib/postgresql/bin/postgres -D /var/postgres/data -d 3 -p 5432 -o '-E -e' >/var/log/postgres.log 2>&1 &
Loading the database from db3.out
Reloading databases...
...


When checking that the postmaster is running, postgresql-dump just
greps for the string postmaster anywhere in the ps output:

if [ -n "${load}" ]
then
	if [ -n "${verbose}" ]
	then
		echo "Checking that the postmaster is running" >&2
	fi
	if [ -z "`ps ax | grep postmaster | grep -v grep`" ]

That's all for now.  Thanks.

--Miguel

--------------Running postgresql-dump as packaged-----------------
I ran postgresql-dump as instructed in README.Debian.migration.gz
(with the -v option added).
$ postgresql-dump -t db3.out -vcilfdp $PGDATA/../data.save
Stopping and restarting the postmaster
Dumping the database to db3.out
Finding the default encoding
Killing the postmaster
This is the ASCII output of the dump for you to check:

...
On the basis of this dump, is it OK to delete the old database? [y/n] y
Destroying old database...
Copying /var/postgres/data to /var/postgres/data/../data.save
Deleting /var/postgres/data
Creating the new database structure
Unrecognized option '--encoding'.  Syntax is:
initdb [-t | --template] [-d | --debug] [-n | --noclean] [-u SUPERUSER | --username=SUPERUSER] [-r DATADIR | --pgdata=DATADIR] [-l LIBDIR | --pglib=LIBDIR] [-e ENCODING | --pgencoding=ENCODING]
initdb failed
$ 
------------end of output to postgresql-dump as packaged--------------


------------with INITOPTS=" --pgencoding=$ENCODING"---------------

... 

Is this dump suitable for loading into the new database? [y/n] y
Creating the new database structure

We are initializing the database system with username postgres (uid=31).
This user will own all the files and must also own the server process.

Creating Postgres database system directory /var/postgres/data/base

Creating template database in /var/postgres/data/base/template1

Creating global classes in /var/postgres/data/base

Adding template1 database to pg_database...

Vacuuming template1
Creating public pg_user view
Creating view pg_rules
Creating view pg_views
Creating view pg_tables
Creating view pg_indexes
Loading pg_description
Checking that the postmaster is running
Starting the postmaster
Starting PostgreSQL postmaster
/usr/lib/postgresql/bin/postmaster -i -b /usr/lib/postgresql/bin/postgres -D /var/postgres/data -d 3 -p 5432 -o '-E -e' >/var/log/postgres.log 2>&1 &
Loading the database from db3.out
Reloading databases...
-- postgresql-dump  on Wed May 31 12:55:30 PDT 2000 from version 6.3
\connect template1
connecting to new database: template1
select datdba into table tmp_pg_shadow       from pg_database where datname = 'template1';
QUERY: select datdba into table tmp_pg_shadow       from pg_database where datname = 'template1';
SELECT
delete from pg_shadow where usesysid <> tmp_pg_shadow.datdba;
QUERY: delete from pg_shadow where usesysid <> tmp_pg_shadow.datdba;
DELETE 0
drop table tmp_pg_shadow;
QUERY: drop table tmp_pg_shadow;
DROP
copy pg_shadow from stdin;
QUERY: copy pg_shadow from stdin;
\connect template1 maw
connecting to new database: template1 as user: maw
create database foo with encoding='';
QUERY: create database foo with encoding='';
ERROR:  invalid encoding name 
\connect foo maw
connecting to new database: foo as user: maw
FATAL 1:  Database foo does not exist in pg_database

Could not connect to new database. exiting
Reload failed
$  
--------------end of output with INITOPTS modification--------------



Reply to: