Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
ibnmajah:618Abū Bakr b. Abū Shaybah > Abū Usāmah > Idrīs al-Awdī from his father > Abū Hurayrah

"The Messenger of Allah said, 'No one of you should stand to pray when he feels some discomfort (because of needing to urinate or defecate).'"  

ابن ماجة:٦١٨حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ حَدَّثَنَا أَبُو أُسَامَةَ عَنْ إِدْرِيسَ الأَوْدِيِّ عَنْ أَبِيهِ عَنْ أَبِي هُرَيْرَةَ قَالَ

قَالَ رَسُولُ اللَّهِ ﷺ لاَ يَقُومُ أَحَدُكُمْ إِلَى الصَّلاَةِ وَبِهِ أَذًى  


See similar narrations below:

Collected by Aḥmad, Suyūṭī
ahmad:9697Muḥammad b. ʿUbayd > Dāwud from his father > Abū Hurayrah

"The Messenger of Allah said, 'No one of you should stand to pray when he feels some discomfort (because of needing to urinate or defecate).'" (Using translation from Ibn Mājah 618)   

أحمد:٩٦٩٧حَدَّثَنَا مُحَمَّدُ بْنُ عُبَيْدٍ قَالَ حَدَّثَنَا دَاوُدُ عَنْ أَبِيهِ عَنْ أَبِي هُرَيْرَةَ قَالَ

قَالَ رَسُولُ اللهِ ﷺ لَا يَقُومَنَّ أَحَدُكُمْإِلَى الصَّلَاةِ وَبِهِ أَذًى يَعْنِي الْبَوْلَ وَالْغَائِطَ  

ahmad:10094Wakīʿ > Dāwud al-Awdī from his father > Abū Hurayrah

"The Messenger of Allah said, 'No one of you should stand to pray when he feels some discomfort (because of needing to urinate or defecate).'" (Using translation from Ibn Mājah 618)   

أحمد:١٠٠٩٤حَدَّثَنَا وَكِيعٌ حَدَّثَنَا دَاوُدُ الْأَوْدِيُّ عَنِ أَبِيهِ عَنِ أَبِي هُرَيْرَةَ قَالَ

قَالَ رَسُولُ اللهِ ﷺ لَا يَقُومَنَّ أَحَدُكُمْ إِلَى الصَّلَاةِ وَبِهِ أَذًى مِنْ غَائِطٍ أَوْ بَوْلٍ