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 1sHqlg-00BCEp-P1 for pgsql-general@arkaria.postgresql.org; Thu, 13 Jun 2024 20:09:56 +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 1sHqle-0075Ia-I4 for pgsql-general@arkaria.postgresql.org; Thu, 13 Jun 2024 20:09:55 +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 1sHqle-0075HT-7f for pgsql-general@lists.postgresql.org; Thu, 13 Jun 2024 20:09:55 +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 1sHqlc-001AkJ-Lb for pgsql-general@lists.postgresql.org; Thu, 13 Jun 2024 20:09:53 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 5CEBC2A2B7C for ; Thu, 13 Jun 2024 13:09:51 -0700 (PDT) Date: Thu, 13 Jun 2024 13:09:51 -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: 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, Ron Johnson wrote: > No need to do that. Just write: > INSERT INTO public.companies (company_name, , industry, status) > VALUES ('Berkshire Hathaway', 'Conglomerate', 'Mumble'); > > The next value of companies_org_nbr_seq will automatically be taken and > inserted into the table. Ron, Aha! So it's likely that by listing the PK column name in the list of columns to be inserted was what caused the problem? No need to specify DEFAULT for it? I'm writing a script to enter all contact within these companies. I'll leave out 'person_nbr' in the list of columns and DEFAULT at the beginning of the VALUES () section. I didn't pick this up in my readings. Thank you, Rich