From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: string function - "format" function proposal |
Date: | 2010-08-30 11:51:55 |
Message-ID: | AANLkTimfkWVrpNz_r2FL0aS7hhhC_hX27tEq4vuJyJh2@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2010/8/30 Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>:
> On Mon, Aug 30, 2010 at 7:58 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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')
>
what is use case for this feature? I don't see it.
> * 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.
I though about integration with to_char function too. There are not
technical barrier. And I can live with just {to_char_format} too. It
can be or cannot be mixed with basic tags together - there is
specified a NULL value behave. If we allow {format} syntax, then we
have to specify a escape syntax for { and }. Do you have a some idea?
Regards
Pavel
>
> --
> Itagaki Takahiro
>
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2010-08-30 12:14:42 | register/unregister standby Re: Synchronous replication |
Previous Message | Itagaki Takahiro | 2010-08-30 11:20:54 | Re: string function - "format" function proposal |