Tracking Down Error in Stored Procedure
Tracking Down Error in Stored Procedure
От:
"Aaron Bono" <postgresql@aranya.com>
Дата:
I have a nightly batch that runs a stored procedure/function. This procedure has a habit of erroring on the first of each month and gives the following:
ERROR: cannot EXECUTE a null querystring
CONTEXT: PL/pgSQL function "update_web_site_hits_fn" line 200 at execute statement
My question is this: What is line 200? Is it the 200th line after the CREATE part of the stored procedure? Or is it the 200th line after the BEGIN? Or maybe something else? I have a possible culprit at both places and don't know which one is the offender.
Also, if the EXECUTE is over many lines, is line 200 the first line of the EXECUTE statement or the ending line of the EXECUTE (where the ; is)?
I am using PostgreSQL 8.1.3 on CENTOS Linux.
Thanks,
Aaron
--
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
http://codeelixir.com
==================================================================
Re: Tracking Down Error in Stored Procedure
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Aaron Bono" writes: > CONTEXT: PL/pgSQL function "update_web_site_hits_fn" line 200 at execute > statement > My question is this: What is line 200? Is it the 200th line after the > CREATE part of the stored procedure? Or is it the 200th line after the > BEGIN? Or maybe something else? It's the 200th line in the function body string. IIRC there is a special case to not count a leading newline in the body string, so that the counting goes like CREATE FUNCTION foo ... RETURNS ... AS $$ DECLARE -- this is line 1 or without exploiting the special case CREATE FUNCTION foo ... RETURNS ... AS $$DECLARE -- this is line 1 regards, tom lane
Re: Tracking Down Error in Stored Procedure
От:
"Aaron Bono" <postgresql@aranya.com>
Дата:
On 12/2/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I got it fixed. Thanks for the help!
--
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
http://codeelixir.com
==================================================================
"Aaron Bono" <postgresql@aranya.com> writes:
> CONTEXT: PL/pgSQL function "update_web_site_hits_fn" line 200 at execute
> statement
> My question is this: What is line 200? Is it the 200th line after the
> CREATE part of the stored procedure? Or is it the 200th line after the
> BEGIN? Or maybe something else?
It's the 200th line in the function body string. IIRC there is a
special case to not count a leading newline in the body string,
so that the counting goes like
CREATE FUNCTION foo ...
RETURNS ...
AS $$
DECLARE -- this is line 1
or without exploiting the special case
CREATE FUNCTION foo ...
RETURNS ...
AS $$DECLARE -- this is line 1
regards, tom lane
I got it fixed. Thanks for the help!
--
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
http://codeelixir.com
==================================================================