Strange Result with char concatenation in query. - Mailing list pgsql-general

From mathieu.chappuis@msg-software.com
Subject Strange Result with char concatenation in query.
Date
Msg-id E17BFlT-0004kv-00@mail.msg-software.fr
Whole thread Raw
Responses Re: Strange Result with char concatenation in query.
Re: Strange Result with char concatenation in query.
List 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



pgsql-general by date:

Previous
From: "Bob Powell"
Date:
Subject: RPM for latest version of Postgres
Next
From: Braud Agnes
Date:
Subject: Using the EXPLAIN results