Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D07CF1337BD8 for ; Tue, 8 Mar 2011 12:41:53 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 76625-01 for ; Tue, 8 Mar 2011 16:41:43 +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 107FE133798E for ; Tue, 8 Mar 2011 12:41:42 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id p28GfhB00195 for pgsql-docs@postgresql.org; Tue, 8 Mar 2011 11:41:43 -0500 (EST) From: Bruce Momjian Message-Id: <201103081641.p28GfhB00195@momjian.us> Subject: Document that char() ignores spaces only in non-pattern comparisons To: PostgreSQL-documentation Date: Tue, 8 Mar 2011 11:41:43 -0500 (EST) X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ELM1299602503-29999-0_" 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/35 X-Sequence-Number: 6468 --ELM1299602503-29999-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" 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. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + --ELM1299602503-29999-0_ Content-Transfer-Encoding: 7bit Content-Type: text/x-diff Content-Disposition: inline; filename="/rtmp/bpchar.diff" diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index b8f6e23..22d4c4e 100644 *** a/doc/src/sgml/datatype.sgml --- b/doc/src/sgml/datatype.sgml *************** SELECT '52093.89'::money::numeric::float *** 1014,1024 **** 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. --- 1014,1026 ---- 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. --ELM1299602503-29999-0_--