Chris Browne cbbrowne at lists.slony.info
Thu Feb 19 08:47:20 PST 2009
Update of /home/cvsd/slony1/slony1-engine/doc/adminguide
In directory main.slony.info:/tmp/cvs-serv18609

Modified Files:
	faq.sgml 
Log Message:
Add FAQ entry re email by Karl Lehenbauer about lastval() capturing
Slony-I sequence updates



Index: faq.sgml
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/doc/adminguide/faq.sgml,v
retrieving revision 1.80
retrieving revision 1.81
diff -C2 -d -r1.80 -r1.81
*** faq.sgml	13 Oct 2008 20:07:27 -0000	1.80
--- faq.sgml	19 Feb 2009 16:47:18 -0000	1.81
***************
*** 2429,2432 ****
--- 2429,2469 ----
  
  </qandaentry>
+ 
+ <qandaentry>
+ 
+ <question> <para> I have a database where we have been encountering
+ the following error message in our application: </para>
+ 
+ <screen> permission denied for sequence sl_action_seq </screen>
+ 
+ <para> When we traced it back, it was due to the application calling
+ <function> lastval() </function> to capture the most recent sequence
+ update, which happened to catch the last update to a &slony1; internal
+ sequence. </para>
+ 
+ </question> 
+ 
+ <para> &slony1; uses sequences to provide primary key values for log
+ entries, and therefore this kind of behaviour may (perhaps
+ regrettably!) be expected.  </para>
+ 
+ <answer> <para> Calling <function>lastval()</function>, to
+ <quote>anonymously</quote> get <quote>the most recently updated
+ sequence value</quote>, rather than using
+ <function>currval('sequence_name')</function> is an unsafe thing to do
+ in general, as anything you might add in that uses DBMS features for
+ logging, archiving, or replication can throw in an extra sequence
+ update that you weren't expecting.  </para>
+ 
+ <para> In general, use of <function>lastval()</function> doesn't seem
+ terribly safe; using it when &slony1; (or any similar trigger-based
+ replication system such as <application>Londiste</application> or
+ <application>Bucardo</application>) can lead to capturing unexpected
+ sequence updates. </para>
+ 
+ </answer> 
+ 
+ </qandaentry>
+ 
  </qandadiv>
  



More information about the Slony1-commit mailing list