Re: BUG #1947: Enhancement Request - CONCAT() function - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1947: Enhancement Request - CONCAT() function
Date
Msg-id 549.1128803590@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1947: Enhancement Request - CONCAT() function  ("Tony Marston" <tony@marston-home.demon.co.uk>)
Responses Re: BUG #1947: Enhancement Request - CONCAT() function
List pgsql-bugs
"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 ...

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: BUG #1948: Enhancement Request - INSERT syntax
Next
From: Tom Lane
Date:
Subject: Re: BUG #1937: Parts of information_schema only accessible to owner