Re: String Concatenation

From: "John Brookes" <jbrookes(at)jobflash(dot)com>
To: "Luiz K(dot) Matsumura" <luiz(at)planit(dot)com(dot)br>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: String Concatenation
Date: 2004-07-23 16:49:08
Message-ID: 007d01c470d5$13f7ac00$6501a8c0@sccorp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


----- Original Message -----
From: Luiz K. Matsumura
To: pgsql-novice(at)postgresql(dot)org
Sent: Friday, July 23, 2004 9:00 AM
Subject: [NOVICE] String Concatenation

I want to concatenate 2 fields :
tpmov char(4) | dsmov char(10)
---------------+----------------
AB | SOMETHING

If I do:

SELECT tpmov || dsmov as History ...

if the field tpmov has a fixed lenght of char(4) the result
expected (I suppose) may be

History
--------------
AB SOMETHING

But Postgres returns

History
------------
ABSOMETHING

Why this occurs ?
How I can get the first result ( AB__SOMETHING ) ?

If I do a select with the literal strings the result is as expected :

SELECT 'AB ' || 'SOMETHING' AS History ;

History
--------------
AB SOMETHING

My reasoning is wrong or this is a bug ?

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message bcscomputers 2004-07-23 17:02:25
Previous Message John Brookes 2004-07-23 16:48:59 Re: ERROR: pg_class_aclcheck: relation (OID) not found with SELECT INTO variable