Subject | Re: [firebird-support] GBAK should validate data during backup, not restore |
---|---|
Author | JHCue@aol.com |
Post date | 2003-12-12T18:22:05Z |
Hello,
Well in this case it is the alter table statement that should be validatted,
when the alter table is issued, an inconcistency is creatted in the database
cause at least a row is creatted with NULL value (FIELD2) in a NOT NULL field.
A workarround here is to force a DEFAULT clause if a NOT NULL field is ADDED
to an existing table, it is possible to force only if altered table is not
empty at the ALTER table time.
Regards:
Jorge Horacio Cué Cantú.
En un mensaje con fecha 12/12/2003 03:54:02 p.m. Hora estándar romance,
david.bonafe@... escribe:
Run that script on a test database:
**********
create table BUG_TEST
(
FIELD1 integer not null
);
commit;
insert into BUG_TEST (FIELD1) values (1);
insert into BUG_TEST (FIELD1) values (2);
insert into BUG_TEST (FIELD1) values (3);
commit;
alter table BUG_TEST
add FIELD2 integer not null;
commit;
select * from BUG_TEST where FIELD2 is null;
***********
then, backup your database with gbak and try to restore it...
***********
gbak: ERROR: validation error for column FIELD2, value "*** null ***"
gbak: ERROR: warning -- record could not be restored
gbak: Exiting before completion due to errors
***********
IMHO that error should occur during backup, not during restore, as a backup
that can't be restored isn't a valid backup.
i've been thinking about posting this on sourceforge, but don't know exactly
if it's a bug or a feature request
PS: sorry if i've made any mistake in spelling or something, cause my
english isn't perfect :)
_
Jorge Horacio Cué Cantú
Paratus Semper Doceri
Director de Desarrollo y Tecnología
EasyDental, S.A. de C.V.
[Non-text portions of this message have been removed]
Well in this case it is the alter table statement that should be validatted,
when the alter table is issued, an inconcistency is creatted in the database
cause at least a row is creatted with NULL value (FIELD2) in a NOT NULL field.
A workarround here is to force a DEFAULT clause if a NOT NULL field is ADDED
to an existing table, it is possible to force only if altered table is not
empty at the ALTER table time.
Regards:
Jorge Horacio Cué Cantú.
En un mensaje con fecha 12/12/2003 03:54:02 p.m. Hora estándar romance,
david.bonafe@... escribe:
Run that script on a test database:
**********
create table BUG_TEST
(
FIELD1 integer not null
);
commit;
insert into BUG_TEST (FIELD1) values (1);
insert into BUG_TEST (FIELD1) values (2);
insert into BUG_TEST (FIELD1) values (3);
commit;
alter table BUG_TEST
add FIELD2 integer not null;
commit;
select * from BUG_TEST where FIELD2 is null;
***********
then, backup your database with gbak and try to restore it...
***********
gbak: ERROR: validation error for column FIELD2, value "*** null ***"
gbak: ERROR: warning -- record could not be restored
gbak: Exiting before completion due to errors
***********
IMHO that error should occur during backup, not during restore, as a backup
that can't be restored isn't a valid backup.
i've been thinking about posting this on sourceforge, but don't know exactly
if it's a bug or a feature request
PS: sorry if i've made any mistake in spelling or something, cause my
english isn't perfect :)
_
Jorge Horacio Cué Cantú
Paratus Semper Doceri
Director de Desarrollo y Tecnología
EasyDental, S.A. de C.V.
[Non-text portions of this message have been removed]