Re: [HACKERS] format() with embedded to_char() formatter

2010-11-24 Thread Itagaki Takahiro
On Tue, Nov 23, 2010 at 03:08, Pavel Stehule pavel.steh...@gmail.com wrote: Or is the intention to replicate the parser's overloaded-function-resolution behavior at runtime?  That seems awkward, duplicative, slow, and probably prone to security issues (think search_path). Ick. I've thought

[HACKERS] format() with embedded to_char() formatter

2010-11-22 Thread Itagaki Takahiro
format() function is very useful to construct formatted text, but it doesn't support embedded formatter unlike sprintf() in C. Of course, we can use to_char() functions for each argument value, but embedded formatter would be more readable. I'd like to propose %{...}s syntax, where

Re: [HACKERS] format() with embedded to_char() formatter

2010-11-22 Thread Pavel Stehule
Hello There is little bit complication. There are no one to_char function - so you cannot to use DirectFunctionCall API. but I am not against to this proposal. regards Pavel 2010/11/22 Itagaki Takahiro itagaki.takah...@gmail.com: format() function is very useful to construct formatted text,

Re: [HACKERS] format() with embedded to_char() formatter

2010-11-22 Thread Tom Lane
Itagaki Takahiro itagaki.takah...@gmail.com writes: I'd like to propose %{...}s syntax, where format('%{xxx}s', arg) is equivalent to format('%s', to_char(arg, 'xxx')). I think the approach is better than implement C-like formatter because we can reuse existing to_char() functions for the

Re: [HACKERS] format() with embedded to_char() formatter

2010-11-22 Thread Robert Haas
On Mon, Nov 22, 2010 at 9:55 AM, Tom Lane t...@sss.pgh.pa.us wrote: Itagaki Takahiro itagaki.takah...@gmail.com writes: I'd like to propose %{...}s syntax, where format('%{xxx}s', arg) is equivalent to format('%s', to_char(arg, 'xxx')). I think the approach is better than implement C-like

Re: [HACKERS] format() with embedded to_char() formatter

2010-11-22 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Mon, Nov 22, 2010 at 9:55 AM, Tom Lane t...@sss.pgh.pa.us wrote: And lastly, AFAICS there is no way to do what you suggest without some really ugly kluges in the parser --- I think the function parsing code would have to have special cases to make

Re: [HACKERS] format() with embedded to_char() formatter

2010-11-22 Thread Robert Haas
On Mon, Nov 22, 2010 at 12:17 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Mon, Nov 22, 2010 at 9:55 AM, Tom Lane t...@sss.pgh.pa.us wrote: And lastly, AFAICS there is no way to do what you suggest without some really ugly kluges in the parser --- I

Re: [HACKERS] format() with embedded to_char() formatter

2010-11-22 Thread Pavel Stehule
2010/11/22 Robert Haas robertmh...@gmail.com: On Mon, Nov 22, 2010 at 12:17 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Mon, Nov 22, 2010 at 9:55 AM, Tom Lane t...@sss.pgh.pa.us wrote: And lastly, AFAICS there is no way to do what you suggest without