Re: Running a query from the OS CLI

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: "Michael Glaesemann" <grzm(at)seespotcode(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Running a query from the OS CLI
Date: 2007-08-08 19:51:09
Message-ID: D7FF158337303A419CF4A183F48302D602F19310@hdsmsx411.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes, that works.

The actual sql executes a stored function that returns a set of records.
Output to the CLI looks great !!!

Thanks to all !!!

-dave

-----Original Message-----
From: Michael Glaesemann [mailto:grzm(at)seespotcode(dot)net]
Sent: Wednesday, August 08, 2007 2:43 PM
To: Gauthier, Dave
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Running a query from the OS CLI

On Aug 8, 2007, at 13:13 , Gauthier, Dave wrote:

> If I have a DB called "foo"

psql --dbname "foo"

>
> ...and...
>
> I want to run "select name from table_a where name like 'john%'"

psql --dbname "foo" -c "select name from table_a where name like 'john
%'"

>
> ...and...
>
> I want no table header "NAME" in the output

psql --dbname "foo" -c "select name from table_a where name like 'john
%'" -t

>
> ...and...
>
> I want to do this as a one-liner from the linux command line

check.

>
> ...and...
>
> I don't want to have to deal with intermediate files or home-grown
> programs...

Does that work?

Michael Glaesemann
grzm seespotcode net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message cluster 2007-08-08 20:06:33 Re: tsearch2: plainto_tsquery() with OR?
Previous Message Emi Lu 2007-08-08 19:18:16 Dump all objects under a specific schema