Re: big problem - Mailing list pgsql-general

From Tom Lane
Subject Re: big problem
Date
Msg-id 26316.1015858954@sss.pgh.pa.us
Whole thread Raw
In response to big problem  (Frank_Lupo Frank_Lupo <frank_lupo@telemail.it>)
List pgsql-general
Frank_Lupo Frank_Lupo <frank_lupo@telemail.it> writes:
> select 'aaa'+'aaa';
> return :
> ?column?
> ----------
> ?

"+" is not the operator for concatenation.  Use the SQL-standard
concatenation operator, "||".

Just FYI, what you seem to be getting is coercion to type "char"
(the single-byte char, not char(N)) and then addition of character
values.

If you really insist on spelling concatenation as "+", try

create operator + (leftarg=text, rightarg=text, procedure=textcat);

This will work better than making one for varchar because text is
the preferred string type.

            regards, tom lane

pgsql-general by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: Unable to identify an operator '=' for types 'numeric' and 'double precision'
Next
From: "Gregory Wood"
Date:
Subject: Re: Advice for optimizing queries using Large Tables