Re: [HACKERS] Sugerencia de opcion

Lists: pgsql-generalpgsql-hackers
From: "Informatica-Cooperativa Cnel(dot) Oviedo" <informatica(at)coopovie(dot)com(dot)py>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Sugerencia de opcion
Date: 2009-01-22 15:55:26
Message-ID: 497896EE.9070700@coopovie.com.py
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-hackers

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Buenos Dias todos, <br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; Soy un usuario de postgres de Paraguay,
consulto sobre la posibilidad de inclucion en la futura version la
siguiente sentencia(Uso de alias en la condicion HAVING ):<br>
<br>
<br>
&nbsp;&nbsp;&nbsp; SELECT id, sum(salario) as SumaSalario<br>
&nbsp;&nbsp;&nbsp; FROM salarios<br>
&nbsp;&nbsp;&nbsp; GROUP BY id<br>
&nbsp;&nbsp;&nbsp; HAVING <b>SumaSalario</b>&gt;500;<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; Saludos,<br>
<br>
<br>
<br>
Edgar Villalba. (edgvill)<br>
Paraguay<br>
&nbsp;&nbsp; <br>
<br>
<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 801 bytes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "Informatica-Cooperativa Cnel(dot) Oviedo" <informatica(at)coopovie(dot)com(dot)py>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] Sugerencia de opcion
Date: 2010-01-24 14:54:21
Message-ID: 603c8f071001240654t11884cc0kae1f0d1907c63e38@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-hackers

2009/1/22 Informatica-Cooperativa Cnel. Oviedo <informatica(at)coopovie(dot)com(dot)py>:
> Buenos Dias todos,
>
>                             Soy un usuario de postgres de Paraguay, consulto
> sobre la posibilidad de inclucion en la futura version la siguiente
> sentencia(Uso de alias en la condicion HAVING ):
>
>
>     SELECT id, sum(salario) as SumaSalario
>     FROM salarios
>     GROUP BY id
>     HAVING SumaSalario>500;

I've wished for that syntax once or twice myself, but I'm assuming
there's a reason we haven't implemented it? Part of the problem is
it's inheritantly ambiguous if salarios happens to contain a column
called sumasalario, which is a problem that seems to arise for me
fairly regularly in practice. Still, it would be nice for WHERE/GROUP
BY/HAVING clauses to have an explicit way to reference "the target
list column called foo".

...Robert


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "Informatica-Cooperativa Cnel(dot) Oviedo" <informatica(at)coopovie(dot)com(dot)py>, pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] Sugerencia de opcion
Date: 2010-01-24 17:14:59
Message-ID: 27577.1264353299@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> 2009/1/22 Informatica-Cooperativa Cnel. Oviedo <informatica(at)coopovie(dot)com(dot)py>:
>> SELECT id, sum(salario) as SumaSalario
>> FROM salarios
>> GROUP BY id
>> HAVING SumaSalario>500;

> I've wished for that syntax once or twice myself, but I'm assuming
> there's a reason we haven't implemented it?

It's contrary to standard. There are some other reasons you can find
in the archives, too.

regards, tom lane