@@ -139,7 +139,7 @@ typedef struct CopyStateData
139
139
140
140
/* these are just for error messages, see CopyFromErrorCallback */
141
141
const char * cur_relname ; /* table name for error messages */
142
- int cur_lineno ; /* line number for error messages */
142
+ uint64 cur_lineno ; /* line number for error messages */
143
143
const char * cur_attname ; /* current att for error messages */
144
144
const char * cur_attval ; /* current att value for error messages */
145
145
@@ -308,7 +308,7 @@ static void CopyFromInsertBatch(CopyState cstate, EState *estate,
308
308
ResultRelInfo * resultRelInfo , TupleTableSlot * myslot ,
309
309
BulkInsertState bistate ,
310
310
int nBufferedTuples , HeapTuple * bufferedTuples ,
311
- int firstBufferedLineNo );
311
+ uint64 firstBufferedLineNo );
312
312
static bool CopyReadLine (CopyState cstate );
313
313
static bool CopyReadLineText (CopyState cstate );
314
314
static int CopyReadAttributesText (CopyState cstate );
@@ -2192,17 +2192,21 @@ void
2192
2192
CopyFromErrorCallback (void * arg )
2193
2193
{
2194
2194
CopyState cstate = (CopyState ) arg ;
2195
+ char curlineno_str [32 ];
2196
+
2197
+ snprintf (curlineno_str , sizeof (curlineno_str ), UINT64_FORMAT ,
2198
+ cstate -> cur_lineno );
2195
2199
2196
2200
if (cstate -> binary )
2197
2201
{
2198
2202
/* can't usefully display the data */
2199
2203
if (cstate -> cur_attname )
2200
- errcontext ("COPY %s, line %d , column %s" ,
2201
- cstate -> cur_relname , cstate -> cur_lineno ,
2204
+ errcontext ("COPY %s, line %s , column %s" ,
2205
+ cstate -> cur_relname , curlineno_str ,
2202
2206
cstate -> cur_attname );
2203
2207
else
2204
- errcontext ("COPY %s, line %d " ,
2205
- cstate -> cur_relname , cstate -> cur_lineno );
2208
+ errcontext ("COPY %s, line %s " ,
2209
+ cstate -> cur_relname , curlineno_str );
2206
2210
}
2207
2211
else
2208
2212
{
@@ -2212,16 +2216,16 @@ CopyFromErrorCallback(void *arg)
2212
2216
char * attval ;
2213
2217
2214
2218
attval = limit_printout_length (cstate -> cur_attval );
2215
- errcontext ("COPY %s, line %d , column %s: \"%s\"" ,
2216
- cstate -> cur_relname , cstate -> cur_lineno ,
2219
+ errcontext ("COPY %s, line %s , column %s: \"%s\"" ,
2220
+ cstate -> cur_relname , curlineno_str ,
2217
2221
cstate -> cur_attname , attval );
2218
2222
pfree (attval );
2219
2223
}
2220
2224
else if (cstate -> cur_attname )
2221
2225
{
2222
2226
/* error is relevant to a particular column, value is NULL */
2223
- errcontext ("COPY %s, line %d , column %s: null input" ,
2224
- cstate -> cur_relname , cstate -> cur_lineno ,
2227
+ errcontext ("COPY %s, line %s , column %s: null input" ,
2228
+ cstate -> cur_relname , curlineno_str ,
2225
2229
cstate -> cur_attname );
2226
2230
}
2227
2231
else
@@ -2242,14 +2246,14 @@ CopyFromErrorCallback(void *arg)
2242
2246
char * lineval ;
2243
2247
2244
2248
lineval = limit_printout_length (cstate -> line_buf .data );
2245
- errcontext ("COPY %s, line %d : \"%s\"" ,
2246
- cstate -> cur_relname , cstate -> cur_lineno , lineval );
2249
+ errcontext ("COPY %s, line %s : \"%s\"" ,
2250
+ cstate -> cur_relname , curlineno_str , lineval );
2247
2251
pfree (lineval );
2248
2252
}
2249
2253
else
2250
2254
{
2251
- errcontext ("COPY %s, line %d " ,
2252
- cstate -> cur_relname , cstate -> cur_lineno );
2255
+ errcontext ("COPY %s, line %s " ,
2256
+ cstate -> cur_relname , curlineno_str );
2253
2257
}
2254
2258
}
2255
2259
}
@@ -2320,7 +2324,7 @@ CopyFrom(CopyState cstate)
2320
2324
#define MAX_BUFFERED_TUPLES 1000
2321
2325
HeapTuple * bufferedTuples = NULL ; /* initialize to silence warning */
2322
2326
Size bufferedTuplesSize = 0 ;
2323
- int firstBufferedLineNo = 0 ;
2327
+ uint64 firstBufferedLineNo = 0 ;
2324
2328
2325
2329
Assert (cstate -> rel );
2326
2330
@@ -2903,11 +2907,11 @@ CopyFromInsertBatch(CopyState cstate, EState *estate, CommandId mycid,
2903
2907
int hi_options , ResultRelInfo * resultRelInfo ,
2904
2908
TupleTableSlot * myslot , BulkInsertState bistate ,
2905
2909
int nBufferedTuples , HeapTuple * bufferedTuples ,
2906
- int firstBufferedLineNo )
2910
+ uint64 firstBufferedLineNo )
2907
2911
{
2908
2912
MemoryContext oldcontext ;
2909
2913
int i ;
2910
- int save_cur_lineno ;
2914
+ uint64 save_cur_lineno ;
2911
2915
2912
2916
/*
2913
2917
* Print error context information correctly, if one of the operations
0 commit comments