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 1sHX23-008hyQ-2X for pgsql-general@arkaria.postgresql.org; Wed, 12 Jun 2024 23:05:31 +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 1sHX20-009M4D-AZ for pgsql-general@arkaria.postgresql.org; Wed, 12 Jun 2024 23:05:29 +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.94.2) (envelope-from ) id 1sHX1z-009M43-EJ for pgsql-general@lists.postgresql.org; Wed, 12 Jun 2024 23:05:28 +0000 Received: from fout6-smtp.messagingengine.com ([103.168.172.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHX1x-001Mw2-1r for pgsql-general@lists.postgresql.org; Wed, 12 Jun 2024 23:05:27 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 52C6A1380112; Wed, 12 Jun 2024 19:05:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 12 Jun 2024 19:05:23 -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=1718233523; x=1718319923; bh=D3XcQT0wLpcV6yVMIAYHFE+CVwF88Oirz21YueMVMgc=; b= pjfryAio6Mo9Wl7+6u28fi9B+xomPGameKL7rspzP5OVO9LpBzxSmm19tqCIZ+gK a78bea0bT4SZfUIYmYMwzwsZd76vA+To//ncAviudP3v8nGxOEFw2pq1zXqdHLjQ OG8okYvue5cgOwQRlX4S9fpD5paDPc2Qey2Zn3IkmFRUU0kzLmz36IX1amzTIFvK fTLCe3VuQ2Sre8Xw11ydmptLkYqRwFGnXonl1r7pP+QVoE1VJvetu0DQQ6dh0882 ythXoD82w12dfu5yJrTZrHBufFkdqARaggijBwMZHKd8OjzG0pOdhs4ht3rHMgwR vgvmXOmcBQSSLMSvjoCN2g== 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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718233523; x= 1718319923; bh=D3XcQT0wLpcV6yVMIAYHFE+CVwF88Oirz21YueMVMgc=; b=N 2L4+4OMDqghwIotV2tpQ9/jJD0xGablI+D6I4XYyxgOOMIHy6zquvsanVFBvm1Eq G8LaWhna0XpJr0OvU/t5lqEfDNaqbMk/Nxz0Qp7kCZ1SHrHsHPvRhheBHrm6c3Wj GbYDuqqdNaFpRGaHYPO5hbnYZz+R5ERCIKd+tQA8epQGnQ8o6tf+Ln0HFTKlT6Ws 8Orkom/j+Dy6xeKEXdLnz9DhCMfBrBoYqITobcj+JJztQ6mJwbpIen2BsaSzmKHc sxuFffKwGpVTJBTeIv6jCAtCNxPtOc8OmIwE1VEZ6mmcKw7rpnu3P80bz/Vj8McC Eu4yg/kDPmqZpGJSWxnZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeduhedgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeeivdfhieehheegueeileejieettdejhedugeefleek vdelkeehtdfgiefffeekudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Jun 2024 19:05:22 -0400 (EDT) Message-ID: <92fdd56a-9600-42d6-bee7-5f071f0f0f09@aklaver.com> Date: Wed, 12 Jun 2024 16:05:21 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Definging columns for INSERT statements To: Rich Shepard , pgsql-general@lists.postgresql.org References: <27d9076-c416-7847-7bd-159a5c3ee38a@appl-ecosys.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: <27d9076-c416-7847-7bd-159a5c3ee38a@appl-ecosys.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/12/24 14:11, Rich Shepard wrote: > I have > 100 rows to add to a table using INSERT INTO statements. I want > the > PK to be the next value in the sequence. Would this be the appropriate > syntax for the columns to be entered? > > INSERT INTO people (person_nbr > DEFAULT('people_person_nbr_seq'),lname,fname,job_title DEFAULT > 'Contact',company_nbr,loc_nbr,direct_phone,cell_phone,email,active > DEFAULT('true')) VALUES > ( ... 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. > > TIA, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com