On Mon, May 7, 2012 at 4:01 AM, Vincent de Phily <vincent.dephily@xxxxxxxxxxxxxxxxx> wrote:
What people need to understand is that there is no way to 'read' a sequence value from a slave. 'SELECT * from sequence_name' will not reliably give you either the most recently assigned or the next sequence value. This is currently covered in the documentation for sequences, but could probably be improved upon and mentioned somewhere in the documentation on setting up slave servers. (I will look at adding it to the binary replication tutorial wiki page.)
Since 'nextval' cannot be called on a sequence on a slave (because a slave can only support read-only transactions), 'currval' will by definition return an error.
To cross-pollinate with another thread, if temporary tables (and insert/delete/update transactions to them) are to be supported on a slave, will the applications using those temporary tables expect to be able to use 'nextval' on inserts to temporary tables as well?
Yes.
--On Sunday 06 May 2012 10:29:17 Simon Riggs wrote:Would be nice to see it added to the documentation (unless I just didn't find
> On 4 May 2012 14:55, Vincent de Phily <vincent.dephily@xxxxxxxxxxxxxxxxx>
wrote:
it ?), as it is quite surprising, and might lead to problems if people expect
to be able to read sequence values from the slave.
What people need to understand is that there is no way to 'read' a sequence value from a slave. 'SELECT * from sequence_name' will not reliably give you either the most recently assigned or the next sequence value. This is currently covered in the documentation for sequences, but could probably be improved upon and mentioned somewhere in the documentation on setting up slave servers. (I will look at adding it to the binary replication tutorial wiki page.)
Since 'nextval' cannot be called on a sequence on a slave (because a slave can only support read-only transactions), 'currval' will by definition return an error.
To cross-pollinate with another thread, if temporary tables (and insert/delete/update transactions to them) are to be supported on a slave, will the applications using those temporary tables expect to be able to use 'nextval' on inserts to temporary tables as well?
As a bonus question, I guess it would be the same if using synchroneous
replication ?
Yes.
Mike Nolan