From: Richard NAGY <richard@presenceweb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL request change when upgrade from 7.0.2 to 7.1.3
Date: Mon, 17 Sep 2001 10:27:53 +0200
Message-ID: <3BA5B409.B57A88D2@presenceweb.com> (raw)
References: <3BA1D7DD.569B218C@presenceweb.com>
<18385.1000667491@sss.pgh.pa.us>
Tom Lane a écrit :
> Richard NAGY <richard@presenceweb.com> writes:
> > SELECT aes.ent_id, e.type, e.nom, aes.sect_id as voulu,
> > cvd_new(current_date, e.date_entree, 'new') FROM ass_entrep_sectact aes,
> > entreprise e WHERE e.id = aes.ent_id and aes.sect_id <> 3 and
> > aes.sect_id <> 9
> > and aes.sect_id <> 1 and aes.sect_id <> 13 and aes.sect_id = 56
> > UNION
> > SELECT distinct on (aes.ent_id) aes.ent_id, e.type, e.nom, aes.sect_id,
> > cvd_new(current_date, e.date_entree, 'new') FROM ass_entrep_sectact aes,
> > entreprise e WHERE e.id = aes.ent_id and aes.sect_id <> 3 and
> > aes.sect_id <> 9
> > and aes.sect_id <> 1 and aes.sect_id <> 13 and aes.sect_id <> 56 and
> > aes.ent_id
> > not in (SELECT ent_id FROM ass_entrep_sectact WHERE sect_id = 56 and
> > sect_id <> 3
> > and sect_id <> 9 and sect_id <> 1 and sect_id <> 13) ORDER BY e.type,
> > e.nom
>
> ORDER BY applied to the result of a UNION has to be on the output
> columns of the UNION. "e.type" etc are names of input-table columns.
> Try just "type" and "nom", which will refer to the second and third
> output columns of the UNION.
>
> Pre-7.1 got this wrong (and would sometimes produce wrong output
> ordering or even a backend crash, if the arms of the UNION didn't
> all yield the same datatype).
>
> regards, tom lane
Hello Tom,
Yes, thanks a lot. It works!
Regards.
--
Richard NAGY
Presenceweb
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: richard@presenceweb.com, tgl@sss.pgh.pa.us
Subject: Re: SQL request change when upgrade from 7.0.2 to 7.1.3
In-Reply-To: <3BA5B409.B57A88D2@presenceweb.com>
* 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