Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id BE9551337B9D for ; Tue, 8 Mar 2011 13:54:42 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 54701-03 for ; Tue, 8 Mar 2011 17:54:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id 08E491337B93 for ; Tue, 8 Mar 2011 13:54:34 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id p28HsX219111; Tue, 8 Mar 2011 12:54:33 -0500 (EST) From: Bruce Momjian Message-Id: <201103081754.p28HsX219111@momjian.us> Subject: Re: Document that char () ignores spaces only in non-patterncomparisons In-Reply-To: <22830.1299606701@sss.pgh.pa.us> To: Tom Lane Date: Tue, 8 Mar 2011 12:54:33 -0500 (EST) CC: Kevin Grittner , pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ELM1299606873-29999-1_" Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/39 X-Sequence-Number: 6472 --ELM1299606873-29999-1_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" Tom Lane wrote: > "Kevin Grittner" writes: > > Bruce Momjian wrote: > >> A private email I received indicated that our documentation about > >> ignoring trailing spaces in CHAR() comparisons was slightly > >> inaccurate. I have update our docs to indicate it is only > >> non-pattern comparisons that ignore spaces with CHAR(). Applied > >> doc patch attached. > > > This language: > > > | disregarded when non-pattern comparing two values > > > seems quite awkward. > > I didn't like it either. I suggest reverting that part of the patch. > The added text later on is sufficient. OK, since you liked that idea too, I have applied an updated patch, attached. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + --ELM1299606873-29999-1_ Content-Transfer-Encoding: 7bit Content-Type: text/x-diff Content-Disposition: inline; filename="/rtmp/bpchar2.diff" diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 22d4c4e..0bb6594 100644 *** a/doc/src/sgml/datatype.sgml --- b/doc/src/sgml/datatype.sgml *************** SELECT '52093.89'::money::numeric::float *** 1014,1025 **** with spaces to the specified width n, and are stored and displayed that way. However, the padding spaces are treated as semantically insignificant. Trailing spaces are ! disregarded when non-pattern comparing two values of type character, and they will be removed when converting a character value to one of the other string types. Note that trailing spaces are semantically significant in character varying and text values, and ! when using pattern matching comparisons, e.g. LIKE, regular expressions. --- 1014,1025 ---- with spaces to the specified width n, and are stored and displayed that way. However, the padding spaces are treated as semantically insignificant. Trailing spaces are ! disregarded when comparing two values of type character, and they will be removed when converting a character value to one of the other string types. Note that trailing spaces are semantically significant in character varying and text values, and ! when using pattern matching, e.g. LIKE, regular expressions. --ELM1299606873-29999-1_--