Thread: Cannot drop user (PostgreSQL 8.1.11)

Cannot drop user (PostgreSQL 8.1.11)

From
Maxim Boguk
Date:
I trying drop old user but got some strange issues:

template1=# drop USER szhuchkov;
ERROR:  role "szhuchkov" cannot be dropped because some objects depend on it
DETAIL:  1 objects in database billing
2 objects in database shop

ok... lets look closer these two DB:


shop=# drop USER szhuchkov;
ERROR:  role "szhuchkov" cannot be dropped because some objects depend on it
DETAIL:  owner of type pg_toast.pg_toast_406750
owner of type pg_toast.pg_toast_1770195
1 objects in database billing

hm damn strange...

shop=# SELECT * from pg_user where usename='szhuchkov';
   usename  | usesysid | usecreatedb | usesuper | usecatupd |  passwd  | valuntil |           useconfig
-----------+----------+-------------+----------+-----------+----------+----------+--------------------------------
  szhuchkov |    16387 | f           | f        | f         | ******** |          | {"search_path=bill, billstat"}
(1 запись)

Lets look pg_type for these two types:

shop=# SELECT typname,typowner from pg_type where typname IN ('pg_toast_406750', 'pg_toast_1770195');
      typname      | typowner
------------------+----------
  pg_toast_1770195 |       10
  pg_toast_406750  |       10
(записей: 2)

owner right (pgsql)



Lets look db billing:

billing=# drop USER szhuchkov;
ERROR:  role "szhuchkov" cannot be dropped because some objects depend on it
DETAIL:  owner of function vz_vds_ip_add(integer,bigint)
2 objects in database shop

billing=# SELECT proname,proowner from pg_proc where proname like '%vz_vds_ip_add%';
     proname    | proowner
---------------+----------
  vz_vds_ip_add |       10
(1 запись)

ok... again right owner... no signs of szhuchkov

Last test... lets try pg_dumpall -s :


[pgsql@ctrl7 /home/mboguk]$ pg_dumpall -s | grep szhuchkov
CREATE ROLE szhuchkov;
ALTER ROLE szhuchkov WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN PASSWORD '*******';
ALTER ROLE szhuchkov SET search_path TO bill, billstat;
GRANT bill1c_r TO szhuchkov GRANTED BY pgsql;
GRANT bill_r TO szhuchkov GRANTED BY pgsql;
GRANT billexch_r TO szhuchkov GRANTED BY pgsql;
GRANT billstat_r TO szhuchkov GRANTED BY pgsql;
GRANT shop_r TO szhuchkov GRANTED BY pgsql;
GRANT templar_r TO szhuchkov GRANTED BY pgsql;

Nothing more... so according pg_dumpall szhuchkov also doesnt have any active objects in DB.

In all other sides DB work 24x7 well without any other issues
(and because 24x7 requirements i cannot stop DB and drop user from single user mode).

Any ideas? or what to check else?

--
Maxim Boguk

Re: Cannot drop user (PostgreSQL 8.1.11)

From
"Ivan Zolotukhin"
Date:
I recall I came across similar issue on older (8.1 or 8.2) versions of
PostgreSQL some time ago. DB was pretty small so I dump-restored it
eventually, but it looks like a bug anyway.

I cannot reproduce it at 8.3.

--
Regards,
 Ivan


On Mon, Jun 2, 2008 at 7:12 PM, Maxim Boguk <mboguk@masterhost.ru> wrote:
> I trying drop old user but got some strange issues:
>
> template1=# drop USER szhuchkov;
> ERROR:  role "szhuchkov" cannot be dropped because some objects depend on it
> DETAIL:  1 objects in database billing
> 2 objects in database shop
>
> ok... lets look closer these two DB:
>
>
> shop=# drop USER szhuchkov;
> ERROR:  role "szhuchkov" cannot be dropped because some objects depend on it
> DETAIL:  owner of type pg_toast.pg_toast_406750
> owner of type pg_toast.pg_toast_1770195
> 1 objects in database billing
>
> hm damn strange...
>
> shop=# SELECT * from pg_user where usename='szhuchkov';
>  usename  | usesysid | usecreatedb | usesuper | usecatupd |  passwd  |
> valuntil |           useconfig
> -----------+----------+-------------+----------+-----------+----------+----------+--------------------------------
>  szhuchkov |    16387 | f           | f        | f         | ******** |
>      | {"search_path=bill, billstat"}
> (1 запись)
>
> Lets look pg_type for these two types:
>
> shop=# SELECT typname,typowner from pg_type where typname IN
> ('pg_toast_406750', 'pg_toast_1770195');
>     typname      | typowner
> ------------------+----------
>  pg_toast_1770195 |       10
>  pg_toast_406750  |       10
> (записей: 2)
>
> owner right (pgsql)
>
>
>
> Lets look db billing:
>
> billing=# drop USER szhuchkov;
> ERROR:  role "szhuchkov" cannot be dropped because some objects depend on it
> DETAIL:  owner of function vz_vds_ip_add(integer,bigint)
> 2 objects in database shop
>
> billing=# SELECT proname,proowner from pg_proc where proname like
> '%vz_vds_ip_add%';
>    proname    | proowner
> ---------------+----------
>  vz_vds_ip_add |       10
> (1 запись)
>
> ok... again right owner... no signs of szhuchkov
>
> Last test... lets try pg_dumpall -s :
>
>
> [pgsql@ctrl7 /home/mboguk]$ pg_dumpall -s | grep szhuchkov
> CREATE ROLE szhuchkov;
> ALTER ROLE szhuchkov WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN
> PASSWORD '*******';
> ALTER ROLE szhuchkov SET search_path TO bill, billstat;
> GRANT bill1c_r TO szhuchkov GRANTED BY pgsql;
> GRANT bill_r TO szhuchkov GRANTED BY pgsql;
> GRANT billexch_r TO szhuchkov GRANTED BY pgsql;
> GRANT billstat_r TO szhuchkov GRANTED BY pgsql;
> GRANT shop_r TO szhuchkov GRANTED BY pgsql;
> GRANT templar_r TO szhuchkov GRANTED BY pgsql;
>
> Nothing more... so according pg_dumpall szhuchkov also doesnt have any
> active objects in DB.
>
> In all other sides DB work 24x7 well without any other issues
> (and because 24x7 requirements i cannot stop DB and drop user from single
> user mode).
>
> Any ideas? or what to check else?
>
> --
> Maxim Boguk
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>