@@ -133,7 +133,7 @@ typedef struct CopyStateData
133
133
134
134
/* these are just for error messages, see CopyFromErrorCallback */
135
135
const char * cur_relname ; /* table name for error messages */
136
- int cur_lineno ; /* line number for error messages */
136
+ uint64 cur_lineno ; /* line number for error messages */
137
137
const char * cur_attname ; /* current att for error messages */
138
138
const char * cur_attval ; /* current att value for error messages */
139
139
@@ -298,7 +298,7 @@ static void CopyFromInsertBatch(CopyState cstate, EState *estate,
298
298
ResultRelInfo * resultRelInfo , TupleTableSlot * myslot ,
299
299
BulkInsertState bistate ,
300
300
int nBufferedTuples , HeapTuple * bufferedTuples ,
301
- int firstBufferedLineNo );
301
+ uint64 firstBufferedLineNo );
302
302
static bool CopyReadLine (CopyState cstate );
303
303
static bool CopyReadLineText (CopyState cstate );
304
304
static int CopyReadAttributesText (CopyState cstate );
@@ -2146,17 +2146,21 @@ void
2146
2146
CopyFromErrorCallback (void * arg )
2147
2147
{
2148
2148
CopyState cstate = (CopyState ) arg ;
2149
+ char curlineno_str [32 ];
2150
+
2151
+ snprintf (curlineno_str , sizeof (curlineno_str ), UINT64_FORMAT ,
2152
+ cstate -> cur_lineno );
2149
2153
2150
2154
if (cstate -> binary )
2151
2155
{
2152
2156
/* can't usefully display the data */
2153
2157
if (cstate -> cur_attname )
2154
- errcontext ("COPY %s, line %d , column %s" ,
2155
- cstate -> cur_relname , cstate -> cur_lineno ,
2158
+ errcontext ("COPY %s, line %s , column %s" ,
2159
+ cstate -> cur_relname , curlineno_str ,
2156
2160
cstate -> cur_attname );
2157
2161
else
2158
- errcontext ("COPY %s, line %d " ,
2159
- cstate -> cur_relname , cstate -> cur_lineno );
2162
+ errcontext ("COPY %s, line %s " ,
2163
+ cstate -> cur_relname , curlineno_str );
2160
2164
}
2161
2165
else
2162
2166
{
@@ -2166,16 +2170,16 @@ CopyFromErrorCallback(void *arg)
2166
2170
char * attval ;
2167
2171
2168
2172
attval = limit_printout_length (cstate -> cur_attval );
2169
- errcontext ("COPY %s, line %d , column %s: \"%s\"" ,
2170
- cstate -> cur_relname , cstate -> cur_lineno ,
2173
+ errcontext ("COPY %s, line %s , column %s: \"%s\"" ,
2174
+ cstate -> cur_relname , curlineno_str ,
2171
2175
cstate -> cur_attname , attval );
2172
2176
pfree (attval );
2173
2177
}
2174
2178
else if (cstate -> cur_attname )
2175
2179
{
2176
2180
/* error is relevant to a particular column, value is NULL */
2177
- errcontext ("COPY %s, line %d , column %s: null input" ,
2178
- cstate -> cur_relname , cstate -> cur_lineno ,
2181
+ errcontext ("COPY %s, line %s , column %s: null input" ,
2182
+ cstate -> cur_relname , curlineno_str ,
2179
2183
cstate -> cur_attname );
2180
2184
}
2181
2185
else
@@ -2196,14 +2200,14 @@ CopyFromErrorCallback(void *arg)
2196
2200
char * lineval ;
2197
2201
2198
2202
lineval = limit_printout_length (cstate -> line_buf .data );
2199
- errcontext ("COPY %s, line %d : \"%s\"" ,
2200
- cstate -> cur_relname , cstate -> cur_lineno , lineval );
2203
+ errcontext ("COPY %s, line %s : \"%s\"" ,
2204
+ cstate -> cur_relname , curlineno_str , lineval );
2201
2205
pfree (lineval );
2202
2206
}
2203
2207
else
2204
2208
{
2205
- errcontext ("COPY %s, line %d " ,
2206
- cstate -> cur_relname , cstate -> cur_lineno );
2209
+ errcontext ("COPY %s, line %s " ,
2210
+ cstate -> cur_relname , curlineno_str );
2207
2211
}
2208
2212
}
2209
2213
}
@@ -2271,7 +2275,7 @@ CopyFrom(CopyState cstate)
2271
2275
#define MAX_BUFFERED_TUPLES 1000
2272
2276
HeapTuple * bufferedTuples = NULL ; /* initialize to silence warning */
2273
2277
Size bufferedTuplesSize = 0 ;
2274
- int firstBufferedLineNo = 0 ;
2278
+ uint64 firstBufferedLineNo = 0 ;
2275
2279
2276
2280
Assert (cstate -> rel );
2277
2281
@@ -2627,11 +2631,11 @@ CopyFromInsertBatch(CopyState cstate, EState *estate, CommandId mycid,
2627
2631
int hi_options , ResultRelInfo * resultRelInfo ,
2628
2632
TupleTableSlot * myslot , BulkInsertState bistate ,
2629
2633
int nBufferedTuples , HeapTuple * bufferedTuples ,
2630
- int firstBufferedLineNo )
2634
+ uint64 firstBufferedLineNo )
2631
2635
{
2632
2636
MemoryContext oldcontext ;
2633
2637
int i ;
2634
- int save_cur_lineno ;
2638
+ uint64 save_cur_lineno ;
2635
2639
2636
2640
/*
2637
2641
* Print error context information correctly, if one of the operations
0 commit comments