pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rodrigo Rezende <Rodrigo.Rezende@hortolandia.marelli.it>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Select & Tables X Select & Views
Date: Mon, 21 Feb 2000 17:27:08 -0500
Message-ID: <29583.951172028@sss.pgh.pa.us> (raw)
In-Reply-To: <38B132D3.5CEB990A@hortolandia.marelli.it>
References: <20000218122631.C12742@rice.edu>
	<38B132D3.5CEB990A@hortolandia.marelli.it>

Rodrigo Rezende <Rodrigo.Rezende@hortolandia.marelli.it> writes:
> The view :
> create view func_aux_stat as select fp.codfuncionario, max(fp.data) as
> data from func_preench as fp group by fp.codfuncionario ;

Ah.  I'm afraid GROUP BY doesn't work very well in views --- it's OK
for simply selecting from the grouped view, but not for joining it
against other tables.  This is because the rule rewriter can only
revise your query into some other query that's still expressible in
SQL, and there's no way to group only one table in a query in the
subset of SQL that we support.

We hope to fix this in 7.1, but for now it's not going to work.
You might think about trying to recast your problem to use subselects,
or some other approach that doesn't involve joining a grouped table
against an ungrouped one.

			regards, tom lane



view thread (4+ messages)

Message-ID: <29583.951172028@sss.pgh.pa.us>
Permalink:  ../29583.951172028@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29583.951172028@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, Rodrigo.Rezende@hortolandia.marelli.it
  Subject: Re: [SQL] Select & Tables X Select & Views
  In-Reply-To: <29583.951172028@sss.pgh.pa.us>
  References: <20000218122631.C12742@rice.edu> <38B132D3.5CEB990A@hortolandia.marelli.it> <29583.951172028@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