General Bug Report: Functions in SQL statements that use aggregations (i.e. group by) causes an abort in psql

From: Unprivileged user <nobody>
To: pgsql-bugs(at)postgresql(dot)org
Subject: General Bug Report: Functions in SQL statements that use aggregations (i.e. group by) causes an abort in psql
Date: 1999-04-26 00:04:22
Message-ID: 199904260004.UAA37912@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Michael Davis
Your email address : mdavis(at)sevainc(dot)com

Category : runtime: back-end: SQL
Severity : serious

Summary: Functions in SQL statements that use aggregations (i.e. group by) causes an abort in psql

System Configuration
--------------------
Operating System : Red Hat 5.1 linux 2.0.34 ELF

PostgreSQL version : 6.5

Compiler used : gcc version 2.7.2.3

Hardware:
---------
Dual Pentium II, 128M RAM
Linux linus 2.0.34 #12 Tue Oct 6 23:24:13 MDT 1998 i686 unknown

Versions of other tools:
------------------------

--------------------------------------------------------------------------

Problem Description:
--------------------
Functions in SQL statements that use aggregations (i.e. group by) causes an abort in psql

--------------------------------------------------------------------------

Test Case:
----------
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 it where i.InventoryID = $1 and i.InventoryTypeID = it.InventoryTypeID' LANGUAGE 'sql';

--------------------------------------------------------------------------

Solution:
---------

--------------------------------------------------------------------------

Browse pgsql-bugs by date

  From Date Subject
Next Message Unprivileged user 1999-04-26 14:34:22 General Bug Report: missing commas in IN( ) ignored; bracketing entries ignored
Previous Message Unprivileged user 1999-04-26 00:02:42 General Bug Report: Case statements in selects with table joins causes psql to abort