Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vr1TG-0057GV-1l for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Feb 2026 22:17:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vr1TF-00GT5n-13 for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Feb 2026 22:17:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vr1TF-00GT5f-04 for pgsql-bugs@lists.postgresql.org; Fri, 13 Feb 2026 22:17:05 +0000 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vr1TC-00000000VwI-0UmZ for pgsql-bugs@lists.postgresql.org; Fri, 13 Feb 2026 22:17:04 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-6729292dcd7so572545eaf.0 for ; Fri, 13 Feb 2026 14:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771021022; x=1771625822; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=exRHY1kzILz9gy5L2a2RRKVDyv6Sii5n9Zf15JeOmC8=; b=g1sTU5tNHk75x+uvi7z9X6Rfpfr+NN7YquAAJLTf3ke5uTykjK30q3xVhM2S/aBwBf q1QMJqNAh9Onk5q9UBjKv4REr1+BWbAnDdqPOJf0VKcQ2gVbBwpxSYGwBvcCxMpzwZ9H 83OndkHAhWzk1ueayimWDvtKHxjbdnwwYfHiNMkJdrI2jo3jzyXzLu/lA9RZkQ510LrH +udTSLNau6aiM5vV97J3zYS5Gl8l72tHcNMnBZnmhsTWOlG+mJjqpxSO4trt8bdwjh5S e2jw/RuaF9nHnqOOrI8ds5ldTIloLKI7k6HzDwLOvKQqT3/wbxBNR2i5y+w59lKwHrtx jomA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771021022; x=1771625822; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=exRHY1kzILz9gy5L2a2RRKVDyv6Sii5n9Zf15JeOmC8=; b=JP3nprOBzwjD802umrxWxuDxLnE1rbq0by6C+v/ImJSXEG2/nF1tKQZYexoX6O8JeB Dr5S9WRbSLp5brFjLwa5GcSfvK8Reboqc+qBoZWrwLtXPLreOnG8JONSshwdMW/ztKHP 0o+RdcGXibENnZCJboE1JRluftnmfQjO20GrzykTTHcUrvUeN5xAY6a+mV9HHz+Vb/Ms HWFksfZEaL6XBjlLU4swxTnmgB9Tw0gdgNpJucROovWWPiqbOFwWKNOZZBOM2ipHJyTI SS5NRqBP//RdzvwwTYh+HcMkquNJaHiKVSQsHpG3U/P8LGbtwLneNS01D1Oc2cpe1+rz ehWw== X-Forwarded-Encrypted: i=1; AJvYcCXD+95DdwxIiJgee6MPh67OdbSgy8xNNyX7EC92Oc7NwOfTaj8jAW9mRvlx4121wL20tReFao4fy7xb@lists.postgresql.org X-Gm-Message-State: AOJu0Yw+UoCkODL928mZohjM1nmMWydsDNPqQSLbXqMkVEF3w4+SJqqQ 44An1SkOUOpugO7fMgdvP/uARssdTM+JuMoW0haOt9FNZYHwZlJPOEhv X-Gm-Gg: AZuq6aJp4Jg5w5PeANZLOWnZa2g6kR2HD1mz1h9cRSn0gortNCW1jlPd3oMiC9bJ30X mL5u2ScfkDdTLZoHvtnhJXBdejH7cx4zjDOa/j8HjLhg5u5MTNgs8nyIjeT1B3Iz+TROJXgEA4E MCJlJjwIqw60CP5d10VRGYx2luCelwJtGKb7uCcbMoarvgZ2W4Z1J+OXX1TA7T5hapJ/uOM0bFc APWCKI5IbCRDilFfnqKN2n0Y2Bx/dAZXbn6suKh6m9h4y8UVhiXbzlO0s5J5ns5eNdEobT+Cjl1 uMC4ioPDTjhFGLXFoOVPNWKteEwwx/qnz2jpjnvJ7oRtMIq5Te+oYgytXdhNVZ1Lk6MnW6r7OxK xhzdVvBIZ85WmsKIMP95jzEjuNnkXuEWIl1/7Ezr5UXtpwbp6SJWJtV/X4nBWPn6Bxzg0aiRikN oB+C9w+13Igv5Fuc7a0Kk6D+ZW68lMul8wHJM2g+0t1weUixAXYaya0sxhCLugOHHukGtO0l1fp pzA0XiMgIYBI2n9 X-Received: by 2002:a05:6820:199b:b0:65f:5bc0:7b2f with SMTP id 006d021491bc7-67768ad8d30mr1649277eaf.46.1771021021735; Fri, 13 Feb 2026 14:17:01 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-67475dc40d0sm5075976eaf.13.2026.02.13.14.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 14:17:01 -0800 (PST) Date: Fri, 13 Feb 2026 16:16:59 -0600 From: Nathan Bossart To: dominik.hirt@hub28.de, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19407: pg_dump : DROP RULE creates forward references Message-ID: References: <19407-0c327e0fc912b451@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Feb 13, 2026 at 03:00:18PM -0600, Nathan Bossart wrote: > On Fri, Feb 13, 2026 at 09:02:37AM +0000, PG Bug reporting form wrote: >> During dump / restore with pg_dump / psql, I encounter a dependency ordering >> issue that breaks the import when using ON_ERROR_STOP=on. >> >> Problem: pg_dump executes DROP RULE for specific views, forcing them to be >> recreated before their dependencies (custom types, collations) exist in the >> dump file, causing import failures. > > I think this is an even simpler reproducer: > > create type t as enum ('a', 'b'); > create table tt (a t primary key, b text); > create view v as select * from tt group by a; > > Commit d8c05aff56 [0] did some work in this area, but this issue may even > predate that. In any case, it seems like pg_dump needs to create the type > before it creates the dummy view to deal with circular dependencies. After some further investigation, I found this discussion from 2022 that mentions the same problem: https://postgr.es/m/flat/b43e03eb-3997-700e-c2d4-92c31e4e31ee%40dalibo.com This led to commit 75af0f401f, which added some clarity to the documentation for pg_dump's --clean and --if-exists options, but AFAICT we don't actually say that using --if-exists with --clean is _not_ guaranteed to prevent all errors due to nonexistent objects. Perhaps we should add that information. I haven't looked into what it would take to actually fix this issue, but from reading around I get the idea that it might not be straightforward. -- nathan