Re: Concatenation Snafu - Mailing list pgsql-sql

From Chad Thompson
Subject Re: Concatenation Snafu
Date
Msg-id 049c01c2f322$69ee2e90$32021aac@chad
Whole thread Raw
In response to Concatenation Snafu  (Thomas Good <tomg@sqlclinic.net>)
Responses Re: Concatenation Snafu
Re: Concatenation Snafu
List pgsql-sql
The assumtion that char and varchar can be compared is gone.  Any comparison
or in this case concatination between the two types needs to be explicitly
cast.

try
SELECT code::varchar || ' ' || diag::varchar, code
FROM dsm4
WHERE axis = 1
ORDER BY code;

Thanks
Chad
----- Original Message -----
From: "Thomas Good" <tomg@sqlclinic.net>
To: "Postgres SQL List" <pgsql-sql@postgreSQL.org>
Sent: Tuesday, March 25, 2003 3:28 PM
Subject: [SQL] Concatenation Snafu



SELECT code || ' ' || diag, code
FROM dsm4
WHERE axis = 1
ORDER BY code;

This worked on 6.3-7.3.1 now it dies with:
'unable to identify an operator || for types 'character' and 'character
varying'

What happened?????

-----------------------------------------------------------------------
Thomas Good                                  e-mail: tomg@sqlclinic.net
Programmer/Analyst                           phone:   (+1) 718.818.5528
Residential Services                         fax:     (+1) 718.818.5056
Behavioral Health Services, SVCMC-NY         mobile:  (+1) 917.282.7359

// Krieg ist selbst Terror - Für Frieden und globale Gerechtigkeit!


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command   (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)



pgsql-sql by date:

Previous
From: Thomas Good
Date:
Subject: Concatenation Snafu
Next
From: Thomas Good
Date:
Subject: Re: Concatenation Snafu