Thread: citext plugin is not working with java applications

citext plugin is not working with java applications

From
PG Doc comments form
Date:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/10/citext.html
Description:

The citext plugin does not work in combination with jdbc. Thus it does not
work with Java applications. It does work in pgadmin because that is python.
I am using the right schema, and setting the jdbc stringtype to unspecified
makes no difference. 
Because Java is the most used programming language, a big warning on the
postgresql citext documentation
(https://www.postgresql.org/docs/10/citext.html) is needed until this is
fixed.
Case insensitive text is standard on many databases, thus this may be a big
obstacle when you want to migrate.

Re: citext plugin is not working with java applications

From
Bruce Momjian
Date:
On Mon, Dec 10, 2018 at 10:21:26AM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/10/citext.html
> Description:
> 
> The citext plugin does not work in combination with jdbc. Thus it does not
> work with Java applications. It does work in pgadmin because that is python.
> I am using the right schema, and setting the jdbc stringtype to unspecified
> makes no difference. 
> Because Java is the most used programming language, a big warning on the
> postgresql citext documentation
> (https://www.postgresql.org/docs/10/citext.html) is needed until this is
> fixed.
> Case insensitive text is standard on many databases, thus this may be a big
> obstacle when you want to migrate.

You have not explained what "does not work" means.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +


Re: citext plugin is not working with java applications

From
"David G. Johnston"
Date:
On Mon, Jan 21, 2019 at 7:39 PM Bruce Momjian <bruce@momjian.us> wrote:
> You have not explained what "does not work" means.

True...but assuming it is true would we accept placing a
driver-specific warning here? We do not do so anywhere else in the
documentation that I am aware.

The main issue, IIUC, is that Prepared Statements require their input
types to be known while most users write queries without specifying
data types explicitly.  The JDBC driver falls back to determining the
untyped input as text instead of citext which forces a "text op text"
comparison instead of a "citext op citext" one when the query is
executed.

The JDBC docs don't seem to cover this, which they should as it is
their limitation, not ours (that I am aware of...), though I'm unsure
exactly what the limitation stems from.

David J.