@@ -1683,7 +1683,8 @@ CopyReadAttributesText(CopyFromState cstate)
1683
1683
strncmp (start_ptr ,cstate -> opts .null_print ,input_len )== 0 )
1684
1684
cstate -> raw_fields [fieldno ]= NULL ;
1685
1685
/* Check whether raw input matched default marker */
1686
- else if (cstate -> opts .default_print &&
1686
+ else if (fieldno < list_length (cstate -> attnumlist )&&
1687
+ cstate -> opts .default_print &&
1687
1688
input_len == cstate -> opts .default_print_len &&
1688
1689
strncmp (start_ptr ,cstate -> opts .default_print ,input_len )== 0 )
1689
1690
{
@@ -1897,7 +1898,8 @@ CopyReadAttributesCSV(CopyFromState cstate)
1897
1898
strncmp (start_ptr ,cstate -> opts .null_print ,input_len )== 0 )
1898
1899
cstate -> raw_fields [fieldno ]= NULL ;
1899
1900
/* Check whether raw input matched default marker */
1900
- else if (cstate -> opts .default_print &&
1901
+ else if (fieldno < list_length (cstate -> attnumlist )&&
1902
+ cstate -> opts .default_print &&
1901
1903
input_len == cstate -> opts .default_print_len &&
1902
1904
strncmp (start_ptr ,cstate -> opts .default_print ,input_len )== 0 )
1903
1905
{