Index: copy.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/copy.c,v
retrieving revision 1.218
diff -u -r1.218 copy.c
--- copy.c	10 Feb 2004 01:55:24 -0000	1.218
+++ copy.c	16 Mar 2004 04:25:46 -0000
@@ -104,8 +104,7 @@
 static const char *copy_relname;	/* table name for error messages */
 static int	copy_lineno;		/* line number for error messages */
 static const char *copy_attname;	/* current att for error messages */
-
-
+int co_rows_inserted;
 /*
  * These static variables are used to avoid incurring overhead for each
  * attribute processed.  attribute_buf is reused on each CopyReadAttribute
@@ -1271,7 +1270,8 @@
 	attr = tupDesc->attrs;
 	num_phys_attrs = tupDesc->natts;
 	attr_count = length(attnumlist);
-	num_defaults = 0;
+	num_defaults = 0; 
+
 
 	/*
 	 * We need a ResultRelInfo so we can use the regular executor's
@@ -1734,6 +1734,7 @@
 	ExecCloseIndices(resultRelInfo);
 
 	FreeExecutorState(estate);
+/*looks like we return success here*/
 }
 
 
@@ -1779,12 +1780,27 @@
 	 * of a frontend multibyte character couldn't look like ASCII characters.
 	 */
 	for (;;)
-	{
+	{               
+
 		c = CopyGetChar();
 		if (c == EOF)
 		{
 			result = true;
-			break;
+                     co_rows_inserted = copy_lineno;
+/*Now report number of rows imported to user*/
+                              
+                    if (co_rows_inserted == 0)
+                       {
+                           ereport(WARNING,(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
+                                            errmsg ("File used to import data is empty."),
+                                            errhint("Double check file name used")));
+                       }else if (co_rows_inserted < 0)
+                                {
+                                    ereport(ERROR,
+                                           (errcode(ERRCODE_BAD_COPY_FILE_FORMAT),                                                                                       errmsg("Rows copied were less than zero.  Copy function has been broken"),
+                                            errhint("File a bug please")));
+                                }
+                              break;
 		}
 		if (c == '\r')
 		{
