pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedError in executing plpgsql function
3+ messages / 2 participants
[nested] [flat]
* Error in executing plpgsql function
@ 2001-12-01 06:23 ananth <ananthreddy@yahoo.com>
0 siblings, 1 reply; 3+ messages in thread
From: ananthreddy@yahoo.com @ 2001-12-01 06:23 UTC (permalink / raw)
To: pgsql-sql
Hi Everyone,
I am newbie and writing a plpgsql function. I have included source
code here for function. When I execute this function where it finds a
row in table it works fine and gives expected output.
The problem is when I run this function by passing a parameter values
where row does not exist in table. I expect it to print message and
return false. Instead it disconnects from server and throughs lot of
errors in log file. Here is output from executing this function
====When row is found======
called from psql
test=# select func1('2');
NOTICE: Value of ID 2
NOTICE: Value of NDI1
NOTICE: Value of CSSG 5007
NOTICE: Value of Interval Discharge
func1
-------
t
(1 row)
======when row is not found=====
test=# select func1('99');
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!#
=====also i see following errors in server logfile===
Server process (pid 21536) exited with status 139 at Fri Nov 30
22:28:57 2001
Terminating any active server processes...
Server processes were terminated at Fri Nov 30 22:28:57 2001
Reinitializing shared memory and semaphores
The Data Base System is starting up
DEBUG: database system was interrupted at 2001-11-30 22:06:39 PST
DEBUG: CheckPoint record at (0, 185703020)
DEBUG: Redo record at (0, 185703020); Undo record at (0, 0); Shutdown
TRUE
DEBUG: NextTransactionId: 2177; NextOid: 1034695
DEBUG: database system was not properly shut down; automatic recovery
in progress...
DEBUG: ReadRecord: record with zero len at (0, 185703084)
DEBUG: redo is not required
DEBUG: database system is in production state
Any idea what is happeing?
Appreciate any help?
BTW- where can I find good documentation on plpgsql functions?
TIA
ananth
=======Function code========
DROP FUNCTION func1(text);
create function func1(text) returns bool as '
declare
key alias for $1;
ndiraw_rec ndiraw%rowtype;
begin
select into ndiraw_rec * from ndiraw
where ID=key;
if not found then
raise notice ''Record Not found for key %'', key;
return false;
end if;
raise notice ''Value of ID %'', ndiraw_rec.ID ;
raise notice ''Value of NDI1 %'',ndiraw_rec.NDI1;
raise notice ''Value of CSSG %'',ndiraw_rec.cssg;
raise notice ''Value of Interval %'',ndiraw_rec.interval;
return true;
end;
' language 'plpgsql'
==========================================
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Error in executing plpgsql function
@ 2001-12-03 19:23 Tom Lane <tgl@sss.pgh.pa.us>
parent: ananth <ananthreddy@yahoo.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2001-12-03 19:23 UTC (permalink / raw)
To: ananthreddy@yahoo.com; +Cc: pgsql-sql
ananthreddy@yahoo.com (ananth) writes:
> The problem is when I run this function by passing a parameter values
> where row does not exist in table. I expect it to print message and
> return false. Instead it disconnects from server and throughs lot of
> errors in log file. Here is output from executing this function
What PG version are you running? I seem to recall that there was a bug
with some not-found cases in plpgsql a while back. If you're not using
7.1.3, update.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Error in executing plpgsql function
@ 2001-12-04 05:23 ananth <ananthreddy@yahoo.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: ananthreddy@yahoo.com @ 2001-12-04 05:23 UTC (permalink / raw)
To: pgsql-sql
tgl@sss.pgh.pa.us (Tom Lane) wrote in message news:<18422.1007407387@sss.pgh.pa.us>...
> ananthreddy@yahoo.com (ananth) writes:
> > The problem is when I run this function by passing a parameter values
> > where row does not exist in table. I expect it to print message and
> > return false. Instead it disconnects from server and throughs lot of
> > errors in log file. Here is output from executing this function
>
> What PG version are you running? I seem to recall that there was a bug
> with some not-found cases in plpgsql a while back. If you're not using
> 7.1.3, update.
I am running 7.1.1.
Thanks. I'll update.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-12-04 05:23 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-12-01 06:23 Error in executing plpgsql function ananth <ananthreddy@yahoo.com>
2001-12-03 19:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-12-04 05:23 ` ananth <ananthreddy@yahoo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox