Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010
    Posts
    1

    Unanswered: importing csv file

    Hi
    I have to import a csv file on postgresql.
    I'm using the COPY command

    Code:
    COPY m_geroref_punti 
    FROM 'E: / DB archaeological map / m_geroref_punti.csv' 
    WITH 
    DELIMITER AS ',';
    the problem is that phppgadmin send me a 'error message' every time a record has one of the fields empty.

    Code:
    ERROR: missing data for column "D" 
    CONTEXT: COPY m_geroref_punti, line 97:
    How can I fix it?
    Thanks

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    I would recommend that you first create the table to hold the data, and define default values for all fields. This way, null values in the source file are automatically converted to the default value.

    Be sure that none of the fields disallow nulls...

    Also, it wouldn't hurt to vacuum the table before you import again. The records that have been inserted (and removed) prior to this point are still taking up space until you do.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •