Re: BUG #1947: Enhancement Request - CONCAT() function
От | Jim C. Nasby |
---|---|
Тема | Re: BUG #1947: Enhancement Request - CONCAT() function |
Дата | |
Msg-id | 20051008212549.GX36108@pervasive.com обсуждение исходный текст |
Ответ на | Re: BUG #1947: Enhancement Request - CONCAT() function (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-bugs |
On Sat, Oct 08, 2005 at 04:33:10PM -0400, Tom Lane wrote: > "Tony Marston" <tony@marston-home.demon.co.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@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
В списке pgsql-bugs по дате отправления: