Re: string function - "format" function proposal
От | Robert Haas |
---|---|
Тема | Re: string function - "format" function proposal |
Дата | |
Msg-id | AANLkTike9LqB3H1Jc_F5hEFOh7AWXP23nMP3SDNOyhdL@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: string function - "format" function proposal (Pavel Stehule <pavel.stehule@gmail.com>) |
Список | pgsql-hackers |
On Mon, Oct 18, 2010 at 1:07 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote: > 2010/10/18, Robert Haas <robertmhaas@gmail.com>: >> On Mon, Oct 18, 2010 at 7:37 AM, Itagaki Takahiro >> <itagaki.takahiro@gmail.com> wrote: >>> On Sat, Oct 16, 2010 at 7:29 AM, Robert Haas <robertmhaas@gmail.com> >>> wrote: >>>> No doubt. The problem is that we're going to end up with those bells >>>> and whistles in two places: in to_char or other type-specific >>>> formatting functions, and again in format. >>> >>> If we decide to use C-like sprintf(), I think the only thing we can do >>> is to implement C-syntax as much as possible. Users will expect the >>> function behaves as sprintf, because it has the similar syntax. >>> It's not an item for now, but someone would request it at a future date. >>> >>> >>> BTW, the interoperability is why I proposed {} syntax. For example, >>> {1:YYYY-MM-DD} for date is expanded to to_char($1, 'YYYY-MM-DD'). >>> (Maybe it's not so easy; It requires function lookups depending on types.) >> >> There's no particular reason why we couldn't make this work with >> sprintf-type syntax; for example, you could allow %{XYZ} to mean >> to_char(value, 'XYZ'). But it seems to me that we have agreement that >> this should start with just %s, %I, %L and allow 3$ or similar in the >> middle to specify which argument it is. We can then argue about how >> many more bells and whistles to add later. > > so, yes. Can we finish this discus with this result? I'll prepare > patch for next commit fest. Next question - what about sprintf > function in core? Is living this idea still? I'm indifferent about whether we put it in core or contrib. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: