pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Moreno Andreo <moreno.andreo@evolu-s.it>
Cc: PostgreSQL mailing lists <pgsql-general@postgresql.org>
Subject: Re: REVOKE to an user that doesn't exist
Date: Wed, 12 Dec 2018 10:01:47 -0500
Message-ID: <12510.1544626907@sss.pgh.pa.us> (raw)
In-Reply-To: <c9bdaeb8-5685-d86c-a18e-6694088a6b78@evolu-s.it>
References: <c9bdaeb8-5685-d86c-a18e-6694088a6b78@evolu-s.it>

Moreno Andreo <moreno.andreo@evolu-s.it> writes:
> I'm trying to pg_upgrade a cluster from 9.1 to 10 (Windows 10, but I 
> don't think it matters).

> At a certain point an error is thrown while parsing a trigger:
> could not execute query: ERROR:  role "1067431" does not exist
> command was: REVOKE ALL ON FUNCTION "x"() FROM PUBLIC;
> GRANT ALL ON FUNCTION "public"."x"() TO "1067431" WITH GRANT OPTION;

Hm.  We've seen similar bugs before; the mechanism is that at some
point the function owner granted privileges to somebody else, and
at some later point the somebody-else role got dropped, but the
privilege grant stayed behind because the system had lost, or never
made, the pg_shdepend entry indicating that this function had an ACL
entry mentioning that role.  The extra ACL entry is harmless, until
you wonder why pg_dump is printing a nonsensical command due to it.

We fixed a couple of bugs of that ilk just last month [1], but they were
for cases involving types and schemas, not functions.  The last case
involving function privileges that I see in a quick trawl of the commit
log predates 9.0 release [2].  I wonder how old this cluster is ...

> How to REVOKE that non-existing user so pg_upgrade can proceed?

The safest way to clean it up manually would be to set the pg_proc.proacl
field for that function to NULL.  If there are other grants about the
function, you could try removing the bad entry, but it would likely be
safer to just re-grant after the upgrade.

			regards, tom lane

[1] https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=fa2952d8e
[2] https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=d691cb914




view thread (6+ messages)  latest in thread

Message-ID: <12510.1544626907@sss.pgh.pa.us>
Permalink:  ../12510.1544626907@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12510.1544626907@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, moreno.andreo@evolu-s.it
  Subject: Re: REVOKE to an user that doesn't exist
  In-Reply-To: <12510.1544626907@sss.pgh.pa.us>
  References: <c9bdaeb8-5685-d86c-a18e-6694088a6b78@evolu-s.it> <12510.1544626907@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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