Hello.

 I am trying to insert a tupla in a view with rules for inserting from a
 function. This is my data:

-----------------------------------------------------------------------
create table dirección (
    cod     serial primary key,
        calle       text,
        vía         int2    references vía(cod),
        localidad   int4    references localidad(cod),
        provincia   int4    references provincia(cod)
);
create index dir_calle_ndx on dirección (calle);
create index dir_via_ndx on dirección (vía);
create index dir_localidad_ndx on dirección (localidad);
create index dir_provincia_ndx on dirección (provincia);

create view v_dirección as
    select * from dirección
;

create rule v_dirección_ins as on insert to v_dirección do instead
    (insert into dirección(calle,vía,localidad,provincia) values (
        NEW.calle,
        NEW.vía,
        NEW.localidad,
        NEW.provincia);
            select currval('dirección_cod_seq'))
;

create function pilpot(calle) returns integer as '
declare
    c alias for $1;
        n integer;
begin
    insert into v_dirección(calle) values (c);
    get diagnostics n = result_oid;
    return n;
end;
' language 'plpgsql';

------------------------------------------------------------------

 I get an error when creating function of type:

        ERROR:  ProcedureCreate: arg type 'calle' is not defined

 but when I try that insert from psql prompt, all works well.

 Where is my mental bug? :)

 Thanks.

                                                                                       
         David

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to