String Concatenation

From: "Luiz K(dot) Matsumura" <luiz(at)planit(dot)com(dot)br>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: String Concatenation
Date: 2004-07-23 16:00:31
Message-ID: 002301c470ce$2f15d3b0$1600a8c0@NOTELUIZ
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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 ?

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John Brookes 2004-07-23 16:48:34 Re: unique ID
Previous Message Bruno Wolff III 2004-07-23 15:54:38 Re: unique ID