Re: How do add primary key contraint on existing table?
Posted in 1997
David Williams <djw@smooth1.demon.co.uk> wrote:
:In article <3385DA3A.179B@ccm2.hf.intel.com>, Jorge Torralba <jorgex_tor
:ralba@ccm2.hf.intel.com> writes
:>> :but I get an ISAM error message that says it has run out of disk space.
:>> :
:>
:>
:>Keep in mind, if you alter a table Informix makes a copy of that table
:>before making changes to it. If your table is very big, you just might
:>not have enough room for the copy.
:>
: Correct - the copy gets created in the root dbspace by default.
Are you realy sure of this David. Remember all he is doing is:
ALTER TABLE tablename ADD CONSTRAINT PRIMARY KEY (colname)
CONSTRAINT tablename_primary;
In my book this doesn't create a copy of the table. It simply adds the
constraint to the existing table. I may be very wrong though as I
haven't ever realy checked to see what is happening. It sure shouldn't
have to create a copy of the table, so I would call it a defect if it
does.
Even if it doesn't create a copy of the table it does create a new
unique index and this may be the reason why he runs out of space.
That's why I suggested that he created the index first (see earlier
post in this thread).
: Look in your $INFORMIXDIR/etc/$ONCONFIG file and change DBSPACETEMP
: to be a comma separate list of dbpaces which should be used to
: store temporary tables which is what the ALTER TABLE effectively
: creates. E.g.
:
: DBSPACETEMP dbspace1,dbspace2,dbspace3
:
:
: Then shutdown and startup online for the change to take effect.
:
:
:--
:David Williams
Nils.Myklebust@idg.no
NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway
My opinions are those of my company
The Informix FAQ is at http://www.iiug.org