Re: RfD: more powerful "any" types

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RfD: more powerful "any" types
Date: 2009-09-11 12:57:22
Message-ID: 1252673842.3950.2.camel@hvost1700
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2009-09-10 at 19:52 +0200, Pavel Stehule wrote:
> 2009/9/10 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> > Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> >> alvherre=# select text_format('% was % at % and said % % times', 'Pavel'::text, 'here'::unknown, now(), row('a','b','c'), '{42}'::int[]);
> >> text_format
> >> -----------------------------------------------------------------------------
> >> Pavel was here at 2009-09-10 13:12:09.054653-04 and said (a,b,c) {42} times
> >> (1 fila)
> >
> > Is that what's being proposed? That pretty much sucks --- it's just
> > another way of concatenating some strings. I thought the idea was to
> > provide the same power as sprintf, eg field width controls, numeric
> > formatting options, etc.
> >
>
> I thing so this is enough - we can get simply message text - like
> raise notice statement. I thing so simple and clean function has more
> usability than heavy real sprintf function. We (c coders) are old
> dinosaurs - but nobody else knows what sprintf function does.

They probably do, as at least PHP and perl have also (s)printf
functions, probably many others as well. But most likely each of them
has a slightly different syntax.

> I thing so the name only "format" is good, it's short. If you need
> some other formating, just you can use to_char function.

yes, format(...) is generic enough that people won't expect it to
confirm to their favorite languages version of printf.

> Pavel
>
> > regards, tom lane
> >

--
Hannu Krosing http://www.2ndQuadrant.com
PostgreSQL Scalability and Availability
Services, Consulting and Training

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Emmanuel Cecchet 2009-09-11 13:16:19 Re: COPY enhancements
Previous Message Aidan Van Dyk 2009-09-11 10:57:27 Re: RfD: more powerful "any" types