Thread

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

    Unprivileged user <nobody> — 1999-04-26T00:02:42Z

    ============================================================================
                            POSTGRESQL BUG REPORT TEMPLATE
    ============================================================================
    
    
    Your name               : Michael Davis
    Your email address      : mdavis@sevainc.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:
    ---------
    
    
    --------------------------------------------------------------------------