Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBPO2-00054M-3S for pgsql-general@arkaria.postgresql.org; Tue, 02 Apr 2019 19:47:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hBPO0-0007t3-Kf for pgsql-general@arkaria.postgresql.org; Tue, 02 Apr 2019 19:47:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBPO0-0007sw-7z for pgsql-general@lists.postgresql.org; Tue, 02 Apr 2019 19:47:56 +0000 Received: from [66.111.4.26] (helo=out2-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBPNx-00038r-Ip for pgsql-general@lists.postgresql.org; Tue, 02 Apr 2019 19:47:55 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id AEDEA21B8B; Tue, 2 Apr 2019 15:47:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 02 Apr 2019 15:47:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=N SaA41RpOvGm98Pi/DvJJkka8QoJvRfeq9A0WSzPQ+M=; b=aLEL4prdugd0wMEyj nzCDm1HzrSM2L8rhKJaQhERSNvf/HkLxWT0EutmkcQqS8lZt5ttbpS61uuIldn2O p56URDAF36ljXZcbsXzxGddBwa0o1Pe25fH4AevJh2PJ9dW3hPedtX1P2sHTyXh5 5YqjJpQZWiOjS3Hp4BBUccgqlmDVVnHgKA0ogkAKa6G/JA9c6Cx/077pK6sdJwae TFvItFtGywIUQbxggsyrn26EC/CMwVQ0KLgXwf/53gTHEhnHdmbYuUbQH+s5ni0q tBQUfDDB0iF1DxKRhMOIM8kiCM9Guv0/p5F+ilJKH9lcWsxflSBEcoZ+k4F1ZfyG ymb9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=NSaA41RpOvGm98Pi/DvJJkka8QoJvRfeq9A0WSzPQ +M=; b=PPvgkkUuBjOMiCzD98YVr9Ac10K0f68GlaAAde0SepEN+cAItkrBKtjPm WejfNHYCpPsBoQ1xXIJAz2VldmBWpDLuvSDepJgbdpamCx+qREaZtWNxuEsFe7+c pSvjoT8gkJtk+IlLzQultKiKasnOs7XjSDMfz6QnbqMH7EOnUj5u6+8cbKLtwq7H MyfHAYN0MTrf7zDA53CbfSJJKBJvYcrBTwQziWeqOxhQnwtL6YKPl8Mm5fdoEWFR j3yCR7BsV+Ppm+CIzZ6n6EnJJLon6697x6oCEXKJpjHJ7sW1PMcRnzutKorL9aQv sOIAwUK9NuVMNzl0sGaq6cuX/CQAw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrtddtgdduvdduucdltddurdeguddtrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffgggjggtgfesthekredttdef jeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhmqeenucfkphepjedurddvuddvrdduhedtrddvtddvnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvg hrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 26791E4210; Tue, 2 Apr 2019 15:47:31 -0400 (EDT) Subject: Re: Running psql in emacs shell generates key conflict error: why? To: Rich Shepard , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <3cb3a26e-23c6-2ab4-3177-cba692b8e818@aklaver.com> Date: Tue, 2 Apr 2019 12:47:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.26 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/2/19 8:00 AM, Rich Shepard wrote: > An unexpected result this morning that I'd like to understand. In emacs I > loaded the file organizations.sql in a buffer to insert new rows in that > table. Rather than running psql from a virtual console, I opened an emacs > shell and entered the command, >   psql -f organizations.sql -d bustrac > and saw an error that the last line in the .sql file was in conflict > with an > existing primary key. (I let postgres assign the keys when new rows are > inserted.) What was the exact message? What was in the last line? > > Checking the table for that primary key confirmed that it was a different > organization so there should not have been a conflict. > > Using a virtual console, and in the directory with the scripts, I ran the > same psql command and it completed as expected. > > I don't think this is a emacs error because the shell opens in the same > directory as the script I'm running. > > Why might postgres fail to run the script within an emacs shell while > having > no issues running the same script from a virtual console? Difference in shell escaping? > > A curious mind wants to learn. > > TIA, > > Rich > > > -- Adrian Klaver adrian.klaver@aklaver.com