Re: diff value retuns, debug mode and play mode

Lists: pgsql-bugspgsql-generalpgsql-sql
From: "AL ELK" <ali(at)verus(dot)com(dot)tr>
To: pgsql-bugs(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: diff value retuns, debug mode and play mode
Date: 2005-02-17 10:18:48
Message-ID: cv1rau$1djf$3@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-general pgsql-sql


I have a postgresql function at the bottom , when i run at EMS POSTGRESQL
debug mode with F8 step by step. Its work great but when i use with play
button it returns null what is the different about debug mode and run mode.

BEST REGARDS.

CREATE OR REPLACE FUNCTION "public"."allocatedamount" (varchar, integer)
RETURNS numeric AS
$body$
/* allocatedamount (varchar,integer)
raporlarda kullan?lmak ?zere belirli bir sold un nekadar?n?n allocate
edildi?ini bulmak i?in
$1: Varchar: Tablo ismi.(SOCIAL,ACCOMODATION,vs)
$2: Integer: Soldid.
*/
declare
res numeric(15,2);
_pida integer[4];
_pid integer;
_rec record;
begin
if $1 = 'REGISTRATION' then begin
_pid:=1;
for _rec in select personaldetails.id from personaldetails where
personaldetails.id=$2 or personaldetails.masterid=$2 loop
_pida[_pid]:=_rec.id;
_pid:=_pid+1;
end loop;

select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid = ANY (_pida::integer[]);
res=888;
end;
ELSIF $1 = 'MASTER-REGISTRATION' then
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid=$2;

ELSIF $1 = 'ACC-REGISTRATION' then
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid=$2;

else
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename=$1 and allocatedpayments.tableid=$2;

end if;

if res is null then
res:=0;
end if;

return res;

end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;


From: "AL ELK" <ali(at)verus(dot)com(dot)tr>
To: pgsql-bugs(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: diff value retuns, debug mode and play mode
Date: 2005-05-09 14:05:25
Message-ID: d5nqnb$o9l$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-general pgsql-sql

it is about null problem
........
declare
res numeric(15,2);
_pida integer[4]; <------------ Problem is here must be ---> pida
integer[4]='{}';
_pid integer;
_rec record;
..................

"AL ELK" <ali(at)verus(dot)com(dot)tr>, haber iletisinde unlar
yazd:cv1rau$1djf$3(at)news(dot)hub(dot)org(dot)(dot)(dot)
>
> I have a postgresql function at the bottom , when i run at EMS POSTGRESQL
> debug mode with F8 step by step. Its work great but when i use with play
> button it returns null what is the different about debug mode and run
> mode.
>
> BEST REGARDS.
>
>
> CREATE OR REPLACE FUNCTION "public"."allocatedamount" (varchar, integer)
> RETURNS numeric AS
> $body$
> /* allocatedamount (varchar,integer)
> raporlarda kullan?lmak ?zere belirli bir sold un nekadar?n?n allocate
> edildi?ini bulmak i?in
> $1: Varchar: Tablo ismi.(SOCIAL,ACCOMODATION,vs)
> $2: Integer: Soldid.
> */
> declare
> res numeric(15,2);
> _pida integer[4]; _pid integer;
> _rec record;
> begin
> if $1 = 'REGISTRATION' then begin
> _pid:=1;
> for _rec in select personaldetails.id from personaldetails where
> personaldetails.id=$2 or personaldetails.masterid=$2 loop
> _pida[_pid]:=_rec.id;
> _pid:=_pid+1;
> end loop;
>
> select into res sum(allocatedpayments.amount) from allocatedpayments
> where allocatedpayments.tablename='REGISTRATION' and
> allocatedpayments.tableid = ANY (_pida::integer[]);
> res=888;
> end;
> ELSIF $1 = 'MASTER-REGISTRATION' then
> select into res sum(allocatedpayments.amount) from allocatedpayments
> where allocatedpayments.tablename='REGISTRATION' and
> allocatedpayments.tableid=$2;
>
>
> ELSIF $1 = 'ACC-REGISTRATION' then
> select into res sum(allocatedpayments.amount) from allocatedpayments
> where allocatedpayments.tablename='REGISTRATION' and
> allocatedpayments.tableid=$2;
>
>
> else
> select into res sum(allocatedpayments.amount) from allocatedpayments
> where allocatedpayments.tablename=$1 and allocatedpayments.tableid=$2;
>
> end if;
>
> if res is null then
> res:=0;
> end if;
>
>
> return res;
>
> end;
> $body$
> LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
>
>


From: joffer <joffer(at)terra(dot)es>
To: ALÝ ÇELÝK <ali(at)verus(dot)com(dot)tr>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: unsuscribe
Date: 2005-05-10 10:43:29
Message-ID: 42809051.40006@terra.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-general pgsql-sql

unsuscribe