Re: BUG #2112: query kills db thread - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2112: query kills db thread
Date
Msg-id 21066.1134577928@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2112: query kills db thread  ("Jim Dew" <jdew@yggdrasil.ca>)
List pgsql-bugs
"Jim Dew" <jdew@yggdrasil.ca> writes:
> Stumbled upon a (broken) query that causes the 8.1.0 thread handling the
> query to die:
> select foo from (select null) as foo

Fixed in 8.0 and up.  If you need the patch for 8.1, it's pretty simple:

Index: src/backend/executor/execQual.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/executor/execQual.c,v
retrieving revision 1.183.2.1
diff -c -r1.183.2.1 execQual.c
*** src/backend/executor/execQual.c    22 Nov 2005 18:23:08 -0000    1.183.2.1
--- src/backend/executor/execQual.c    14 Dec 2005 16:25:05 -0000
***************
*** 541,547 ****
      Assert(variable->varno != OUTER);
      slot = econtext->ecxt_scantuple;

!     tuple = slot->tts_tuple;
      tupleDesc = slot->tts_tupleDescriptor;

      /*
--- 541,547 ----
      Assert(variable->varno != OUTER);
      slot = econtext->ecxt_scantuple;

!     tuple = ExecFetchSlotTuple(slot);
      tupleDesc = slot->tts_tupleDescriptor;

      /*

Thanks for the report!

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2112: query kills db thread
Next
From: "Wojciech Sobczuk"
Date:
Subject: BUG #2113: PostgreSQL hangs after running for 2 days