COPY, but not everything...

From: "Ian Harding" <ianh(at)tpchd(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: COPY, but not everything...
Date: 2003-06-24 18:41:08
Message-ID: sef8391c.078@mail.tpchd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a big ascii text file that I would only like to import columns 1, 3 and 7 from. I know I can filter it through cut, but I wonder if there is an undocumented way to do it with COPY. Sybase has a useless function called filler() that you use for fields you want to ignore. For example (psuedocode...)

COPY mytable (col1, filler(), filler(), col2, filler(), col3) FROM '/tmp/foobar';

I like the new functionality allowing me to ignore columns in the target table, and to rearrange the columns, but this functionality seems to be missing... (Or I am reading it wrong...)

Thanks!

Ian Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
iharding(at)tpchd(dot)org
Phone: (253) 798-3549
Pager: (253) 754-0002

Browse pgsql-general by date

  From Date Subject
Next Message Paul Ramsey 2003-06-24 18:44:09 Re: Failure to install 7.3.3
Previous Message Dennis Gearon 2003-06-24 18:29:09 Re: Database design problem: multilingual strings