aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 12895a1c7f6..4f87fe45f73 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.174 2006/10/06 17:14:00 petere Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.175 2006/12/16 00:38:43 adunstan Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@@ -303,10 +303,26 @@ exec_command(const char *cmd,
/* \copy */
else if (pg_strcasecmp(cmd, "copy") == 0)
{
+ /* Default fetch-it-all-and-print mode */
+ TimevalStruct before,
+ after;
+ double elapsed_msec = 0;
+
char *opt = psql_scan_slash_option(scan_state,
OT_WHOLE_LINE, NULL, false);
-
+ if (pset.timing)
+ GETTIMEOFDAY(&before);
+
success = do_copy(opt);
+
+ if (pset.timing && success)
+ {
+ GETTIMEOFDAY(&after);
+ elapsed_msec = DIFF_MSEC(&after, &before);
+ printf(_("Time: %.3f ms\n"), elapsed_msec);
+
+ }
+
free(opt);
}