Hi there!

Please forgive my affords in making the backend crash (this time postgres
6.3.1), seems I've got too much spare time :-)

a)

SELECT DISTINCT * from x2 UNION SELECT * FROM x2;

crashes the backend and corrupts shmem, so that other connections break
too, if x2 is a view returning NULL values

E.g.:
postgres=> create table x (i int4, j int4);
CREATE
postgres=> create view x2 as select j from x;
CREATE
postgres=> insert into x values (1,2);
INSERT 144128 1
postgres=> insert into x values (3);
INSERT 144129 1
postgres=> insert into x values (NULL,4);
INSERT 144130 1
postgres=> select * from x;
i|j
-+-
1|2
3|
 |4
(3 rows)

postgres=> select distinct * from x2 union select * from x2;
PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
        This probably means the backend terminated abnormally before or
while processing the request.            
(The second x2 can also be other table)


b)
Another way is to remove the table a view is based upon, e.g.

postgres=> create table x (i int);
CREATE
postgres=> create view x2 as select * from x;
CREATE
postgres=> drop table x;
DROP
postgres=> select * from x2;
PQexec() -- Request was sent to backend, but b...

Best regards,
MB

-- 
Michael Bussmann <bus@fgan.de> [Tel.: +49 228 9435 211; Fax: +49 228 348953]
"It's still the same old story, a fight for love and glory,
A case of do or die, The world will always welcome lovers, as time goes by."

Sat, 28 Mar 1998 13:02:33 +0100
Michael Bussmann <bus@fgan.de>
Ways to crash the backend
> 
> Hi there!
> 
> Please forgive my affords in making the backend crash (this time postgres
> 6.3.1), seems I've got too much spare time :-)
> 
> a)
> 
> SELECT DISTINCT * from x2 UNION SELECT * FROM x2;

Sorry to disappoint you, but this is fixed in the 6.3.1 patch.


-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

Sat, 28 Mar 1998 10:15:48 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Ways to crash the backend