Christopher Browne cbbrowne
Tue Sep 12 20:26:47 PDT 2006
Manuel V?zquez Acosta wrote:
> Hi all,
>
> I've been asigned to set up a postgresql replication system with
> slony. I've read all the docs, run all the tests (with the pgbench
> database) over two machines.
>
> Now I'm trying to set it up with the actual db schema for which the
> replica must work.
>
> I have create some slonik scripts:
>
> 1) init_cluster: Which sets up the cluster: init cluster, store node,
> store path and store listen clauses only.
> 2) create_tablekeys: Which creates all "missing" keys: table add key
> clauses only.
> 3) create_repsets: Which creates the replications sets: create set,
> set add table and set add sequence clauses.
>
> The 1st and 2nd scripts works fine. But when I run the 3rd one, slonik
> says that:
>
> <stdin>:25: PGRES_FATAL_ERROR select
> "_saime_cluster".determineIdxnameUnique('public.workflow_type_map',
> NULL);  - ERROR:  Slony-I: table "public"."workflow_type_map" has no
> primary key
>
>
> However, the 2nd scripts DOES have a clause for it:
> table add key (node id = 1, fully qualified name = 'public.workflow_type_map');
>
> And when I inspect the db schema (after running the 1st and 2nd
> script) I see the slony-created key:
>
> CREATE TABLE workflow_type_map
> (
>  "type" varchar(255) NOT NULL DEFAULT ''::character varying,
>  wid int4 NOT NULL DEFAULT 0,
>  "_Slony-I_saime_cluster_rowID" int8 DEFAULT
> nextval('_saime_cluster.sl_rowid_seq'::regclass)
> )
> WITH OIDS;
>
>
> I really don't find a clue in the docs. Can anyone help me?
>   
Drew's reservations about using "TABLE ADD KEY" are well founded, and
I'd agree with him in general.  There is a common opinion amongst
Slony-I developers (I'd not call it universal, but there are multiple of
us...) that TABLE ADD KEY was a mistaken feature to add.

The particular problem you run into is that it is not sufficient to
merely request the extra column; the SET ADD TABLE request needs to
point out that  this column should be used.

notably, it should include the option 'key = SERIAL'.

Thus, you shouldn't have just the statement:
   SET ADD TABLE (set id=1, origin = 1, id=4, fully qualified name =
'public.workflow_type_map');

You need to have...
   SET ADD TABLE (set id=1, origin = 1, id=4, fully qualified name =
'public.workflow_type_map', key = serial);

The 'key = serial' part is probably missing, and that, I expect, is the
problem.



More information about the Slony1-general mailing list