<p>This initial version makes sure that drops on old table are handled before table rename and also fixes up rename_field/alter_field so that old field table name is changed to the name of the new table to prevent calls to alter_field from croaking. Test diffs are reordered but are otherwise unchanged.<br>
I've added a test in a separate commit which uses Test::PostgreSQL to demonstrate one specific bug that this PR fixes (GH issue <a href="https://github.com/dbsrgits/sql-translator/issues/40" class="issue-link" title="::Diff tries to modify old table after table rename for PK col name change">#40</a>).</p>

<hr>

<h4>You can merge this Pull Request by running</h4>
<pre>  git pull https://github.com/SysPete/sql-translator topic/producer_postgresql_batch_alter_table</pre>
<p>Or view, comment on, or merge it at:</p>
<p>&nbsp;&nbsp;<a href='https://github.com/dbsrgits/sql-translator/pull/44'>https://github.com/dbsrgits/sql-translator/pull/44</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>initial batch_alter_table for ::Producer::PostgreSQL</li>
  <li>test to demonstrate Pg diff failure with rename_table+rename_field</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/44/files#diff-0">lib/SQL/Translator/Producer/PostgreSQL.pm</a>
    (66)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/44/files#diff-1">t/30sqlt-new-diff-pgsql.t</a>
    (24)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/44/files#diff-2">t/postgresql-rename-table-and-field.t</a>
    (77)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/dbsrgits/sql-translator/pull/44.patch'>https://github.com/dbsrgits/sql-translator/pull/44.patch</a></li>
  <li><a href='https://github.com/dbsrgits/sql-translator/pull/44.diff'>https://github.com/dbsrgits/sql-translator/pull/44.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/dbsrgits/sql-translator/pull/44">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/302594__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyNDMyMTE1MiwiZGF0YSI6eyJpZCI6NDAzODg2NjF9fQ==--492cef08c10c844eb6a43f9057ea6eb89829d77f.gif" width="1" /></p>