Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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'-



pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group