record new has no field cat - Mailing list pgsql-general

From Fabrice Pollet
Subject record new has no field cat
Date
Msg-id 200010171552.RAA10305@fab.ensta.fr
Whole thread Raw
Responses Re: record new has no field cat  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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


pgsql-general by date:

Previous
From: "Mitch Vincent"
Date:
Subject: Re: Re: C function returning rows, was Boolean text, with phrase ranking, search under Postgres
Next
From: Tom Lane
Date:
Subject: Re: C function and NULL result