Skip to content

Commit c68040d

Browse files
committed
Fix psql's counting of script file line numbers during COPY.
handleCopyIn incremented pset.lineno for each line of COPY data read from a file. This is correct when reading from the current script file (i.e., we are doing COPY FROM STDIN followed by in-line data), but it's wrong if the data is coming from some other file. Per bug #6083 from Steve Haslam. Back-patch to all supported versions.
1 parent 0b7af46 commit c68040d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/psql/copy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,8 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary)
801801
}
802802
}
803803

804-
pset.lineno++;
804+
if (copystream == pset.cur_cmd_source)
805+
pset.lineno++;
805806
}
806807
}
807808

0 commit comments

Comments
 (0)