Re: how to merge a table from another DB - Mailing list pgsql-general

From Troy Campano
Subject Re: how to merge a table from another DB
Date
Msg-id 1077062347.6938.3.camel@floweria.troygeek.net
Whole thread Raw
In response to how to merge a table from another DB  ("Hought, Todd" <Todd.Hought@echostar.com>)
List pgsql-general
Could you do...

UPDATE mytable SET mycolumn =
(
 SELECT myothercolumn
 FROM myothertable
 WHERE myothertable.primarykey = mytable.primarykey
)

Not sure how this works in PostgreSQL, but I do it all the time in
Oracle (note only one table definition in subselect)


thanks!

 ~ Troy Campano ~



On Tue, 2004-02-17 at 13:55, Hought, Todd wrote:
> I have a bit of a dilemma, I'm fairly new to PG, and not quite sure how
> to do this:
> I have a DB that has been basically 'forked' - a copy of the original
> was made for a handful of users to play with without messing with the
> live DB. Now, they would like to know if the changes they have made to
> the forked db can be merged back in to the live one. A change to one
> column of every row in a certain table. How can I update just that field
> in every row of the db without harming the existing data already in that
> table?
>
> thanks in advance.
>
> -Todd
>
> ---------------------------(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


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: String manipulation
Next
From: Tom Lane
Date:
Subject: Re: String manipulation