Can COPY skip a header line?

From: Adam Witney <awitney(at)sghms(dot)ac(dot)uk>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Can COPY skip a header line?
Date: 2004-11-19 15:43:18
Message-ID: BDC3C516.3C31D%awitney@sghms.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Following on from my question yesterday... Can COPY then be made to skip a
header line (the first line of the file say)?

The problem is this... I need to allow a user to upload a data file through
a web browser (PHP driven). This is then processed and the selected file
columns mapped to fields in a database, and then the data file uploaded. I
can do this fine with small files.... But if I get above a 1000 rows it
takes so long it time out.

I can upload a 10,000 row equivalent file using COPY from psql in 2 seconds,
so the time is down to the PHP processing (really all it does is send itto
pg_put_Line)

I liked Toms idea to create a temporary table, but I need to be able to get
rid of the header row then... Is there anyway of avoiding getting PHP
involved in the file processing?

Any ideas?

Thanks

Adam

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Secrétariat 2004-11-19 15:45:57 PostegreSQL 8.0.0 Beta4 Win32
Previous Message Tom Lane 2004-11-19 15:42:11 Re: Phantom user in db--'128'