Re: change attnum in pg_catalog.pg_attribute

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Grzegorz(dot)Przezdziecki(at)PolskieSklepy(dot)pl
Cc: somee(at)poczta(dot)onet(dot)pl, pgsql-general(at)postgresql(dot)org
Subject: Re: change attnum in pg_catalog.pg_attribute
Date: 2005-04-05 18:41:32
Message-ID: 26417.1112726492@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Grzegorz =?iso-8859-2?q?Prze=BCdziecki?= <Grzegorz(dot)Przezdziecki(at)PolskieSklepy(dot)pl> writes:
>> It won't work and will likely crash the backend.

> Even if I will do like this and for ever??

> 1. attnum will be unique and greater than 0
> 2. no holes in attnum numeric
> 3. Make change
> 4. restart postgresql

Yes, unless you also TRUNCATE the table, because attnum ordering tells
about the physical data layout within the table rows. Furthermore,
altering only pg_attribute is unlikely to represent a complete update
of the catalogs --- attnums also show up in pg_index, pg_attrdef,
pg_depend, pg_rewrite if there are any rules or views mentioning the
columns, and probably some other places I forgot.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Przeździecki 2005-04-05 18:44:24 Re: change attnum in pg_catalog.pg_attribute
Previous Message David Rysdam 2005-04-05 18:29:55 Re: Check for existence of index