Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHk9i-0006RE-Is for pgsql-admin@arkaria.postgresql.org; Tue, 17 Jan 2023 11:29:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHk9h-0005JK-Cj for pgsql-admin@arkaria.postgresql.org; Tue, 17 Jan 2023 11:29:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHk9h-0005JB-2Y for pgsql-admin@lists.postgresql.org; Tue, 17 Jan 2023 11:29:29 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHk9a-0002Ii-Dy for pgsql-admin@lists.postgresql.org; Tue, 17 Jan 2023 11:29:28 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4Nx69N1sNYz9sQ7; Tue, 17 Jan 2023 12:29:12 +0100 (CET) Date: Tue, 17 Jan 2023 12:29:11 +0100 (CET) From: Erik Wienhold To: Kouber Saparev , pgsql-admin@lists.postgresql.org Message-ID: <946179387.343291.1673954951660@office.mailbox.org> In-Reply-To: References: Subject: Re: ERROR: failed to change schema dependency for type xxx.yyy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4Nx69N1sNYz9sQ7 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 17/01/2023 11:46 CET Kouber Saparev wrote: > > Trying to change the schema of an enumerated type results in the error be= low: > > db=3D# ALTER TYPE xxx.yyy SET SCHEMA zzz; > ERROR: failed to change schema dependency for type xxx.yyy What Postgres version are you on? I cannot reproduce the error on 14.6: =09CREATE SCHEMA xxx; =09CREATE TYPE xxx.yyy AS ENUM (); =09CREATE SCHEMA zzz; =09ALTER TYPE xxx.yyy SET SCHEMA zzz; > I was able to track this down to=C2=A0changeDependencyFor() within pg_dep= end.c, but > still am not able to understand the reason for this error. > > When looking into the pg_depend catalog, originally there were 700 entrie= s. > After a series of cascading drops of the tables, views and functions invo= lved, > only one was left: > > db=3D# SELECT deptype, objid::regclass FROM pg_depend WHERE refobjid =3D = (SELECT oid FROM pg_type WHERE typnamespace =3D 'xxx'::regnamespace AND typ= name =3D 'yyy'); > =C2=A0deptype | objid > ---------+------------ > =C2=A0i | 1202633909 > (1 row) > > Then I deleted manually from pg_depend this entry, and there were 0 entri= es > left, but still the error was persisting. I am not able to change the sch= ema, > which is quite a blocker in our migration plan. > > Any ideas how we could proceed any further? And btw what is the entry abo= ve: > objid =3D 1202633909=C2=A0+ deptype =3D i? That entry is type xxx.yyy[]: =09test=3D# SELECT classid::regclass, objid::regtype, refclassid::regclass,= refobjid::regtype FROM pg_depend WHERE refobjid =3D (SELECT oid FROM pg_ty= pe WHERE typnamespace =3D 'xxx'::regnamespace AND typname =3D 'yyy'); =09 classid | objid | refclassid | refobjid=20 =09---------+-----------+------------+---------- =09 pg_type | xxx.yyy[] | pg_type | xxx.yyy =09(1 row) -- Erik