Re: RfD: more powerful "any" types

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RfD: more powerful "any" types
Date: 2009-09-11 13:23:27
Message-ID: 20090911132327.GA5125@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kevin Grittner escribió:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
> > what is more readable?
> >
> > select 'i=' || i || ', b=' || b || ', c=' || c ..
> >
> > or
> >
> > select format('i=%, b=%, c=%', i, b, c ..)
>
> Seriously, those are about dead even for me. The concatenation
> might have a slight edge, particularly since I have the option, if
> it gets out of hand, to do:
>
> select 'i=' || i
> || ', b=' || b
> || ', c=' || c
> ..

That barely works for me, and then only because it's a trivial example.
In real uses it's never that clear-cut, and the format version is a lot
better than the || alternative.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua Tolley 2009-09-11 13:39:56 autovacuum_max_workers docs
Previous Message Emmanuel Cecchet 2009-09-11 13:16:19 Re: COPY enhancements