Re: string function - "format" function proposal

Поиск
Список
Период
Сортировка
От Itagaki Takahiro
Тема Re: string function - "format" function proposal
Дата
Msg-id AANLkTi=J4MMFbczzBU11zhxDY7KNf_hkXHEr16s6JkZP@mail.gmail.com
обсуждение исходный текст
Ответ на string function - "format" function proposal  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: string function - "format" function proposal  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Mon, Aug 30, 2010 at 7:58 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> propsals:
> * "format" function - uses same formatting as PL/pgSQL RAISE statement
> * "sprintf" function
>
> Now I propose a compromise - "format" function with only three tags:
> %s .. some string
> %i  .. SQL identifier
> %l  .. string literal

These are just ideas:

* Use $n, as like as PREPARE command. It allows for us to swap arguments in any order. SELECT format('$2 before $1',
'aaa','bbb') 

* Call to_char() functions for each placeholder. For example,   format('=={YYYY-MM-DD}==', tm::timestamp) is equivalent
to  '==' || to_char(tm, 'YYYY-MM-DD') || '==' '{}' prints the input with the default format. 

New languages' libraries might be of some help. LLs, C#, etc.

--
Itagaki Takahiro


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: string function - "format" function proposal
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: string function - "format" function proposal