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 1sqEPd-0081TL-7X for pgsql-general@arkaria.postgresql.org; Mon, 16 Sep 2024 16:17:18 +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 1sqEPc-00GIf4-RL for pgsql-general@arkaria.postgresql.org; Mon, 16 Sep 2024 16:17:16 +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 1sqEPc-00GIew-GW for pgsql-general@lists.postgresql.org; Mon, 16 Sep 2024 16:17:16 +0000 Received: from fout8-smtp.messagingengine.com ([103.168.172.151]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqEPZ-001TUy-66 for pgsql-general@lists.postgresql.org; Mon, 16 Sep 2024 16:17:15 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id 76CB313803BF; Mon, 16 Sep 2024 12:17:11 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Mon, 16 Sep 2024 12:17:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc: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=1726503431; x=1726589831; bh=srWDCHvVFYj+Kw4KtqusAcCj2G32WPg1Y3cSCPhYiy8=; b= aegx24SaNatTEBrR+jjn5ZCHglD/S1dSiOaJTwlIb6JJMp1niM9yB7DARu36Ky4o kdpu11lNfEo8c92saAzzJV6l9XHsC59YR1Do3gd+TaNsXxfNJZzRtxagIGYVy3xb iVfdZxPFwsk/6jg59IBFrlb6AfdU/GQ5lS4P779oOejVcU0jcMLZDJTUyLKAALbz RsNuS0LeM4H1Cz0MBxk4IhChhaDQp1tnM3eppIkLNnpx0M+vH0RK1NaSjH/q8Z5j yMYTC4Bg+plL8+b1gek4jUpFpyKSd6ELU6U22pmM9WBVgglMjAA7ToIN957yItXY Vt19VBZzB/BoxZKvDzKigw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1726503431; x= 1726589831; bh=srWDCHvVFYj+Kw4KtqusAcCj2G32WPg1Y3cSCPhYiy8=; b=X ep/+59I2Jg39XjV0GSLnRqN1+CafnMEz9fO5CBLdtpyurhDNIECSoHYGkWi6LN+8 hrUOlStuNbYQGZ+ai/lp9Q+Gzk1e8t/K2FW8R+JYnwYLonSTJza7nrEuCldsGaGB AnPXY8UBy86pYOvWiRjEYGYwiNseGeJxitWeD81qp89IjKCSrc/HHBMjglVqMeLh sR0XnrsiyuWVaQJ4eifwNfMDbaU2MMrmhVC/XH2duBtm+wZjsW14Z9iP0F5+Rv96 ZgtbkmnWqHgcUqMyBcBR7disDJyOew6E3aOU6Y8soAJC89YE/b9Ime57h4+MlEbr /EDJUg2G0arzjojFo/iag== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudekhedgleejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdej necuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepgfdufeekhfevfeelveei ueevhedvuddukeduvddvlefhueeuieejtdeuvdevvdeunecuffhomhgrihhnpehpohhsth hgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsg gprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehhrghrthhm rghniedthhhomhgvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepfhholhgrrhhtvgesph gvohhplhgvtggrlhhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlhes lhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 16 Sep 2024 12:17:10 -0400 (EDT) Message-ID: <9f5a968f-bd6d-49b6-b5b7-7e5a355f445a@aklaver.com> Date: Mon, 16 Sep 2024 09:17:09 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: load fom csv To: Andy Hartman , Francisco Olarte Cc: pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/16/24 09:12, Andy Hartman wrote: > 2024-09-16 12:06:00.968 EDT [4968] ERROR:  relation > "image_classification_master" does not exist > 2024-09-16 12:06:00.968 EDT [4968] STATEMENT:  COPY > Image_Classification_Master FROM STDIN DELIMITER ',' CSV HEADER; I'm assuming this is from the Postgres log. Best guess is the table name in the database is mixed case and needs to be double quoted in the command to preserve the casing. See: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS for why. > > On Mon, Sep 16, 2024 at 11:52 AM Francisco Olarte > > wrote: > > > > On Mon, 16 Sept 2024 at 17:36, Andy Hartman > wrote: > > I'm trying to run this piece of code from Powershell and it just > sits there and never comes back. There are only 131 records in > the csv. > $connectionString = > "Host=$pgServer;Database=$pgDatabase;Username=$pgUser;Password=$pgPassword" > $copyCommand = "\COPY $pgTable FROM '$csvPath' DELIMITER ',' CSV > HEADER;" > psql -h $pgServer -d $pgDatabase -U $pgUser -c $copyCommand > how can I debug this? > > > I would start by adding -a and -e after "psql". > > IIRC Powershell is windows, and in windows shell do not pass command > words preparsed as in *ix to the executable, but a single command > line with the executable must parse. Given the amount of quoting, -a > and -e will let you see the commands are properly sent, and if it is > trying to read something what it is. > > I will also try to substitute the -c with a pipe. If it heals, it is > probably a quoting issue. > > Also, I just caught Ron's message, and psql might be waiting for a > password. > > Francisco Olarte. > -- Adrian Klaver adrian.klaver@aklaver.com