title: Automagic rollback of a junction table
body: <p>There is a CMS system based on PostgreSQL, Python and SQLAlchemy. The publication part of the system is based on a structure:</p>
  
  <p>Each entity of "Portal"s can have many "Page"s.</p>
  
  <pre><code>Portal &gt;--to many(junction_table_1)--&lt; Page 
  </code></pre>
  
  <p>Let's imagine we have a portal with some web pages. 
  At some point of time the design is changed - the old pages are removed and the new ones are added as well as all config files. <strong>Let's call this point in time (T)</strong>. Starting from that point the new web pages show up. </p>
  
  <p>There is an error with one of the forms. After submitting it says there is a session problem. 
  This error can be replicated on each and every machine and web browser and no further issues are visible.</p>
  
  <p>Magic starts here:
  There is one identified computer in the office which - if the mentioned error is caused from it - results with extraordinary change in the database. 
  The state of the table "junction_table_1" is <strong>reverted to the point in time before (T)</strong>. The "portal" shows up all the old web pages in relations as well as to the users. Just to say it clearly: it's not the whole database. It's <strong>just</strong> that one junction table. </p>
  
  <p>I know "it is not possible" but I've seen it replicated with that single machine over and over again.</p>
  
  <p>We have checked locks on the database, hanging rollbacks etc. Nothing there. No scripts, triggers, procedures - the scheme contains only tables and sequences.</p>
  
  <p>Any hints? Tools? Ideas where to start looking for some explanation? I need a Wizard to take part in an adventure...</p>