Skip site navigation (1) Skip section navigation (2)

rule calls function, passing OLD

From: R(dot)Welz <linuxprodukte(at)gmx(dot)de>
To: Postgesql list <pgsql-novice(at)postgresql(dot)org>
Subject: rule calls function, passing OLD
Date: 2004-07-14 13:00:57
Message-ID: D8DE87E2-D595-11D8-8F8D-0003936EF152@gmx.de (view raw or flat)
Thread:
Lists: pgsql-novice
Hello.
I am a beginner with pgsql and struggeling with the documentation.

Why can't I pass OLD from my rule to the function so the function knows 
on which row the rule was called?


test=# \i '/home/myAccount/Documents/Datenbank Layout/Postgres 
Sytax/test/Regeln2'
CREATE FUNCTION
psql:/home/myAccount/Documents/Datenbank Layout/Postgres 
Sytax/test/Regeln2:16: ERROR:  function 
deny_namen_telefonverweise(namen_telefonverweise) does not exist
HINT:  No function matches the given name and argument types. You may 
need to add explicit type casts.
test=#


When I pass an integer instead, everything works.

Is there another way of letting the function know on which row the rule 
was called?



CREATE OR REPLACE FUNCTION deny_namen_telefonverweise(record) RETURNS 
void AS '
	DECLARE
	result RECORD;
	
	BEGIN
	/* DELETE ROW LATER */
	SELECT 1+1;

	END;
	'
	LANGUAGE 'plpgsql';


CREATE OR REPLACE RULE deny_namen_Telefonverweise AS ON DELETE TO 
Namen_Telefonverweise
DO INSTEAD
SELECT DENY_Namen_Telefonverweise(OLD);


Responses

pgsql-novice by date

Next:From: Stephan SzaboDate: 2004-07-14 14:26:17
Subject: Re: rule calls function, passing OLD
Previous:From: M. BastinDate: 2004-07-14 10:32:32
Subject: Extended query: prepared statements list?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group