Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmHXB-0002Ml-1n for pgsql-admin@arkaria.postgresql.org; Fri, 19 Jun 2020 13:58:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jmHX9-0002IC-VU for pgsql-admin@arkaria.postgresql.org; Fri, 19 Jun 2020 13:58:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmHX9-0002I1-O1; Fri, 19 Jun 2020 13:58:19 +0000 Received: from [66.111.4.25] (helo=out1-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmHX5-0004mi-NA; Fri, 19 Jun 2020 13:58:19 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E466E5C0131; Fri, 19 Jun 2020 09:58:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 19 Jun 2020 09:58:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=E vnRYqGX17BBlE7HJWs+f7w/bKCPjSRjqGNSW5OFsXc=; b=hB7yXfXKQhpn6dKuc wOM+ii4HnJ/NaQ12XDXcaI+I8n3PSqi3kU48i0lvq+oA4O+2CPvHFLfKCMcSUN57 bEq9MIHN7nt+Bzuu6dEH27ITC9CqUXU1+2+PE2aFkT3Geo6sLekkPC23cxnUBnT0 xT+9KBVdSMCHlDpHrNipWGGiRIOFUhHkBgcLAmEBzqTJAdKK+Ie5z2Tr0XwqA3Rr n+HAaJfd5Lp7Ocdak4tQFlwhseVszr8nsx4brgFvq1Nl1XN5e5RDNY92mXF3Kq4V 1cOp5si16+9GS1x0QZrGJTn0XT9is7ISu5Jj1NZhE6S3TSfJvdUzb6DYwErJTifa Hv7Jw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm3; bh=EvnRYqGX17BBlE7HJWs+f7w/bKCPjSRjqGNSW5OFs Xc=; b=VEWieqdn4xWc7A6K2rSEylrA3B8DNV6DHIfcvmSFkPz1imd8bR8MwZyfs 81YyYVNoyU5ARbvPtYkhF0ua2iiXEMevD9ZXOko4C7z9ho/FrXQdsZ7mM3NXn07q wRSxjUco6Lywehdq6WH+m81L0IwlEJE5/lca+gycgD2LMRRXdVekSO1UFNDe2An8 rA7dfjWKawaMvDjy+9U/jAEozhRe2ARw6xoEPNLMOEVS07y4GAnDy4R3aJscMXhZ PBqrymFfj8NaGPC6TgTniOsNiST9f4WBLmrUAGZmEGMBT45k6u/YQbkYGzl/U0wM nPDCH7Ma8cuiAjAe17oU59dC0cnqA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejiedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeehvdelledujefhteekueefvddtuedvudekjefgvedu ieduteeijefgudekveevgeenucffohhmrghinheprghmrgiiohhnrgifshdrtghomhdpph hoshhtghhrvghsqhhlrdhorhhgnecukfhppeejhedrudejvddrhedrvdefudenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkh hlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id EA7AE328005E; Fri, 19 Jun 2020 09:58:02 -0400 (EDT) Subject: Re: create batch script to import into postgres tables To: Pepe TD Vo , cgerard999@gmail.com Cc: Christopher Browne , Pgsql-admin , Pgsql-general References: <37a9ad71-b297-96b3-9c1f-1043e75dec58@aklaver.com> <939136830.464657.1592565150445@mail.yahoo.com> <519aa822-cb75-0565-1073-180c911f40a7@aklaver.com> <448905667.492834.1592574816699@mail.yahoo.com> From: Adrian Klaver Message-ID: <3bbdbc7b-0ca8-b162-5967-5822cc2edfd3@aklaver.com> Date: Fri, 19 Jun 2020 06:58:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <448905667.492834.1592574816699@mail.yahoo.com> 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.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/19/20 6:53 AM, Pepe TD Vo wrote: > Thank you sir and I am sorry for the typo not having "--" on password. > I did spelling out with --password=mypassword Please go back and read my post again. > >>> echo select count(*) from tableA; | "C:\Program > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h > hostname.amazonaws.com -p 5432 --password=mypassword > > even -W for password >>> echo select count(*) from tableA; | "C:\Program > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h > hostname.amazonaws.com -p 5432 -W=mypassword > > none of them work, still prompt me for password to type in.  I will look > into the pgpassfile which I know it will fail again. > > > very respectfully, > > ** > *Bach-Nga > > *No one in this world is pure and perfect.  If you avoid people for > their mistakes you will be alone. So judge less, love, and forgive > more.EmojiEmojiEmoji > To call him a dog hardly seems to do him justice though in as much as he > had four legs, a tail, and barked, I admit he was, to all outward > appearances. But to those who knew him well, he was a perfect gentleman > (Hermione Gingold) > > **Live simply **Love generously **Care deeply **Speak kindly. > *** Genuinely rich *** Faithful talent *** Sharing success > > > > > On Friday, June 19, 2020, 09:19:35 AM EDT, Adrian Klaver > wrote: > > > On 6/19/20 4:12 AM, Pepe TD Vo wrote: > > thank you,   I tried that too, remove the quote around the echo and it > > prompt for password, as I mentioned no matter I put -P mypassword no > > matter what I spell out password=mypassword still argument error > > Once again -P has nothing to do with password. Also --password does not > take an argument, it is meant to be used as is. The purpose is to force > a password prompt. This is all spelled out here: > > https://www.postgresql.org/docs/12/app-psql.html > > Also spelled out in above is: > > " It is also convenient to have a ~/.pgpass file to avoid regularly > having to type in passwords. See Section 33.15 for more information." > > And Section 33.15: > > https://www.postgresql.org/docs/12/libpq-pgpass.html > > "The file .pgpass in a user's home directory can contain passwords to be > used if the connection requires a password (and no password has been > specified otherwise).  ..." > > Read more at link for how to do that. > > > > > >  >>echo select count(*) from tableA; | "C:\Program > > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h > > hostname.amazonaws.com -p 5432 > > > >  >> echo select count(*) from tableA; | "C:\Program > > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h > > hostname.amazonaws.com -p 5432 password=mypassword > > > > all usernames are same password. > > > > thank you so much for all input. > > > > v/r, > > > > ** > > *Bach-Nga > > -- > Adrian Klaver > adrian.klaver@aklaver.com > > -- Adrian Klaver adrian.klaver@aklaver.com