Postgres bytea error when binding null to prepared statements
问题 I am working with a Java application which uses JPA and a Postgres database, and I am trying to create a flexible prepared statement which can handle a variable number of input parameters. An example query would best explain this: SELECT * FROM my_table WHERE (string_col = :param1 OR :param1 IS NULL) AND (double_col = :param2 OR :param2 IS NULL); The idea behind this "trick" is that if a user specifies only one parameter, say :param1 , we can just bind null to :param2 , and the WHERE clause