Thread: PG 7.0 crash on SELECT

PG 7.0 crash on SELECT

From
Louis-David Mitterrand
Date:
Issuing the followin SELECT crashes PG 7.0:

auction=# SELECT a.id,a.title,a.id,(select CASE WHEN a.stopdate < 'now' THEN 'closed' ELSE 'open' end) as
status,to_char(a.time,'DD-MMHH24:MI'),b.price FROM auction* a, bid b WHERE a.id = b.auctionid AND b.login = 'mito2';
 
pqReadData() -- backend closed the channel unexpectedly.       This probably means the backend terminated abnormally
  before or while processing the request.
 
The connection to the server was lost. Attempting reset: Failed.
!# \q

Apparently PG doesn't like the (SELECT CASE ... ) statement, until I
added it everything went well. 

Here are the table descriptions:
                              Table "auction" Attribute   |   Type    |                     Modifier

 
--------------+-----------+--------------------------------------------------id           | integer   | not null
defaultnextval('auction_id_seq'::text)login        | text      | not nullstartdate    | timestamp | not null default
now()stopdate    | timestamp | not nulldescription  | text      | not nullstartprice   | float8    | not
nullreserveprice| float8    | category     | text      | not nullimageurl     | text      | title        | text      |
notnullquantity     | integer   | default 1time         | timestamp | not null default now()option       | bigint    |

Index: auction_pkey
Constraints: (quantity > 0)            (imageurl ~ '^http://'::text)            (stopdate > startdate)
((reservepriceISNULL) OR (reserveprice > startprice))
 
                 Table "bid"Attribute |   Type    |        Modifier        
-----------+-----------+------------------------login     | text      | not nullauctionid | integer   | not nullprice
 | float8    | not nullquantity  | integer   | not null default 1time      | timestamp | not null default now()
 
Index: bid_pkey


-- 
Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.fr

WARNING TO ALL PERSONNEL: Firings will continue until morale improves.   


Re: PG 7.0 crash on SELECT

From
Tom Lane
Date:
Louis-David Mitterrand <cunctator@apartia.ch> writes:
> Issuing the followin SELECT crashes PG 7.0:
> auction=# SELECT a.id,a.title,a.id,(select CASE WHEN a.stopdate < 'now' THEN 'closed' ELSE 'open' end) as
status,to_char(a.time,'DD-MMHH24:MI'),b.price FROM auction* a, bid b WHERE a.id = b.auctionid AND b.login = 'mito2';
 
> pqReadData() -- backend closed the channel unexpectedly.
>         This probably means the backend terminated abnormally
>         before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
> !# \q

> Apparently PG doesn't like the (SELECT CASE ... ) statement, until I
> added it everything went well. 

The crash certainly is a bug, but you could get around it for now
by not using an unnecessary sub-SELECT.  Why not just...,a.id,(CASE WHEN ...
        regards, tom lane