Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A5E39133798E for ; Fri, 11 Feb 2011 12:39:38 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 64490-01 for ; Fri, 11 Feb 2011 16:39:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 0B8541336FA7 for ; Fri, 11 Feb 2011 12:39:37 -0400 (AST) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p1BGdbVB098697 for ; Fri, 11 Feb 2011 16:39:37 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p1BGdbgc098696; Fri, 11 Feb 2011 16:39:37 GMT (envelope-from www) Date: Fri, 11 Feb 2011 16:39:37 GMT Message-Id: <201102111639.p1BGdbgc098696@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5882: last_value of sequence on replicated properly From: "lou fridkis" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201102/112 X-Sequence-Number: 29384 The following bug has been logged online: Bug reference: 5882 Logged by: lou fridkis Email address: lfridkis@earthlink.net PostgreSQL version: 9.0 Operating system: linux Description: last_value of sequence on replicated properly Details: I am testing pg9 hot standby. I set up a primary and secondary on separate hosts. I wrote a simple program to insert 10,000 rows into a table as fast as possible. The table definition is: \d loutest1 Table "loutest1" Column | Type | Modifiers -------------------- lou_id | integer | not null default nextval('loutest1_lou_id_seq'::regclass) i1 | integer | v1 | character varying(10) | The insert statement is: insert into loutest1 (i1, v1) VALUES (1, 'hi'); The problem is that the values for loutest1_lou_id_seq are different after the test: select * from loutest1_lou_id_seq; sequence_name | last_value | start_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called - loutest1_lou_id_seq | 10143 | 1 | 1 | 9223372036854775807 | 1 | 1 | 0 | f | t vs. select * from pnp.loutest1_lou_id_seq; sequence_name | last_value | start_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called - loutest1_lou_id_seq | 10111 | 1 | 1 | 9223372036854775807 | 1 | 1 | 32 | f | t The data in the two tables is still identical with the max value of lou_id being 10111 in both. Any idea what could cause the seq values to differ? Has anyone else found anything like this? Any suggestions for solutions? So far this is not critical, since the secondary's value is bigger. In the case of a failover, there would be a gap, but no error. But, if the secondary were to be smaller, it would be critical. Any thoughts?