<p>The docs quoted by the PostgreSQL provider say that all constraints can be deferrable.</p>

<p><a href="https://metacpan.org/pod/SQL::Translator::Producer::PostgreSQL#PostgreSQL-Create-Table-Syntax">https://metacpan.org/pod/SQL::Translator::Producer::PostgreSQL#PostgreSQL-Create-Table-Syntax</a></p>

<p>However, if we just shove DEFERRABLE on everything, most things will break, because a deferrable primary key cannot be used in someone else's foreign key.</p>

<p>After some discussion in #dbix-class we decided it would suffice to change the DEFERRABLE default so that it is true for foreign keys, but false otherwise. This mimics the existing behaviour, while still allowing for the new behaviour to be specified.</p>

<p>I've fixed the tests to allow for this change, but I've not extended them to look for it.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>&nbsp;&nbsp;<a href='https://github.com/dbsrgits/sql-translator/pull/75'>https://github.com/dbsrgits/sql-translator/pull/75</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Honour the deferred flag on *all* constraints</li>
  <li>Set deferrable default to 1 for FK, 0 otherwise</li>
  <li>Set deferrable lazy, so default can see type attribute</li>
  <li>Special-case the default deferrable value in tests</li>
  <li>Fix all tests where deferrable has become relevant</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-0">lib/SQL/Translator/Producer/PostgreSQL.pm</a>
    (5)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-1">lib/SQL/Translator/Schema/Constraint.pm</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-2">lib/Test/SQL/Translator.pm</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-3">t/17sqlfxml-producer.t</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-4">t/23json.t</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-5">t/24yaml.t</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-6">t/39-filter-globals.t</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-7">t/data/diff/pgsql/create1.yml</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-8">t/data/diff/pgsql/create2.yml</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-9">t/data/template/testresult_basic.txt</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/dbsrgits/sql-translator/pull/75/files#diff-10">t/data/xml/schema.xml</a>
    (8)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/dbsrgits/sql-translator/pull/75.patch'>https://github.com/dbsrgits/sql-translator/pull/75.patch</a></li>
  <li><a href='https://github.com/dbsrgits/sql-translator/pull/75.diff'>https://github.com/dbsrgits/sql-translator/pull/75.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/75">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AASeApyPQkWCknImj0zSP2iIVTSSZvyKks5pCI1hgaJpZM4Ga0Ju.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/dbsrgits/sql-translator/pull/75"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>