@ -132,7 +132,6 @@ static dlist_head lsn_mapping = DLIST_STATIC_INIT(lsn_mapping);
typedef struct SlotErrCallbackArg
typedef struct SlotErrCallbackArg
{
{
LogicalRepRelMapEntry * rel ;
LogicalRepRelMapEntry * rel ;
int local_attnum ;
int remote_attnum ;
int remote_attnum ;
} SlotErrCallbackArg ;
} SlotErrCallbackArg ;
@ -503,36 +502,23 @@ slot_fill_defaults(LogicalRepRelMapEntry *rel, EState *estate,
}
}
/*
/*
* Error callback to give more context info about type conversion failure .
* Error callback to give more context info about data conversion failures
* while reading data from the remote server .
*/
*/
static void
static void
slot_store_error_callback ( void * arg )
slot_store_error_callback ( void * arg )
{
{
SlotErrCallbackArg * errarg = ( SlotErrCallbackArg * ) arg ;
SlotErrCallbackArg * errarg = ( SlotErrCallbackArg * ) arg ;
LogicalRepRelMapEntry * rel ;
LogicalRepRelMapEntry * rel ;
char * remotetypname ;
Oid remotetypoid ,
localtypoid ;
/* Nothing to do if remote attribute number is not set */
/* Nothing to do if remote attribute number is not set */
if ( errarg - > remote_attnum < 0 )
if ( errarg - > remote_attnum < 0 )
return ;
return ;
rel = errarg - > rel ;
rel = errarg - > rel ;
remotetypoid = rel - > remoterel . atttyps [ errarg - > remote_attnum ] ;
errcontext ( " processing remote data for replication target relation \" %s.%s \" column \" %s \" " ,
/* Fetch remote type name from the LogicalRepTypMap cache */
remotetypname = logicalrep_typmap_gettypname ( remotetypoid ) ;
/* Fetch local type OID from the local sys cache */
localtypoid = get_atttype ( rel - > localreloid , errarg - > local_attnum + 1 ) ;
errcontext ( " processing remote data for replication target relation \" %s.%s \" column \" %s \" , "
" remote type %s, local type %s " ,
rel - > remoterel . nspname , rel - > remoterel . relname ,
rel - > remoterel . nspname , rel - > remoterel . relname ,
rel - > remoterel . attnames [ errarg - > remote_attnum ] ,
rel - > remoterel . attnames [ errarg - > remote_attnum ] ) ;
remotetypname ,
format_type_be ( localtypoid ) ) ;
}
}
/*
/*
@ -553,7 +539,6 @@ slot_store_data(TupleTableSlot *slot, LogicalRepRelMapEntry *rel,
/* Push callback + info on the error context stack */
/* Push callback + info on the error context stack */
errarg . rel = rel ;
errarg . rel = rel ;
errarg . local_attnum = - 1 ;
errarg . remote_attnum = - 1 ;
errarg . remote_attnum = - 1 ;
errcallback . callback = slot_store_error_callback ;
errcallback . callback = slot_store_error_callback ;
errcallback . arg = ( void * ) & errarg ;
errcallback . arg = ( void * ) & errarg ;
@ -573,7 +558,6 @@ slot_store_data(TupleTableSlot *slot, LogicalRepRelMapEntry *rel,
Assert ( remoteattnum < tupleData - > ncols ) ;
Assert ( remoteattnum < tupleData - > ncols ) ;
errarg . local_attnum = i ;
errarg . remote_attnum = remoteattnum ;
errarg . remote_attnum = remoteattnum ;
if ( tupleData - > colstatus [ remoteattnum ] = = LOGICALREP_COLUMN_TEXT )
if ( tupleData - > colstatus [ remoteattnum ] = = LOGICALREP_COLUMN_TEXT )
@ -622,7 +606,6 @@ slot_store_data(TupleTableSlot *slot, LogicalRepRelMapEntry *rel,
slot - > tts_isnull [ i ] = true ;
slot - > tts_isnull [ i ] = true ;
}
}
errarg . local_attnum = - 1 ;
errarg . remote_attnum = - 1 ;
errarg . remote_attnum = - 1 ;
}
}
else
else
@ -679,7 +662,6 @@ slot_modify_data(TupleTableSlot *slot, TupleTableSlot *srcslot,
/* For error reporting, push callback + info on the error context stack */
/* For error reporting, push callback + info on the error context stack */
errarg . rel = rel ;
errarg . rel = rel ;
errarg . local_attnum = - 1 ;
errarg . remote_attnum = - 1 ;
errarg . remote_attnum = - 1 ;
errcallback . callback = slot_store_error_callback ;
errcallback . callback = slot_store_error_callback ;
errcallback . arg = ( void * ) & errarg ;
errcallback . arg = ( void * ) & errarg ;
@ -702,7 +684,6 @@ slot_modify_data(TupleTableSlot *slot, TupleTableSlot *srcslot,
{
{
StringInfo colvalue = & tupleData - > colvalues [ remoteattnum ] ;
StringInfo colvalue = & tupleData - > colvalues [ remoteattnum ] ;
errarg . local_attnum = i ;
errarg . remote_attnum = remoteattnum ;
errarg . remote_attnum = remoteattnum ;
if ( tupleData - > colstatus [ remoteattnum ] = = LOGICALREP_COLUMN_TEXT )
if ( tupleData - > colstatus [ remoteattnum ] = = LOGICALREP_COLUMN_TEXT )
@ -747,7 +728,6 @@ slot_modify_data(TupleTableSlot *slot, TupleTableSlot *srcslot,
slot - > tts_isnull [ i ] = true ;
slot - > tts_isnull [ i ] = true ;
}
}
errarg . local_attnum = - 1 ;
errarg . remote_attnum = - 1 ;
errarg . remote_attnum = - 1 ;
}
}
}
}
@ -1217,8 +1197,7 @@ apply_handle_relation(StringInfo s)
/*
/*
* Handle TYPE message .
* Handle TYPE message .
*
*
* Note we don ' t do local mapping here , that ' s done when the type is
* This is now vestigial ; we read the info and discard it .
* actually used .
*/
*/
static void
static void
apply_handle_type ( StringInfo s )
apply_handle_type ( StringInfo s )
@ -1229,7 +1208,6 @@ apply_handle_type(StringInfo s)
return ;
return ;
logicalrep_read_typ ( s , & typ ) ;
logicalrep_read_typ ( s , & typ ) ;
logicalrep_typmap_update ( & typ ) ;
}
}
/*
/*