@@ -136,7 +136,7 @@ typedef struct CopyStateData
136
136
137
137
/* these are just for error messages, see CopyFromErrorCallback */
138
138
const char * cur_relname ; /* table name for error messages */
139
- int cur_lineno ; /* line number for error messages */
139
+ uint64 cur_lineno ; /* line number for error messages */
140
140
const char * cur_attname ; /* current att for error messages */
141
141
const char * cur_attval ; /* current att value for error messages */
142
142
@@ -309,7 +309,7 @@ static void CopyFromInsertBatch(CopyState cstate, EState *estate,
309
309
ResultRelInfo * resultRelInfo , TupleTableSlot * myslot ,
310
310
BulkInsertState bistate ,
311
311
int nBufferedTuples , HeapTuple * bufferedTuples ,
312
- int firstBufferedLineNo );
312
+ uint64 firstBufferedLineNo );
313
313
static bool CopyReadLine (CopyState cstate );
314
314
static bool CopyReadLineText (CopyState cstate );
315
315
static int CopyReadAttributesText (CopyState cstate );
@@ -2174,17 +2174,21 @@ void
2174
2174
CopyFromErrorCallback (void * arg )
2175
2175
{
2176
2176
CopyState cstate = (CopyState ) arg ;
2177
+ char curlineno_str [32 ];
2178
+
2179
+ snprintf (curlineno_str , sizeof (curlineno_str ), UINT64_FORMAT ,
2180
+ cstate -> cur_lineno );
2177
2181
2178
2182
if (cstate -> binary )
2179
2183
{
2180
2184
/* can't usefully display the data */
2181
2185
if (cstate -> cur_attname )
2182
- errcontext ("COPY %s, line %d , column %s" ,
2183
- cstate -> cur_relname , cstate -> cur_lineno ,
2186
+ errcontext ("COPY %s, line %s , column %s" ,
2187
+ cstate -> cur_relname , curlineno_str ,
2184
2188
cstate -> cur_attname );
2185
2189
else
2186
- errcontext ("COPY %s, line %d " ,
2187
- cstate -> cur_relname , cstate -> cur_lineno );
2190
+ errcontext ("COPY %s, line %s " ,
2191
+ cstate -> cur_relname , curlineno_str );
2188
2192
}
2189
2193
else
2190
2194
{
@@ -2194,16 +2198,16 @@ CopyFromErrorCallback(void *arg)
2194
2198
char * attval ;
2195
2199
2196
2200
attval = limit_printout_length (cstate -> cur_attval );
2197
- errcontext ("COPY %s, line %d , column %s: \"%s\"" ,
2198
- cstate -> cur_relname , cstate -> cur_lineno ,
2201
+ errcontext ("COPY %s, line %s , column %s: \"%s\"" ,
2202
+ cstate -> cur_relname , curlineno_str ,
2199
2203
cstate -> cur_attname , attval );
2200
2204
pfree (attval );
2201
2205
}
2202
2206
else if (cstate -> cur_attname )
2203
2207
{
2204
2208
/* error is relevant to a particular column, value is NULL */
2205
- errcontext ("COPY %s, line %d , column %s: null input" ,
2206
- cstate -> cur_relname , cstate -> cur_lineno ,
2209
+ errcontext ("COPY %s, line %s , column %s: null input" ,
2210
+ cstate -> cur_relname , curlineno_str ,
2207
2211
cstate -> cur_attname );
2208
2212
}
2209
2213
else
@@ -2224,14 +2228,14 @@ CopyFromErrorCallback(void *arg)
2224
2228
char * lineval ;
2225
2229
2226
2230
lineval = limit_printout_length (cstate -> line_buf .data );
2227
- errcontext ("COPY %s, line %d : \"%s\"" ,
2228
- cstate -> cur_relname , cstate -> cur_lineno , lineval );
2231
+ errcontext ("COPY %s, line %s : \"%s\"" ,
2232
+ cstate -> cur_relname , curlineno_str , lineval );
2229
2233
pfree (lineval );
2230
2234
}
2231
2235
else
2232
2236
{
2233
- errcontext ("COPY %s, line %d " ,
2234
- cstate -> cur_relname , cstate -> cur_lineno );
2237
+ errcontext ("COPY %s, line %s " ,
2238
+ cstate -> cur_relname , curlineno_str );
2235
2239
}
2236
2240
}
2237
2241
}
@@ -2301,7 +2305,7 @@ CopyFrom(CopyState cstate)
2301
2305
#define MAX_BUFFERED_TUPLES 1000
2302
2306
HeapTuple * bufferedTuples = NULL ; /* initialize to silence warning */
2303
2307
Size bufferedTuplesSize = 0 ;
2304
- int firstBufferedLineNo = 0 ;
2308
+ uint64 firstBufferedLineNo = 0 ;
2305
2309
2306
2310
Assert (cstate -> rel );
2307
2311
@@ -2902,11 +2906,11 @@ CopyFromInsertBatch(CopyState cstate, EState *estate, CommandId mycid,
2902
2906
int hi_options , ResultRelInfo * resultRelInfo ,
2903
2907
TupleTableSlot * myslot , BulkInsertState bistate ,
2904
2908
int nBufferedTuples , HeapTuple * bufferedTuples ,
2905
- int firstBufferedLineNo )
2909
+ uint64 firstBufferedLineNo )
2906
2910
{
2907
2911
MemoryContext oldcontext ;
2908
2912
int i ;
2909
- int save_cur_lineno ;
2913
+ uint64 save_cur_lineno ;
2910
2914
2911
2915
/*
2912
2916
* Print error context information correctly, if one of the operations
0 commit comments