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 27CA4DA955 for ; Thu, 20 Oct 2005 17:29:54 -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 12188-02 for ; Thu, 20 Oct 2005 20:29:23 +0000 (GMT) Received: from mxsf17.cluster1.charter.net (mxsf17.cluster1.charter.net [209.225.28.217]) by svr1.postgresql.org (Postfix) with ESMTP id 7AAF4DA942 for ; Thu, 20 Oct 2005 17:29:24 -0300 (ADT) Received: from mxip03a.cluster1.charter.net (mxip03a.cluster1.charter.net [209.225.28.133]) by mxsf17.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j9KKTMSp011095 for ; Thu, 20 Oct 2005 16:29:23 -0400 Received: from 66-188-129-117.dhcp.mdsn.wi.charter.com (HELO shiva) ([66.188.129.117]) by mxip03a.cluster1.charter.net with ESMTP; 20 Oct 2005 16:29:23 -0400 X-IronPort-AV: i="3.97,236,1125892800"; d="scan'208"; a="1558169497:sNHT23792636" Received: from quale by shiva with local (Exim 3.36 #1 (Debian)) id 1ESh2Q-0003Kn-00 for ; Thu, 20 Oct 2005 15:29:22 -0500 To: Subject: Re: [pgsql-advocacy] Oracle buys Innobase References: From: Doug Quale Date: Thu, 20 Oct 2005 15:29:22 -0500 In-Reply-To: (Guy Rouillier's message of "Wed, 19 Oct 2005 16:07:23 -0500") Message-ID: <878xwokk4d.fsf@charter.net> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200510/1316 X-Sequence-Number: 85545 "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.