pqReadData() -- backend closed the channel unexpectedly.

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема pqReadData() -- backend closed the channel unexpectedly.
Дата
Msg-id 200105171745.f4HHjWg08478@hub.org
обсуждение исходный текст
Ответы Re: pqReadData() -- backend closed the channel unexpectedly.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Kristis Makris (kristis.makris@datasoft.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
statementin it enters data in a yyyy variable declared as "RECORD". IF delcared as BOOL, TEXT or INT4, I get the
pqReadDataerror. 

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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unusual slowdown using subselects
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pqReadData() -- backend closed the channel unexpectedly.