Re: Varchar concatenate fields as Char or Varchar, not Text

From: MargaretGillon(at)chromalloy(dot)com
To: "Uwe C(dot) Schroeder" <uwe(at)oss4u(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Varchar concatenate fields as Char or Varchar, not Text
Date: 2006-08-07 19:11:36
Message-ID: OFE61A5F9A.5287F4EA-ON882571C3.00690DB0-882571C3.00696F18@CHROMALLOY.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>"Uwe C. Schroeder" <uwe(at)oss4u(dot)com> wrote on 08/07/2006 11:30:28 AM:
> Well, you cast all those fields to be concatenated to text. Why should
the db
> make a varchar out of that? I seriously doubt that 7.x made a varchar of
that
> - but then, 7.2 is very very old.
> So either cast your fields to varchar (i.e. c.refullname::varchar ||
> d.enname::varchar) or cast the result of the concatenation to a varchar.
>
> UC

FYI in 8.1.4 if the cast is changed to varchar the result still comes out
as a text field
>> SELECT (c.refullname::varchar || d.enname::varchar ||
f.evname::varchar) AS evlinkname1,
results in evlinkname1 as text

Margaret Gillon

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2006-08-07 19:18:17 Re: Varchar concatenate fields as Char or Varchar, not
Previous Message MargaretGillon 2006-08-07 19:05:42 Re: Varchar concatenate fields as Char or Varchar, not Text