Permit to drop bad record from a bank import

This commit is contained in:
sparkyx 2006-07-14 22:13:39 +00:00
parent 8eeb46c7da
commit d672886b70
11 changed files with 81 additions and 40 deletions

View file

@ -1,6 +1,6 @@
begin;
alter table import_tmp add column status varchar(1);
alter table import_tmp alter status set default 'w';
alter table import_tmp alter status set default 'n';
create or replace function trim_cvs_quote() returns trigger as $trim$
declare
modified import_tmp%ROWTYPE;
@ -16,10 +16,10 @@ end;
$trim$ language plpgsql;
update import_tmp set status = 't' where ok=true;
update import_tmp set status = 'w' where ok = false;
update import_tmp set status = 'w' where ok is null;
update import_tmp set status = 'n' where ok = false;
update import_tmp set status = 'n' where ok is null;
alter table import_tmp add constraint chk_status check (status in ('w','d','t'));
alter table import_tmp add constraint chk_status check (status in ('n','w','d','t'));
alter table import_tmp drop column ok ;
@ -42,4 +42,4 @@ end;
$trim$ language plpgsql;
update version set val=15;
commit;
commit;