pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: Gary Stainburn <gary.stainburn@ringways.co.uk>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: where'd the spaces come from
Date: Thu, 2 Aug 2001 11:50:32 -0400 (EDT)
Message-ID: <200108021550.f72FoW727322@candle.pha.pa.us> (raw)
In-Reply-To: <003a01c11366$a6495420$1001a8c0@archonet.com>


Does anyone have a fix for this?


> From: "Gary Stainburn" <gary.stainburn@ringways.co.uk>
> 
> > psql -c "select t.tregion || '/' || to_char(t.tnumber,'000') || '-' ||
> > to_char(m.mnumber,'00') as unitno from teams t, members m
> > where m.mteam = t.tid;"
> >    unitno
> > -------------
> >  SW/ 041- 03
> >  SW/ 041- 05
> 
> Looks like a buglet in to_char()s handling of numbers (unless I
> misunderstand the way the formatting is supposed to work).
> 
> select '[' || to_char(12,'x000') || ']';
>  ?column?
> ----------
>  [x 012]
> 
> If you're running the current version, might be worth posting a bug report.
> You can work around it with something like:
> 
> ... substr(to_char(t.tnumber,'000'),2,3) ...
> 
> HTH
> 
> - Richard Huxton
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (7+ messages)  latest in thread

Message-ID: <200108021550.f72FoW727322@candle.pha.pa.us>
Permalink:  ../200108021550.f72FoW727322@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200108021550.f72FoW727322@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, dev@archonet.com, gary.stainburn@ringways.co.uk
  Subject: Re: where'd the spaces come from
  In-Reply-To: <200108021550.f72FoW727322@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox