pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #11090: Unclear error message in pg_upgrade
15+ messages / 7 participants
[nested] [flat]
* BUG #11090: Unclear error message in pg_upgrade
@ 2014-07-29 17:40 brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 15+ messages in thread
From: brorfred@gmail.com @ 2014-07-29 17:40 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 11090
Logged by: Bror Jonsson
Email address: brorfred@gmail.com
PostgreSQL version: 9.2.0
Operating system: Mac OS X
Description:
pg_upgrade requires that the old and new database has the same install
superuser (superuser that ran initdb). If this requirement isn't fulfilled,
you'll get the following error:
"Old and new cluster install users have different values for
pg_authid.oid.\n"
(https://github.com/postgres/postgres/blob/master/contrib/pg_upgrade/check.c,
line 168)
This was very confusing to me. A suggested rephrase would be:
"Old and new cluster must be created by the same user. Try to re-init the
new database with the flag "-U %s" \n"
Where %s is the the install user in the old cluster.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
@ 2014-07-29 18:58 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 19:53 ` Re: BUG #11090: Unclear error message in pg_upgrade John R Pierce <pierce@hogranch.com>
2014-07-29 20:40 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
0 siblings, 2 replies; 15+ messages in thread
From: Alvaro Herrera @ 2014-07-29 18:58 UTC (permalink / raw)
To: brorfred@gmail.com; +Cc: pgsql-bugs
brorfred@gmail.com wrote:
> pg_upgrade requires that the old and new database has the same install
> superuser (superuser that ran initdb). If this requirement isn't fulfilled,
> you'll get the following error:
>
> "Old and new cluster install users have different values for
> pg_authid.oid.\n"
To me, the bug is that we required both superusers to be named the same
in the first place.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2014-07-29 19:53 ` John R Pierce <pierce@hogranch.com>
2014-07-29 20:44 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
1 sibling, 1 reply; 15+ messages in thread
From: John R Pierce @ 2014-07-29 19:53 UTC (permalink / raw)
To: pgsql-bugs
On 7/29/2014 11:58 AM, Alvaro Herrera wrote:
> brorfred@gmail.com wrote:
>
>> >pg_upgrade requires that the old and new database has the same install
>> >superuser (superuser that ran initdb). If this requirement isn't fulfilled,
>> >you'll get the following error:
>> >
>> >"Old and new cluster install users have different values for
>> >pg_authid.oid.\n"
> To me, the bug is that we required both superusers to be named the same
> in the first place.
so, if its enhanced with a -U newsuperuser flag, any objects owned by
'postgres' on the original cluster are now owned by 'newsuperuser' on
the new cluster?
--
john r pierce 37N 122W
somewhere on the middle of the left coast
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 19:53 ` Re: BUG #11090: Unclear error message in pg_upgrade John R Pierce <pierce@hogranch.com>
@ 2014-07-29 20:44 ` David G Johnston <david.g.johnston@gmail.com>
2014-07-29 20:57 ` Re: BUG #11090: Unclear error message in pg_upgrade Jeff Janes <jeff.janes@gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: David G Johnston @ 2014-07-29 20:44 UTC (permalink / raw)
To: pgsql-bugs
John R Pierce wrote
> On 7/29/2014 11:58 AM, Alvaro Herrera wrote:
>>
> brorfred@
> wrote:
>>
>>> >pg_upgrade requires that the old and new database has the same install
>>> >superuser (superuser that ran initdb). If this requirement isn't
>>> fulfilled,
>>> >you'll get the following error:
>>> >
>>> >"Old and new cluster install users have different values for
>>> >pg_authid.oid.\n"
>> To me, the bug is that we required both superusers to be named the same
>> in the first place.
>
> so, if its enhanced with a -U newsuperuser flag, any objects owned by
> 'postgres' on the original cluster are now owned by 'newsuperuser' on
> the new cluster?
Please no. I'm not a pg_upgrade user but this just seems like asking for
trouble. There has been one complaint and while I can see why the user
tried this it is not a very convincing use case. Rewording the error is
sufficient.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-11090-Unclear-error-message-in-pg-upgrade-tp5813198p5813...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 19:53 ` Re: BUG #11090: Unclear error message in pg_upgrade John R Pierce <pierce@hogranch.com>
2014-07-29 20:44 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
@ 2014-07-29 20:57 ` Jeff Janes <jeff.janes@gmail.com>
2014-07-29 21:04 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 15+ messages in thread
From: Jeff Janes @ 2014-07-29 20:57 UTC (permalink / raw)
To: David G Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-bugs
On Tue, Jul 29, 2014 at 1:44 PM, David G Johnston <
david.g.johnston@gmail.com> wrote:
> John R Pierce wrote
> > On 7/29/2014 11:58 AM, Alvaro Herrera wrote:
> >>
>
> > brorfred@
>
> > wrote:
> >>
> >>> >pg_upgrade requires that the old and new database has the same install
> >>> >superuser (superuser that ran initdb). If this requirement isn't
> >>> fulfilled,
> >>> >you'll get the following error:
> >>> >
> >>> >"Old and new cluster install users have different values for
> >>> >pg_authid.oid.\n"
> >> To me, the bug is that we required both superusers to be named the same
> >> in the first place.
> >
> > so, if its enhanced with a -U newsuperuser flag, any objects owned by
> > 'postgres' on the original cluster are now owned by 'newsuperuser' on
> > the new cluster?
>
> Please no. I'm not a pg_upgrade user but this just seems like asking for
> trouble. There has been one complaint and while I can see why the user
> tried this it is not a very convincing use case. Rewording the error is
> sufficient.
>
I have one database with a retrospectively poor choice of initdb -U. I
certainly wish there was a way, short of dump and restore, to change the
name of that user. Although I don't think pg_upgrade would be the ideal
way to do that.
Cheers,
Jeff
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 19:53 ` Re: BUG #11090: Unclear error message in pg_upgrade John R Pierce <pierce@hogranch.com>
2014-07-29 20:44 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-29 20:57 ` Re: BUG #11090: Unclear error message in pg_upgrade Jeff Janes <jeff.janes@gmail.com>
@ 2014-07-29 21:04 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 21:13 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 15+ messages in thread
From: Alvaro Herrera @ 2014-07-29 21:04 UTC (permalink / raw)
To: Jeff Janes <jeff.janes@gmail.com>; +Cc: David G Johnston <david.g.johnston@gmail.com>; pgsql-bugs
Jeff Janes wrote:
> I have one database with a retrospectively poor choice of initdb -U. I
> certainly wish there was a way, short of dump and restore, to change the
> name of that user. Although I don't think pg_upgrade would be the ideal
> way to do that.
Have you tried an UPDATE pg_authid?
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 19:53 ` Re: BUG #11090: Unclear error message in pg_upgrade John R Pierce <pierce@hogranch.com>
2014-07-29 20:44 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-29 20:57 ` Re: BUG #11090: Unclear error message in pg_upgrade Jeff Janes <jeff.janes@gmail.com>
2014-07-29 21:04 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2014-07-29 21:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-07-29 21:59 ` Re: BUG #11090: Unclear error message in pg_upgrade Jeff Janes <jeff.janes@gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: Tom Lane @ 2014-07-29 21:13 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Jeff Janes <jeff.janes@gmail.com>; David G Johnston <david.g.johnston@gmail.com>; pgsql-bugs
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Jeff Janes wrote:
>> I have one database with a retrospectively poor choice of initdb -U. I
>> certainly wish there was a way, short of dump and restore, to change the
>> name of that user. Although I don't think pg_upgrade would be the ideal
>> way to do that.
> Have you tried an UPDATE pg_authid?
Or even just ALTER USER RENAME?
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 19:53 ` Re: BUG #11090: Unclear error message in pg_upgrade John R Pierce <pierce@hogranch.com>
2014-07-29 20:44 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-29 20:57 ` Re: BUG #11090: Unclear error message in pg_upgrade Jeff Janes <jeff.janes@gmail.com>
2014-07-29 21:04 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 21:13 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
@ 2014-07-29 21:59 ` Jeff Janes <jeff.janes@gmail.com>
0 siblings, 0 replies; 15+ messages in thread
From: Jeff Janes @ 2014-07-29 21:59 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@2ndquadrant.com>; David G Johnston <david.g.johnston@gmail.com>; pgsql-bugs
On Tue, Jul 29, 2014 at 2:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > Jeff Janes wrote:
> >> I have one database with a retrospectively poor choice of initdb -U. I
> >> certainly wish there was a way, short of dump and restore, to change the
> >> name of that user. Although I don't think pg_upgrade would be the ideal
> >> way to do that.
>
> > Have you tried an UPDATE pg_authid?
>
No. Updating the system catalog directly sounds like one of those 'you get
to keep both pieces' situations, and it wasn't that important to me.
>
> Or even just ALTER USER RENAME?
>
I thought I tried that. On a test system, I see that it works once I
create yet another superuser to be logged in as as I do the renaming. I
think the problem I was having before I gave up is that the desired new
role already existed and owned some inconsequential objects. I tried to
REASSIGN OWNED the rest of the objects to it, which wouldn't work. What I
should have done is REASSIGNED OWNED the few stray objects from the desired
role back to the -U role (or to a completely different role), drop the
desired one, and then rename the -U user to the desired one.
So yeah, I think there is a path to do this, it is just quite convoluted.
Cheers,
Jeff
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2014-07-29 20:40 ` David G Johnston <david.g.johnston@gmail.com>
2014-07-29 21:31 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 15+ messages in thread
From: David G Johnston @ 2014-07-29 20:40 UTC (permalink / raw)
To: pgsql-bugs
Alvaro Herrera-9 wrote
> brorfred@
> wrote:
>
>> pg_upgrade requires that the old and new database has the same install
>> superuser (superuser that ran initdb). If this requirement isn't
>> fulfilled,
>> you'll get the following error:
>>
>> "Old and new cluster install users have different values for
>> pg_authid.oid.\n"
>
> To me, the bug is that we required both superusers to be named the same
> in the first place.
It seems a reasonable limitation for something the simply purports to
"upgrade". The data should not be changed in the process.
My question: is there a way to change the name of the assigned install user
as long as you can manage to ensure they have the same oid? The error
implies there is.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-11090-Unclear-error-message-in-pg-upgrade-tp5813198p5813...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 20:40 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
@ 2014-07-29 21:31 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 02:08 ` Re: BUG #11090: Unclear error message in pg_upgrade Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 15+ messages in thread
From: Tom Lane @ 2014-07-29 21:31 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; David G Johnston <david.g.johnston@gmail.com>; Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-bugs
David G Johnston <david.g.johnston@gmail.com> writes:
> Alvaro Herrera-9 wrote
>> To me, the bug is that we required both superusers to be named the same
>> in the first place.
> It seems a reasonable limitation for something the simply purports to
> "upgrade". The data should not be changed in the process.
Yeah, I wouldn't really expect pg_upgrade to deal with such a case.
For one thing, what if the new cluster's superuser name conflicts with
some non-superuser in the old cluster?
Having said that, I think the actual implementation restriction is not
that they have the same *name*, but that they have the same *OID*.
And the OID of the bootstrap superuser is always gonna be 10. As long
as the new cluster's bootstrap superuser name doesn't collide with
any other usernames in the old cluster, it could in principle be
different. The only difficulty is that pg_upgrade has but one -U
switch to specify both names ... and it's not exactly clear that it's
worth the complication to have two such switches.
I agree that it'd be better if the error message said something like
"you have to use the bootstrap superuser, which is 'foo' in this cluster".
That would be overconstraining the user of pg_upgrade, but not by much,
and it would be a lot easier to understand than the current situation.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 20:40 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-29 21:31 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
@ 2014-07-30 02:08 ` Bruce Momjian <bruce@momjian.us>
2014-07-30 02:33 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 15+ messages in thread
From: Bruce Momjian @ 2014-07-30 02:08 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@2ndquadrant.com>; David G Johnston <david.g.johnston@gmail.com>; pgsql-bugs
On Tue, Jul 29, 2014 at 05:31:47PM -0400, Tom Lane wrote:
> Having said that, I think the actual implementation restriction is not
> that they have the same *name*, but that they have the same *OID*.
> And the OID of the bootstrap superuser is always gonna be 10. As long
> as the new cluster's bootstrap superuser name doesn't collide with
> any other usernames in the old cluster, it could in principle be
> different. The only difficulty is that pg_upgrade has but one -U
> switch to specify both names ... and it's not exactly clear that it's
> worth the complication to have two such switches.
>
> I agree that it'd be better if the error message said something like
> "you have to use the bootstrap superuser, which is 'foo' in this cluster".
> That would be overconstraining the user of pg_upgrade, but not by much,
> and it would be a lot easier to understand than the current situation.
Basically, here are the pg_upgrade restrictions:
o same user must exist in old and new clusters
o only one user can be defined in the new cluster (most likely the
install user)
o the oids of the two users must be the same (likely the install user
on the old cluster as well)
The error message generated:
"Old and new cluster install users have different values for
pg_authid.oid.\n"
basically is failing on the last check. Odds are the user specified by
-U existed in both the old and new clusters, and was the sole/install
user in the new cluster. What failed was that the old user was not the
install user, so didn't have the install oid (10) in the old cluster.
I am not sure we can improve that error message. I don't think we can
assume anything more than an oid mismatch. The oids might not match
because of the case above, or the new cluster might have created a new
user and then dropped the install user, and in that case the new user
oid would be the wrong one.
The basic logic is outlined in this C comment:
* We only allow the install user in the new cluster because other defined
* users might match users defined in the old cluster and generate an
* error during pg_dump restore.
What I think you actually can do is to run pg_upgrade with a user that
is not the install user in either cluster, as long as the oids match. I
am afraid any more specific message could technically be wrong in some
rare cases.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 20:40 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-29 21:31 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 02:08 ` Re: BUG #11090: Unclear error message in pg_upgrade Bruce Momjian <bruce@momjian.us>
@ 2014-07-30 02:33 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 03:31 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-30 14:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Bruce Momjian <bruce@momjian.us>
0 siblings, 2 replies; 15+ messages in thread
From: Tom Lane @ 2014-07-30 02:33 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Alvaro Herrera <alvherre@2ndquadrant.com>; David G Johnston <david.g.johnston@gmail.com>; pgsql-bugs
Bruce Momjian <bruce@momjian.us> writes:
> What I think you actually can do is to run pg_upgrade with a user that
> is not the install user in either cluster, as long as the oids match. I
> am afraid any more specific message could technically be wrong in some
> rare cases.
I think you missed my point. I'm suggesting actually restricting what
pg_upgrade will accept, so that the error conditions become simpler to
understand.
Furthermore, if your description of the restrictions is accurate, then
restricting to "the user must be the bootstrap superuser in both clusters"
is actually not an extra restriction. You said:
> o only one user can be defined in the new cluster (most likely the
> install user)
If there is only one user in the new cluster, it *is* the bootstrap
superuser, because that user cannot be deleted.
> o the oids of the two users must be the same (likely the install user
> on the old cluster as well)
If the OIDs are the same, then the old-cluster user is also the bootstrap
superuser, because the bootstrap superuser's hard-wired OID is 10. QED.
So I think you should get rid of the existing error check and simplify it
to "user must be bootstrap superuser (ie, OID 10) in both clusters".
The existing approach adds only confusion, not flexibility.
> What I think you actually can do is to run pg_upgrade with a user that
> is not the install user in either cluster, as long as the oids match.
I don't think you actually can, and if you could, I frankly would not
trust the results.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 20:40 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-29 21:31 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 02:08 ` Re: BUG #11090: Unclear error message in pg_upgrade Bruce Momjian <bruce@momjian.us>
2014-07-30 02:33 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
@ 2014-07-30 03:31 ` David G Johnston <david.g.johnston@gmail.com>
1 sibling, 0 replies; 15+ messages in thread
From: David G Johnston @ 2014-07-30 03:31 UTC (permalink / raw)
To: pgsql-bugs
Tom Lane-2 wrote
> Bruce Momjian <
> bruce@
> > writes:
>> What I think you actually can do is to run pg_upgrade with a user that
>> is not the install user in either cluster, as long as the oids match. I
>> am afraid any more specific message could technically be wrong in some
>> rare cases.
>
> I think you missed my point. I'm suggesting actually restricting what
> pg_upgrade will accept, so that the error conditions become simpler to
> understand.
>
> Furthermore, if your description of the restrictions is accurate, then
> restricting to "the user must be the bootstrap superuser in both clusters"
> is actually not an extra restriction. You said:
>
>> o only one user can be defined in the new cluster (most likely the
>> install user)
>
> If there is only one user in the new cluster, it *is* the bootstrap
> superuser, because that user cannot be deleted.
>
>> o the oids of the two users must be the same (likely the install user
>> on the old cluster as well)
>
> If the OIDs are the same, then the old-cluster user is also the bootstrap
> superuser, because the bootstrap superuser's hard-wired OID is 10. QED.
>
> So I think you should get rid of the existing error check and simplify it
> to "user must be bootstrap superuser (ie, OID 10) in both clusters".
> The existing approach adds only confusion, not flexibility.
>
>> What I think you actually can do is to run pg_upgrade with a user that
>> is not the install user in either cluster, as long as the oids match.
>
> I don't think you actually can, and if you could, I frankly would not
> trust the results.
For the archives - the "original" complaint with detail is here:
http://www.postgresql.org/message-id/2B69ABB0-014A-4296-8D34-D2E83A84FA77@gmail.com
Basically:
1) Original database created with default "postgres" user
2) DBA decides it would be better if "bob" was the superuser
3) Create "bob" in original database (as opposed to doing a rename)
4) <assume> REASSIGN OWNED FROM postgres TO bob;
5) pg_upgrade time - decide "bob" should be doing this (totally forgot about
postgres by now)
6) DBA sees error
Note the missing piece was, for me, the fact that you cannot delete the
"postgres" user in the original database. If you could then there would be
no possible way to get oid 10 in the new cluster to match the now deleted
oid 10 in the original cluster. Once that is "frozen" then as Tom said all
of the other rules amount to the same thing - "postgres" must be the name of
the user in the new database.
NOTE: had the DBA done an "ALTER USER postgres RENAME TO bob" instead of
simply adding "bob" then everything supposedly would have worked correctly.
> "Old and new cluster must be created by the same user. Try to re-init the
> new database with the flag "-U %s" \n"
The OP's proposed message seems good to me though s/database/cluster/? Or
is there some unspoken assumption we can make at this point in the process.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-11090-Unclear-error-message-in-pg-upgrade-tp5813198p5813...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 20:40 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-29 21:31 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 02:08 ` Re: BUG #11090: Unclear error message in pg_upgrade Bruce Momjian <bruce@momjian.us>
2014-07-30 02:33 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
@ 2014-07-30 14:58 ` Bruce Momjian <bruce@momjian.us>
2014-08-04 15:57 ` Re: BUG #11090: Unclear error message in pg_upgrade Bruce Momjian <bruce@momjian.us>
1 sibling, 1 reply; 15+ messages in thread
From: Bruce Momjian @ 2014-07-30 14:58 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@2ndquadrant.com>; David G Johnston <david.g.johnston@gmail.com>; pgsql-bugs
On Tue, Jul 29, 2014 at 10:33:17PM -0400, Tom Lane wrote:
> I think you missed my point. I'm suggesting actually restricting what
> pg_upgrade will accept, so that the error conditions become simpler to
> understand.
>
> Furthermore, if your description of the restrictions is accurate, then
> restricting to "the user must be the bootstrap superuser in both clusters"
> is actually not an extra restriction. You said:
>
> > o only one user can be defined in the new cluster (most likely the
> > install user)
>
> If there is only one user in the new cluster, it *is* the bootstrap
> superuser, because that user cannot be deleted.
>
> > o the oids of the two users must be the same (likely the install user
> > on the old cluster as well)
>
> If the OIDs are the same, then the old-cluster user is also the bootstrap
> superuser, because the bootstrap superuser's hard-wired OID is 10. QED.
>
> So I think you should get rid of the existing error check and simplify it
> to "user must be bootstrap superuser (ie, OID 10) in both clusters".
> The existing approach adds only confusion, not flexibility.
OK, I had never made this logical conclusion that it had to be the
install user. Since you can't remove the install user, and the new
cluster can only have one user (the install user), and because we
preserve pg_authid.oid, the old cluster has to be the install user too.
I have developed the 9.5-only patch which simplifies these checks and
error messages; attached.
> > What I think you actually can do is to run pg_upgrade with a user that
> > is not the install user in either cluster, as long as the oids match.
>
> I don't think you actually can, and if you could, I frankly would not
> trust the results.
Agreed.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Attachments:
user.diff (text/x-diff, 6.1K) download
diff --git a/contrib/pg_upgrade/check.c b/contrib/pg_upgrade/check.c
new file mode 100644
index 79b6c3c..b216e61
*** a/contrib/pg_upgrade/check.c
--- b/contrib/pg_upgrade/check.c
***************
*** 9,14 ****
--- 9,15 ----
#include "postgres_fe.h"
+ #include "catalog/pg_authid.h"
#include "mb/pg_wchar.h"
#include "pg_upgrade.h"
*************** static void check_locale_and_encoding(Co
*** 19,25 ****
ControlData *newctrl);
static bool equivalent_locale(const char *loca, const char *locb);
static bool equivalent_encoding(const char *chara, const char *charb);
! static void check_is_super_user(ClusterInfo *cluster);
static void check_for_prepared_transactions(ClusterInfo *cluster);
static void check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster);
static void check_for_reg_data_type_usage(ClusterInfo *cluster);
--- 20,26 ----
ControlData *newctrl);
static bool equivalent_locale(const char *loca, const char *locb);
static bool equivalent_encoding(const char *chara, const char *charb);
! static void check_is_install_user(ClusterInfo *cluster);
static void check_for_prepared_transactions(ClusterInfo *cluster);
static void check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster);
static void check_for_reg_data_type_usage(ClusterInfo *cluster);
*************** check_and_dump_old_cluster(bool live_che
*** 94,100 ****
/*
* Check for various failure cases
*/
! check_is_super_user(&old_cluster);
check_for_prepared_transactions(&old_cluster);
check_for_reg_data_type_usage(&old_cluster);
check_for_isn_and_int8_passing_mismatch(&old_cluster);
--- 95,101 ----
/*
* Check for various failure cases
*/
! check_is_install_user(&old_cluster);
check_for_prepared_transactions(&old_cluster);
check_for_reg_data_type_usage(&old_cluster);
check_for_isn_and_int8_passing_mismatch(&old_cluster);
*************** check_new_cluster(void)
*** 158,179 ****
if (user_opts.transfer_mode == TRANSFER_MODE_LINK)
check_hard_link();
! check_is_super_user(&new_cluster);
!
! /*
! * We don't restore our own user, so both clusters must match have
! * matching install-user oids.
! */
! if (old_cluster.install_role_oid != new_cluster.install_role_oid)
! pg_fatal("Old and new cluster install users have different values for pg_authid.oid.\n");
!
! /*
! * We only allow the install user in the new cluster because other defined
! * users might match users defined in the old cluster and generate an
! * error during pg_dump restore.
! */
! if (new_cluster.role_count != 1)
! pg_fatal("Only the install user can be defined in the new cluster.\n");
check_for_prepared_transactions(&new_cluster);
}
--- 159,165 ----
if (user_opts.transfer_mode == TRANSFER_MODE_LINK)
check_hard_link();
! check_is_install_user(&new_cluster);
check_for_prepared_transactions(&new_cluster);
}
*************** create_script_for_old_cluster_deletion(c
*** 698,714 ****
/*
! * check_is_super_user()
*
! * Check we are superuser, and output user id and user count
*/
static void
! check_is_super_user(ClusterInfo *cluster)
{
PGresult *res;
PGconn *conn = connectToServer(cluster, "template1");
! prep_status("Checking database user is a superuser");
/* Can't use pg_authid because only superusers can view it. */
res = executeQueryOrDie(conn,
--- 684,701 ----
/*
! * check_is_install_user()
*
! * Check we are the install user, and that the new cluster
! * has no other users.
*/
static void
! check_is_install_user(ClusterInfo *cluster)
{
PGresult *res;
PGconn *conn = connectToServer(cluster, "template1");
! prep_status("Checking database user is the install user");
/* Can't use pg_authid because only superusers can view it. */
res = executeQueryOrDie(conn,
*************** check_is_super_user(ClusterInfo *cluster
*** 716,727 ****
"FROM pg_catalog.pg_roles "
"WHERE rolname = current_user");
! if (PQntuples(res) != 1 || strcmp(PQgetvalue(res, 0, 0), "t") != 0)
! pg_fatal("database user \"%s\" is not a superuser\n",
os_info.user);
- cluster->install_role_oid = atooid(PQgetvalue(res, 0, 1));
-
PQclear(res);
res = executeQueryOrDie(conn,
--- 703,718 ----
"FROM pg_catalog.pg_roles "
"WHERE rolname = current_user");
! /*
! * We only allow the install user in the new cluster (see comment below)
! * and we preserve pg_authid.oid, so this must be the install user in
! * the old cluster too.
! */
! if (PQntuples(res) != 1 ||
! atooid(PQgetvalue(res, 0, 1)) != BOOTSTRAP_SUPERUSERID)
! pg_fatal("database user \"%s\" is not the install user\n",
os_info.user);
PQclear(res);
res = executeQueryOrDie(conn,
*************** check_is_super_user(ClusterInfo *cluster
*** 731,737 ****
if (PQntuples(res) != 1)
pg_fatal("could not determine the number of users\n");
! cluster->role_count = atoi(PQgetvalue(res, 0, 0));
PQclear(res);
--- 722,734 ----
if (PQntuples(res) != 1)
pg_fatal("could not determine the number of users\n");
! /*
! * We only allow the install user in the new cluster because other defined
! * users might match users defined in the old cluster and generate an
! * error during pg_dump restore.
! */
! if (cluster == &new_cluster && atooid(PQgetvalue(res, 0, 0)) != 1)
! pg_fatal("Only the install user can be defined in the new cluster.\n");
PQclear(res);
diff --git a/contrib/pg_upgrade/pg_upgrade.h b/contrib/pg_upgrade/pg_upgrade.h
new file mode 100644
index 0410b02..61e5de0
*** a/contrib/pg_upgrade/pg_upgrade.h
--- b/contrib/pg_upgrade/pg_upgrade.h
*************** typedef struct
*** 256,263 ****
char major_version_str[64]; /* string PG_VERSION of cluster */
uint32 bin_version; /* version returned from pg_ctl */
Oid pg_database_oid; /* OID of pg_database relation */
- Oid install_role_oid; /* OID of connected role */
- Oid role_count; /* number of roles defined in the cluster */
const char *tablespace_suffix; /* directory specification */
} ClusterInfo;
--- 256,261 ----
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: BUG #11090: Unclear error message in pg_upgrade
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 20:40 ` Re: BUG #11090: Unclear error message in pg_upgrade David G Johnston <david.g.johnston@gmail.com>
2014-07-29 21:31 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 02:08 ` Re: BUG #11090: Unclear error message in pg_upgrade Bruce Momjian <bruce@momjian.us>
2014-07-30 02:33 ` Re: BUG #11090: Unclear error message in pg_upgrade Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 14:58 ` Re: BUG #11090: Unclear error message in pg_upgrade Bruce Momjian <bruce@momjian.us>
@ 2014-08-04 15:57 ` Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 15+ messages in thread
From: Bruce Momjian @ 2014-08-04 15:57 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@2ndquadrant.com>; David G Johnston <david.g.johnston@gmail.com>; pgsql-bugs
On Wed, Jul 30, 2014 at 10:58:03AM -0400, Bruce Momjian wrote:
> OK, I had never made this logical conclusion that it had to be the
> install user. Since you can't remove the install user, and the new
> cluster can only have one user (the install user), and because we
> preserve pg_authid.oid, the old cluster has to be the install user too.
>
> I have developed the 9.5-only patch which simplifies these checks and
> error messages; attached.
Patch applied, with doc addition.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 15+ messages in thread
end of thread, other threads:[~2014-08-04 15:57 UTC | newest]
Thread overview: 15+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29 17:40 BUG #11090: Unclear error message in pg_upgrade brorfred@gmail.com
2014-07-29 18:58 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 19:53 ` John R Pierce <pierce@hogranch.com>
2014-07-29 20:44 ` David G Johnston <david.g.johnston@gmail.com>
2014-07-29 20:57 ` Jeff Janes <jeff.janes@gmail.com>
2014-07-29 21:04 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2014-07-29 21:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-07-29 21:59 ` Jeff Janes <jeff.janes@gmail.com>
2014-07-29 20:40 ` David G Johnston <david.g.johnston@gmail.com>
2014-07-29 21:31 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 02:08 ` Bruce Momjian <bruce@momjian.us>
2014-07-30 02:33 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-07-30 03:31 ` David G Johnston <david.g.johnston@gmail.com>
2014-07-30 14:58 ` Bruce Momjian <bruce@momjian.us>
2014-08-04 15:57 ` Bruce Momjian <bruce@momjian.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox