Home > Archive > Slony1 PostgreSQL Replication > August 2005 > PK change for subscribed table









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PK change for subscribed table
John Sidney-Woollett

2005-08-15, 11:24 am

I need to change the primary key for a table in a subscribed set, and
add a new sequence to the set. The table currently has no records if
that makes any difference.

The table is question "customer.wccustoffer" was added to set 4 using
the following script slonik

create set (id=4, origin=1, comment='bp customer');
[snipped]
set add table (set id=4, origin=1, id=4004, full qualified
name='customer.wccustoffer', comment='customer.wccustoffer');
[snipped]

After the cluster was created, all sets were moved from 1 to 2, so that
2 is now the master origin or provider.

I just want to check what the correct method of doing the PK change for
this table is?

Do I drop the table from set 4 as follows:

SET DROP TABLE(id=4004, origin=2)

where node 2 is my current master/provider?

After I make the changes, do I add the "customer.wccustoffer" table and
its new sequence (for the PK value) to a temp set (number 99) and then
merge sets?

# create temp set with table and sequence
create set (id=99, origin=2, comment='bp temp');
set add table (set id=99, origin=2, id=4004, full qualified
name='customer.wccustoffer', comment='customer.wccustoffer');
set add sequence (set id=99, origin=2, id=4108, full qualified
name='customer.seq_wccustoffer', comment='seq_wccusto
ffer');

# merge the temp set into existing set 4
merge set(id=4, add id=99, origin=2),

Is it safe to leave the ID of the modified table as 4004 in the temp
set? This ID is unique within my set definitions.

Also, if I need to make use of a temp set again later, can I re-use set
number 99 for another new merge of different objects? Does the merge set
discard all info relating to set 99 following the merge?

What kind of wait statements will I need to be ensure that things go right?

Thanks for help.

John
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com