From: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: string function - "format" function proposal |
Date: | 2010-09-01 00:53:44 |
Message-ID: | AANLkTi=a6BAd6wTn2A6VVKmGwz4jThW8kRk+naDJARKd@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Sep 1, 2010 at 6:07 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> I don't found a nice mix for placeholders and positional placeholders
How about %pos$format, used in C-printf()? It might be
only in Linux's libc.
printf("<%2$s> <%1$d>\n", 123, "abc");
=> <abc> <123>
http://linux.die.net/man/3/printf
> %i ... sql identifier
> %v ... sql value
> %s ... string --- the most used tag I expect
> %l ... literal
Looks good designed. I have a couple of comments and questions:
* There is no examples for %l. What's the difference from %v and %s?
If it always quotes, how does it work? Like as quote_literal()
or quote_nullable()?
* %v quotes text values (and maybe all non-numeric values) with
single quotes, but doesn't numeric values. How do we determine
the difference? By type oid?
* %v also doesn't quote boolean values, but t and f are not valid.
You should use true and false (or 't' and 'f') for the cases.
(So, your "INSERT INTO" example is broken.)
--
Itagaki Takahiro
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2010-09-01 01:02:51 | Re: Synchronous replication - patch status inquiry |
Previous Message | David Fetter | 2010-09-01 00:45:47 | Re: Synchronous replication - patch status inquiry |