Re: [Fwd: Re: [Pljava-dev] char with trailing space, - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: [Fwd: Re: [Pljava-dev] char with trailing space,
Date
Msg-id Pine.BSO.4.63.0606271211590.8616@leary2.csoft.net
Whole thread Raw
In response to [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject & SetString]  (Thomas Hallgren <thomas@tada.se>)
Responses Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject
List pgsql-jdbc

On Tue, 27 Jun 2006, Thomas Hallgren wrote:

> There's an inconsistency between the handling of trailing whitespace in
> query parameters in the client jdbc driver compared to the PL/Java SPI
> based driver. According to Jean-Pierre, the former apparently trims the
> trailing spaces before passing the query (see below). What is the
> correct behavior?

The JDBC driver does not trim spaces.  What it does is pass setString()
values with a type of varchar, perhaps pljava is using text and exposing
this subtle difference:

# select 'a '::char(2) = 'a '::text;
  ?column?
----------
  f
(1 row)
# select 'a '::char(2) = 'a '::varchar;
  ?column?
----------
  t
(1 row)

The original archive discussion here:
http://archives.postgresql.org/pgsql-jdbc/2004-10/msg00241.php

Kris Jurka

pgsql-jdbc by date:

Previous
From: Thomas Hallgren
Date:
Subject: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject & SetString]
Next
From: Thomas Hallgren
Date:
Subject: Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject