copy

From: Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>
To: pgsql-hackers(at)postgresql(dot)org
Subject: copy
Date: 1998-11-27 13:46:45
Message-ID: 14615.981127@bo.nettuno.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I have a strange behavior while copying from a text file, I don't know
if this will be considered a bug or a feature.

I have this text file:
------------------------
XXX|QWERTYUIOPASDFGHJKLA
A01|BAIO
A02|BAIO CHIARO
A03|BAIO OSCURO
------------------------

and this table:

Table = mantelli
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| m_codice | char() | 3 |
| m_descr | char() | 20 |
+----------------------------------+----------------------------------+-------+
Index: i5_mantelli

prova=> copy mantelli from '/tmp/mantelli.load' using delimiters '|';
COPY
prova=> select * from mantelli;
m_codice|m_descr
--------+--------------------
XXX |QWERTYUIOPASDFGHJKLA

|BAIO CHIARO
|BAIO OSCURO
(4 rows)

prova=> select m_descr,m_codice from mantelli ;
m_descr |m_codice
--------------------+--------
QWERTYUIOPASDFGHJKLA|XXX
|A01
|A02
|A03
(4 rows)

prova=> select m_codice from mantelli ;
m_codice
--------
XXX
A01
A02
A03
(4 rows)

prova=> select m_descr from mantelli ;
m_descr
--------------------
QWERTYUIOPASDFGHJKLA

ARO
URO
(4 rows)

Seems that COPY expects that last field is 20 char long and if it is less than 20
it becomes crazy.

-Jose'-

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Iven 1998-11-27 15:20:56 DROPping tables with SERIALs
Previous Message The Hermit Hacker 1998-11-27 13:37:51 Re: [HACKERS] Re: Mysql 321 - Mysql 322 - msql