|
From: Ann W. H. <aha...@ib...> - 2009-11-16 15:47:30
|
Calin Pirtea(RDS) wrote: > > Sounds to me like what you suggest is to create the not null field and on > next read make it look like it has a value. That sounds sooo wrong to me. > Currently, every time I create a new not null field I follow it with a full > table update. > It may sound wrong to you, but it is the general style that Firebird and InterBase have used for years. When you add a column to a table, Firebird generates a new record in RDB$FORMATS, describing the new physical structure. Existing records are unchanged. When Firebird reads a record, it compares the format version in the record header with the format requested - which may not be the most recent, depending on what's happening and how old the request is - and, if necessary, moves the record forward or back to the requested format. So if you add a field FOO to a table and read that table, you'll see a bunch of null FOO's. They're not stored, but are created on reference. If you update those records, they'll be stored in the new format with the FOO field. What Adriano is proposing is a mechanism to add new fields with a NOT NULL constraint without doing a full table update. That would be a good thing. Cheers, Ann |