Skip site navigation (1) Skip section navigation (2)

pg_upgrade fails for non-postgres user

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_upgrade fails for non-postgres user
Date: 2011-01-28 22:08:22
Message-ID: AANLkTi=84YRXFom1bhq9JaCr-WKg+SAauYgFYjkTucdJ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
I just tried doing pg_upgrade on a database when logged in as user
"mha" rather than "postgres" on my system. And it failed. Even though
the db was initialized with superuser "mha". The reason for this was
that pg_upgrade tried to connect to the database "mha" (hardcoded to
be the db username), and that certainly didn't exist.

When that was fixed, I realized the psql command to create the
datanbases connect to database "template1" only to immediately switch
to database "postgres", which also seems rather pointless.

Attach patch makes it connect to the "postgres" database instead of
$USER, and then also changes the psql command to actually use it.

I know way too little about pg_upgrade to tell if this is fully safe,
but it does fix the problem in my installation.

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Attachment: pg_upgrade_db.patch
Description: text/x-patch (991 bytes)

Responses

pgsql-hackers by date

Next:From: Alex HunsakerDate: 2011-01-28 22:27:06
Subject: Re: arrays as pl/perl input arguments [PATCH]
Previous:From: Thom BrownDate: 2011-01-28 21:52:29
Subject: Re: WIP: RangeTypes

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group