X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C5A08D798A for ; Thu, 20 Oct 2005 21:45:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86116-10 for ; Fri, 21 Oct 2005 00:45:22 +0000 (GMT) Received: from hub.org (hub.org [200.46.204.220]) by svr1.postgresql.org (Postfix) with ESMTP id 33E6BD7239 for ; Thu, 20 Oct 2005 21:45:24 -0300 (ADT) Received: from localhost (av.hub.org [200.46.204.144]) by hub.org (Postfix) with ESMTP id 358F064BF48 for ; Thu, 20 Oct 2005 21:45:29 -0300 (ADT) Received: from hub.org ([200.46.204.220]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31721-01; Fri, 21 Oct 2005 00:45:19 +0000 (GMT) Received: from ganymede.hub.org (blk-222-82-85.eastlink.ca [24.222.82.85]) by hub.org (Postfix) with ESMTP id 0D81E64BF44; Thu, 20 Oct 2005 21:45:26 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id DFDA7462F7; Thu, 20 Oct 2005 21:45:29 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id DE2D1462EA; Thu, 20 Oct 2005 21:45:29 -0300 (ADT) Date: Thu, 20 Oct 2005 21:45:29 -0300 (ADT) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: Doug Quale Cc: pgsql-general@postgresql.org Subject: Re: [pgsql-advocacy] Oracle buys Innobase In-Reply-To: <878xwokk4d.fsf@charter.net> Message-ID: <20051020214518.Q1006@ganymede.hub.org> References: <878xwokk4d.fsf@charter.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.333 required=5 tests=[AWL=0.283, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/1329 X-Sequence-Number: 85558 On Thu, 20 Oct 2005, Doug Quale wrote: > "Guy Rouillier" writes: > >> Doug Quale wrote: >>> >>> # select 'a'::char(8) = 'a '::char(8); >>> ?column? >>> ---------- >>> t >>> (1 row) >>> >>> Trailing blanks aren't significant in fixed-length strings, so the >>> question is whether Postgresql treats comparison of varchars right. >> >> This result is being misinterpreted. >> >> select length('a'::char(8)) ==> 1 >> select length('a '::char(8)) ==> 1 >> >> So it isn't that the two different strings are comparing equal. The >> process of casting them to char(8) is trimming the blanks, so by the >> time they become fixed length strings, they are indeed equal. > > Huh??? What version of PG are you using? On 7.4.9, > > > test=# select length('a'::char(8)); > length > -------- > 8 > (1 row) > > test=# select length('a '::char(8)); > length > -------- > 8 > (1 row) > > The truncation you describe would simply be wrong. ams=# select length('a '::char(8)); length -------- 1 (1 row) ams=# select version(); version ---------------------------------------------------------------------- PostgreSQL 8.0.2 on i386-portbld-freebsd4.11, compiled by GCC 2.95.4 (1 row) ams=# ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664