General Bug Report: Case statements in selects with table joins causes psql to abort

From: Unprivileged user <nobody>
To: pgsql-bugs(at)postgresql(dot)org
Subject: General Bug Report: Case statements in selects with table joins causes psql to abort
Date: 1999-04-26 00:02:42
Message-ID: 199904260002.UAA37776@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: Case statements in selects with table joins causes psql to abort

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:
--------------------
Case statements in selects with table joins causes psql to abort

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

Test Case:
----------
The following works:

1) SELECT OrderTypeID, invoiceid, (CASE OrderTypeID WHEN 1 THEN 'OrderTypeName'::text ELSE 'iname'::text END) as invdesc
FROM Invoice
WHERE invoiceid = 16476;

The following causes psql to abort:

2) SELECT i.OrderTypeID, i.invoiceid, il.memberid, (CASE i.OrderTypeID WHEN 1 THEN 'OrderTypeName'::text ELSE 'iname'::text END) as invdesc
FROM Invoice i, InvoiceLines il
WHERE i.invoiceid = 16476 and i.InvoiceID = il.InvoiceID and il.memberid = 685;

The following causes psql to abort:

3) SELECT OrderTypeID, invoiceid, (CASE OrderTypeID WHEN 1 THEN 'OrderTypeName'::text ELSE 'iname'::text END) as invdesc
FROM InvoiceInvoiceLines
WHERE invoiceid = 16476;

InvoiceInvoiceLines is view that basically looks just like #2 about

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

Solution:
---------

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

Browse pgsql-bugs by date

  From Date Subject
Next Message Unprivileged user 1999-04-26 00:04:22 General Bug Report: Functions in SQL statements that use aggregations (i.e. group by) causes an abort in psql
Previous Message Piotr Kucharski 1999-04-24 17:45:14 'DROP VIEW' crashes