Heikki Linnakangas <hlinn...@iki.fi> writes: > On 08/24/2015 08:06 AM, Pavel Stehule wrote: >> it works perfectly - but the line >> xargs -P 3 -I % sh -c "psql % -q -c 'analyze pg_attribute'; echo %" >> is little bit ugly - with some psql option it can be cleaned to >> xargs -P3 -I % psql % -q --echo-db -c "analyze pg_attribute" | ... >> --echo-db requires -q option >> What are you thinking about this idea?
> Seems like a one-tricky-pony to me. You're just as likely to need to > print a relation name or something else, as the current database. Not only that, but: (1) there is no reason to believe that the db name and only the db name is needed to do another connection; what about port, host, user, etc? (2) this commandeers the pipe connection to transmit out-of-band data, making it impossible to use the pipe for its natural function, viz transmitting ordinary data from one processing step to the next. Sure, there are use-cases where there's no such data and you can repurpose the pipe like that, but that's an enormous limitation. > Overall, once your pipeline gets that complicated, I'd rather write a > little bash or perl script with for-loops and variables. Yeah, on the whole this seems like a band-aid to let a bad scripting approach limp a few steps further before it collapses completely. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers