create table inventaire (
id serial primary key,
cat�gorie text
constraint cat�gorie check (cat�gorie='informatique' or
cat�gorie='bureautique' or cat�gorie='technique' or cat�gorie='contrat'),
n�_contrat text,
n�_facture text,
n�_commande text,
nie text,
n�_barre int,
n�_s�rie text,
ref_fabriquant text,
marque text,
d�signation text,
dimension text,
nb_pieds text,
nb_tiroir text,
quantit� int,
service text default 'uei' check (service='uei' or service='bcm'),
lieu text,
date datetime default 'now'::text,
individu text default getpgusername(),
check (nie notnull or n�_barre notnull));
create function func_inventaire ()
returns opaque
as 'begin
if (new.dimension isnull or new.nb_pieds isnull or new.nb_tiroir isnull) and
new.cat�gorie !~ ''bureautique'' then raise exception ''empname cannot be NULL
value'';
end if;
new.date=''now''::text;
new.individu=getpgusername();
return new;
end;'
language 'plpgsql';
create trigger trig_inventaire before insert or update on inventaire for each
row execute procedure func_inventaire();
ERROR: INSERT has more expressions than target columns
I get this message when I insert in table inventaire.
--
Fabrice POLLET
ENSTA / LEI / AMI
32 boulevard Victor T�l : +33 01 45 52 54 25
75739 PARIS CEDEX 15 Fax : +33 01 45 52 55 87
F R A N C E