Re: Query RE using COPY

From: "Phillip Smith" <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
To: "'Paul Lambert'" <paul(dot)lambert(at)autoledgers(dot)com(dot)au>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Query RE using COPY
Date: 2007-05-08 04:14:49
Message-ID: 003b01c79127$6b957ee0$9b0014ac@wbaus090
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Can you modify the 'extract' and make the extra column "\n" which is the
null escape?

That would be the only other option.

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org]
On Behalf Of Paul Lambert
Sent: Tuesday, 8 May 2007 12:44
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Query RE using COPY

Jonah H. Harris wrote:
> COPY mytbl (col1, col2, col3, col4, col6) FROM 'myfile.txt' WITH
> DELIMITER AS '^' QUOTE '\f' CSV HEADER;
>
>

I would rather not do it this way as I use the same load script at all
customer sites where the extracts and requirements may vary. I.e. one
customer may not use the location field mentioned above, but another might.

What I would prefer to do, if possible, is set that column in the
database to 'not required' so that if I get an extract that doesn't have
that column in the file, the copy doesn't care.

As it stands now I generally have to drop all the unneeded columns from
numerous tables, perform my load and then re-add them back again.

When we're talking about 40 or more tables in each database some tables
with several hundred columns... your suggestion would be a bit
cumbersome - particularly if it is only one or two columns in each table
that that the client doesn't need.

--
Paul Lambert
Database Administrator
AutoLedgers

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee. If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Paul Lambert 2007-05-08 04:22:01 Re: Query RE using COPY
Previous Message Paul Lambert 2007-05-08 02:44:21 Re: Query RE using COPY