Clear Reduced Column Messages

I have a table in the postgres database that is used in a testing environment where we need to add and remove several columns at a time. The problem is that postgres has a maximum of 1600 columns, and this count includes discarded columns. My table will never have 1600 full “dropped” columns, but over time it accumulates to over 1600 with drops.

I tried using VACUUMand VACUUM FULL, and I tried to remake the existing column as my own type ( ALTER TABLE table ALTER COLUMN anycol TYPE anytype) to force postgres to scan all columns and clear memory of deleted columns, but none of these columns reset postgres'.

I know that this could be solved by copying the entire table, but it has its own problems in a separate issue.

Do you know how to make postgres forget that it had columns?

I know that postgres was not intended for such applications, but I'm not going to understand why we decided to implement it this way. If you have an alternative tool to use, I would be interested to know about it, but I would still like to find a solution to this.

+5
source share
2 answers

This is not possible, except to recreate the table, as you already learned.

- , , , , . .

+5

pg_attribute - () . , .

SELECT 
  relnatts, 
  attname, 
  attisdropped 
FROM 
  pg_class 
    JOIN pg_attribute att ON attrelid = pg_class.oid 
WHERE 
  relname = 'your_table_name';

bugreport, , pgsql-bugs@postgresql.org http://www.postgresql.org/support/submitbug?

0

All Articles