Re: Problems with complex queries ...

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: "J(dot) Fernando Moyano" <txinete(at)wanadoo(dot)es>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problems with complex queries ...
Date: 2000-08-29 23:19:41
Message-ID: Pine.BSF.4.10.10008291611500.56994-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Without seeing the schema or anything, a similar
query to your first one appears to run on my
Postgres 7.0.2 setup. It's probably worth upgrading.

On Wed, 30 Aug 2000, J. Fernando Moyano wrote:
> I try this on my system: (Postgres 6.5.2, Linux)
>
> "select n_lote from pedidos except select rp.n_lote from relpedidos rp,
> relfacturas rf where rp.n_lote=rf.n_lote group by rp.n_lote having
> sum(rp.cantidad)=sum(rf.cantidad)"
>
> and I get this result:
>
> ERROR: rewrite: comparision of 2 aggregate
> columns not supported
>
> but if I try this one:
>
> "select rp.n_lote from relpedidos rp, relfacturas rf where
> rp.n_lote=rf.n_lote group by rp.n_lote having sum(rp.cantidad)=sum(rf.cantidad)"
>
> It's OK !!
>
> What's up???
> Do you think i found a bug ???
> Do exists some limitation like this in subqueries??
>
> (Perhaps Postgres don't accept using aggregates in subqueries ???)
>
> I tried this too:
>
> "select n_lote from pedidos where n_lote not in (select rp.n_lote from
> relpedidos rp, relfacturas rf where rp.n_lote=rf.n_lote group by rp.n_lote
> having sum(rp.cantidad)=sum(rf.cantidad))"
>
> but the result was the same !
>
> And i get the same error message (or similar) when i try other variations.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-08-29 23:21:57 Re: Problems with complex queries ...
Previous Message J. Fernando Moyano 2000-08-29 22:46:18 Problems with complex queries ...