Postgresql 9.0b2 : pg_upgrade not passing username to pgdumpall ?

Lists: pgsql-adminpgsql-testers
From: "Cassiano, Marco" <mcassiano(at)manord(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Postgresql 9.0b2 : pg_upgrade not passing username to pgdumpall ?
Date: 2010-06-21 16:33:27
Message-ID: BC53C974C3B9E542BC0A9BD4C5B1168A0CC2D371@NEWMAIL.manord.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-testers

Hi all,

it's my first trial with pg_upgrade so I'm surely missing something....

I'm trying to launch pg_upgrade passing my super user name but
pg_dumpall fails with a permission denied error....

I don't see the username in the pgdumpall call....could it be this the
problem ?

Thank you (I hope this is the right list to post this)

Marco

The output :

------------------------------

-bash-3.2$ /usr/local/pgsql/bin/pg_upgrade -d /dbms/pgdata-8.4 -D
/dbms/pgdata -b /usr/local/pgsql-8.4/bin -B /usr/local/pgsql/bin -l
/tmp/pg_upgrade.log -v --user=mysuperuser

Running in verbose mode

Performing Consistency Checks

-----------------------------

Checking old data directory (/dbms/pgdata-8.4) ok

Checking new data directory (/dbms/pgdata) ok

"/usr/local/pgsql-8.4/bin/pg_ctl" -l "/tmp/pg_upgrade.log" -D
"/dbms/pgdata-8.4" -o "-p 5432 -c autovacuum=off -c
autovacuum_freeze_max_age=2000000000" start >> "/tmp/pg_upgrade.log"
2>&1

Checking for /contrib/isn with bigint-passing mismatch ok

Checking for large objects ok

Creating catalog dump
"/usr/local/pgsql/bin/pg_dumpall" --port 5432 --schema-only
--binary-upgrade >
"/home/postgres/pg_upgrade_output/pg_upgrade_dump_all.sql"

pg_dumpall: query failed: ERROR: permission denied for relation
pg_authid

pg_dumpall: query was: SELECT rolname, rolsuper, rolinherit,
rolcreaterole, rolcreatedb, rolcatupdate, rolcanlogin, rolconnlimit,
rolpassword, rolvaliduntil, pg_catalog.shobj_description(oid,
'pg_authid') as rolcomment FROM pg_authid ORDER BY 1


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Cassiano, Marco" <mcassiano(at)manord(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Postgresql 9.0b2 : pg_upgrade not passing username to pgdumpall ?
Date: 2010-06-22 16:48:12
Message-ID: 201006221648.o5MGmC218301@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-testers

Cassiano, Marco wrote:
> Hi all,
>
>
>
> it's my first trial with pg_upgrade so I'm surely missing something....
>
> I'm trying to launch pg_upgrade passing my super user name but
> pg_dumpall fails with a permission denied error....
>
> I don't see the username in the pgdumpall call....could it be this the
> problem ?
>
> Thank you (I hope this is the right list to post this)

Turns out I was missing the user name designation. I am attaching the
patch that fixes this, and a pg_ctl issue on Win32.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 5.4 KB

From: "Cassiano, Marco" <mcassiano(at)manord(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: <pgsql-admin(at)postgresql(dot)org>, <pgsql-testers(at)postgresql(dot)org>
Subject: R: Postgresql 9.0b2 : pg_upgrade not passing username to pgdumpall ?
Date: 2010-06-23 16:02:32
Message-ID: BC53C974C3B9E542BC0A9BD4C5B1168A0CC2D40B@NEWMAIL.manord.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-testers

Thank you Bruce,

I applied the patch and found two things you might want to take in consideration :

1) dump.c Line 25 should be :

SYSTEMQUOTE, ctx->new.bindir, ctx->old.port, ctx->user, ctx->output_dir);

And not

SYSTEMQUOTE, ctx->new.bindir, ctx->old.port, ctx->user, ctx->cwd);

(sorry, I'm not confident at producing patch files....)

2) I then recompiled pg_upgrade and reinstalled it.
Now it goes a little bit further but I think there's another point (vacuumdb of the new cluster) in which the username is missing.
You might want to take a look at this output (/tmp/pg_upgrade.log)

....

Checking for presence of required libraries ok

| If pg_upgrade fails after this point, you must
| re-initdb the new cluster before continuing.
| You will also need to remove the ".old" suffix
| from /dbms/pgdata-8.4/global/pg_control.old.

Performing Migration
--------------------
Adding ".old" suffix to old global/pg_control ok
Analyzing all rows in the new cluster "/usr/local/pgsql/bin/vacuumdb" --port 5432 --all --analyze >> /tmp/pg_upgrade.log 2>&1
FATAL: role "postgres" does not exist
vacuumdb: could not connect to database postgres: FATAL: role "postgres" does not exist

..............

If I launch it manually adding the -U mysuperuser option it works...

Hope this is somehow useful

Regards

Marco

-----Messaggio originale-----
Da: Bruce Momjian [mailto:bruce(at)momjian(dot)us]
Inviato: martedì 22 giugno 2010 18:48
A: Cassiano, Marco
Cc: pgsql-admin(at)postgresql(dot)org
Oggetto: Re: [ADMIN] Postgresql 9.0b2 : pg_upgrade not passing username to pgdumpall ?

Cassiano, Marco wrote:
> Hi all,
>
>
>
> it's my first trial with pg_upgrade so I'm surely missing something....
>
> I'm trying to launch pg_upgrade passing my super user name but
> pg_dumpall fails with a permission denied error....
>
> I don't see the username in the pgdumpall call....could it be this the
> problem ?
>
> Thank you (I hope this is the right list to post this)

Turns out I was missing the user name designation. I am attaching the patch that fixes this, and a pg_ctl issue on Win32.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Cassiano, Marco" <mcassiano(at)manord(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org, pgsql-testers(at)postgresql(dot)org
Subject: Re: [TESTERS] R: Postgresql 9.0b2 : pg_upgrade not passing username to pgdumpall ?
Date: 2010-06-23 20:04:22
Message-ID: 201006232004.o5NK4MA15973@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-testers

Cassiano, Marco wrote:
> Thank you Bruce,
>
> I applied the patch and found two things you might want to take in consideration :
>
> 1) dump.c Line 25 should be :
>
> SYSTEMQUOTE, ctx->new.bindir, ctx->old.port, ctx->user, ctx->output_dir);
>
> And not
>
> SYSTEMQUOTE, ctx->new.bindir, ctx->old.port, ctx->user, ctx->cwd);
>
> (sorry, I'm not confident at producing patch files....)

OK, the problem here is that I changed output_dir to cwd since beta2;
your change is fine for your version of pg_upgrade.

> 2) I then recompiled pg_upgrade and reinstalled it. Now it goes
> a little bit further but I think there's another point (vacuumdb of
> the new cluster) in which the username is missing. You might want
>to take a look at this output (/tmp/pg_upgrade.log)

Ah, you are right --- I seem to have missed a bunch of username
designations. I went through and looked all all the exec calls, and
added the username to each one that supported it; applied patch
attached.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 6.5 KB