Skip site navigation (1) Skip section navigation (2)

Bug #517: TO_CHAR(timestamp, 'Day') adds extra whitespace

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #517: TO_CHAR(timestamp, 'Day') adds extra whitespace
Date: 2001-11-20 09:51:01
Message-ID: 200111200951.fAK9p1m03188@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Ashley Cambrell (ash(at)freaky-namuh(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
TO_CHAR(timestamp, 'Day') adds extra whitespace

Long Description
Using the postgresql TO_CHAR function with Day, DAY, day, Month, MONTH or month as the text argument, extra whitespace is appended to the output.

It's easy enough to fixup on the client side, but it's pretty annoying.

Sample Code
SELECT TO_CHAR('2001-01-01'::date, 'Month');
  to_char  
-----------
 January  
(1 row)

SELECT LENGTH('January');
 length 
--------
      7
(1 row)

SELECT LENGTH(TO_CHAR('2001-01-01'::date, 'Month'));      
 length 
--------
      9
(1 row)

ELECT TO_CHAR('2001-01-01'::date, 'Day');
  to_char  
-----------
 Monday   
(1 row)

SELECT LENGTH('Monday');
 length 
--------
      6
(1 row)

SELECT LENGTH(TO_CHAR('2001-01-01'::date, 'Day'));
 length 
--------
      9
(1 row)

-- notice requested single space after Monday
SELECT LENGTH('Monday '); 
 length 
--------
      7
(1 row)

-- notice requested single space after Day
SELECT LENGTH(TO_CHAR('2001-01-01'::date, 'Day ')); 
 length 
--------
     10
(1 row)



No file was uploaded with this report


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2001-11-20 14:58:34
Subject: Re: Bug #517: TO_CHAR(timestamp, 'Day') adds extra whitespace
Previous:From: Ashley CambrellDate: 2001-11-20 09:44:15
Subject: http://www.ca.postgresql.org/bugs/index.php doesn't work under mozilla

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group