title: Drop column doesn't remove column references entirely - postgresql
body: <p>I have a table that contained 1600 columns and would like to add more fields in that but as per the database rule the more fields not allowed to be created because the higher limit reached.</p>
  
  <p>So I decided to drop few unwanted fields from the table and I did it. Again I tried to add few fields in that table but it's raise the same error that 1600 columns are there you can't add more.</p>
  
  <p>I gone through other tables of postgresql "<strong>pg_attribute</strong>" and all those fields are there and having delete parameter = True.</p>
  
  <blockquote>
    <p><strong>What I have tried so far</strong></p>
    
    <p>Drop Constraints Take table data into another table Truncate Table
    Re-Create Constraints Re-Copy data to the main table.</p>
    
    <p>But still the dropped columns are there in pg_attributes table.</p>
    
    <p>I also tried to remove that records from <strong>pg_attribute</strong> but then it
    gives me error like that.</p>
  
  <pre><code>ERROR:  catalog is missing 1 attribute(s) for relid 208996
  
  ********** Error **********
  
  ERROR: catalog is missing 1 attribute(s) for relid 208996
  SQL state: XX000
  </code></pre>
    
    <p><strong>Why we have these many columns reason is</strong></p>
    
    <p>We have odoo-magento (postgresql db in used by odoo) integration and
    in magento there are more than 60000 products and having 3000 unique
    attributes, so in connector all these attributes are created as fields
    in product table and I already synced magento -> odoo products and
    1600 limit reached. Now it won't me allow to drop fields from that
    table. </p>
    
    <p>I have fixed that issue in magento-odoo connector and it will only
    sync required attributes but what should I do for already synced
    fields how can I remove it ???? </p>
    
    <p>Even dropping a table is not a proper way because it's huge and very
    important table so I can take any risk with that.</p>
    
    <p><strong>What I want to do</strong> </p>
    
    <p>I want to simply remove those columns from the table and will need to
    be added few other columns instead.</p>
    
    <p>Is there any other possible solution for this issue ?</p>
  </blockquote>
  
  <p>Any help would be really appreciated.</p>