Re: RfD: more powerful "any" types - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: RfD: more powerful "any" types
Date
Msg-id 162867790909101125s4a071029j29cf87d1ef61ec02@mail.gmail.com
Whole thread Raw
In response to Re: RfD: more powerful "any" types  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: RfD: more powerful "any" types
Re: RfD: more powerful "any" types
List pgsql-hackers
2009/9/10 Tom Lane <tgl@sss.pgh.pa.us>:
> Pavel Stehule <pavel.stehule@gmail.com> writes:
>>> On Sep 10, 2009, at 10:16 AM, Tom Lane wrote:
>>>> I thought the idea was to
>>>> provide the same power as sprintf, eg field width controls, numeric
>>>> formatting options, etc.
>
>> no - we have to_char function, why we need different formatting system?
>
> Why do we need this at all, when we have the concatenation operator?

what is more readable?

select 'i=' || i || ', b=' || b || ', c=' || c ..

or

select format('i=%, b=%, c=%', i, b, c ..)

> I think the point of it is that people are used to how sprintf works.
> So it should work as nearly like sprintf as possible.
>

How sprintf will be print bytea type, or char(n) type values? I can
understand, so people like some what is well known, but sprintf
function is from other domain than databases. There isn't possible
100% compatible implementation - because sprintf desn't knows arrays,
custom types, rows.

>                        regards, tom lane
>


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: RfD: more powerful "any" types
Next
From: Andrew Dunstan
Date:
Subject: Re: Ragged CSV import