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 1njQ9k-0004kK-Jf for pgsql-general@arkaria.postgresql.org; Tue, 26 Apr 2022 18:43:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1njQ9i-0001wr-1L for pgsql-general@arkaria.postgresql.org; Tue, 26 Apr 2022 18:43:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njQ9h-0001vm-Mv for pgsql-general@lists.postgresql.org; Tue, 26 Apr 2022 18:43:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njQ9c-00067O-Jr for pgsql-general@lists.postgresql.org; Tue, 26 Apr 2022 18:43:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 23QIhDTd252495; Tue, 26 Apr 2022 14:43:13 -0400 From: Tom Lane To: JORGE MALDONADO cc: pgsql-general@lists.postgresql.org Subject: Re: Backing up a DB excluding certain tables In-reply-to: References: Comments: In-reply-to JORGE MALDONADO message dated "Tue, 26 Apr 2022 13:15:17 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <252493.1650998593.1@sss.pgh.pa.us> Date: Tue, 26 Apr 2022 14:43:13 -0400 Message-ID: <252494.1650998593@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk JORGE MALDONADO writes: > I am using *pg_dump* to backup a DB but I would like to exclude some tables > so I added the *-T* switch with a pattern like this: *aspnet*.**. The > backup command includes the *-s* switch to consider the schema only > because I do not need the data. However, even with the *-T* switch, the > tables with the above pattern are created and I also want to exclude their > creation. Is this possible? Or maybe I am not setting the pattern > correctly. This is the command I am issuing: > pg_dump -E win1252 -f c:/temp/respaldo.backup -F p -n riopoderoso -h > localhost -p 5432 -U postgres -W -T aspnet*.* -s riopoderoso "-n riopoderoso" is already restricting the dump to objects in schema riopoderoso, so it doesn't look to me like that -T switch is going to change anything. I suspect the problem is somewhere else in your process. Maybe you are restoring the backup into a database that isn't empty, but already contains the aspnet*.* tables? regards, tom lane