Fix counting of lines in scripts with 'copy from stdin'.
authorPeter Eisentraut <peter_e@gmx.net>
Sun, 3 Dec 2000 15:39:38 +0000 (15:39 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Sun, 3 Dec 2000 15:39:38 +0000 (15:39 +0000)
src/bin/psql/copy.c

index 2e27ecb1ed36f6073995189634cd8020c56709de..14082417b6732ae11e3039a6fa8ef8627130cc50 100644 (file)
@@ -403,6 +403,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, const char *prompt)
        int                     bufleft;
        int                     c = 0;
        int                     ret;
+       unsigned int linecount=0;
 
 #ifdef USE_ASSERT_CHECKING
        assert(copy_in_state);
@@ -458,8 +459,10 @@ handleCopyIn(PGconn *conn, FILE *copystream, const char *prompt)
                        }
                }
                PQputline(conn, "\n");
+               linecount++;
        }
        ret = !PQendcopy(conn);
        copy_in_state = false;
+       pset.lineno += linecount;
        return ret;
 }