Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 77543B5DBDF for ; Wed, 29 Jun 2011 10:38:26 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 83050-05 for ; Wed, 29 Jun 2011 13:38:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 91F64B5D803 for ; Wed, 29 Jun 2011 10:38:25 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p5TDcPZj012368 for ; Wed, 29 Jun 2011 13:38:25 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p5TDcPTZ012367; Wed, 29 Jun 2011 13:38:25 GMT (envelope-from www) Date: Wed, 29 Jun 2011 13:38:25 GMT Message-Id: <201106291338.p5TDcPTZ012367@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6083: psql script line numbers incorrectly count \copy data From: "Steve Haslam" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201106/219 X-Sequence-Number: 30598 The following bug has been logged online: Bug reference: 6083 Logged by: Steve Haslam Email address: araqnid@googlemail.com PostgreSQL version: 9.0.4 Operating system: Debian GNU/Linux (amd64) Description: psql script line numbers incorrectly count \copy data Details: test_linenumbers.dat: 1 1 2 3 5 8 test_linenumbers.sql: DO $$ BEGIN RAISE INFO 'Before copy'; END; $$; -- line 1 CREATE TEMP TABLE test_linenumbers_data(value int); \copy test_linenumbers_data from test_linenumbers.dat DO $$ BEGIN RAISE INFO 'After copy'; END; $$; -- line 4 Performing "psql -f test_linenumbers.sql" produces: psql:test_linenumbers.sql:1: INFO: Before copy DO CREATE TABLE psql:test_linenumbers.sql:11: INFO: After copy DO However, it seems to me that the second INFO should be reported against test_linenumbers.sql:4 rather than :11. Apparently, the data read from \copy is incrementing the script line number counter? Also occurs with 9.1b2 and a recent 9.2devel.