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 1jmGvV-0001NP-GM for pgsql-admin@arkaria.postgresql.org; Fri, 19 Jun 2020 13:19:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jmGvS-0001ol-Sd for pgsql-admin@arkaria.postgresql.org; Fri, 19 Jun 2020 13:19:22 +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 1jmGvR-0001oa-Bd; Fri, 19 Jun 2020 13:19:22 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmGvO-0003Pb-9L; Fri, 19 Jun 2020 13:19:20 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6B63D5C0239; Fri, 19 Jun 2020 09:19:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 19 Jun 2020 09:19:16 -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=f hiCNK1zhlXs+yA02zeAqPDk4/2NpI6oz8TBSUwOSV0=; b=smupdghoSsaJcbqCS +/V1NO8bBRaNMGWVAA0gjAhR6PBdeCCoqf8yOvIRxP3//M/A716ua5oJuxG5Fh4Q ALq0X8kWA4C4GkxzzJH3gw+tOSQiAMM5W7IRXXfe1jKmE7YSokYMRQKDOKUZSViO oOJ/3QTeHAFvGTSaSwORfdI/NuScKXSyawU0qgMU6CPw2Mb0hI+ExISTtYeI8r6F Sh//7hihvXocpjl4D894lwitizrgKIjqioot80A8Us+M3UqQeGGPSLakYqo/JvgF UALbkvppeGdgfxX/chKKx9ZDQ9S2OWEsntsNfsxhW2w8o4pEMHIMNYmj+LL1hTzu 1sKWw== 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=fhiCNK1zhlXs+yA02zeAqPDk4/2NpI6oz8TBSUwOS V0=; b=oKgjnyfIicYlRgTem76BAg388aLul4Jv0EmVJwb5T7CGx2PeHHPc9MuYo yWyQGQdpuX/Iv/EVrfX4ErNu/s58egRnTmuqsOvwfkUKPaYxCyBu6leYqPonuz+d z7aJh6SogX2UG4rO5nS1UKxs5fOXxw9N4EuJvSV1odwXK9+PW3cy2lf188ncuxlj RQsieJKM2+qq1sDktw5hg43ZfAQ4AL69BEwJK34UUfUNK0x6oWkF+itQyXUHRqmU +a3IKx/sOxO4J2rq5BdLnwXqSNjR1BQscfw1xtAweigvi/eprd76TkdyBDdTpxaG CC93JNUXFtmuIZW9dmUCwyDS7z8BA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejiedgieefucetufdoteggodetrfdotf 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 650DD328005D; Fri, 19 Jun 2020 09:19:15 -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> From: Adrian Klaver Message-ID: <519aa822-cb75-0565-1073-180c911f40a7@aklaver.com> Date: Fri, 19 Jun 2020 06:19:14 -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: <939136830.464657.1592565150445@mail.yahoo.com> 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 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