Query causesExecSubPlan: NULL value error - Mailing list pgsql-bugs

From Rick Smith
Subject Query causesExecSubPlan: NULL value error
Date
Msg-id 000701bfd491$7aa01080$0103100a@e-1.east.burnaby.admin
Whole thread Raw
Responses Re: Query causesExecSubPlan: NULL value error  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
============================================================================
                         POSTGRESQL BUG REPORT TEMPLATE

============================================================================


 Your name               :    Richard Smith
 Your email address      :    Rsmith@artschool.com


 System Configuration
 ---------------------
   Architecture (example: Intel Pentium)          :Intel Pentium

   Operating System (example: Linux 2.0.26 ELF)   :Red Hat Linux 6.2 (Stock)

   PostgreSQL version (example: PostgreSQL-6.5.3) :PostgreSQL-6.5.3

   Compiler used (example:  gcc 2.8.0)            :n/a


 Please enter a FULL description of your problem:
 ------------------------------------------------

 I am studying Postgres and have been working thru Bruce Momjian's book.

 In figure 8.9 on page 79 I am doing the second query in that
 figure.  I have typed it in exactly as he presented it but I get a:

 "ERROR:  ExecSubPlan: null value returned by expression subselect"

 type error.  I belive my table structures are ok, because the
 previous examples (including the one on the same page) have
 worked on it.

 I emailed this problem to Bruce and he replied:
    "That is strange.  It sounds like a PostgreSQL bug.  My guess is that
    there is one or two rows that is causing this.  Please report it to the
    bugs list so we can fix it."

 I have copied and pasted the query and the error message below:
     test1=> SELECT f1.firstname, f1.lastname, f1.age  FROM friend f1  WHERE
age = (
     test1->     SELECT MAX(f2.age)  FROM friend f2  WHERE f1.state =
f2.state )
     test1-> ORDER BY firstname, lastname ;
     ERROR:  ExecSubPlan: null value returned by expression subselect
     test1=>

 I have copied the data set:
    test1=> SELECT * FROM friend ;
    firstname      |lastname            |city           |state|age
    ---------------+--------------------+---------------+-----+---
    Cindy          |Anderson            |Denver         |CO   | 23
    Mike           |Nichols             |Tampa Bay      |FL   | 20
    Mark           |Middleton           |Indianapolis   |IN   |
    Jack           |Burger              |               |     | 27
    Dean           |Yeager              |Plymouth       |MA   | 24
    Ned            |Millstone           |Cedar Creek    |MD   | 27
    Sandy          |Gleason             |Ocean City     |MA   | 33
    Victor         |Tabor               |Williamsport   |PA   | 22
    Dick           |Gleason             |Ocean City     |NJ   | 20
    Mari-Jo        |Anderson            |Long Island    |NY   | 32
    Pete           |Moxeiter            |Saskatoon      |SK   | 35
    Sid            |Gleason             |Denver         |CO   | 21
    Sam            |I Am                |New York       |NY   | 27
    Sam            |Jackson             |Allentown      |PA   | 23
    Deb            |Bouchier            |Saskatoon      |SK   | 32
    Natalie        |Fisher              |Fortbywater    |NJ   | 22
    (16 rows)

    test1=>


 Please describe a way to repeat the problem.   Please try to provide a
 concise reproducible example, if at all possible:
 ----------------------------------------------------------------------

 This problem occures everytime I run the query.

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Bug in move 0
Next
From: Tom Lane
Date:
Subject: Re: Query causesExecSubPlan: NULL value error