Re: Redirecting output from a SELECT command

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: Redirecting output from a SELECT command
Дата
Msg-id ibtdpe$dl9$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на Redirecting output from a SELECT command  (peter@vfemail.net)
Список pgsql-novice
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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Machiel Richards
Дата:
Сообщение: Postgresql certifications
Следующее
От: Thom Brown
Дата:
Сообщение: Re: Postgresql certifications