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 1sHp7w-00B27F-4w for pgsql-general@arkaria.postgresql.org; Thu, 13 Jun 2024 18:24:48 +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 1sHp7t-005Gax-Ci for pgsql-general@arkaria.postgresql.org; Thu, 13 Jun 2024 18:24:46 +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 1sHp7t-005Gap-0k for pgsql-general@lists.postgresql.org; Thu, 13 Jun 2024 18:24:45 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHp7n-0019su-4x for pgsql-general@lists.postgresql.org; Thu, 13 Jun 2024 18:24:44 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 651442A2B7C for ; Thu, 13 Jun 2024 11:24:37 -0700 (PDT) Date: Thu, 13 Jun 2024 11:24:37 -0700 (PDT) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: Reset sequence to current maximum value of rows In-Reply-To: Message-ID: <1b139d9a-b95f-f7c8-52fb-9d7442c69ad9@appl-ecosys.com> References: <387fa6c2-5de-f24-d522-46282597703@appl-ecosys.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 13 Jun 2024, David G. Johnston wrote: > You need to show your work here. As your PK is a number it cannot have a > company name as a value and so this doesn't make sense. David, insert into companies (company_nbr,company_name,industry,status) values (DEFAULT,'new company name','Industry','Opportunity') With DEFAULT as the company_nbr why can't the company_name not have a value? > It didn't... I changed the company_name for all company_nbr using the 'new company name' for all rows with 'Industry' in that column. > And how to I reset sequences to ignore all current values > This doesn't make sense... Then I cannot use the sequence for adding new rows in the table and I must manually enter each PK number? > If you use the default when inserting the next value in the sequence is > used. Yes, that's the theory. It didn't work for me and why it didn't is what I want to understand. Regards, Rich