Melvin Davidson mdavidson at cctus.com
Tue Apr 24 12:16:52 PDT 2007
> What happens when I add a table that's higher up on the heirarchy?
> For example now I want to add a companies table.

Brad
>If this scenario is one that you expect to face, I'd recommend leaving
>gaps in your table id's so you can plug things in later without having
>to do this.

To reinforce what Brad has said, you will find it easier if you also
prefix your table id with the set id.

eg:
...
...
CREATE SET (ID=1, ORIGIN=1, COMMENT='schema1 tables');

SET ADD TABLE (SET ID=1, ORIGIN=1, ID=1010, FULLY QUALIFIED
NAME='schema1.users', comment='Users') ;

SET ADD TABLE (SET ID=1, ORIGIN=1, ID=1020, FULLY QUALIFIED
NAME='schema1.articles', comment='Articles') ;
...
...

That way, if you need to add the 'company' table later, it's easier to
do.
eg:

...
...
#CREATE NEW TEMP SET
CREATE SET ( ID=999, ORIGIN = 1, COMMENT = 'temporary new set' );

#Add the table(s) and/or sequence(s) to the new temp set

SET ADD TABLE (SET ID=999, ORIGIN=1, ID=1005, FULLY QUALIFIED
NAME='schema1.company', comment='company') ;

##SET ADD SEQUENCE ( SET ID=999, ORIGIN=1, ID=1005, FULLY QUALIFIED
NAME='schema1.company_company_id_seq',
COMMENT='company_company_id_seq');

#Subscribe the slave(s) to the new set
SUBSCRIBE SET ( ID = 999, PROVIDER = 1, RECEIVER = 101, FORWARD = NO );

#Need to wait for 101 to confirm before continuing
WAIT FOR EVENT (ORIGIN=1, CONFIRMED=101);

MERGE SET( ID=1, ADD ID=999, ORIGIN=1 );

_EOF_

Melvin Davidson
Database Developer
Computer & Communication Technologies, Inc.
6 Inverness Court East, Suite 220
Englewood, CO  80112
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Melvin Davidson.vcf
Type: text/x-vcard
Size: 407 bytes
Desc: Melvin Davidson.vcf
Url : http://lists.slony.info/pipermail/slony1-general/attachments/20070424/055f0d39/MelvinDavidson.vcf


More information about the Slony1-general mailing list