Re: [GENERAL] Suggested "minor" change to psql

Поиск
Список
Период
Сортировка
От Ed Loehr
Тема Re: [GENERAL] Suggested "minor" change to psql
Дата
Msg-id 384EB09A.472A931B@austin.rr.com
обсуждение исходный текст
Ответ на Suggested "minor" change to psql  (Mark Dalphin <mdalphin@amgen.com>)
Список pgsql-general
Mark Dalphin wrote:

> Sometimes, however, rather than using the "\i" command, I would like to simply
> load my schema directly into psql and capture the output on STDOUT (ie "psql <
> mySchema.sql >&  myOutput").  The problem that arises is that the errors and
> notices all come out on STDERR. I am not sure this is the right choice. Because
> of the lack of synchronization between STDOUT and STDERR, it becomes impossible
> to associate an SQL statement with either a CREATE or an ERROR message. The
> option, "-e", is supposed to echo the query, but it doesn't help.

I have experienced this problem as well.  It is a bit of a pain.  I would love to
hear how others are handling this.  I have one partial workaround.

   % psql -d test -f createdb.sql 2>&1 | less

For whatever reason, the above seems to keep the msgs fairly synchronized (at least
on Redhat 6.0), making it useful for visual inspection of short loads.
Unfortunately, that approach far exceeds my patience for my situation.  I'm
frequently recreating 150 tables and redoing ~1400 INSERTs via psql with input
scripts.  That takes about 4 minutes on a dual PII 450 and generates ~15K lines of
output (~500 PAGER pages @30 lines/page).  Instead, I pipe STDERR/STDOUT to a file,
and then grep the file for 'INSERT 0 0', 'ERROR', and other problem signs.  I've
gotten pretty good at matching up the error msgs with the problem by interspersing
judiciously comments and queries, but it's still a pain.

It'd be nice to be able to get all psql msgs sync'ed on either STDERR or STDOUT.

Cheers.
Ed





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

Предыдущее
От: Daniel Stolk
Дата:
Сообщение: Re: [GENERAL] Size of database
Следующее
От: Kevin Heflin
Дата:
Сообщение: get the previous assigned sequence value