Strange bug in PLpgsql?

Started by Dr. Evilabout 25 years ago4 messagesgeneral
Jump to latest
#1Dr. Evil
drevil@sidereal.kz

When I try this function:

CREATE FUNCTION pgtest(INT4, INT4, INT4, INT4, INT8, INT4, INT2,
INT8, VARCHAR(100), VARCHAR(100), INT4, CHAR(40), INT4)
RETURNS INT4
AS '
DECLARE result INT4;
BEGIN
result := $1 + 12;
RETURN result;
END;
' LANGUAGE 'plpgsql';

it always returns NULL. If I have less arguments in there (like just
one argument) it works. I know that there is a compiled-in limit of
16 args, but this is less than 16 args, and I recompiled postgres to
take up to 30 args anyway. Any idea what's going on? Is there some
limit as to the amount of bytes a function can have as arguments?

I'm very perplexed.

Thanks

#2Dr. Evil
drevil@sidereal.kz
In reply to: Dr. Evil (#1)
Resolved, maybe (Re: Strange bug in PLpgsql?)

Well, I did a dropdb and then I recreated everything, and then it
started working the way I thought it should. There must have been
some function in there that was confusing it, or who knows what. As
I'm writing and debugging functions, I do a lot of DROP FUNCTION and
CREATE FUNCTION, so maybe something happened.

Strange.

#3Dr. Evil
drevil@sidereal.kz
In reply to: Dr. Evil (#2)
Not resolved, maybe (Re: Strange bug in PLpgsql?)

The bug is back, and I can't figure it out.

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dr. Evil (#1)
Re: Strange bug in PLpgsql?

<drevil@sidereal.kz> writes:

When I try this function:
it always returns NULL.

Are you passing any arguments that are NULL?

regards, tom lane