Re: Redirecting output from a SELECT command

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Redirecting output from a SELECT command
Date: 2010-11-11 18:42:12
Message-ID: 20101111184212.GA18518@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

peter(at)vfemail(dot)net <peter(at)vfemail(dot)net> wrote:

>
> >From a shell prompt in FreeBSD, I can use a command like:
>
> cat file.txt | mail email(at)domain(dot)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(at)domain(dot)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°

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message peter 2010-11-11 18:58:53 Re: Redirecting output from a SELECT command
Previous Message Richard Broersma 2010-11-11 18:15:52 Re: CSVLOG fields