pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyle <kyle@actarg.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Query broken under 7.1RC2
Date: Wed, 04 Apr 2001 11:54:22 -0400
Message-ID: <10791.986399662@sss.pgh.pa.us> (raw)
In-Reply-To: <3ACB3CB9.CB5F0C46@actarg.com>
References: <3ACB3CB9.CB5F0C46@actarg.com>

Kyle <kyle@actarg.com> writes:
> The SQL is a little strange because the subquery tries to reference
> individual records from the outer query and then sum them.
> The more I look at it, I wonder if it is not just bad SQL.

It is bad SQL, but pre-7.1 Postgres failed to catch it.  Here's the
CVS log entry:

2000-09-25 14:09  tgl

	* src/backend/optimizer/plan/planner.c: System neglected to
	complain about ungrouped variables passed to sublinks when outer
	query contained aggregates but no GROUP clause.

Since you have a SUM(), the outer query is a grouped query, and so
references to the ungrouped h.* columns in the SELECT targetlist are
not well defined.  Lord knows what result you were getting from 7.0 ...

			regards, tom lane



view thread (2+ messages)

Message-ID: <10791.986399662@sss.pgh.pa.us>
Permalink:  ../10791.986399662@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10791.986399662@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, kyle@actarg.com
  Subject: Re: Query broken under 7.1RC2
  In-Reply-To: <10791.986399662@sss.pgh.pa.us>
  References: <3ACB3CB9.CB5F0C46@actarg.com> <10791.986399662@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox