Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id F0214641CC2 for ; Wed, 13 Jan 2010 13:14:20 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 97056-04 for ; Wed, 13 Jan 2010 17:14:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 5D9D6641BBE for ; Wed, 13 Jan 2010 13:14:10 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o0DHE7q1014775; Wed, 13 Jan 2010 12:14:07 -0500 (EST) To: "Kevin Grittner" cc: "Charles O'Farrell" , pgsql-bugs@postgresql.org Subject: Re: Substring auto trim In-reply-to: <4B4D9A0F020000250002E432@gw.wicourts.gov> References: <65d71e1c1001130102j5f46299cm87477efcfd0c5a51@mail.gmail.com><65d71e1c1001130102j5f46299cm87477efcfd0c5a51@mail.gmail.com> <10878.1263396935@sss.pgh.pa.us> <4B4D9A0F020000250002E432@gw.wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Wed, 13 Jan 2010 10:01:51 -0600" Date: Wed, 13 Jan 2010 12:14:07 -0500 Message-ID: <14774.1263402847@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/115 X-Sequence-Number: 25619 "Kevin Grittner" writes: > Tom Lane wrote: >> What's the data type of the value being compared to? I get, for >> instance, >> >> postgres=# select substr('ab '::char(4), 1, 4) = 'ab '::char(4); > This looks like another situation where we're running into trouble > because of non-standard behavior when people might be expecting > something consistent with other products and the explicit language > in the standard. If we were to change that so that 'ab ' were implicitly typed as char(4), then we'd start getting bug reports from people complaining that "select 'ab' = 'ab '" yields true. I remain of the opinion that char(n) is so hopelessly brain-damaged that we should be very careful to NOT bring it into our mainstream behavior. regards, tom lane