Re: Role problem in Windows

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Role problem in Windows
Date: 2018-07-06 15:34:55
Message-ID: CANu8Fiz-ozRcBq_Y02_A5MV+BjneMPyn8Yp-SSGZqVb6Awjk7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 6, 2018 at 10:01 AM, Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it>
wrote:

> Hi,
> Running 9.1 on Windows 10, upgrading to 10 with pg_upgrade.
>
> "Once upon a time" there was a bug in our automatic role creation
> procedure that did not mask vowels with accent (used in Italian language),
> like "ò, è" and the result was a role with an empty name.
> We are now upgrading to 10, and pg_dumpall exits complaining with this
> role, showing its name (with mis-encoded UTF-8 accented vowel) as an
> invalid utf-8 character.
>
> Trying to get rid of the role, that can't be deleted with a drop role
> because of the empty name, I did
> delete from pg_authid where oid = nnnn
>
> Role disappeared from role list.
>
> At the next execution of the pg_upgrade it complains that role "nnnn" does
> not exist while dumping a trigger function. I tried remove the privilege
> from function ACL, but "role nnnnn does not exists".
>
> Is there a way to recreate the deleted role, either as a dummy, so I can
> finish upgrade?
> Is there another way to bypass the problem?
>
> Any help would be appreciated.
>
> Cheers,
> Moreno.-
>
>
>
>Is there a way to recreate the deleted role, either as a dummy, so I can
finish upgrade?
I can't really suggest how to recreate the dummy role, but I do have an
alternate solution.
Most probably pg_dump is complaining that role 'xxx' owns some tables. So
you can use the
attached script and add 'AND a.rolname = 'xxx' to the WHERE clause.
Then as a superuser you can use ALTER TABLE xyz OWNER TO new_owner for each
table found.

--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!

Attachment Content-Type Size
tables_and_owners.sql text/plain 349 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Duarte Carreira 2018-07-06 16:42:53 correcting tablespaces inside data folder
Previous Message Moreno Andreo 2018-07-06 14:01:04 Role problem in Windows