Subject | RE: [ib-support] Database Backup |
---|---|
Author | Alan McDonald |
Post date | 2003-06-10T03:20:11Z |
OTOH John, you suerly do not mean that the previous database had table
metadata containg default values, and the restore now has created the tables
but columns are now defined without their default value metadata??
Alan
metadata containg default values, and the restore now has created the tables
but columns are now defined without their default value metadata??
Alan
> -----Original Message-----
> From: Helen Borrie [mailto:helebor@...]
> Sent: Tuesday, 10 June 2003 1:07 PM
> To: ib-support@yahoogroups.com
> Subject: Re: [ib-support] Database Backup
>
>
> John,
>
> At 12:33 PM 10/06/2003 +1000, you wrote:
>
> >Hi all,
> >
> >I have what is (hopefully) a simple question.
> >
> >We have an Interbase 5.6 database that we recently backed up using gbak.
> >We then moved the database to another production machine and restored it.
> >Upon further investigation we have noticed that tables with fields that
> >contain default values have not been recreated with the default values.
> >Is there any way to add the default value to the field without losing the
> >data that is already in the table (500,000 records)?
>
> Sorry, but you are going to have to look for a more plausible reason why
> your "default values are missing". If default values were written at the
> time the rows were created, then they became physical data, just like any
> value that was written there by any other means. Gbak has no way of
> knowing that a particular value in a particular column in a
> particular row
> was put there by a default constraint.
>
> A more likely reason is that you *thought* default values should
> have been
> written, when in reality they were not. Defaults work only in a very
> restricted set of circumstances, viz.
> 1. on an insert. (They don't apply to updates at all.)
> 2. only where the INSERT statement does not include the defaulted column
> in its field list.
>
> If you want a default value to be written wherever the column would
> otherwise receive NULL, then you have to write Before Insert and Before
> Update triggers to make it happen.
>
> As to how to fix the situation one-off, for existing data:
>
> UPDATE atable
> set defaulted_col = TheDefault
> where defaulted_col is null ;
>
> heLen
>
>
>
>
> >Thanks in advance
> >Johnb
> >
> >
> >To unsubscribe from this group, send an email to:
> >ib-support-unsubscribe@egroups.com
> >
> >
> >
> >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>