Re: Fastest way to import only ONE column into a table? (COPY doesn't work) - Mailing list pgsql-general

From Phoenix Kiula
Subject Re: Fastest way to import only ONE column into a table? (COPY doesn't work)
Date
Msg-id e373d31e0708152250u7274b30fl9bc2bcf856c0e62@mail.gmail.com
Whole thread Raw
In response to Re: Fastest way to import only ONE column into a table? (COPY doesn't work)  (Rodrigo De León <rdeleonp@gmail.com>)
List pgsql-general
On 16/08/07, Rodrigo De León <rdeleonp@gmail.com> wrote:
> On Aug 15, 11:46 pm, phoenix.ki...@gmail.com ("Phoenix Kiula") wrote:
> > Appreciate any tips, because it would
> > be nasty to have to do this with millions of UPDATE statements!
>
> - Create an interim table
> - COPY the data into it
> - Do an UPDATE ... FROM ...


Thanks! I thought about it and then gave up because SQL trumped me up.
Could you please suggest what the query should look like?

Based on this:
http://www.postgresql.org/docs/8.1/static/sql-update.html

I tried this:

UPDATE
    t1 SET title = title FROM t2
WHERE
    t1.id = t2.id;


But I am miles from what it needs to be! The example in the docs does
not refer to a column in the other table, it just increments a value
in the same table based on the join ("UPDATE employees SET sales_count
= sales_count + 1 FROM accounts....").

TIA!

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: language interface in postgresql
Next
From: "Sabin Coanda"
Date:
Subject: Re: memory optimization