@ -608,52 +608,6 @@ BeginCopyTo(ParseState *pstate,
}
}
}
}
/* Convert FORCE_NOT_NULL name list to per-column flags, check validity */
cstate - > opts . force_notnull_flags = ( bool * ) palloc0 ( num_phys_attrs * sizeof ( bool ) ) ;
if ( cstate - > opts . force_notnull )
{
List * attnums ;
ListCell * cur ;
attnums = CopyGetAttnums ( tupDesc , cstate - > rel , cstate - > opts . force_notnull ) ;
foreach ( cur , attnums )
{
int attnum = lfirst_int ( cur ) ;
Form_pg_attribute attr = TupleDescAttr ( tupDesc , attnum - 1 ) ;
if ( ! list_member_int ( cstate - > attnumlist , attnum ) )
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_COLUMN_REFERENCE ) ,
errmsg ( " FORCE_NOT_NULL column \" %s \" not referenced by COPY " ,
NameStr ( attr - > attname ) ) ) ) ;
cstate - > opts . force_notnull_flags [ attnum - 1 ] = true ;
}
}
/* Convert FORCE_NULL name list to per-column flags, check validity */
cstate - > opts . force_null_flags = ( bool * ) palloc0 ( num_phys_attrs * sizeof ( bool ) ) ;
if ( cstate - > opts . force_null )
{
List * attnums ;
ListCell * cur ;
attnums = CopyGetAttnums ( tupDesc , cstate - > rel , cstate - > opts . force_null ) ;
foreach ( cur , attnums )
{
int attnum = lfirst_int ( cur ) ;
Form_pg_attribute attr = TupleDescAttr ( tupDesc , attnum - 1 ) ;
if ( ! list_member_int ( cstate - > attnumlist , attnum ) )
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_COLUMN_REFERENCE ) ,
errmsg ( " FORCE_NULL column \" %s \" not referenced by COPY " ,
NameStr ( attr - > attname ) ) ) ) ;
cstate - > opts . force_null_flags [ attnum - 1 ] = true ;
}
}
/* Use client encoding when ENCODING option is not specified. */
/* Use client encoding when ENCODING option is not specified. */
if ( cstate - > opts . file_encoding < 0 )
if ( cstate - > opts . file_encoding < 0 )
cstate - > file_encoding = pg_get_client_encoding ( ) ;
cstate - > file_encoding = pg_get_client_encoding ( ) ;