* Martijn van Oosterhout ([EMAIL PROTECTED]) wrote: > On Wed, Apr 16, 2008 at 05:22:17PM -0400, Tom Lane wrote: > > Even if we had some way of letting the application notice that the copy > > had already failed, I don't see that psql could do very much with it, > > at least not for COPY FROM STDIN. It's got to read through the source > > data anyway or it'll be out of sync with the script file. > > psql could ignore the result of PQputData if it wanted, no big deal > there.
erm, maybe I'm missing something here, but psql could certainly stop reading the file it was given on a \copy line when an error on the backend happens. I agree that a user doing a copy-from-stdin wouldn't be able to have it stop, though it'd go alot faster if it's just psql throwing away data rather than it being sent across the network. Also, imv, we should consider adding a 'stdin' option to \copy to let psql know that it's ok to error-out if it starts to get errors from the backend. Admittedly, I do use "zcat | psql -c "copy ... from stdin" quite a bit, but I'd be extremely happy to change that, in pretty much any way necessary, to make it so that psql just exit's when the backend starts reporting errors. Actually, ideally psql would just say "oh, this is a -c command, not a script anyway, so I can error out if that command starts to fail for whatever reason". Thanks, Stephen
signature.asc
Description: Digital signature