Postgres SQL 'Could Not Determine Data Type of Parameter' by Hibernate

YesQL/pgsql could not determine data type of parameter $1

So I just found the answer. The solution is to manually cast the parameter's type:

-- name: ip-addresses
SELECT ipo.ip_address_id::varchar as address, ipo.user_id
FROM ip_ownerships AS ipo
WHERE :uids::int IS NULL OR ipo.user_id IN (:uids)

Getting error could not determine data type of parameter $2 while putting $2 in CONCAT()

Turns out I can set the data type by doing the ::text after the paramterized value($1 in this case). Here's the solution code:

db.query(
`
UPDATE stories
SET story = CONCAT(story, $1::text)
WHERE id = $2;
`,
["testinggg", req.params.id]
)

Thanks for the help anyways!

PostgreSQL ERROR: could not determine data type of parameter Ruby exec_params

Simply:

WHERE labels ILIKE $1::text

I assume labels is a plain character type like text, too.

Spring Data query could not determine data type of UUID parameter

You can correct your query in the following way:

@Query("from Rental r where (cast(:userId as org.hibernate.type.UUIDCharType) IS NULL OR r.userId = :userId) AND (:status IS NULL OR r.status = :status)")
Page<Rental> findAllUsingFilterUserIdAndStatus(@Param("userId") UUID userId,
@Param("status") RentalStatus status,
Pageable pageable);


Related Topics



Leave a reply



Submit