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 1sHXKw-008lzy-3U for pgsql-general@arkaria.postgresql.org; Wed, 12 Jun 2024 23:25:02 +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 1sHXKt-009gDl-Sq for pgsql-general@arkaria.postgresql.org; Wed, 12 Jun 2024 23:25:00 +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 1sHXKt-009gCv-Hb for pgsql-general@lists.postgresql.org; Wed, 12 Jun 2024 23:25:00 +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 1sHXKr-0011ze-S3 for pgsql-general@lists.postgresql.org; Wed, 12 Jun 2024 23:24:59 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 759342A2B7C for ; Wed, 12 Jun 2024 16:24:56 -0700 (PDT) Date: Wed, 12 Jun 2024 16:24:56 -0700 (PDT) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: Definging columns for INSERT statements In-Reply-To: <92fdd56a-9600-42d6-bee7-5f071f0f0f09@aklaver.com> Message-ID: <61398511-e28d-f9bd-d44-33a69a1c55@appl-ecosys.com> References: <27d9076-c416-7847-7bd-159a5c3ee38a@appl-ecosys.com> <92fdd56a-9600-42d6-bee7-5f071f0f0f09@aklaver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 12 Jun 2024, Adrian Klaver wrote: > Assuming 'people_person_nbr_seq' is the sequence attached to person_nbr > and the other DEFAULTs are the column defaults then the syntax would be: > > INSERT INTO people > (person_nbr, lname, fname, job_title, company_nbr,loc_nbr, direct_phone, > cell_phone,email, active) > VALUES > (DEFAULT, 'klaver', 'adrian', DEFAULT, 1, 1, '555-1234', '555-4321', > 'adrian.klaver@aklaver.com', DEFAULT); > > If they are not the column defaults then just supply the literal value. Adrian, No matter how many postgres docs and web pages I read I didn't find an example as explicit as yours. Columns other than the person_nbr were not defined with defaults and I expected to enter them for each row. Many thanks for another valuable lesson. Best regards, Rich