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 1w2Vap-000Lyx-31 for pgsql-general@arkaria.postgresql.org; Tue, 17 Mar 2026 14:40:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2Vao-002DlE-36 for pgsql-general@arkaria.postgresql.org; Tue, 17 Mar 2026 14:40:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2VXg-0029WM-2n for pgsql-general@lists.postgresql.org; Tue, 17 Mar 2026 14:37:09 +0000 Received: from fhigh-a7-smtp.messagingengine.com ([103.168.172.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2VXd-00000000cKq-1GH6 for pgsql-general@lists.postgresql.org; Tue, 17 Mar 2026 14:37:08 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 44437140005F; Tue, 17 Mar 2026 10:37:03 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 17 Mar 2026 10:37:03 -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=1773758223; x=1773844623; bh=bRvrXOTmNVmY8UoD6Q3w5AytXMlyzmbcLpw1+XTRnec=; b= FH5VRTZGWKHL7hYHc+lmwVOD+mX8AtxGKKvkesvLR1iKJd7adI6+Ly4LOTBbWqtt YZEPm3YGT0og4Hh5l7UQwYu0K2311Ozitr7u6bu+ih5cosh0Jt5jN67pK1Xvsanj cFggEXxOqRh4jO0pfcfW7JNB6b+c5Kei+RJcdS9HAncwnQTLAZAuFrlUBgrIF+GA PQ9NU1ZGj3cR7rePZHTPplbgqt//La9hWEFh41FHucErZ/6XcLQJO10I/6bjok7z XVYmj0nkk199to70/vSd1iLjGfDgwiJhBM4NBIV7XZF2jEeWDYGWVb0ttGs+HY6u DMxTTflB8Mg0RdOGmBCD3w== 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=1773758223; x=1773844623; bh=b RvrXOTmNVmY8UoD6Q3w5AytXMlyzmbcLpw1+XTRnec=; b=Kfl3MOfAR4vDt3BS4 h6o6rQVv6FvoGONReovBN5z9ZcodBQD8Tac3BcxxUBGY2PwMm+A3hznFtFZTfXu+ 2HvWWmmQoOPdM43846mmh/aWwxNgYsntCF0Wa8Ff8fQ1fn5Y9Zp3Bh8XcTs6/0Jg K8sqdzOkunfRHjFe82YiPcfiYOywaxlwMspKhQbRilixHy4Usx4iy/pKQWndPF/6 nTtD7L/ibqowWhl4PEsAiKCEeOAwZJPSX/0O2hPeP8VHOFRdkpUDzG03H27tl17y Hj3J8skn5dDWwmcvRWVcKVhtSPZ21BynB0IIQIxYDYM4dhppyHD6giPTt0Ox4iVN 6HoFw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftdduheduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhirghn ucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqe enucggtffrrghtthgvrhhnpeffleegieefgfevudehtdfhkeeutdffjeevgeffgeejvedt hefgudeiteefheejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggp rhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehshhgrhhgvvg guhhgrqhhuvgesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghr rghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Mar 2026 10:37:02 -0400 (EDT) Message-ID: <85f5b5b4-e530-4458-b562-5a49a4e2ff09@aklaver.com> Date: Tue, 17 Mar 2026 07:37:02 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Can I use pg_dump to save a sequence for a table that is not also being saved? To: Shaheed Haque , pgsql-general list References: Content-Language: en-US From: Adrian Klaver In-Reply-To: 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/26 6:58 AM, Shaheed Haque wrote: > Hi, > > I observe when using pg_dump like this: > > pg_dump -h localhost -p 5432 -U dbcoreuser -Ft -f abc.tar --no- > privileges --data-only \ > > --exclude-table="public.(jobs|queues|results) \ > > --table=public.django_migrations \ > > --table=public.paiyroll_input \ > > --table=public.*_id_seq \ > > --verbose foo > > > that the dumped data contains the content of the two tables, and the two > sequences.  (FWIW, the above command is actually submitted via a Python > subprocess call, so quoting should not be an issue). The verbose output > confirms this: > > pg_dump: processing data for table "public.django_migrations" > pg_dump: processing data for table "public.paiyroll_input" > pg_dump: executing SEQUENCE SET django_migrations_id_seq > pg_dump: executing SEQUENCE SET paiyroll_input_id_seq > > > Note that the instance "foo" contains many other tables, whose sequences > I was expecting to be included. To confirm this, if I drop the second > "--table", the verbose log shows only: > > pg_dump: processing data for table "public.django_migrations" > pg_dump: executing SEQUENCE SET django_migrations_id_seq > > > My conclusion is that - despite what I understood from the pg_dump docs > - the use of "--table=public.*id_seq" does not include all the sequences > in fo, only those named by another --table. > > Did I misunderstand, or formulate the command incorrectly? My bet is this due to a dependency of paiyroll_input_id_seq on public.paiyroll_input. Provide the output, in psql, of: \d public.paiyroll_input > > Thanks, Shaheed -- Adrian Klaver adrian.klaver@aklaver.com