X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id BB38D9FA502 for ; Tue, 27 Jun 2006 15:06:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 07594-01 for ; Tue, 27 Jun 2006 15:06:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tada.se (1-1-2-48a.rny.sth.bostream.se [82.182.133.12]) by postgresql.org (Postfix) with ESMTP id DB1839FA10A for ; Tue, 27 Jun 2006 15:06:20 -0300 (ADT) Received: from [127.0.0.1] (unverified [127.0.0.1]) by tada.se (SurgeMail 3.7b3) with ESMTP id 488 for multiple; Tue, 27 Jun 2006 20:06:18 +0200 Message-ID: <44A1739A.2080102@tada.se> Date: Tue, 27 Jun 2006 20:06:18 +0200 From: Thomas Hallgren User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Kris Jurka CC: "Pgsql-Jdbc@Postgresql.Org" Subject: Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject References: <44A16388.3060108@tada.se> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Server: High Performance Mail Server - http://surgemail.com r=849097733 X-Authenticated-User: thomas@tada.se X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/117 X-Sequence-Number: 15397 Kris Jurka wrote: > > 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) > I'm missing something. Both text and varchar consider the space significant: thhal=# select length(' '::char); length -------- 0 (1 row) thhal=# select length(' '::varchar); length -------- 1 (1 row) thhal=# select length(' '::text); length -------- 1 (1 row) so why does it make a difference to use varchar instead of text? I.e. why are your comparison results different? Why is the space insignificant when using char? Regards, Thomas Hallgren