Re: Bad error message

From: Decibel! <decibel(at)decibel(dot)org>
To: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bad error message
Date: 2008-10-06 15:57:28
Message-ID: 97F41A40-F7FF-471F-80F4-2BD1DED3A590@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Oct 1, 2008, at 12:12 AM, Gurjeet Singh wrote:
> On Wed, Oct 1, 2008 at 9:39 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com> writes:
> > On Wed, Oct 1, 2008 at 3:07 AM, Decibel! <decibel(at)decibel(dot)org>
> wrote:
> >> ERROR: aggregates not allowed in WHERE clause
>
> > No, the real issue is that you are referencing the outer table's
> column's
> > max() in the inner query (correlated sub-query).
>
> Yeah. It's not easy to see how the software could guess your real
> intentions here. We could maybe offer a vaguely-worded HINT but I'm
> not able to think of wording that would be very helpful.
>
> Can we do something like this in the code:
>
> if( "level of the referenced column's relation" != "level of
> the (sub)query being processed" )
> errhint( "The subquery may be unintentionally referencing
> an outer query's column!" );

Yeah, something like that would be very helpful.

> Mail sent from my BlackLaptop device

Haha. +1
--
Decibel!, aka Jim C. Nasby, Database Architect decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-10-06 15:58:12 Displaying references to fields of record variables
Previous Message Steve Crawford 2008-10-06 15:47:29 Re: [HACKERS] Monitoring postgres