Search Postgresql Archives

Fastest way to import only ONE column into a table? (COPY doesn't work)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What is the fastest way to import the values of *only one* column into
an already existing table? Say the table looks like this:

  id (primary key)
  description
  created_on

I want to import only a new column so the table looks like this:

  id (primary key)
  title
  description
  created_on

So I have a large-ish text file with the following format:

   id1||title1
   id2||title2
   id3||title3
   id4||title4
   id5||title5
   id6||title6

I try to import it in with

   COPY table1 (id, title) from "/usr/tmp/titles.txt"

But this doesn't seem to be working, because COPY doesn't know how to
UPDATE values, it just inserts. Appreciate any tips, because it would
be nasty to have to do this with millions of UPDATE statements!

TIA

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux