From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: string function - "format" function proposal |
Date: | 2010-10-15 14:54:57 |
Message-ID: | 20524.1287154497@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Fri, Oct 15, 2010 at 12:55 AM, Itagaki Takahiro
> <itagaki(dot)takahiro(at)gmail(dot)com> wrote:
>> I agree that full-spec sprintf is too complex, but precision and
>> zero-full for numeric types are commonly used. I think someone
>> will ask us "Why don't have numeric formats though we have %s?".
> I think someone might also ask - why are you bothering to create this
> at all? The amount of work that has been put into this is, IMHO, far
> out of proportion to the value of the feature. As Pavel points out,
> we already have perfectly good mechanisms for converting our various
> data types to text. We do not need to invent new ones.
I beg to differ. IMO to_char is a lot closer to the "sucks big-time"
end of the spectrum than the "perfectly good" end of the spectrum:
it's a bad implementation of a crummy design. I think a lot of people
would like to have something closer to sprintf-style formatting.
I think we should go into this with the idea that it might only do 10%
of what sprintf can do initially, but there will be pressure to cover a
lot of the other 90% eventually. So it would be a good idea to ensure
that we don't make any choices that are gratuitously incompatible with
standard sprintf format codes. In particular, I agree with the idea of
using %I not %i for identifiers --- in fact I'd go so far as to suggest
that all specifiers we invent, rather than borrowing from sprintf, be
upper-case.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2010-10-15 15:13:45 | Re: Foreign Visual Studio builds |
Previous Message | Stephen Frost | 2010-10-15 14:52:48 | Re: [JDBC] Support for JDBC setQueryTimeout, et al. |