title: Inheritance and foreign key constraints with postgresql?
body: <p>In our project we benefit a lot from the inheritance feature of the PostgreSQL database! </p>
  
  <p>We implement the dynamical creation of schemes for different agencies. This structure permits us to solve a lot of security issues which occurs immediately in the case of bulk tables (without partitioning).</p>
  
  <p>The only problem we encountered is to guarantee the database integrity, which usually (in the sense of the structure without inheritance) is realised by the foreign key constraints.</p>
  
  <p>Since the PostgreSQL has certain limitations (see <a href="http://www.postgresql.org/docs/8.4/static/ddl-inherit.html" rel="nofollow noreferrer">inheritance caveats</a>) we're forced to maintain the tables structure <strong>without</strong> the constraints.</p>
  
  <p><strong>Is there any possibility to 'simulate', even supposing the relative performance decay, the foreign keys constraints by means of triggers and/or checks?</strong></p>
  
  <p>Any suggestions are very appreciated!
  Thank you.</p>