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 1vYVqV-005b93-1F for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Dec 2025 20:52:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vYVqT-005cxJ-10 for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Dec 2025 20:52:34 +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 1vYVqS-005cxA-3C for pgsql-hackers@lists.postgresql.org; Wed, 24 Dec 2025 20:52:33 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vYVqR-002S0D-35 for pgsql-hackers@postgresql.org; Wed, 24 Dec 2025 20:52:32 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5957d7e0bf3so6365800e87.0 for ; Wed, 24 Dec 2025 12:52:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766609550; x=1767214350; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1U3gAd+4lCBprw2a5BxN7lN+pUE8hO1RJp7RRR40UK8=; b=gFMNgk5rGbZbGaqaR0h3aAEJkzxowi0KUnFR1fIqaV+XClJ+OEUmnDc1kY0Wwc316m W3N+vCKgz06uNHyggnM325WtgzdY0yomZtqfZFA5XfdxL9A3sZ9DP1WAuWBftaEDGMKv HxLTaqZZV83+9jl40a0yX+yMx1UBXFanEVVEGfMtlbPoUcuK0fXiGTbrVsflospRe+ul tdExdQk17A7ZEy+NWScz+ElpOpbKIJxsayJgqq66p4/9W2RgCv45Hj5n8efnS1sURlhj c/X/rU+45vqHYFahFt9nEQmAZcFatWt984qAPkx4PEDA01kuczMWmR4dF5RCV3P4GVNP Kv+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766609550; x=1767214350; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1U3gAd+4lCBprw2a5BxN7lN+pUE8hO1RJp7RRR40UK8=; b=nNSDT8XiOxSCkP4rDtpzm7fXMGXtrBOGnf4l3tgT03I+uDZ+BWkGmXRSSw7mtlb72w Yeaq94o9fk9k6ZW1A4NF315OXEOcWcfaQ7tujxMxhLAJD5U77dhe5UHFr6VH6MaLhhmO tDJ2TUyCTkXDTJdFfrNbFXErmqD5f16W60hBoanxBWE5bwBdiTcPY8UdF6X+6CWfhxps Qb7sO4z1bIPOlgvj+K1lvXTnhPWB082U9hbDWIEAixVt3aIey/ZO6RWZlozqWNrfxERo e5tHY8PXfDOFjuqEhf6zaRPiIXmdS+ul6UHJxNPT1YQkzNxrTPkVroARCkq+WxKfM4BK ELPg== X-Gm-Message-State: AOJu0YwGvKnfFVxV8pWBw2a8NuGtW7XBhaJysVMIwyaIohkfS4TcTtMW ydmc95TJ3tWsR0gxH41+qm8U6JwF4x3dhzcBbbyqMbEGnGXiYswlGMJQPw9tdxgbOFh/c/wrU9K j55H/FuVfgP66MayrC+CcqYm8NBGOwpk= X-Gm-Gg: AY/fxX6Hz7UqsHYDz17mR+VmhRCWtn8en7bt4OPdRE2bfjCi5Xbhl1Ml/EoNYNDAPht bbEDC2sEQs8OrIUeFjHh6qgLFKh6PgHPCGqOZ/e4Ee3HCiBU+XTxQPX5OxkMAWEDViRsE31r649 bBXbErbp6LvRzkNZcDYoJ1iVRLSZP89d1Ry2RNF6HwUSUJRVrGsfJMQErbEa9BtDXbJ7spSEWmI pOuGpxwJmGnhNvmiZnODES30Vpl+LNT8K2D2Py+GDypE3AmakjiPMrulA8ncfM3vvumCyjQR4iV 1mrjWElVcNS9IYe4xKGShAtf2B7K7HqR5bbdqBX/FV8EWYUvEoZi8b12Trnk6Q7gVj9Y X-Google-Smtp-Source: AGHT+IHcyqYJOF9XtePoQ4Q+20SyVtf6HfSZu46wU7FzuqtjYT115Cip6AMNYKwjXxx3SZ5D8Rd4qblh2MQv47rgIzk= X-Received: by 2002:a2e:a54a:0:b0:37e:5208:e2d7 with SMTP id 38308e7fff4ca-3812085b41emr57948071fa.19.1766609549619; Wed, 24 Dec 2025 12:52:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Matthias van de Meent Date: Wed, 24 Dec 2025 21:52:18 +0100 X-Gm-Features: AQt7F2rDijnMeaKLNFOPcI_QLV7iyZZ7d9kfMJKY2oAy0-c4QfiYg5JGFFwV7kE Message-ID: Subject: Re: Add --extra-dependencies and immediate data dumping for pg_dump/pg_upgrade To: Jeevan Chalke Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 24 Dec 2025 at 12:45, Jeevan Chalke wrote: > > Hello Hackers, > > We have identified a dependency issue=E2=80=94most notably observed with = the PostGIS extension=E2=80=94where a table's column definition relies on d= ata existing in another table's catalog at restore time. Because pg_dump ty= pically separates schema and data into distinct sections, these implicit da= ta-level dependencies are not captured, leading to failures during pg_upgra= de or pg_restore. > > Jakub Wartak previously reported a detailed example of this issue here: h= ttps://www.postgresql.org/message-id/CAKZiRmwWyh-yGM8Hrvuuo04JiYFy8S4TLM-3M= n-zi9Rfqc744Q%40mail.gmail.com Ah, yes, that does sound like an issue. > Following a discussion with Alvaro Herrera, we have developed a patch bas= ed on his suggestions. > > The Problem > > In certain extension-heavy schemas, an object's schema definition cannot = be created unless another table's data is already populated. Current pg_dum= p logic handles schema-to-schema dependencies via pg_depend, but it lacks a= mechanism to: > > Enforce a specific order for dependencies not recorded in pg_depend. > Interleave data loading with schema creation for specific tables. Is there something that prevents PostGIS from recording this kind of dependency in pg_depend, and by doing so force the right order in pg_dump? It seems to me that pg_depend's model is generic enough to enable that kind of dependency; so is the issue that pg_dump doesn't currently track and resolve that type of dependency in a satisfactory manner? I'm personally not a big fan of new pg_dump and pg_upgrade options to solve this, as they require a user input to register a dependency that should've been stored in the catalog; it should've been handled natively. So, if we could make it work using pg_depend instead of expecting user input here, then that'd be very much appreciated. Kind regards, Matthias van de Meent