From 247ec030e5f27702657c2148b3836978aa5c0fd6 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:21:20 +0200 Subject: [PATCH] fix: use COALESCE in audit JPQL to prevent lower(bytea) error Hibernate passes null search param as bytea type, causing PostgreSQL to fail on LOWER(bytea). COALESCE converts null to empty string. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../java/net/siegeln/cameleer/saas/audit/AuditRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/siegeln/cameleer/saas/audit/AuditRepository.java b/src/main/java/net/siegeln/cameleer/saas/audit/AuditRepository.java index b60c6b6..408cb89 100644 --- a/src/main/java/net/siegeln/cameleer/saas/audit/AuditRepository.java +++ b/src/main/java/net/siegeln/cameleer/saas/audit/AuditRepository.java @@ -26,8 +26,8 @@ public interface AuditRepository extends JpaRepository { AND (:from IS NULL OR a.createdAt >= :from) AND (:to IS NULL OR a.createdAt <= :to) AND (:search IS NULL - OR LOWER(a.actorEmail) LIKE LOWER(CONCAT('%', :search, '%')) - OR LOWER(a.resource) LIKE LOWER(CONCAT('%', :search, '%'))) + OR LOWER(a.actorEmail) LIKE LOWER(CONCAT('%', COALESCE(:search, ''), '%')) + OR LOWER(a.resource) LIKE LOWER(CONCAT('%', COALESCE(:search, ''), '%'))) ORDER BY a.createdAt DESC """) Page findFiltered(