From: | "Ian Harding" <iharding(at)tpchd(dot)org> |
---|---|
To: | <awitney(at)sghms(dot)ac(dot)uk>, <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Can COPY skip columns? |
Date: | 2004-11-19 18:47:11 |
Message-ID: | s19dcf5e.084@MAIL.TPCHD.ORG |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Since we can specify the order of columns in copy, how hard would it be
(he asked, naively) to specify a column name that points to /dev/null
(or the postgresql internals equivalent)? Sybase's copy utility is very
similar to our copy, and has a function that you can specify in your
column list instead of a real column name that ignores the data.
Something like
copy mytable (col1, col2, ignore(), col3) from '/tmp/dump';
Not a big deal, but kind of handy.
Ian Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
iharding(at)tpchd(dot)org
Phone: (253) 798-3549
Pager: (253) 754-0002
>>> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 11/18/04 9:15 AM >>>
Adam Witney <awitney(at)sghms(dot)ac(dot)uk> writes:
> Is it possible for the COPY command to read data from a file, but skip
> specific columns?
Nope. When you get into significant massaging of the input data,
usually the best bet is to COPY into a temp table that exactly matches
the format of the data file, and then do your rearrangements using an
INSERT/SELECT into the final target table.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
joining column's datatypes do not match
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Green | 2004-11-19 18:51:41 | phpPgAdmin problem - this list? |
Previous Message | Pierre-Frédéric Caillaud | 2004-11-19 18:46:55 | Re: Can COPY skip a header line? |