pgsql: Add new SQL function, format(text).

Lists: pgsql-committers
From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add new SQL function, format(text).
Date: 2010-11-21 03:34:37
Message-ID: E1PK0hJ-0005RT-Fc@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Add new SQL function, format(text).

Currently, three conversion format specifiers are supported: %s for a
string, %L for an SQL literal, and %I for an SQL identifier. The latter
two are deliberately designed not to overlap with what sprintf() already
supports, in case we want to add more of sprintf()'s functionality here
later.

Patch by Pavel Stehule, heavily revised by me. Reviewed by Jeff Janes
and, in earlier versions, by Itagaki Takahiro and Tom Lane.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=750487077802861a2accd94164166747ec311fa4

Modified Files
--------------
doc/src/sgml/func.sgml | 25 +++++
doc/src/sgml/plpgsql.sgml | 23 ++++
src/backend/utils/adt/varlena.c | 195 ++++++++++++++++++++++++++++++++++++
src/include/catalog/pg_proc.h | 4 +
src/include/utils/builtins.h | 2 +
src/test/regress/expected/text.out | 108 ++++++++++++++++++--
src/test/regress/sql/text.sql | 32 ++++++-
7 files changed, 374 insertions(+), 15 deletions(-)


From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Cc: Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: pgsql: Add new SQL function, format(text).
Date: 2010-11-21 22:22:08
Message-ID: 201011212322.09020.andres@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

On Sunday 21 November 2010 04:34:37 Robert Haas wrote:
> Add new SQL function, format(text).
>
> Currently, three conversion format specifiers are supported: %s for a
> string, %L for an SQL literal, and %I for an SQL identifier. The latter
> two are deliberately designed not to overlap with what sprintf() already
> supports, in case we want to add more of sprintf()'s functionality here
> later.
>
> Patch by Pavel Stehule, heavily revised by me. Reviewed by Jeff Janes
> and, in earlier versions, by Itagaki Takahiro and Tom Lane.
A tiny question: Why does that commit remove quote_ident() test cases?

Andres


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-committers(at)postgresql(dot)org, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: pgsql: Add new SQL function, format(text).
Date: 2010-11-22 00:11:02
Message-ID: AANLkTikxYdPFvMtr9cBFvJJRNV7-jJF=wc5xu216U7M0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

On Sun, Nov 21, 2010 at 5:22 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> On Sunday 21 November 2010 04:34:37 Robert Haas wrote:
>> Add new SQL function, format(text).
>>
>> Currently, three conversion format specifiers are supported: %s for a
>> string, %L for an SQL literal, and %I for an SQL identifier.  The latter
>> two are deliberately designed not to overlap with what sprintf() already
>> supports, in case we want to add more of sprintf()'s functionality here
>> later.
>>
>> Patch by Pavel Stehule, heavily revised by me.  Reviewed by Jeff Janes
>> and, in earlier versions, by Itagaki Takahiro and Tom Lane.
> A tiny question: Why does that commit remove quote_ident() test cases?

Because my git-fu is distinctly second rate. Will fix.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company