Re: [GENERAL] concatenation of string literals - Mailing list pgsql-general

From Maarten Boekhold
Subject Re: [GENERAL] concatenation of string literals
Date
Msg-id Pine.SUN.3.91.980717221308.9027A-100000@dutepp0.et.tudelft.nl
Whole thread Raw
In response to Re: [GENERAL] concatenation of string literals  (eric@gateway.ctlno.com)
List pgsql-general
> > This works :
> > psql -c "select arcode ||  phnum from nccbor_member;"
> >
> >  But this doesn't
> > psql -c " select arcode || '-' || phnum from nccbor_member;"
> >
> >  It's an inconvience because I am doing mail merges in wordperfect
> > using postodbc, and I keep having to do things like put dashes in
> > phone numbers and such in wordperfect, is there another way to concat
> > string
> literals?
> >
> > --
> > Kurt Seel, Systems Engineer
> > Unified Technologies Corp.
> > Phone : 610 964 8200
> > Email : kseel@ut{anti-spam]corp.com
> >
> >  To send me email, remove the {anti-spam] from the above address.
> >
>
> You will probably need to put parenthases around either the first two or
> the last two strings:
>
> psql -c " select (arcode || '-') || phnum from nccbor_member;"
>
> that should work fine

My guess is you have to cast the '-' to text and that postgresql at the
moment sees '-' as a char:

select arcode || '-'::text || phnum from nccbor_members

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems  |
|                   Department of Electrical Engineering                    |
|           Computer Architecture and Digital Technique section             |
|                          M.Boekhold@et.tudelft.nl                         |
-----------------------------------------------------------------------------


pgsql-general by date:

Previous
From: Bruno LEVEQUE
Date:
Subject: PQputline
Next
From: Michael
Date:
Subject: PERL Interface - upgrade from 6.2.1 to 6.3.2