@@ -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
@@ -297,7 +297,7 @@ static void CopyFromInsertBatch(CopyState cstate, EState *estate,
297
297
ResultRelInfo * resultRelInfo , TupleTableSlot * myslot ,
298
298
BulkInsertState bistate ,
299
299
int nBufferedTuples , HeapTuple * bufferedTuples ,
300
- int firstBufferedLineNo );
300
+ uint64 firstBufferedLineNo );
301
301
static bool CopyReadLine (CopyState cstate );
302
302
static bool CopyReadLineText (CopyState cstate );
303
303
static int CopyReadAttributesText (CopyState cstate );
@@ -1960,17 +1960,21 @@ void
1960
1960
CopyFromErrorCallback (void * arg )
1961
1961
{
1962
1962
CopyState cstate = (CopyState ) arg ;
1963
+ char curlineno_str [32 ];
1964
+
1965
+ snprintf (curlineno_str , sizeof (curlineno_str ), UINT64_FORMAT ,
1966
+ cstate -> cur_lineno );
1963
1967
1964
1968
if (cstate -> binary )
1965
1969
{
1966
1970
/* can't usefully display the data */
1967
1971
if (cstate -> cur_attname )
1968
- errcontext ("COPY %s, line %d , column %s" ,
1969
- cstate -> cur_relname , cstate -> cur_lineno ,
1972
+ errcontext ("COPY %s, line %s , column %s" ,
1973
+ cstate -> cur_relname , curlineno_str ,
1970
1974
cstate -> cur_attname );
1971
1975
else
1972
- errcontext ("COPY %s, line %d " ,
1973
- cstate -> cur_relname , cstate -> cur_lineno );
1976
+ errcontext ("COPY %s, line %s " ,
1977
+ cstate -> cur_relname , curlineno_str );
1974
1978
}
1975
1979
else
1976
1980
{
@@ -1980,16 +1984,16 @@ CopyFromErrorCallback(void *arg)
1980
1984
char * attval ;
1981
1985
1982
1986
attval = limit_printout_length (cstate -> cur_attval );
1983
- errcontext ("COPY %s, line %d , column %s: \"%s\"" ,
1984
- cstate -> cur_relname , cstate -> cur_lineno ,
1987
+ errcontext ("COPY %s, line %s , column %s: \"%s\"" ,
1988
+ cstate -> cur_relname , curlineno_str ,
1985
1989
cstate -> cur_attname , attval );
1986
1990
pfree (attval );
1987
1991
}
1988
1992
else if (cstate -> cur_attname )
1989
1993
{
1990
1994
/* error is relevant to a particular column, value is NULL */
1991
- errcontext ("COPY %s, line %d , column %s: null input" ,
1992
- cstate -> cur_relname , cstate -> cur_lineno ,
1995
+ errcontext ("COPY %s, line %s , column %s: null input" ,
1996
+ cstate -> cur_relname , curlineno_str ,
1993
1997
cstate -> cur_attname );
1994
1998
}
1995
1999
else
@@ -2010,14 +2014,14 @@ CopyFromErrorCallback(void *arg)
2010
2014
char * lineval ;
2011
2015
2012
2016
lineval = limit_printout_length (cstate -> line_buf .data );
2013
- errcontext ("COPY %s, line %d : \"%s\"" ,
2014
- cstate -> cur_relname , cstate -> cur_lineno , lineval );
2017
+ errcontext ("COPY %s, line %s : \"%s\"" ,
2018
+ cstate -> cur_relname , curlineno_str , lineval );
2015
2019
pfree (lineval );
2016
2020
}
2017
2021
else
2018
2022
{
2019
- errcontext ("COPY %s, line %d " ,
2020
- cstate -> cur_relname , cstate -> cur_lineno );
2023
+ errcontext ("COPY %s, line %s " ,
2024
+ cstate -> cur_relname , curlineno_str );
2021
2025
}
2022
2026
}
2023
2027
}
@@ -2085,7 +2089,7 @@ CopyFrom(CopyState cstate)
2085
2089
#define MAX_BUFFERED_TUPLES 1000
2086
2090
HeapTuple * bufferedTuples = NULL ; /* initialize to silence warning */
2087
2091
Size bufferedTuplesSize = 0 ;
2088
- int firstBufferedLineNo = 0 ;
2092
+ uint64 firstBufferedLineNo = 0 ;
2089
2093
2090
2094
Assert (cstate -> rel );
2091
2095
@@ -2440,11 +2444,11 @@ CopyFromInsertBatch(CopyState cstate, EState *estate, CommandId mycid,
2440
2444
int hi_options , ResultRelInfo * resultRelInfo ,
2441
2445
TupleTableSlot * myslot , BulkInsertState bistate ,
2442
2446
int nBufferedTuples , HeapTuple * bufferedTuples ,
2443
- int firstBufferedLineNo )
2447
+ uint64 firstBufferedLineNo )
2444
2448
{
2445
2449
MemoryContext oldcontext ;
2446
2450
int i ;
2447
- int save_cur_lineno ;
2451
+ uint64 save_cur_lineno ;
2448
2452
2449
2453
/*
2450
2454
* Print error context information correctly, if one of the operations
0 commit comments