cbbrowne at ca.afilias.info cbbrowne
Wed May 17 05:16:45 PDT 2006
> Hello everybody!
>     I used the slony to replication my database data. For some
> purposes,I would like to replicate the master database table(name:
> person) to the slave database talbe(name: person01. different from the
> master database table name), I want know can the slony define the
> slave's ectypal table name? or have other ways to do it?

There isn't a way to redefine the table name on a subscriber.

To do this (and "this" would also include the notion of changing the
namespace) would require having an extra configuration table that
specifies some set of table name mappings.

Probably something like the following...

create table sl_table_map (
  mp_node integer,
  mp_tab_id integer,
  mp_fqtn text
);

This would be filled in with node IDs, table IDs, and "fully qualified
table names."  Any time we try to set up a table name for an
insert/update/delete on a subscriber, we'd check to see if this table
contains an override for the table, to use that, rather than the name in
sl_table.

*Probably* the way to handle "bootup" of this process would be to populate
this via a new slonik command, something like:

set alter table (id=42, node id = 4, fully qualified
name='"new_schema"."new_table_name"');

That would alter the name between SYNCs and keep consistency...

This would also affect all operations that touch tables (execute script,
move set, ...).

It seems to me it would likely be required to prevent that node from being
treated as a "forwarding" node; I don't think you'd want that node to be
able to become origin...  There's messiness there...

By the way, when you do this sort of renaming, using EXECUTE SCRIPT to do
updates on that table becomes impossible because the table name won't be
consistent with what the usual script would use for naming...




More information about the Slony1-general mailing list