From: | pgsql-bugs(at)postgresql(dot)org |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | pqReadData() -- backend closed the channel unexpectedly. |
Date: | 2001-05-17 17:45:32 |
Message-ID: | 200105171745.f4HHjWg08478@hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Kristis Makris (kristis(dot)makris(at)datasoft(dot)com) reports a bug with a severity of 2
The lower the number the more severe it is.
Short Description
pqReadData() -- backend closed the channel unexpectedly.
Long Description
Here are the facts:
I have a plpgsql function that should return a value out of a query. The function works when the select xxx into yyyy statement in it enters data in a yyyy variable declared as "RECORD". IF delcared as BOOL, TEXT or INT4, I get the pqReadData error.
Here's a snippet of code that exhibits that.
Sample Code
Here's the function declaration when does not work while it should:
CREATE FUNCTION GetCheckNumber(INT4) RETURNS TEXT AS '
DECLARE
lDepositID ALIAS FOR $1;
lTemp TEXT;
BEGIN
SELECT mc.checknumber
INTO lTemp
FROM Deposit d,
MoneyCheck mc
WHERE mc.type_id = d.id;
IF NOT FOUND THEN
RETURN ''N/A'';
ELSE
RETURN lTemp;
END IF;
END;
' LANGUAGE 'plpgsql';
And here's a working version of the function using the RECORD type:
CREATE FUNCTION GetCheckNumber(INT4) RETURNS TEXT AS '
DECLARE
lDepositID ALIAS FOR $1;
lTemp RECORD;
BEGIN
SELECT mc.checknumber
INTO lTemp
FROM Deposit d,
MoneyCheck mc
WHERE mc.type_id = d.id;
IF NOT FOUND THEN
RETURN ''N/A'';
ELSE
RETURN lTemp.checknumber;
END IF;
END;
' LANGUAGE 'plpgsql';
No file was uploaded with this report
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-05-17 18:29:58 | Re: pqReadData() -- backend closed the channel unexpectedly. |
Previous Message | Tom Lane | 2001-05-17 00:53:07 | Re: Unusual slowdown using subselects |