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 1w2YSI-000OUc-2a for pgsql-general@arkaria.postgresql.org; Tue, 17 Mar 2026 17:43:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2YSH-003mNE-1K for pgsql-general@arkaria.postgresql.org; Tue, 17 Mar 2026 17:43:45 +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 1w2YSG-003mN6-1i for pgsql-general@lists.postgresql.org; Tue, 17 Mar 2026 17:43:45 +0000 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2YSD-00000000e16-0vl1 for pgsql-general@lists.postgresql.org; Tue, 17 Mar 2026 17:43:44 +0000 Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id CE2D714000BE; Tue, 17 Mar 2026 13:43:38 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Tue, 17 Mar 2026 13:43:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc: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=1773769418; x=1773855818; bh=DsTeCRYSJqWC4GyV3YmcNk/y+5FbKHkPVnfnzdQmP7Y=; b= RY+9V/Gc2N0pqGGVR89qvwZ8d/buGHWZgJSOpZUYRAsUM7J9S6UzT44yw3iOaazz fljkRPnqHJpCfFBt/cENFVHGjFj0+UlHBE45E48rNW9gjVmtjkG1kViDmg1RQin8 SgCG6AL233vR2fTBhM+CWNvzyMeYvXBacg0Z0O0Jp+910dsCqifAcwQEVuPf8nfh qtxeIVcbWa1rUhaBJYgwp+hsDuuPy89j/9k+VMeiyiGaEPYjQl6oLm1rrqpBLQmT STulF0usoy8oS9JSiA09wNAVxl4XaLjNUvwhoKol/DtOvxB3771QbI3w4knE6apI 75hWRseKvvWWJkms2FOgkA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1773769418; x= 1773855818; bh=DsTeCRYSJqWC4GyV3YmcNk/y+5FbKHkPVnfnzdQmP7Y=; b=K Mwb9DFVh0Sre9LUDOBurWmZLnA4rzb4n127Nzpr7QIvWwksukzKtb8fLHDNkHebJ Wx71qdD/dJQHBDq2Dk33ijho1FgcWktD6WboZwFCCVV+2ILw+zXDiRYVQwWpQZqc vuPHv1qVIALBviwKcoc84fnUhthSiPjU20yK0vCY7W4+g0PzBQCDCQPdbfP5chdl 9ASOsI7RrvqhYTs/AH5kMJAcIxt+tCZltLvcZsc0o2SJvobqOYcveWyu7Ojcu8Hp 835bRpG9bYfRu16LgpCQ6qdslQk6Gh6dCtv31Qh8+jN0Xu+zNFMUQTusGKXh1k2k UXlIm4VnJUrTwUPNSibwA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftddukeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepfeegfeeiuedtgffgteeggfehkeejheetieeliefgteei keejvdeiveeigfehvedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnhgs pghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepshhhrghhvg gvughhrghquhgvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgv rhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Mar 2026 13:43:38 -0400 (EDT) Message-ID: <4f3fce72-042a-45e5-b5af-186876a02de1@aklaver.com> Date: Tue, 17 Mar 2026 10:43:37 -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 Cc: pgsql-general list References: <85f5b5b4-e530-4458-b562-5a49a4e2ff09@aklaver.com> <0c4e4d9c-bd93-4bec-91c5-13180eb71aa8@aklaver.com> 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 10:28 AM, Shaheed Haque wrote: > Hi Adrian, > > Thanks for the kind replies, but it seems my email was not very clear... > > I was hoping, possibly foolishly, that specifying the wildcard in "-- > table=public.*id_seq" would dump the  matched sequences, irrespective of > whether the associated table data was being dumped. Is there a way to > get just the sequences? 1) You are using --data-only which means you won't get the sequence definition, only the statement to set the sequence value: SELECT pg_catalog.setval('public.seq_test_line_id_seq', 1, false); If the sequence is not already in the database instance the above will fail. 2) Sequences are an object that can be created as a stand alone which you then use as needed or more generally these days as a dependent object to a serial 'type' or a GENERATED ALWAYS AS IDENTITY attribute to a column. In the latter cases the table needs to exist for the sequence to have any relevance. In your case I'm thinking that the sequences you want are tied to tables and in the case where you don't dump the associated table the sequence data(pg_catalog.setval(...)) is not dumped as there is no point. > > It is very possible that I am barking up the wrong tree with pg_dump, > and what I need is some queries using the information_schema. I'm going to say yes you will need to find another method. It would help to know exactly what it is you want. > > Thanks, Shaheed > -- > Adrian Klaver > adrian.klaver@aklaver.com >