On 2010-11-11, peter@vfemail.net <peter@vfemail.net> wrote:
>
> Frmail email@domain.comom 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?
yes.
-- open a pipe
\o | mail email@domain.com -s 'the database result'
-- run the query
select * from table;
-- close the pipe and cause delivery
\o
> I'd like to share a printed copy of that output with someone, and there's no printer connected to the database
server,and I only have access to the database server from the console.
\o | lpr -H SERVER -P QUEUE
(eg into a ssh tunnel leading to printer or server on your lan)
--
⚂⚃ 100% natural