string function - "format" function proposal
От | Pavel Stehule |
---|---|
Тема | string function - "format" function proposal |
Дата | |
Msg-id | AANLkTinMPvVm_iztJ2zPtAj0jNThONrcCo+TwTQm3V6X@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: string function - "format" function proposal
|
Список | pgsql-hackers |
Hello I am returning back to string functions. For me, the most important function isn't commited still. There was discussion about "format" or "sprintf" fuction. So I'll do a small resume. goal: to get function that helps with formatting a message texts and helps with building a SQL commands (used as dynamic SQL) propsals: * "format" function - uses same formatting as PL/pgSQL RAISE statement * "sprintf" function Itagaki objectives to "format" function: * there are not possibility put two parameters without a space between * it is too simple My objectives to sprintf function: * it is designed to different environment than SQL - missing support NULL, missing support for date, timestamp, boolean, ... * it is too complex, some parameters has different meaning for different tags * we have a "to_char" function for complex formatting now. Now I propose a compromise - "format" function with only three tags: %s .. some string %i .. SQL identifier %l .. string literal using a NULL: for %s NULL is transformed to empty string - like "concat" for %i NULL raises an exception for %l NULL is transformed to ' NULL ' string. This system is still simple and enough. Implemented sprintf function can be moved to "sprintf" contrib module. comments Regards Pavel Stehule
В списке pgsql-hackers по дате отправления: