Strange Result with char concatenation in query.

From: "mathieu(dot)chappuis(at)msg-software(dot)com" <mathieu(dot)chappuis(at)msg-software(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Strange Result with char concatenation in query.
Date: 2002-05-24 14:09:54
Message-ID: E17BFlT-0004kv-00@mail.msg-software.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

A short example, is IMHO more explicit :

% cat file.csv
1,100/100
2,100/100
3,200/200

Creation :
CREATE TABLE test(
numtst INT,
chartst VARCHAR(8)
);

\c - postgres
COPY test FROM '/home/ou/file.csv' USING DELIMITERS ',' WITH NULL AS '';

\c - ou
SELECT '+'||numtst||'+' AS "numtst", '*'||chartst||'*' AS "chartst" FROM test;

Result :

test_db=> SELECT '+'||numtst||'+' AS "numtst", '*'||chartst||'-' AS "chartst" FROM test;
numtst | chartst
--------+------------
-+2+ | *100/100
-+4+ | *100/100
-+5+ | *200/200
(3 rows)

As you see the last '-' in the second column is appended to the first column.

Any help would be kindy.

Mathieu,

PGP Public Key Fingerprint: D775 C0FC 039D 203E 3221 76F1 9BB4 43D2

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Johnson, Shaunn 2002-05-24 14:11:20 examples with execute
Previous Message Randall Perry 2002-05-24 13:55:56 Re: Serious environment problem with 7.2 on Solaris