mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Native query exception while named parameter is null used in query #7508
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @saifulferoz on GitHub (May 26, 2025).
Bug Report
Summary
Current behavior
My native query is WITH due_base AS (select portfolio.student_id,
portfolio.full_name student_name,
portfolio.short_code as program,
sum(installment.net_payable - installment.net_receivable) as payable,
COALESCE(sum(adv_due.total_payable), 0) -COALESCE(sum(adv_due.total_receivable), 0) as total_payable
from fin_payment_requests payment_request
inner join fin_payment_installments installment
on payment_request.id = installment.request_id
and installment.payment_status = 'DUE'
inner join std_student_academic_portfolios portfolio
on payment_request.portfolio_id = portfolio.id
LEFT JOIN fin_prior_due_advance adv_due
ON adv_due.portfolio_id = portfolio.id
AND (adv_due.is_applied IS false
OR adv_due.is_removable IS true)
where payment_request.semester_session_id <= ?
and portfolio.current_session_semester_id = ?
and portfolio.academic_type in ('UNDERGRADUATE', 'POSTGRADUATE')
and payment_request.payment_status IN ('DUE', 'PARTIALLY_PAID')
and (? is null or portfolio.academic_type=?)
and (? is null or portfolio.short_code=?)
group by portfolio.student_id, portfolio.full_name, portfolio.short_code)
SELECT student_id,student_name, program,
payable + total_payable AS total_payable
FROM due_base
WHERE payable + total_payable > 0
Params: Array
(
[0] => 20251
[1] => 20251
[2] =>
[3] =>
[4] =>
[5] =>
)
and Types
Array
(
[0] => 2
[1] => 2
[2] => 0
[3] => 0
[4] => 0
[5] => 0
)
Getting exception An exception occurred while executing a query: SQLSTATE[42P18]: Indeterminate datatype: 7 ERROR: could not determine data type of parameter $3
Expected behavior
Application should execute the query and return result
How to reproduce
use named parameter and check named parameter is null or name parameter used in a column value check.