Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

On Monday 07 August 2006 11:20, MargaretGillon@xxxxxxxxxxxxxx wrote:
> Last week I upgraded to postgresql 8.1.4 (YEAH!)  In my database I have a
> view which concatenates three varchar fields to a new field. With
> postgresql 7.2.3 the field resulting from the concatenation was a varchar,
> with postgresql 8.1.4 the new field is a text field. This is affecting all
> kinds of forms in my application. Is there a way I can get the output as
> char  or varchar? View code is below.
>
>
> CREATE OR REPLACE VIEW vweventsummary AS
> SELECT b.ltname, (c.refullname::text || d.enname::text) || f.evname::text
> AS evlinkname1,
> (g.refullname::text || h.enname::text) || i.evname::text AS evlinkname2,
> a.evid, a.evlinktype, a.eventity1, a.evevent1, a.evresource1, a.eventity2,
> a.evevent2, a.evresource2
> FROM event a, linktype b, resource c, entity d, event f, resource g,
> entity h, event i
> WHERE a.evlinktype = b.ltid AND a.evevent1 = f.evid AND
> a.evevent2 = i.evid AND a.evresource1 = c.reid
> AND a.evresource2 = g.reid AND a.eventity1 = d.enid AND a.eventity2 =
> h.enid;
>
>
> *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
> *** ***
> Margaret Gillon, IS Dept., Chromalloy Los Angeles, ext. 297
>
> This e-mail message and any attachment(s) are for the sole use of the
> intended recipient(s) and may contain proprietary and/or confidential
> information which may be privileged or otherwise protected from
> disclosure.  Any unauthorized review, use, disclosure or distribution is
> prohibited.  If you are not the intended recipient(s), please contact the
> sender by reply email and destroy the original message and any copies of
> the message as well as any attachment(s) to the original message.

-- 
	UC

--
Open Source Solutions 4U, LLC	1618 Kelly St
Phone:  +1 707 568 3056		Santa Rosa, CA 95401
Cell:   +1 650 302 2405		United States
Fax:    +1 707 568 6416


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux