From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: string function - "format" function proposal |
Date: | 2010-10-14 07:00:28 |
Message-ID: | AANLkTinC=OfsMjtzQ1ECvCcxanhxrDTOOmV3++1DdTGm@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
2010/10/14 Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>:
>> Let's make format support %s, %i, and %l, as well as
>> allowing things like %$3l (meaning, escape the third argument as a
>> literal and interpolate here), and call it good.
>
> Your idea is:
> % [ $ pos ] format -- ex. %$3l , %l
> Escapes: %% => %
>
> Just for information, $ and pos are reversed in C sprintf.
> % [ pos $ ] format -- ex. %3$l , %l
> Escapes: %% => %
ook - +1 for %3$l
>
> IMHO, I like {} syntax as like as C# because the format strings are extensible.
> { pos [ : format ] } -- ex {3:l}, {3} (, and {l} could be also supported)
> Escapes: {{ => {, }} => }
>
I dislike it. The target usage for this function is plpgsql code. I
prefer a simply design - second sprintf is useles. More - {} can be
used in messages relative often and with your proposal, you have to
intensivelly use a escaping.
Regards
Pavel
> --
> Itagaki Takahiro
>
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2010-10-14 07:39:15 | Re: WIP: extensible enums |
Previous Message | Radosław Smogura | 2010-10-14 06:59:23 | Re: [JDBC] Support for JDBC setQueryTimeout, et al. |