pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pepe TD Vo <pepevo@yahoo.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
To: cgerard999@gmail.com
Cc: Christopher Browne <cbbrowne@gmail.com>
Cc: Pgsql-admin <pgsql-admin@postgresql.org>
Cc: Pgsql-general <pgsql-general@postgresql.org>
Subject: Re: create batch script to import into postgres tables
Date: Fri, 19 Jun 2020 11:12:30 +0000 (UTC)
Message-ID: <939136830.464657.1592565150445@mail.yahoo.com> (raw)
In-Reply-To: <AB7CEEE5-3BC8-4F24-83D1-C60744E9B479@gmail.com>
References: <37a9ad71-b297-96b3-9c1f-1043e75dec58@aklaver.com>
	<AB7CEEE5-3BC8-4F24-83D1-C60744E9B479@gmail.com>

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
>>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

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.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 Thursday, June 18, 2020, 09:25:41 PM EDT, <cgerard999@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 à 02:00, Adrian Klaver <adrian.klaver@aklaver.com> a écrit :



On 6/18/20 4:37 PM, Pepe TD Vo wrote:

thank you for the link.  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 hostname.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 learning how to 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 both aws and linux.  Otherwise manually run using pgAdmin.


v/r,


**


*Bach-Nga



-- 
Adrian Klaver
adrian.klaver@aklaver.com



  

view thread (32+ messages)  latest in thread

Message-ID: <939136830.464657.1592565150445@mail.yahoo.com>
Permalink:  ../939136830.464657.1592565150445@mail.yahoo.com/
Also on:    postgresql.org/message-id/939136830.464657.1592565150445@mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: pepevo@yahoo.com, adrian.klaver@aklaver.com, cgerard999@gmail.com, cbbrowne@gmail.com, pgsql-general@postgresql.org
  Subject: Re: create batch script to import into postgres tables
  In-Reply-To: <939136830.464657.1592565150445@mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox