Re: The notorious to_char bug

From: "Jonah H(dot) Harris" <jharris(at)nightstarcorporation(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <greg(at)turnstep(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The notorious to_char bug
Date: 2002-09-18 17:45:47
Message-ID: 001001c25f3b$396a6b60$b77b2344@gemini
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Oracle 8.1.7.2

SQL> SELECT to_char(0,'FM999.99') AS tst_char FROM dual;

TST_CHA
-------
0.

SQL> SELECT to_char(1,'FM999.99') AS tst_char FROM dual;

TST_CHA
-------
1.

-----Original Message-----
From: pgsql-hackers-owner(at)postgresql(dot)org
[mailto:pgsql-hackers-owner(at)postgresql(dot)org]On Behalf Of Tom Lane
Sent: Wednesday, September 18, 2002 9:12 AM
To: greg(at)turnstep(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] The notorious to_char bug

greg(at)turnstep(dot)com writes:
> (From the SQL list:)

>> And we know it is a bug:
>> * to_char(0,'FM999.99') returns a period, to_char(1,'FM999.99') does not

> I took a look at this bug a week ago, and noticed that inside of the file
> src/backend/utils/adt/formatting.c
> we are specifically causing the above behavior, perhaps in an effort to
> mimic Oracle's implementation of it.

Hm. Can anyone try these cases on Oracle? If the code goes out of its
way to have this odd behavior, maybe it's because Oracle does too.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-09-18 19:17:21 Re: RPMS for 7.3 beta.
Previous Message Bruce Momjian 2002-09-18 17:29:35 Re: RPMS for 7.3 beta.