Re: BUG #1947: Enhancement Request - CONCAT() function

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tony Marston <tony(at)marston-home(dot)demon(dot)co(dot)uk>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1947: Enhancement Request - CONCAT() function
Date: 2005-10-08 21:25:49
Message-ID: 20051008212549.GX36108@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Oct 08, 2005 at 04:33:10PM -0400, Tom Lane wrote:
> "Tony Marston" <tony(at)marston-home(dot)demon(dot)co(dot)uk> writes:
> > I would like the option to use CONCAT(field1, ' ', field2) instead of the
> > vertical bar syntax (field1 || ' ' || field2) as this is also available in
> > other popular databases (MySQL, ORACLE).
>
> || is the SQL standard, CONCAT() is not. But feel free to write your
> own functions:
>
> create function concat(text,text) returns text as
> 'select $1 || $2' language sql strict immutable;
> create function concat(text,text,text) returns text as
> 'select $1 || $2 || $3' language sql strict immutable;
> ... repeat up to whatever number of parameters seems needed ...

And you might want to make it a project at http://pgfoundry.org so
others can make use of it. You might also want to define it as accepting
an array; I think that would allow you to accept any number of
parameters.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-10-08 21:30:04 Re: BUG #1947: Enhancement Request - CONCAT() function
Previous Message David Fetter 2005-10-08 21:16:28 Re: BUG #1947: Enhancement Request - CONCAT() function