Fri Jul 22 10:20:03 PDT 2011
- Previous message: [Slony1-general] Is it possible to add slony to an existing DB (imported from old-slony-server)?
- Next message: [Slony1-general] Is it possible to add slony to an existing DB (imported from old-slony-server)?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jul 22, 2011 at 11:37 AM, marmu <mu at forsa.de> wrote: > > Hello Guillaume, > > ok, that was my mistake. but now I altered the psql command accordingly and > this is the output: > > fquest-b1:~ # psql -U $PGBENCHUSER -h localhost -d $MASTERDBNAME -c "begin; > alter table pgbench_history add column id serial; update pgbench_history set > id = > nextval('history_id_seq'); alter table pgbench_history add primary key(id); > commit"; > NOTICE: ALTER TABLE will create implicit sequence "pgbench_history_id_seq" > for serial column "pgbench_history.id" > ERROR: relation "history_id_seq" does not exist > LINE 2: nextval('history_id_seq'); alter table pgbench_history add p... > ^ > fquest-b1:~ # psql -U $PGBENCHUSER -h localhost -d $MASTERDBNAME -c > "begin;update pgbench_history set id = nextval('pgbench_history_id_seq'); > alter table pgbench_history add primary key(id); commit"; > ERROR: relation "pgbench_history_id_seq" does not exist > LINE 1: begin;update pgbench_history set id = nextval('pgbench_histo... > > I really don't get it. Where should the relation "pgbench_history_id_seq" > come from, do I have to create everything manually? Slony is kind of a pain > in the ass for novices like me, excuse my language. > My colleage says, "but when it is finally running, it is solid as a rock and > amazingly fast". I'd like to experience that soon :) This isn't notably a Slony issue, except insofar as the Slony documentation describes how pgbench *used* to work, rather than what it got changed to more recently. Understanding what's going on is a lot more important than getting a recipe, because when PostgreSQL or pgbench change, that means the recipe may need to change, and that is indeed what happened. Slony requires that all replicated tables have a primary key defined. The pgbench "history" table doesn't have one of those by default, so, to replicate the pgbench schema requires adding a primary key to that table. On older versions of pgbench, what was necessary was to run a query like: alter table history add column id serial; alter table history add primary key(id); And then add the sequence that gets generated for that ID column to replication. On newer versions of pgbench, the tables have the prefix "pgbench_" prepended to them, thereby changing the queries to: alter table pgbench_history add column id serial; alter table pgbench_history add primary key (id); Since the names of the tables and sequences have all changed, the Slony configuration needs to account for the new names. Nobody updated the documentation, so I have done so. <http://git.postgresql.org/gitweb/?p=slony1-engine.git;a=commit;h=928300d1fc0078d2e980aa3f601c351c12495d8a>
- Previous message: [Slony1-general] Is it possible to add slony to an existing DB (imported from old-slony-server)?
- Next message: [Slony1-general] Is it possible to add slony to an existing DB (imported from old-slony-server)?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list