On Sat, Oct 08, 2005 at 04:33:10PM -0400, Tom Lane wrote: > "Tony Marston" <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match