Hi Chao, I tested v2 on current master (51ae21aa313). The code change looks fine to me.
One more argument for it, on master the file is opened, or the program is run, before the relkind check fires. For example: create sequence s; copy s from program 'touch /tmp/marker'; ERROR: cannot copy to sequence "s" On master /tmp/marker gets created; with v2 it doesn't. And copy s from '/nonexistent/file' fails with "could not open file" on master, but "cannot copy to sequence" with v2. Might be worth a line in the commit message. The copy2.sql change needs to be dropped, though. Since Tom's 3045a25ba81, which went in after v2, psql skips the in-line data when COPY FROM STDIN fails early. With test1 and . removed, psql now eats everything up to the next ., i.e. the CREATE FUNCTION, CREATE TRIGGER and the next COPY, and copy2 fails. If you keep those two lines, the expected output doesn't change. Apart from that I checked sequences, views and matviews (error before reading any input), plain/partitioned tables the WHERE clause error (still reported first). +1 with the test being removed. Regards, Surya Poondla
