Strange Result with char concatenation in query.

Поиск
Список
Период
Сортировка
От mathieu.chappuis@msg-software.com
Тема Strange Result with char concatenation in query.
Дата
Msg-id E17BFlT-0004kv-00@mail.msg-software.fr
обсуждение исходный текст
Ответы Re: Strange Result with char concatenation in query.  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Strange Result with char concatenation in query.  (Manfred Koizar <mkoi-pg@aon.at>)
Список 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 по дате отправления:

Предыдущее
От: "Bob Powell"
Дата:
Сообщение: RPM for latest version of Postgres
Следующее
От: Braud Agnes
Дата:
Сообщение: Using the EXPLAIN results