From 152dc0bae4cd95aa999adb292e3bfad71ee68c3a Mon Sep 17 00:00:00 2001 From: "hehihoho3@gmail.com" Date: Sun, 31 May 2026 09:56:28 +0900 Subject: [PATCH] fix(discover): cast nullable params so Postgres can infer type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The discover @Query used the `(:param is null or col >= :param)` idiom. For the timestamp (publishedAfter) and numeric (minRatio) params, Postgres threw "could not determine data type of parameter $1" because the bare `$1 is null` placeholder is untyped — returning HTTP 500 and breaking the whole /discover page. (The search() query survives because its nullable params are only bigint/varchar, which Postgres can null-type.) Wrap the two problematic params in cast(... as timestamp/big_decimal) in the is-null check so the type is explicit. ORDER BY ... nulls last / fetch first were never the problem. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../hlab/yanalyst/domain/channel/ChannelVideoRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hlab/yanalyst/domain/channel/ChannelVideoRepository.java b/src/main/java/com/hlab/yanalyst/domain/channel/ChannelVideoRepository.java index b04ff1d..a7fea3b 100644 --- a/src/main/java/com/hlab/yanalyst/domain/channel/ChannelVideoRepository.java +++ b/src/main/java/com/hlab/yanalyst/domain/channel/ChannelVideoRepository.java @@ -55,8 +55,8 @@ public interface ChannelVideoRepository extends JpaRepository 'EXCLUDED' and " - + "(:publishedAfter is null or v.publishedAt >= :publishedAfter) and " - + "(:minRatio is null or v.viewsPerSubRatio >= :minRatio) and " + + "(cast(:publishedAfter as timestamp) is null or v.publishedAt >= :publishedAfter) and " + + "(cast(:minRatio as big_decimal) is null or v.viewsPerSubRatio >= :minRatio) and " + "(:source is null or v.source = :source) and " + "(:shortsOnly = false or v.isShorts = true) and " + "(:unprocessedOnly = false or v.interestStatus in ('NEW','REVIEWING'))")