Re: RfD: more powerful "any" types - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: RfD: more powerful "any" types
Date
Msg-id 20090909194845.GU4132@alvh.no-ip.org
Whole thread Raw
In response to Re: RfD: more powerful "any" types  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: RfD: more powerful "any" types
List pgsql-hackers
Pavel Stehule escribió:
> 2009/9/9 Alvaro Herrera <alvherre@commandprompt.com>:

> > I already published a pseudo-sprintf function in the wiki here:
> > http://wiki.postgresql.org/wiki/Sprintf  I'm looking for something
> > better, not just the same hacks.
> >
> > I don't see any good reason that the function needs to be far from core.
> 
> what is use case? Why you need sprintf function, when you have ||
> operator. This functionality is redundant and out of standard. What I
> know, only MySQL has similar function.

Extensive use of || turns into horrible messes quickly.  sprintf() makes
this kind of thing much cleaner.  You could use strcat/strcpy in C too,
but do you?  You could argue that sprintf is redundant in C, yet it
turns out to be extremely useful.

One use case is using it for error messages in RAISE/USING.  Yes, I am
aware you can use concatenation there.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: RfD: more powerful "any" types
Next
From: Pavel Stehule
Date:
Subject: Re: RfD: more powerful "any" types