Using copy with a file containing blank rows

From: "George Weaver" <gweaver(at)shaw(dot)ca>
To: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Using copy with a file containing blank rows
Date: 2012-03-15 16:17:59
Message-ID: FD185BE0E2D0486987390B97953292C9@D420
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I am trying to use COPY to import postgresql logs into a postgresql database
for further review and sorting.

The problem I'm encountering happens when COPY hits a blank row:

development=# COPY log
development-# FROM
'D:/PostgreSQL/9.1/pg_log/postgresql-2012-03-15_093730.log'
development-# WITH DELIMITER '^' NULL AS '';

ERROR: missing data for column "ip_address"
CONTEXT: COPY log, line 2: " "

Line 2 is a blank line.

Is there any way to use COPY with blank lines or do the blank lines have to
removed before using COPY?

Thanks,
George

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2012-03-15 16:22:29 Re: Did xpath_table get dropped.
Previous Message Albe Laurenz 2012-03-15 15:30:24 Re: Backups