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 1jmEww-0006AG-0B for pgsql-general@arkaria.postgresql.org; Fri, 19 Jun 2020 11:12:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jmEws-0005eD-EJ for pgsql-general@arkaria.postgresql.org; Fri, 19 Jun 2020 11:12:42 +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 1jmEwr-0005e0-Ow for pgsql-general@lists.postgresql.org; Fri, 19 Jun 2020 11:12:42 +0000 Received: from sonic303-2.consmr.mail.bf2.yahoo.com ([74.6.131.41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jmEwo-00034R-5p for pgsql-general@postgresql.org; Fri, 19 Jun 2020 11:12:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1592565155; bh=miSC1dauSQ0K3j4YWmgHSe2fEqCpbGDBtoAbmPo3x9M=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=fSZJ2J51GT0msvZXhgMUjR8dXR3/iMVWM0p24PFbDH5Ivc9Jkbo2+wTWXiHtwjhAe/ZUuf+5rsVpEOHUd/mmByLx1Tww7pof2o/xYqUEc+dEOFJydUrEkx+n7xgwoys8Q0n8LokqzRx9Xgp5svILWFFiC46O9YSApsG+GiyFhGckdi3RQ0w/JhjcBd5Wpkw59666W5tzmMnGWYIrVOFj1B7NQC9yDZ1EaHrnm7gRrL483HF+sJarKkEt9DNAQq6J6fLWIgyAZJ2RezXiT/gg9kDZXuqzXya/R54y0Dryc9Dq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JVuaz4JfCbvExAcpVrIMm_pEZx5vV_PZTpR52PJrf kXdwq0g5p.ZjcynmvcR8cDsr9608SH0Soh1kUhGiXCdJsQ.FF1iz5O3slcinpbUdARbv2MZUK5VY .m78vw3YIs6LwSVJIn7omOzCFe4brRkUSQELun3CqR.RngtuhVHRuVMSgbgFqXIOAZSnbmR4AnJ3 ve1VEz3YHDQj7TY.AlutTdytn9t0yMTKpU3UNJhoo268lV2v3H7AZvvYnNNl503c1_LKXQOmyqcQ qMiW5vh1j6Y_afhyqSuHqaoB2TsHyvehKc8egixOe94PU1RdVmiKLwihwg82Uu4cpKeqDHgUQgQf ePHLq2xdHyEauEbBsQhncBs2TrBBqsT.pItvBXUzAEOAG7OgcPgBnck.lJY8mR.uP Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.bf2.yahoo.com with HTTP; Fri, 19 Jun 2020 11:12:35 +0000 Date: Fri, 19 Jun 2020 11:12:30 +0000 (UTC) From: Pepe TD Vo Reply-To: Pepe TD Vo To: Adrian Klaver , Cc: Christopher Browne , Pgsql-admin , Pgsql-general Message-ID: <939136830.464657.1592565150445@mail.yahoo.com> In-Reply-To: References: <37a9ad71-b297-96b3-9c1f-1043e75dec58@aklaver.com> Subject: Re: create batch script to import into postgres tables MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_464656_664878187.1592565150442" X-Mailer: WebService/1.1.16138 YMailNorrin Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Content-Length: 12557 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_464656_664878187.1592565150442 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable thank you,=C2=A0 =C2=A0I tried that too, remove the quote around the echo a= nd it prompt for password, as I mentioned no matter I put -P mypassword no = matter what I spell out password=3Dmypassword still argument error >>echo select count(*) from tableA; |=C2=A0"C:\Program Files\PostgreSQL\11\= bin\psql" -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432=C2=A0= =C2=A0 >>=C2=A0echo=C2=A0select count(*) from tableA; |=C2=A0"C:\Program Files\Pos= tgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p= 5432 password=3Dmypassword all usernames are same password. thank you so much for all input. v/r, Bach-Nga No one in this world is pure and perfect.=C2=A0 If you avoid people for the= ir mistakes you will be alone. So judge less, love, and forgive more.To cal= l 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 =20 On Thursday, June 18, 2020, 09:25:41 PM EDT, wro= te: =20 =20 =20 Remove the quotes around echo echo select count(*) from web_20200619; | "C:\Program Files\postgresql\11\b= in\psql" -d *** -h *** -U *** or, store your query into a text file and use=C2=A0 psql -f query.sql Sent from my mobile phone Le 19 juin 2020 =C3=A0 02:00, Adrian Klaver a = =C3=A9crit=C2=A0: =EF=BB=BFOn 6/18/20 4:37 PM, Pepe TD Vo wrote: thank you for the link.=C2=A0 I did try it and it's still error echo 'SELECT count(*) FROM tableA;' | C:\Program Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h hostna= me.amazonaws.com -p 5432 This is getting old. The error is? I can run 'psql -u postgres -d PSCIDR -p 5432' (on Linux server, still lear= ning how to run it from psql shell in Window) fine from psql prompt.=C2=A0 = Just still wonder how to connect directly to the instance PSCIDR from scrip= ting in both aws and linux.=C2=A0 Otherwise manually run using pgAdmin. v/r, ** *Bach-Nga --=20 Adrian Klaver adrian.klaver@aklaver.com =20 ------=_Part_464656_664878187.1592565150442 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
thank you,   I tried th= at 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 pas= sword=3Dmypassword still argument error

>>echo <= span>select count(*) from tableA; | <= /span>"C:\Program Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d P= SCIDR -h hostname.amazonaws.com -p 5432  

>>= ; echo select count(*) from tableA; | "C:\Program Files\PostgreSQL\11\bin\psql" -U PSmaste= ruser -d PSCIDR -h hostname.amazonaws.com -p 5432 password=3Dmypassword

all usernames = are same password.

thank you so much for all input.

v/r,

<= /font>
Bach-Nga

No one in this world is pure and perfec= t.  If you avoid people for their mistakes you will be alone. So judge= less, love, and forgive more.3D"Emoji"3D"Emoji"3D"Emoji"=
To call him a dog hardly seems to do hi= m justice though in as much as he had four legs, a tail, and barked, I admi= t he was, to all outward appearances. But to those who knew him well, he wa= s a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deepl= y **Speak kindly.
*** Genuinely rich *** Fa= ithful talent *** Sharing success



=20
=20
On Thursday, June 18, 2020, 09:25:41 PM EDT, <cgera= rd999@gmail.com> wrote:


Remove the quotes around echo

echo select count(*) from web_20200619; | "C:\Program = Files\postgresql\11\bin\psql" -d *** -h *** -U ***

or, store your query into a text file and use 

psql -f query.sql



Sent from my mobile phone

Le 19 juin 2020 =C3=A0 02:00, Adrian Kl= aver <adrian.klaver@aklaver.com> a =C3=A9crit :

=EF=BB=BFOn 6/18/20 4:37 PM, Pepe TD Vo wrote:
thank you for the link. = ; I did try it and it's still error
<= blockquote type=3D"cite">echo 'SELECT count(*) FROM tableA;' |=
C:\Program = Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h hostname.amazonaw= s.com -p 5432


This is getting old. The er= ror is?
I can run = 'psql -u postgres -d PSCIDR -p 5432' (on Linux server, still learning how t= o run it from psql shell in Window) fine from psql prompt.  Just still= wonder how to connect directly to the instance PSCIDR from scripting in bo= th aws and linux.  Otherwise manually run using pgAdmin.
v/r,
**
*Bach-Nga

--
Adrian Klaver
adrian.klaver@aklaver.com


<= /blockquote>
------=_Part_464656_664878187.1592565150442--