Re: Concatenation Snafu

From: "Chad Thompson" <chad(at)weblinkservices(dot)com>
To: "Thomas Good" <tomg(at)sqlclinic(dot)net>, "Postgres SQL List" <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: Concatenation Snafu
Date: 2003-03-25 23:01:03
Message-ID: 049c01c2f322$69ee2e90$32021aac@chad
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sqlclinic(dot)net>
To: "Postgres SQL List" <pgsql-sql(at)postgreSQL(dot)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(at)sqlclinic(dot)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(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Good 2003-03-25 23:30:17 Re: Concatenation Snafu
Previous Message Thomas Good 2003-03-25 22:28:08 Concatenation Snafu