title: How to make PREPARE TRANSACTION work
body: <p>As per Postgres Documentation - Once prepared, a transaction can later be committed or rolled back with COMMIT PREPARED or ROLLBACK PREPARED, respectively. Those commands can be issued from any session, <code>not only the one that executed the original transaction.</code></p>
  
  <p>I am trying to import data from csv into database tables and for this, I am using the</p>
  
  <p><code>COPY tablename [ ( column [, ...] ) ]
      FROM { 'filename' }</code> </p>
  
  <p>all this is done in a shell script.
  Now the issue is that I am executing <code>psql</code> command and passing this command as parameter via the <code>-c</code> option ( I start transaction via the command </p>
  
  <p><code>prepare transaction 'some-id'</code> in that command). </p>
  
  <p>I want to create a Savepoint and rollback to it incase of any errors.</p>
  
  <p>After a few other tasks in the shell script, I check for errors that the previous psql statement have produced and when I then try to rollback using the command </p>
  
  <p><code>Prepared Rollback 'transaction-id'</code> ( in separate <code>psql command with sql statements</code> )</p>
  
  <p>It reports "<code>No "transaction-id" found</code>"</p>
  
  <p>Am I getting the concept wrong or missing something in the process?</p>
  
  <p>Is this happening because I am issuing <code>psql</code> command multiple time and each is resulting in new transaction ?</p>