pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problems with complex queries ...
3+ messages / 3 participants
[nested] [flat]

* Problems with complex queries ...
@ 2000-08-29 22:46 J. Fernando Moyano <txinete@wanadoo.es>
  2000-08-29 23:19 ` Re: Problems with complex queries ... Stephan Szabo <sszabo@megazone23.bigpanda.com>
  2000-08-29 23:21 ` Re: Problems with complex queries ... Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: J. Fernando Moyano @ 2000-08-29 22:46 UTC (permalink / raw)
  To: pgsql-sql


Hey everybody !!!
I am new on this list !!!

I have a little problem .....

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.

Thanks !!!

Fer

-- 
  ************* ******   ******  **********  *****   *****    *******
 *************   ***** ******   **********  ******  *****  ***********
    *****         ********        ****     *************  ****    ****
   *****           ****          ****     ***** *******  ****    ****
  *****          *******        ****     *****  ******  ****    ****
 *****        ****** *****   *********  *****   *****  ************
*****       ******   ****** *********  *****   *****    ******** 

 (*) SymeX ==> http://www.lantik.com
 (*) Web en http://www.arrakis.es/~txino      
 (*) Informate sobre LINUX en http://www.linux.org



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problems with complex queries ...
  2000-08-29 22:46 Problems with complex queries ... J. Fernando Moyano <txinete@wanadoo.es>
@ 2000-08-29 23:19 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Stephan Szabo @ 2000-08-29 23:19 UTC (permalink / raw)
  To: J. Fernando Moyano <txinete@wanadoo.es>; +Cc: 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.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problems with complex queries ...
  2000-08-29 22:46 Problems with complex queries ... J. Fernando Moyano <txinete@wanadoo.es>
@ 2000-08-29 23:21 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2000-08-29 23:21 UTC (permalink / raw)
  To: J. Fernando Moyano <txinete@wanadoo.es>; +Cc: pgsql-sql

"J. Fernando Moyano" <txinete@wanadoo.es> writes:
> 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 

I think this is fixed in 7.0.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-08-29 23:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-29 22:46 Problems with complex queries ... J. Fernando Moyano <txinete@wanadoo.es>
2000-08-29 23:19 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2000-08-29 23:21 ` Tom Lane <tgl@sss.pgh.pa.us>

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