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

Modified Files:
      Tag: REL_1_2_STABLE
	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.66.2.6
retrieving revision 1.66.2.7
diff -C2 -d -r1.66.2.6 -r1.66.2.7
*** faq.sgml	11 Jun 2007 16:00:58 -0000	1.66.2.6
--- faq.sgml	19 Feb 2009 16:47:05 -0000	1.66.2.7
***************
*** 2200,2203 ****
--- 2200,2240 ----
  
  </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