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.94.2) (envelope-from ) id 1tuCHI-004yzz-EQ for pgsql-general@arkaria.postgresql.org; Mon, 17 Mar 2025 15:21:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tuCHG-00EUfe-OD for pgsql-general@arkaria.postgresql.org; Mon, 17 Mar 2025 15:21:18 +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.94.2) (envelope-from ) id 1tuCHF-00EUdb-RH for pgsql-general@lists.postgresql.org; Mon, 17 Mar 2025 15:21:18 +0000 Received: from fhigh-a6-smtp.messagingengine.com ([103.168.172.157]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tuCHD-003LGT-2b for pgsql-general@lists.postgresql.org; Mon, 17 Mar 2025 15:21:16 +0000 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 083D41140089; Mon, 17 Mar 2025 11:21:14 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Mon, 17 Mar 2025 11:21:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1742224874; x=1742311274; bh=AWC/7rxUB/UoLfe09HWp6RyxnGQU/x2yKsGxd4c/OUY=; b= OYiY49myJoEBZxCy+Y7pOPhriD1/H+R0mo9wugbkGC8dypmjxc+VEhjsX0luBPQg j+e6nSwN8tfwpKrez7T7lkQpfYRbCxW+6pr8J1p31wRCTiXJQUqIPZtkBbz66G7T jHd351v4HaD7lNWFKA5DaxtZ/tsGRUwaNSyTdhYuRCgkLyL4xjhbj6iUR2nTmHk5 /Fq1k9jCLbYWwOxgER2VJL2mOCLdD6Y5vFgJQrY14fwg7pgHZyUlEzp8JWMcIYn+ wvuFTkvx7jOJpbjS8eztoJ+CQYcnclqYJIs7LlRNZAgvafD0206AUCfcBH67JT// bdKdAb8Wrzxxn/d8WlMOqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1742224874; x=1742311274; bh=A WC/7rxUB/UoLfe09HWp6RyxnGQU/x2yKsGxd4c/OUY=; b=OZ+qlSKK9bWuVm7jo JySRnWt0M1k7PJI2RywNLaIzSs2zi3YOLiVy5+jT931lrCsEXmhgC1sqFECCvgOy l7NagXZI09ZJ7LC7KTLt8M5p3qVDmOA69iV5xfXczdv963fbRAwUfMO0g4Ttt3ur acS92vhkAjfwQZh2nCHkVacUxf4B9O9fgWG1XDXGpMCqZxy0JFMQLtO+HRdjJ2FJ S6vW9MqfXMIXOvcZrcg/cMUAQVnbx8Lo12PI5RPruS5uRHQfSvP/SEEbEkNTzqmn mpU89v6d3SChdQQvo/EhbJ2axQXQV2fVbNs/DfEtLinSRDYsSzCX2uRVWir6Paie b8lVQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddufeelkeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddv jeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeffleegieefgfevudeh tdfhkeeutdffjeevgeffgeejvedthefgudeiteefheejheenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegr khhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuth dprhgtphhtthhopehshihlvhgrihhnsehilhhmqdhinhhfohhrmhgrthhiqhhuvgdrfhhr pdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvg hsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 17 Mar 2025 11:21:13 -0400 (EDT) Message-ID: Date: Mon, 17 Mar 2025 08:21:11 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Restoring only a subset of schemas To: Sylvain Cuaz , pgsql-general@lists.postgresql.org References: <7d869dac-5fe0-488c-a7a1-436b1d939057@ilm-informatique.fr> Content-Language: en-US From: Adrian Klaver In-Reply-To: <7d869dac-5fe0-488c-a7a1-436b1d939057@ilm-informatique.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/17/25 07:57, Sylvain Cuaz wrote: > Hi all, > >     I have a DB with one schema named "Common" holding data referenced > by other schemas. All other schemas have the same structure (tables and > fields) and are named "cXXX" where XXX is just an int. Thus the only > cross-schema foreign keys are in "cXXX" pointing to "Common", and each > "cXXX" is completely independent of other "cXXX" schemas. >     Now if I want to restore from a full dump of this DB, but with only > one "cXXX" and the "Common" schema : > - if I pass --create --schema=Common, then the CREATE SCHEMA is missing, > i.e. it only emits data inside "Common" and the restore fails. I am not seeing that. For: pg_dump -d test -U postgres -s --create --schema=other_sch --schema=public In the output I get: [...] CREATE SCHEMA other_sch; ALTER SCHEMA other_sch OWNER TO postgres; -- -- Name: public; Type: SCHEMA; Schema: -; Owner: pg_database_owner -- CREATE SCHEMA public; ALTER SCHEMA public OWNER TO pg_database_owner; [...] What is the complete command you are using for the pg_dump? What Postgres version(s) are you using? > > Cheers, > > Sylvain > > > -- Adrian Klaver adrian.klaver@aklaver.com