Functions with aggregations (i.e. group by) causes an abort - Mailing list pgsql-hackers

From Michael J Davis
Subject Functions with aggregations (i.e. group by) causes an abort
Date
Msg-id 93C04F1F5173D211A27900105AA8FCFC145419@lambic.prevuenet.com
Whole thread Raw
Responses Re: [HACKERS] Functions with aggregations (i.e. group by) causes an abort
List pgsql-hackers
The following works in psql:
  SELECT MemberID, InvoiceID, sum(quantity * unitprice) as InvAmount,
si_InventoryCategory(InventoryID) as CategoriesID  FROM InvoiceLines  WHERE memberid = 685  GROUP BY MemberID,
InvoiceID,InventoryID;
 

The following causes psql to abort:
  SELECT MemberID, InvoiceID, sum(quantity * unitprice) as InvAmount,
si_InventoryCategory(InventoryID) as CategoriesID  FROM InvoiceLines  WHERE memberid = 685  GROUP BY MemberID,
InvoiceID,CategoriesID;
 

Here is the abort message:

pqReadData() -- backend closed the channel unexpectedly.       This probably means the backend terminated abnormally
  before or while processing the request.
 
We have lost the connection to the backend, so further processing is
impossible.  Terminating.

There is nothing in the postgreSQL log files.

InvoiceLines is a table.  Here is si_InventoryCategory():

CREATE FUNCTION si_InventoryCategory(int4) RETURNS int4 AS '  'select it.CategoriesID from Inventory i, InventoryType
itwhere
 
i.InventoryID = $1 and i.InventoryTypeID = it.InventoryTypeID' LANGUAGE
'sql';


I am using Red Hat 5.1, PostgreSQL version 6.5 as of this morning.  Any
suggestions on what I can do to work around this?

Thanks, Michael


pgsql-hackers by date:

Previous
From: Ryan Bradetich
Date:
Subject: Re: [HACKERS] create view as select distinct (fwd)
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Functions with aggregations (i.e. group by) causes an abort