[SQL] Bug#960: WAS: Trigger calling a function HELP ME! (2)

2004-04-22 Thread abief_ag_-postgresql
Ok. I think I found the problem is related to this Bug.

is there anywhere to check the status of this bug?

regards,



=
Riccardo G. Facchini

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[SQL] Trigger calling a function HELP ME! (2)

2004-04-21 Thread abief_ag_-postgresql
Sorry. I realize I slipped an error in my code:
 
 the code is:
 ---
  CREATE TABLE public.imp_test
  (
id int8,
value text
  ) WITHOUT OIDS;
  
  CREATE OR REPLACE FUNCTION public.imp_test_to_out_test(imp_test)
RETURNS imp_test AS
  'begin
   return $1;
 end;'
LANGUAGE 'plpgsql' STABLE;
  
  CREATE OR REPLACE FUNCTION public.imp_test_trigger()
RETURNS trigger AS
  'begin
  return imp_test_to_out_test(new);
  end;'
LANGUAGE 'plpgsql' STABLE;
  
  CREATE TRIGGER imp_test_trigger_001
BEFORE INSERT OR UPDATE
ON public.imp_test
FOR EACH ROW
EXECUTE PROCEDURE public.imp_test_trigger();
 ---
 
 regards,
 


=
Riccardo G. Facchini

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[SQL] Trigger calling a function HELP ME!

2004-04-21 Thread abief_ag_-postgresql
Hi all,

first of all, let me explain what I'm trying to do.

I have a table with a fairly complicated trigger. In this trigger I
have a specific set of codelines that can be executed in more than 50
places that works on the new.* fields in order to fix/clean them.

In order to improve readability, I created a function that manages this
small set of codelines, but I'm stuck on the following error:

---
ERROR:  return type mismatch in function returning tuple at or near
"imp_test_to_out_test"
CONTEXT:  compile of PL/pgSQL function "imp_test_trigger" near line 2
---

as a model, I've created this run-down example:
---
CREATE TABLE public.imp_test
(
  id int8,
  value text
) WITHOUT OIDS;

CREATE OR REPLACE FUNCTION public.imp_test_to_out_test(imp_test)
  RETURNS imp_test AS
'begin
 return new;
end;'
  LANGUAGE 'plpgsql' STABLE;

CREATE OR REPLACE FUNCTION public.imp_test_trigger()
  RETURNS trigger AS
'begin
return imp_test_to_out_test(new);
end;'
  LANGUAGE 'plpgsql' STABLE;

CREATE TRIGGER imp_test_trigger_001
  BEFORE INSERT OR UPDATE
  ON public.imp_test
  FOR EACH ROW
  EXECUTE PROCEDURE public.imp_test_trigger();
---
Whenever I run the following select, I get the a.m. result:

---
insert into imp_test
(id, value)
values(1, 'A');
---

Can somebody help me?

regards,

=
Riccardo G. Facchini

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])