In postgres - I currently create a table and copy data from a csv file (in the following I create in postgres the exact table, which corresponds to my csv file's table - so the same number of columns) - as follows:
CREATE TABLE SupEnh_AGK50kb_K27ac (
EnhancerID_AGK50kb_K27ac character(80) NOT NULL,
Status_AGK50kb_K27ac character(15) NOT NULL,
Enrich_D_AGK50kb_K27ac float,
Enrich_R_AGK50kb_K27ac float,
Enrich_LR_AGK50kb_K27ac float,
Span_D_AGK50kb_K27ac float,
Span_R_AGK50kb_K27ac float,
Span_LR_AGK50kb_K27ac float,
Multiplication_D_AGK50kb_K27ac float,
Multiplication_R_AGK50kb_K27ac float,
Multiplication_LR_AGK50kb_K27ac float,
NumPeaks_D_AGK50kb_K27ac float,
NumPeaks_R_AGK50kb_K27ac float,
NumPeaks_LR_AGK50kb_K27ac float,
PVal_D_AGK50kb_K27ac float,
PVal_R_AGK50kb_K27ac float,
Pval_lr_AGK50kb_K27ac float,
CONSTRAINT AGK50kb_27ac_Key PRIMARY KEY (EnhancerID_AGK50kb_K27ac)
);
COPY SupEnh_AGK50kb_K27ac
FROM 'G:\CarrollLab\EnhancerAnalysis\AGK_K27ac.KeyFile'
WITH (FORMAT 'csv', DELIMITER E'\t', NULL 'NULL',HEADER);
This procedure works like a charm, but I would like to amend it slightly, so I'll be able to create first a small version of my postgres table - one the holds only the first 5 columns. I then want to load directly from my csv file the first 5 columns. Is there a way to change slightly the code that I provided here so it'll allow me to do what I'm after (and without using a temporary table that would be created on postgres and will hold all columns) ? Thanks a lot, Roy
COPY