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 1jmI5O-0003Nb-M9 for pgsql-general@arkaria.postgresql.org; Fri, 19 Jun 2020 14:33:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jmI5N-0007YZ-AV for pgsql-general@arkaria.postgresql.org; Fri, 19 Jun 2020 14:33:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmI5L-0007YO-0N; Fri, 19 Jun 2020 14:33:40 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmI5C-00042d-Q1; Fri, 19 Jun 2020 14:33:37 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9D2235C00CB; Fri, 19 Jun 2020 10:33:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 19 Jun 2020 10:33:29 -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=Y S7BSdD9DyVoztP5sHoIllXsx2J3DCZO0yNWUsVA6ho=; b=BOuAPQk95fNPvU08B UQ220Qa/DU0bo/hotfv7AvlivGSBqoLe0geSkNTXyVCC+Iz96TdGOINQ9rKo0Xsl OiRcKci/PBZeYEqPGlLlDoQ3b+GMpBZEQAeEsqm4bUcPSG9//Ex+5ICDhHKftnrg r6jeXS+hqBsN5pYlcx+hIL04q1L72oyjlRl/Eo979ZyHrgK4GfrKz3GMhDnopjC5 OIxoFfY74ISmHxKJvSx6D37sy1n78q6AQmxaw/xXSEwLy6dcS+FgKXpHIHp7TxEd O0AGiEbUONyysbdM2MoHi/QJtdITSWbEryktYgwKhcGZ63kxjX3OGSAmBxHAe3xi El5LQ== 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=YS7BSdD9DyVoztP5sHoIllXsx2J3DCZO0yNWUsVA6 ho=; b=LO9d38y17+T60AX0/SJtuvJk2zTsx3Qb/Tve+QOmbUCHq/B47qU4R6dHv itlM5moGDN/4fihPZcbJc3E+FLTwsy2bILmhGGNzGI+/EZJk96AKdRLBiy9CTrmM I9lMASApzyh3FdnIrDcp7MlBf+Adv9C+A6RgyC5wPHxJJtznLo7385+rsiKjULq6 MuWO54XWdGvcH62qENjfBdmTvDEWc3Vwk+hZdsdnMc7Uyr+6j695A21exvB4BJlx NGUhjhYVkrqy2bmPtRO5Ikyk4cd9EDSEGzVZRInm6uTHPpCcd4OOC3utK9yOR0AD rUyy2gyodmx6zWrA5V3ZRmBkleQvA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejiedgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeehvdeikeevgfevveeihfffhfetkeefledtjeffgfdv vdfhudegvdeuvdffhffgjeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpd grmhgriihonhgrfihsrdgtohhmnecukfhppeejhedrudejvddrhedrvdefudenucevlhhu 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 AC37E328005D; Fri, 19 Jun 2020 10:33:28 -0400 (EDT) Subject: Re: create batch script to import into postgres tables To: pepevo , cgerard999@gmail.com Cc: Christopher Browne , Pgsql-admin , Pgsql-general References: From: Adrian Klaver Message-ID: <61c306a5-932a-fdea-89dd-ec27fcaba37c@aklaver.com> Date: Fri, 19 Jun 2020 07:33:27 -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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/19/20 7:17 AM, pepevo wrote: > I understand your post about "password does not take an argument, it is > meant to be used as is. The purpose is to force a password prompt." When > I used -W and --password=.  That's what I said I will try pgpassfile. > Thought it like mysq/oracle can indicate out without creating password > file. If you want to expose your password in the script file then: https://www.postgresql.org/docs/12/app-psql.html Usage Connecting to a Database "An alternative way to specify connection parameters is in a conninfo string or a URI, which is used instead of a database name. This mechanism give you very wide control over the connection. For example: $ psql "service=myservice sslmode=require" $ psql postgresql://dbmaster:5433/mydb?sslmode=require This way you can also use LDAP for connection parameter lookup as described in Section 33.17. See Section 33.1.2 for more information on all the available connection options." So: psql postgresql://PSmasteruser:mypassword@hostname.amazonaws.com:5432/PSCIDR or psql 'dbname=PSCIDR user=PSmasteruser host=hostname.amazonaws.com port= 5432 password=mypassword ' > > Thank you again. > > Bach-Nga > > Sent from my Metro By T-Mobile 4G LTE Android Device > > > -------- Original message -------- > From: Adrian Klaver > Date: 6/19/20 09:58 (GMT-05:00) > To: Pepe TD Vo , cgerard999@gmail.com > Cc: Christopher Browne , Pgsql-admin > , Pgsql-general > Subject: Re: create batch script to import into postgres tables > > 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 > > -- Adrian Klaver adrian.klaver@aklaver.com