Ramin Zahedi
Ramin Zahedi

Reputation: 485

How to import multiple column tab separated text file to a single column PostgreSQL table?

I have a 30 GB tab separated text file with 11 columns. I want to import it to a single column PostgreSQL table. How can I do this?

What should I put for delimiter variable in \copy command? Every character could possibly exist in the text file. How can I force PostgreSQL to consider the file as a one column file?

below is the first 5 rows of the data, some rows are not English and can be in any language.

01B27BE8    Evaluating Polarity for Verbal Phraseological Units evaluating polarity for verbal phraseological units 2014    2014/11/16  10.1007/978-3-319-13647-9_19    mexican international conference on artificial intelligence micai       42D7146F    19517
027D0030    Automatic Monitoring the Content of Audio Broadcasted by Internet Radio Stations    automatic monitoring the content of audio broadcasted by internet radio stations    2012    2012/10/27  10.1007/978-3-642-37807-2_11    mexican international conference on artificial intelligence micai   42D7146F    19444
7CFE299E    Towards a set of Measures for Evaluating Software Agent Autonomytowards a set of measures for evaluating software agent autonomy    2009    2009/11 10.1109/MICAI.2009.15   mexican international conference on artificial intelligence micai       42D7146F    18870
59BEBE1C    Learning Probability Densities of Optimization Problems with Constraints and Uncertainty    learning probability densities of optimization problems with constraints and uncertainty    2008    2008/10/27  10.1007/978-3-540-88636-5_25    mexican international conference on artificial intelligence micai       42D7146F    19444
5873C011    Towards a Model for an Immune System    towards a model for an immune system    2002    2002/04/22  10.1007/3-540-46016-0_42    mexican international conference on artificial intelligence micai       42D7146F19177

Upvotes: 1

Views: 480

Answers (1)

user330315
user330315

Reputation:

Using e.g. \x01 as the delimiter works for me:

\copy the_table from 'data.txt' with (delimiter E'\x01')

Upvotes: 1

Related Questions