pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Running queries from scripts.
3+ messages / 2 participants
[nested] [flat]

* Running queries from scripts.
@ 2000-07-06 15:50 DalTech - Continuing Technical Education <CTE@Dal.Ca>
  2000-07-06 15:58 ` Re: Running queries from scripts. Margarita Barvinok <brita@umich.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: DalTech - Continuing Technical Education @ 2000-07-06 15:50 UTC (permalink / raw)
  To: pgsql-sql

I was wondering if anyone could help me out with the syntax of running queries from a unix script.

psql -c select 'I am a dummy' -d dbname  - never seems to work.  I've tried variations on the command line, but to no success.

Does the -c option work?

Cheers,
Christopher Currie

__________________________________
Dalhousie: DalTech - CTE
Visit our Web site at http://www.cte.dal.ca
(902) 494-6079
(800) 565-1179

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Running queries from scripts.
  2000-07-06 15:50 Running queries from scripts. DalTech - Continuing Technical Education <CTE@Dal.Ca>
@ 2000-07-06 15:58 ` Margarita Barvinok <brita@umich.edu>
  2000-07-06 16:16   ` Re: Running queries from scripts. DalTech - Continuing Technical Education <CTE@Dal.Ca>
  0 siblings, 1 reply; 3+ messages in thread

From: Margarita Barvinok @ 2000-07-06 15:58 UTC (permalink / raw)
  To: DalTech - Continuing Technical Education <CTE@Dal.Ca>; +Cc: pgsql-sql


Hi,

It works for me, for example, this way:
athens% psql -d template1 -c "select datname from pg_database"
  datname  
-----------
 template1
 postgres
 biology
 test
(4 rows)
 
Hope this helps,
-Rita


On Thu, 6 Jul 2000, DalTech - Continuing Technical Education wrote:

> I was wondering if anyone could help me out with the syntax of running queries from a unix script.
> 
> psql -c select 'I am a dummy' -d dbname  - never seems to work.  I've tried variations on the command line, but to no success.
> 
> Does the -c option work?
> 
> Cheers,
> Christopher Currie
> 
> __________________________________
> Dalhousie: DalTech - CTE
> Visit our Web site at http://www.cte.dal.ca
> (902) 494-6079
> (800) 565-1179
> 

--------------------------------------------------------
Margarita Barvinok                University of Michigan
System Administrator II           Department of Biology
brita@umich.edu
---------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Running queries from scripts.
  2000-07-06 15:50 Running queries from scripts. DalTech - Continuing Technical Education <CTE@Dal.Ca>
  2000-07-06 15:58 ` Re: Running queries from scripts. Margarita Barvinok <brita@umich.edu>
@ 2000-07-06 16:16   ` DalTech - Continuing Technical Education <CTE@Dal.Ca>
  0 siblings, 0 replies; 3+ messages in thread

From: DalTech - Continuing Technical Education @ 2000-07-06 16:16 UTC (permalink / raw)
  To: Margarita Barvinok <brita@umich.edu>; +Cc: pgsql-sql

> It works for me, for example, this way:
> athens% psql -d template1 -c "select datname from pg_database"

Thanks, I feel a little sheepish at not trying it with quotes around the
query, but the manuals don't mention that you have to enclose the query in
quotes when you use the -c option.

-Christopher Currie




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-07-06 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-06 15:50 Running queries from scripts. DalTech - Continuing Technical Education <CTE@Dal.Ca>
2000-07-06 15:58 ` Margarita Barvinok <brita@umich.edu>
2000-07-06 16:16   ` DalTech - Continuing Technical Education <CTE@Dal.Ca>

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