Skip to content

Commit e7c8022

Browse files
committed
Fix counting of lines in scripts with 'copy from stdin'.
1 parent 6969b8f commit e7c8022

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bin/psql/copy.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.15 2000/04/16 15:46:40 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.16 2000/12/03 15:39:38 petere Exp $
77
*/
88
#include "postgres.h"
99
#include "copy.h"
@@ -403,6 +403,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, const char *prompt)
403403
int bufleft;
404404
int c = 0;
405405
int ret;
406+
unsigned int linecount=0;
406407

407408
#ifdef USE_ASSERT_CHECKING
408409
assert(copy_in_state);
@@ -458,8 +459,10 @@ handleCopyIn(PGconn *conn, FILE *copystream, const char *prompt)
458459
}
459460
}
460461
PQputline(conn, "\n");
462+
linecount++;
461463
}
462464
ret = !PQendcopy(conn);
463465
copy_in_state = false;
466+
pset.lineno += linecount;
464467
return ret;
465468
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy