Re: Redirecting output from a SELECT command - Mailing list pgsql-novice

From Andreas Kretschmer
Subject Re: Redirecting output from a SELECT command
Date
Msg-id 20101111184212.GA18518@tux
Whole thread Raw
In response to Redirecting output from a SELECT command  (peter@vfemail.net)
Responses Re: Redirecting output from a SELECT command
List pgsql-novice
peter@vfemail.net <peter@vfemail.net> wrote:

>
> >From a shell prompt in FreeBSD, I can use a command like:
>
>     cat file.txt | mail email@domain.com
>
> to e-mail the contents of a file somewhere.
>
> Is it possible from a PostgreSQL pgsql> shell prompt to e-mail the results of a:
>
>     select * from table;
>
> command somewhere?

Sure.

psql db_name -c "select * from table" | mail email@domain.com



Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

pgsql-novice by date:

Previous
From: Richard Broersma
Date:
Subject: Re: CSVLOG fields
Next
From: peter@vfemail.net
Date:
Subject: Re: Redirecting output from a SELECT command