Using rule with function for view delete gives error on OLD.* type

From: christine(dot)homer(at)powerconv(dot)alstom(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Using rule with function for view delete gives error on OLD.* type
Date: 2005-03-22 11:09:12
Message-ID: OFF3EEA8D2.D1CE17C4-ON80256FCC.003179C3-80256FCC.003DC893@test.alstom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shaun Clements 2005-03-22 11:25:30 PHP SQL
Previous Message Qingqing Zhou 2005-03-22 08:32:06 Re: Measuring Query Performance