Using rule with function for view delete gives error on OLD.* type - Mailing list pgsql-general

From christine.homer@powerconv.alstom.com
Subject Using rule with function for view delete gives error on OLD.* type
Date
Msg-id OFF3EEA8D2.D1CE17C4-ON80256FCC.003179C3-80256FCC.003DC893@test.alstom.com
Whole thread Raw
Responses Re: Using rule with function for view delete gives error on OLD.* type
List pgsql-general

Hi,

Can anyone explain or suggest a workaround for the following:

I am getting the error:

"ERROR:  record type has not been registered"
CONTEXT:  PL/pgSQL function "f_cmplx_prdct_dlte" while storing call arguments into local variables

when I call a function from a delete rule for a view I've created.

The view has 42 fields.

Selecting from the view works OK, and inserting using an insert function called from the insert rule using new.* works OK.

 A delete function called from the delete rule using old.* gives the error above.

The type seems to be in the database correctly.

 I have another similar view, using 45 fields (most of them the same!) with a delete rule and function that works OK.

 I have tried deleting and re-creating the view and its associated functions, the error did not change.

 I get the same error even if the delete function contents are blank

The rule that fails is:

CREATE OR REPLACE RULE rle_cmplx_prdct_dlte AS
    ON DELETE TO complex_product DO INSTEAD  SELECT f_cmplx_prdct_dlte(old.*) AS f_cmplx_prdct_dlte;

The function it calls starts as follows (it fails before the 'raise warning'):

CREATE OR REPLACE FUNCTION bsns_obj.f_cmplx_prdct_dlte(bsns_obj.complex_product)
  RETURNS void AS
$BODY$

DECLARE
        oldrst ALIAS FOR $1;

        fn varchar;

        FnResult varchar;
        intResult integer;
BEGIN
raise warning 'Start of f_cmplx_prdct_dlte';



I am using a Postgres 8 server on Windows 2000, my client is running on Windows XP.

Thanks,


  Christine.
:.________________
CONFIDENTIALITY : This  e-mail  and  any attachments are confidential and may be privileged. If  you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium.

pgsql-general by date:

Previous
From: "FERREIRA William (COFRAMI)"
Date:
Subject: Re: pl/perl problem
Next
From: Shaun Clements
Date:
Subject: PHP SQL