Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVYnn-0000km-T8 for pgsql-general@arkaria.postgresql.org; Tue, 06 Sep 2022 13:39:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oVYnm-00012A-Oq for pgsql-general@arkaria.postgresql.org; Tue, 06 Sep 2022 13:39:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVYnm-000121-ER for pgsql-general@lists.postgresql.org; Tue, 06 Sep 2022 13:39:42 +0000 Received: from smtp69.ord1c.emailsrvr.com ([108.166.43.69]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVYni-00080m-5x for pgsql-general@lists.postgresql.org; Tue, 06 Sep 2022 13:39:41 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp17.relay.ord1c.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 48B0D600D8; Tue, 6 Sep 2022 09:39:36 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Postgres SQL unable to handle Null values for Text datatype From: Christophe Pettus In-Reply-To: Date: Tue, 6 Sep 2022 06:38:35 -0700 Cc: pgsql-general@lists.postgresql.org X-Mailbutler-Message-Id: 67E82771-E648-44FB-B9B1-F479C33F0C92 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Karthik K L V X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Classification-ID: 8c77f9de-6c6e-4765-94cb-4c5ea9360939-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Sep 5, 2022, at 23:10, Karthik K L V = wrote: > The above query fails with the below exception when the value of ?1 = resolves to null. > org.postgresql.util.PSQLException: ERROR: operator does not exist: = character varying =3D bytea > Hint: No operator matches the given name and argument types. You = might need to add explicit type casts. > Position: 64 This is a Hibernate issue. If you use setParameter with a NULL without = specifying the type, it assumes bytea (with the PostgreSQL JDBC driver, = at least). You'll need to use the three-parameter form of = setParameter() that specifies a type, if the value is going to be NULL. = You can also use the setXXXX methods on SQLQuery, since the type is = specified by the particular method there. That being said, PostgreSQL's handling of NULL string values is = different from Oracle's, and this is an area that code changes are often = required.=