Re: Sending query to a file
От | Brett W. McCoy |
---|---|
Тема | Re: Sending query to a file |
Дата | |
Msg-id | Pine.LNX.4.30.0111101624100.2354-100000@chapelperilous.net обсуждение исходный текст |
Ответ на | Re: Sending query to a file (Francisco Reyes <lists@natserv.com>) |
Список | pgsql-novice |
On Sat, 10 Nov 2001, Francisco Reyes wrote: > Thanks. That worked. > Is there a better way to use "\g" than running it after running the query > initially? > The description says "send query to backend (and results in [file] or > |pipe)". For starters when I do "\g" it doesn't seem to go to the backend. > It processes the last query and I don't get the prompt back until it is > done. Why do you need to use \g? Just terminate your query with a semi-colon and press enter. They do the same thing. If you want to save the result of a query, start your session with \o [file], and use \o without any options to make query results go back to stdout. Or use \g [file] in one shot. These are more or less the same: \o result.txt SELECT * FROM sometable WHERE id > 12; \o SELECT * FROM sometable WHERE id > 12 \g result.txt -- Brett http://www.chapelperilous.net/ ------------------------------------------------------------------------ You can always pick up your needle and move to another groove. -- Tim Leary
В списке pgsql-novice по дате отправления: