(1) the table already exist and the immediately doesn't exist?
(2) report ERROR on UPDATE when there are no UPDATES in the input file
Most likely the first attempt was schema qualified and so found the existing targets table while the second attempt was not schema qualified and targets is not in the search path.
One guess I have is that triggers are involved here and those triggers need to be more resiliant in face of the recent search_path security update.
David J.