From: | Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar> |
---|---|
To: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: plpgsql |
Date: | 2003-10-20 12:39:00 |
Message-ID: | 200310200939.00884.martin@bugs.unl.edu.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
El Dom 19 Oct 2003 18:25, Alvaro Herrera escribió:
> On Sat, Oct 18, 2003 at 06:48:10PM -0300, Martin Marques wrote:
> > We are trying to make some things work with plpgsql. The problem is that
> > I built several functions that call one another, and I thought that the
> > way of calling it was just making the assign:
> >
> > var:=func1(arg1,arg2);
>
> Have you tried plpgsql's SELECT INTO ?
OK, let me be more specific. I tried this aready with this error:
2003-10-20 09:28:05 [27039] ERROR: parser: parse error at or near ")" at
character 15
2003-10-20 09:28:05 [27039] WARNING: plpgsql: ERROR during compile of
objetosdatosactualizadicc near line 2
Now, here are the specifications about my function.
I'm building a function that does things with the fields of each row inserted.
This function is called from a Trigger. Also, this function calls another
function with does the actual job (well, it really cals some other functions,
all writen in plpgsql).
Here's the code:
CREATE OR REPLACE FUNCTION objetosdatosActualizaDicc() RETURNS TRIGGER AS '
DECLARE
newPk INT;
oldPk INT;
newVcampo VARCHAR;
oldVcampo VARCHAR;
salida RECORD;
BEGIN
IF TG_OP = ''UPDATE'' OR TG_OP = ''INSERT'' THEN
newPk := NEW.codigo;
newVcampo := NEW.titulo;
END IF;
IF TG_OP = ''UPDATE'' OR TG_OP = ''DELETE'' THEN
oldPk := OLD.codigo;
oldVcampo := OLD.titulo;
END IF;
SELECT INTO salida
actualizarDiccionario(newPk,newVcampo,oldPk,oldVcampo,
''biblioteca'',''titulo'',TG_RELNAME,TG_OP);
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
(actualizarDiccionario is declared like this:
actualizarDiccionario(INT,INT,INT,INT,VARCHAR,VARCHAR,VARCHAR,VARCHAR)
)
This is what's giving me the error:
2003-10-20 09:28:05 [27039] ERROR: parser: parse error at or near ")" at
character 15
2003-10-20 09:28:05 [27039] WARNING: plpgsql: ERROR during compile of
objetosdatosactualizadicc near line 2
If I change the last SELECT INTO for a PERFORM I don't get the error, but I
also don't get the things from actualizarDiccionario() done (as if it wasn't
executed).
--
09:28:01 up 17 days, 19:00, 3 users, load average: 0.33, 0.38, 0.36
-----------------------------------------------------------------
Martín Marqués | mmarques(at)unl(dot)edu(dot)ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Ben-Nes Michael | 2003-10-20 12:48:01 | Re: Recomended FS |
Previous Message | Carla Mello | 2003-10-20 12:34:43 | Re: Help or Bug? |