adding 'duplicate' keyword check and catch for ProgrammingError (pg8000...)