Received: from finch-post-11.mail.demon.net (finch-post-11.mail.demon.net [194.217.242.39]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f73A3af61066 for ; Fri, 3 Aug 2001 06:03:36 -0400 (EDT) (envelope-from dev@archonet.com) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by finch-post-11.mail.demon.net with esmtp (Exim 2.12 #1) id 15Sbnp-000Bbt-0B; Fri, 3 Aug 2001 10:03:34 +0000 Received: from client (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with SMTP id B32D5138BE; Fri, 3 Aug 2001 10:39:46 +0100 (BST) Message-ID: <01b001c11c00$3ae2bbc0$1001a8c0@archonet.com> From: "Richard Huxton" To: "Bruce Momjian" , "Gary Stainburn" Cc: "pgsql-sql" References: <200108021631.f72GV8T03473@candle.pha.pa.us> Subject: Re: where'd the spaces come from Date: Fri, 3 Aug 2001 10:39:42 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200108/30 X-Sequence-Number: 4251 From: "Bruce Momjian" > > Hi Bruce, > > > > a fix for what? > > If you're meaning the leading space, then the fix is in the followup post > > that I made to my original quiestion. i.e. > > > > psql -c "select to_char(12,'xFM000');" > > to_char > > --------- > > x012 > > (1 row) > > > > The 'FM' removes the space. > > So the FM is the correct way to do this, right? There is no bug? Well - it's certainly *unexpected* behaviour isn't it? It is documented though (Karel Zak's given plenty of examples too): "FM suppresses leading zeroes or trailing blanks that would otherwise be added to make the output of a pattern be fixed-width" Some of the examples show the difference too: to_char(12,'9990999.9') => ' 0012.0' to_char(12,'FM9990999.9') => '0012' I think the issue is you look at to_char() and make assumptions if you're not familiar with it. I *seem* to remember someone saying Oracle worked this way. - Richard Huxton