Calling a function from another

From: Együd Csaba <csegyud(at)freemail(dot)hu>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Calling a function from another
Date: 2003-02-15 08:09:32
Message-ID: 002d01c2d4c9$c0dd5180$200a0a0a@notebook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
Could you please give me some help? I would like to call a function from
another. There are three functions, (say fa(int,int), fb(int,int) and
fc(int,int)). What's the problem with this:

create function "fc" (int, int) returns int as'
declare
x alias for $1;
y alias for $2;
begin
perform fa (x,y);
perform fb (x,y);
end;
' language 'plpgsql'

Or this:

create function "fc" (int, int) returns int as'
declare
x alias for $1;
y alias for $2;
begin
execute ''select fa('' || x || '','' || y || '')'';
execute ''select fb('' || x || '','' || y || '')'';
end;
' language 'plpgsql'

Or this:

create function "fc" (int, int) returns int as'
declare
x alias for $1;
y alias for $2;
begin
execute ''select fa('' || quote_literal(x) || '','' || quote_literal(y) ||
'')'';
execute ''select fb('' || quote_literal(x) || '','' || quote_literal(y) ||
'')'';
end;
' language 'plpgsql'

I tried all of them above. When I called them one after another from the
console, they worked proprely. But calling the composite function it did
nothing. No errors, just does not do anything.
How should I call these functions.

Thank you in advance,
Csaba

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Emmanuel Charpentier 2003-02-15 08:37:35 Re: Aggregates with non-commutative transition functions
Previous Message Shridhar Daithankar<shridhar_daithankar@persistent.co.in> 2003-02-15 06:42:00 Re: Performance a lot