Re: [GENERAL] pg_upgrade not detecting version properly

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Chris Ernst <cernst(at)zvelo(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] pg_upgrade not detecting version properly
Date: 2012-10-10 21:06:45
Message-ID: 20121010210645.GA21812@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Oct 10, 2012 at 01:54:49PM -0400, Bruce Momjian wrote:
> On Wed, Oct 10, 2012 at 10:35:06AM -0600, Chris Ernst wrote:
> > On 10/10/2012 09:56 AM, Bruce Momjian wrote:
> > > Can you show me what is in the PG_VERSION file in the old cluster? It
> > > should be "9.1".
> >
> > Hi Bruce,
> >
> > Thank you for the reply. Indeed it is "9.1":
> >
> > # cat /postgresql/9.1/main/PG_VERSION
> > 9.1
> >
> > And just for good measure:
> >
> > cat /postgresql/9.2/main/PG_VERSION
> > 9.2
> >
> > And there are no other PostgreSQL versions on this machine.
> >
> > Hmm... I was just about to send this when something else occurred to me.
> > I had initially tried to run pg_upgrade as root and it said it couldn't
> > be run as root. So I've been running it as my own user (which is in the
> > postgres group). However, everything in /postgresql/9.1/main is owned
> > by postgres with 700 permissions.
> >
> > I switched to the postgres user and now pg_upgrade is running. Perhaps
> > just a more informative error message is in order.
> >
> > Thank you for the shove in the right direction =)
>
> Oops, that code was returning zero if it couldn't open the file. The
> attached, applied patch to head and 9.2 issues a proper error message.
>
> Seems this "zero return" has been in the code since the beginning. :-(

CC to hackers.

Above is the email that caused me to fixed pg_upgrade's handling when it
can't read the data directory; patch attached.

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

+ It's impossible for everything to be true. +

Attachment Content-Type Size
open.diff text/x-diff 929 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gavin Flower 2012-10-10 23:25:58 Re: Index only scan
Previous Message Sergey Konoplev 2012-10-10 20:28:41 Re: Shorthand syntax for triggers

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2012-10-10 21:07:34 Re: Review for pg_dump: Sort overloaded functions in deterministic order
Previous Message Andres Freund 2012-10-10 21:05:26 Re: change in LOCK behavior