Re: [GENERAL] text formatting in a query, a la sprintf

2006-08-20 Thread Michael Fuhr
On Sun, Aug 20, 2006 at 08:21:18PM -0700, Reece Hart wrote: > On Sat, 2006-08-19 at 16:50 -0600, Michael Fuhr wrote: > > Here's a trivial (and only minimally tested) PL/Ruby function: > > Thanks, Michael. That's a solution I can use. Now I just have to > compile postgresql for ruby support... Y

Re: [GENERAL] text formatting in a query, a la sprintf

2006-08-19 Thread Michael Fuhr
On Sat, Aug 19, 2006 at 01:59:17PM -0700, Reece Hart wrote: > I often desire text and number formatting that's not available with > functions like to_char. I'd really like to have functionality akin to > sprintf, such as: > > $ select no_hits,term,sprintf('http://google.com?q=% > s',replace(queryt

[GENERAL] text formatting in a query, a la sprintf

2006-08-19 Thread Reece Hart
I often desire text and number formatting that's not available with functions like to_char. I'd really like to have functionality akin to sprintf, such as: $ select no_hits,term,sprintf('http://google.com?q=%s',replace(queryterm,' ','+')) as url from queries; $ select event,sprintf("%.2g",prob