6
6
*
7
7
*
8
8
* IDENTIFICATION
9
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.46 1998/06/15 19:28:13 momjian Exp $
9
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.47 1998/06/19 11:40:46 scrappy Exp $
10
10
*
11
11
*-------------------------------------------------------------------------
12
12
*/
@@ -61,7 +61,7 @@ static char *CopyReadAttribute(FILE *fp, bool *isnull, char *delim, int *newline
61
61
static char * CopyReadAttribute (FILE * fp , bool * isnull , char * delim );
62
62
63
63
#endif
64
- static void CopyAttributeOut (FILE * fp , char * string , char * delim );
64
+ static void CopyAttributeOut (FILE * fp , char * string , char * delim , int is_array );
65
65
static int CountTuples (Relation relation );
66
66
67
67
extern FILE * Pfout ,
@@ -277,7 +277,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
277
277
{
278
278
string = (char * ) (* fmgr_faddr (& out_functions [i ]))
279
279
(value , elements [i ], typmod [i ]);
280
- CopyAttributeOut (fp , string , delim );
280
+ CopyAttributeOut (fp , string , delim , attr [ i ] -> attnelems );
281
281
pfree (string );
282
282
}
283
283
else
@@ -554,7 +554,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
554
554
{
555
555
loaded_oid = oidin (string );
556
556
if (loaded_oid < BootstrapObjectIdData )
557
- elog (ERROR , "COPY TEXT: Invalid Oid" );
557
+ elog (ERROR , "COPY TEXT: Invalid Oid. line: %d" , lineno );
558
558
}
559
559
}
560
560
for (i = 0 ; i < attr_count && !done ; i ++ )
@@ -603,7 +603,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
603
603
{
604
604
fread (& loaded_oid , sizeof (int32 ), 1 , fp );
605
605
if (loaded_oid < BootstrapObjectIdData )
606
- elog (ERROR , "COPY BINARY: Invalid Oid" );
606
+ elog (ERROR , "COPY BINARY: Invalid Oid line: %d" , lineno );
607
607
}
608
608
fread (& null_ct , sizeof (int32 ), 1 , fp );
609
609
if (null_ct > 0 )
@@ -642,7 +642,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
642
642
ptr += sizeof (int32 );
643
643
break ;
644
644
default :
645
- elog (ERROR , "COPY BINARY: impossible size!" );
645
+ elog (ERROR , "COPY BINARY: impossible size! line: %d" , lineno );
646
646
break ;
647
647
}
648
648
}
@@ -1099,7 +1099,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
1099
1099
case '.' :
1100
1100
c = getc (fp );
1101
1101
if (c != '\n' )
1102
- elog (ERROR , "CopyReadAttribute - end of record marker corrupted" );
1102
+ elog (ERROR , "CopyReadAttribute - end of record marker corrupted. line: %d" , lineno );
1103
1103
return (NULL );
1104
1104
break ;
1105
1105
}
@@ -1115,22 +1115,16 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
1115
1115
if (!done )
1116
1116
attribute [i ++ ] = c ;
1117
1117
if (i == EXT_ATTLEN - 1 )
1118
- elog (ERROR , "CopyReadAttribute - attribute length too long" );
1118
+ elog (ERROR , "CopyReadAttribute - attribute length too long. line: %d" , lineno );
1119
1119
}
1120
1120
attribute [i ] = '\0' ;
1121
1121
return (& attribute [0 ]);
1122
1122
}
1123
1123
1124
1124
static void
1125
- CopyAttributeOut (FILE * fp , char * string , char * delim )
1125
+ CopyAttributeOut (FILE * fp , char * string , char * delim , int is_array )
1126
1126
{
1127
1127
char c ;
1128
- int is_array = false;
1129
- int len = strlen (string );
1130
-
1131
- /* XXX - This is a kludge, we should check the data type */
1132
- if (len && (string [0 ] == '{' ) && (string [len - 1 ] == '}' ))
1133
- is_array = true;
1134
1128
1135
1129
for (; (c = * string ) != '\0' ; string ++ )
1136
1130
{
0 commit comments