I have a local table with many fields. I need to update the values on a different server(same db structure) just for one column. How can I do this ?
2 Answers
The only way I can think of is to return the changed column in the results and to apply the changes on both servers.
create table test123 {
id serial primary key,
myvalue int4
};
Assume, you have rows from 1 to 100 in both tables on both servers. This statement updates your rows, and produces a single string result with update statements you can do on the other server also.
update test123 set myvalue = rand()
returning 'UPDATE test123 SET myvalue='||test123||' WHERE id='||id||';';
PS: Untested, but should work with minor syntax fixes.