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 ************